Files

5.7 KiB
Raw Permalink Blame History

The Domi identity (custos-vault, identity)

Every Domi app gets its own subkey, certified by one root Ed25519 key per person. The root key lives in the vault and never leaves it: no function of this crate returns it, and the vault signs nothing with it but subkey certificates and revocations of keys the person revoked. The certificate format, the match code and verification are in Fundamentum (crates/tessera, docs/TESSERA.md); this page is the vault side.

Creating it: the order is mandatory

entropy   32 bytes from the OS CSPRNG
mnemonic  BIP39 English, 24 words, shown ONCE
confirm   the person types 3 words the vault picks at random
root      Ed25519 secret = HKDF-SHA256(salt = "tessera root v1", ikm = BIP39 seed(mnemonic, ""), info = "ed25519")
import    the secret goes into the vault; entropy, seed and mnemonic are wiped

A key that was created non-extractable first could never be backed up. So the code cannot do it in the other order: identity::Enrollment is a typestate.

Type Holds Only way forward
Enrollment the entropy show(display): hands the 24 words to display, once
Shown the entropy, 3 word positions confirm(words): the 3 words, or it hands itself back to try again
Confirmed the derived root secret; the entropy is wiped import(&mut vault): stores the root, returns its public key

import exists only on Confirmed, Confirmed only comes from confirm, and confirm only from show. Swapping the order does not compile (compile_fail doctests in src/identity.rs). None of the three types is Clone or Serialize; each prints [redacted].

Test vector: entropy 00 × 32 → abandon × 23 + art → root public key vCrwX9p44un1ftQLgJtuaVQ0qPWbFfzNjgrlDkL4TKs (base64url). Fundamentum pins the same value.

Restoring it from the 24 words (core 0.10.0)

Enrollment::restore(phrase) takes the whole phrase, typed back, and gives a Confirmed: the person typed all 24 words, which proves more than three. The words are checked against the BIP39 English list and its checksum (any case, any spacing between them); anything else is Error::NotAMnemonic, which names no word. The same words give the same root, so every app and every group trusts it again.

In the vault file

A body member next to items (docs/FORMAT.md, "Body"); old vaults without it open as before:

"identity": {
  "root": "<64 hex: the Ed25519 secret>",
  "public": "<64 hex>",
  "created": 1793000000000,
  "issued": [
    { "kind": "app", "app_id": "fiscus", "purpose": "sync", "subkey": "<base64url>", "label": "fiscus.exe",
      "not_before": 1793000000, "not_after": 1824536000, "issued": 1793000000000,
      "revoked_at": 1795000000, "revocation": ["<base64url TRV1>"] }
  ]
}
  • issued records each cert the vault signed, for Domi identity → apps and devices. It is a record, not a trust list.
  • revoked_at (Unix seconds, core 0.10.0) is set when the person revokes the key; revocation holds the signed statements once they exist. Both are left out until then. A renewed key has several certs: all of them are marked.
  • A Custos older than core 0.10.0 drops revoked_at and revocation when it saves the vault, so a revocation in progress would have to be started again.
  • An older Custos drops the member when it saves the vault (it ignores members it does not know). Every Custos that saves this vault must run core 0.7.0 or later. The mnemonic recovers the root either way.

Using it

Function What
Vault::domi_root_public() the root public key, if there is an identity
Vault::domi_sign_cert(tbs) Ed25519 over "tessera cert v1\0" ‖ tbs. Refuses a tbs that does not start with TSC1 followed by this root's public key
Vault::domi_issued(), domi_record(issued) the record of issued certs
Vault::domi_mark_revoked(subkey, at) the person revoked this key: marks every cert of it, returns the time in effect (the first one, if it was marked before)
Vault::domi_sign_revocation(tbs) Ed25519 over "tessera revoke v1\0" ‖ tbs. Refuses a tbs that does not start with TRV1, this root's public key, a key marked revoked and that key's revoked_at
Vault::domi_record_revocation(subkey, statements) keeps the signed statements with the key's certs
Vault::domi_backup_secret(app_id) the app's backup secret (below)

The prefix checks mean the vault is not a general signing oracle: whatever the app hands it, the result can only ever verify as a certificate naming this root, or as a revocation of a key the person revoked, at the time they did. The two domains differ, so neither can pass for the other. Statement format: Fundamentum docs/TESSERA.md §12.

The backup secret (core 0.10.0)

backup secret = HKDF-SHA256(salt = "tessera backup v1", ikm = the root secret, info = app id)

Custos hands an app its own (Domi pipe backup_key, behind the app's namespace grant); the app seals its backup with it and names its backup mailbox from it (Fundamentum docs/TESSERA.md §12). It comes back from the 24 words alone. The caller passes a valid app id (a-z, 0-9, -). Test vector, shared with Fundamentum: the zero-entropy root, app fiscus → HKDF-Expand(secret, "mailbox") = IygCOrh-ibO6-KY5AXQ9Prl2SyPWQIyZZ-anffcbMCU, and XChaCha20-Poly1305 with HKDF-Expand(secret, "seal"), a zero nonce and empty input = ci_JRbtsx5prR83KT9Y7LA (the tag).

What it does not protect

The root secret is in the vault body, so everything in docs/THREAT_MODEL.md about an unlocked vault applies: malware running as you while the vault is open can read it from memory. It never reaches the webview, the Domi pipe, logs or the web vault.