Back up my key
A person exports the key file of an identity, after a clear warning, so the identity can be restored later.

As an identity holder, I want to export a key file for an identity and store it somewhere safe, so that I can restore the identity if I lose this phone.

Situation

I have an identity on this phone and I am not sure I still have its recovery words, or it came from my vault and I never saw them. I am on the Me tab and I have a safe place ready, such as a password manager.

What I do

    Open the identity from Me.

    Scroll to "Backup" and tap "Export key file".

    Read the warning and tap "Reveal".

    Tap "Copy", or "Share…" and choose my password manager.

    Tap "Hide".

What I should see

    Under "Backup" there is one row, "Export key file", and the note "The key file is your unencrypted private key. Anyone who has it can act as this identity." See Identity detail.

    Tapping the row shows an alert titled "Reveal the private key?" with "The export is your unencrypted private key. Keep it somewhere safe and never share it with anyone you don’t trust." and the buttons "Reveal" and "Cancel".

    After "Reveal", the key file appears in place of the row as a short block of text I can select, with "Copy", "Share…" and "Hide" under it.

    "Copy" puts the text on the clipboard. "Share…" opens the system share sheet.

    "Hide" removes the text and brings "Export key file" back.

    The text is also hidden when I switch identity or remove this one.

    The revealed text shows only on the screen of the identity it belongs to, never on another identity's screen.

    Pasting the same text into Import identity restores the same identity.

When something goes wrong

    If I tap the row by mistake, "Cancel" closes the alert and nothing is revealed.

    If the identity was removed on another device in the meantime, the screen says "This identity is no longer on this device." I restore it with Import an identity I already have.

Not included

    The export cannot be protected with a password. It is always the plain key. See Current limits and known gaps.

    The recovery words cannot be shown again. A key file is the only backup the app can produce after creation.

    No file is written to Files. I get text to copy or share.

    Revealing asks for no passcode or Face ID, and "Copy" gives no confirmation.

    If the export fails, no message is shown and the row simply stays. The share and copy rows have no automated interface test. See Contract UI tests.

Trace

Story US-ID-05, status Shipped. These links are kept in step with the traceability matrix and with the "User stories" section of every page listed here.

Design

Page

Part it plays

Identity detail

The Backup section, the reveal alert and the revealed key

Me

Entry point: the current identity row

Import identity sheet

Where the key file is used again

dialog

The Reveal the private key? alert

text

Selectable monospace text for the key file

button

Export, Copy, Share… and Hide rows

Confirmations and alerts

The reveal confirmation in the alert inventory

Share, copy and open

Copy and Share… for the key file

Buttons and actions

Danger goes last and asks first

States for every screen

Exporting and key revealed states

Honest state: loading, failure and empty

The footer says plainly what a key file is

Representative strings

The exact warning wording

Typography

Monospace caption for the key file

Implementation

Page

Part it plays

Me: identities and servers

Orientation: the package that owns identities

Me: screens and components

MeIdentityScreen and the export actions; the export shows only on its own screen

Me: sources and import logic

meExportKey: the only answer that carries a key

Identity: key storage

exportSeedKey and the key file format

Crypto: parity vectors against the original client

The key file matches the desktop format byte for byte

Root declarations: Me, Profile, Crypto and Vault

meExported and meExportFor

Contract views and built-in calls

The built-in copyText, share and showModal calls

Current limits and known gaps

No password protection for key files

Contract UI tests

The UI tests that reveal and hide the export

Bun unit tests

Unit tests for the export format and its safety checks

Code

File

What

me.contract L196-211

Backup section: Export key file, revealed text, Copy, Share…, Hide

me.contract L222-227

Reveal the private key? dialog

app.contract L227-229

meExported and meExportFor

app.contract L237

meExportText

app.contract L631-644

meAskExport, meReveal, meHideExport, meCopyExport, meShareExport

app.contract L600-604

meSwitch clears a revealed export

app.contract L871-872

the export is passed only to the screen of its own identity

src/me/sources.ts L113-118

meExportKey

src/identity/index.ts L180-196

buildSeedKeyExport

src/identity/index.ts L229-235

exportSeedKey

src/crypto/seedkey.ts

A second key file codec, exercised only by tests

Tests

File

What it checks

me.test.contract

me: identity detail exports the key file after asking, and removes

me.test.contract

me: an exported key shows only on its own identity's screen

src/identity/__tests__/identity.test.ts

.seedkey: export format; import round trip and errors; exportSeedKey from the store

src/identity/__tests__/storage.test.ts

export never returns another account key from a mismatched record

src/crypto/__tests__/crypto.test.ts

seedkey desktop JSON parity

Delivery

Delivered by #1470.

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime

Comments