me.contract declares the Me tab's interface in Contract. The components hold no data of their own: every value and action arrives as a prop from the root component, where the pkg:me blocks of app.contract declare the state and resources (Package conventions and ownership blocks).
Shapes and helpers
Shapes: MeIdentity (accountId, keyName, shortId, createdAt), MeProfile (accountId, name, icon), MeWords (mnemonic, words), MeReply (ok, error, value), MeCheck (kind, valid, message, count), MeExport (ok, error, text). They match the answers in Me: sources and import logic.
Functions: meDisplayName picks profile name, then key name, then short id ("names, never a bare z6Mk… as the label"); meIcon picks the profile icon; meHost strips the scheme from a URL.
Components
Component | Route | Renders | Main testIds |
|---|---|---|---|
| Identities section (current identity as a link with a 56 pt |
| |
| Header card, Edit profile link, Use this identity, Account ID with copy and share, Key name, Backup (export key file), Remove, and three dialogs ( |
| |
| Optional name, the 12 numbered words, Copy, a confirmation switch, and Create (disabled until confirmed) |
| |
| A text area for a phrase or key file, a live status line, optional name, Import (disabled until the check is valid) |
| |
| Radio rows for |
|
MeIdentityScreen declares two local actions, copyId (copies and plays a success haptic) and shareId (opens the share sheet). Avatar comes from Shared components.
Root declarations
Kind | Names |
|---|---|
State |
|
Persisted state |
|
Resources |
|
Mutations |
|
Derived |
|
The comment on meImportName records a deliberate choice: name drafts survive a reload, "never the import text: it may be a recovery phrase or key".
The shared server and currentAccount are declared just above the package blocks at lines 76 to 77.
Actions
pkg:me actions, grouped by flow:
Create: meOpenCreate resets the form, sends meWords = meNewWords() and pushes /me/create. meCreate sends meCreateIdentity(meMnemonic, name, time.epochAtZero + performanceNow()). meAfterAdd sets currentAccount, clears the words and pops the sheet.
Import: meOpenImport, meEditImport, meEditImportName, meImport, meAfterImport, with the same pattern.
Switch and remove: meSwitch sets currentAccount and clears any shown export. meAskRemove stores the target in meAimed and opens me-remove-detail on the identity screen or me-remove elsewhere. meRemove sends meRemoveIdentity(meAimed, currentAccount); meAfterRemove adopts the returned account.
Rename: meAskRename, meEditRename, meRename.
Export: meAskExport, meReveal (records meExportFor and sends meExportKey), meHideExport, meCopyExport, meShareExport. The view passes the export text only when the route's uid equals meExportFor, so "an export is displayed only on that identity's screen".
Server: mePickServer, meEditServer, meConnect, meAfterServer (adopts the checked origin and appends it to meServers unless it is a preset), meForgetServer (falls back to https://hyper.media when the removed server was in use), meRetry.
The time argument follows the rule in State, refresh and stale-reply patterns: the data module has no clock of its own.
The view switch renders one component per stack entry. Error props are blanked while their mutation is pending, for example error=(pending(meCreated) ? "" : meCreateError).
Contract tests
me.test.contract has 13 tests, using "Throwaway keys only": public BIP-39 test phrases and a key file with a fixed public seed.
Area | Tests |
|---|---|
Empty state | 1 |
Create: 12 words, confirmation required, listed and current, survives | 1 |
Import: invalid phrase reasons; phrase then key file then switch then remove; duplicate name refused | 3 |
Identity detail: export after asking, remove; rename with a bad name refused; export shown only on its own screen; unnamed identity, copy and share | 4 |
Server: persists across relaunch; bad address refused; a custom server must pass its config check; saved servers | 4 |
The saved-server test points the app at http://127.0.0.1:4790, the local test server. How these files run is in Contract UI tests.
User stories
The code described here exists to deliver these stories. Each story lists this page in its Trace (traceability).
US-READ-01 Open the app to my site's home: Where the server that decides the home is chosen
US-DISC-05 Be guided to create an identity before commenting: MeCreateScreen
US-AGENT-02 Choose my agent server: The Me row that links to the sheet
US-ID-01 Create an identity: MeCreateScreen, its props and the create actions
US-ID-02 Import an identity I already have: MeImportScreen and the import actions
US-ID-03 Switch between my identities: MeScreen, MeIdentityScreen and meSwitch
US-ID-04 See and share my account ID, and name my key on this device: MeIdentityScreen, copyId, shareId and the rename actions
US-ID-05 Back up my key: MeIdentityScreen and the export actions; the export shows only on its own screen
US-ID-06 Remove an identity from this device: meAskRemove chooses the dialog; meRemove and meAfterRemove
US-ID-07 Edit my public profile: The Edit profile link and the meProfiles names that update
US-ID-08 Choose which Seed server I read from: MeServerScreen and the server actions
US-VAULT-04 Trust that my keys stay safe: The export shows only on its own screen; import text is never persisted
US-APP-01 The app feels like an iPhone app: Me: grouped list, swipe to delete and the remove alert
US-APP-02 Move around the app without losing my place: Rows that push Server and Vault and open the agent server sheet
US-APP-06 See people and spaces by name: meDisplayName and the identity rows
US-APP-07 Read clear, consistent wording: Alerts, the server form and identity actions
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime