[vault] Identity: docs/IDENTITY.md and the mandatory tests, before the code
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
# 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. 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.
|
||||
|
||||
## In the vault file
|
||||
|
||||
A body member next to `items` (docs/FORMAT.md, "Body"); old vaults without it open as before:
|
||||
|
||||
```json
|
||||
"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 }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
- `issued` records each cert the vault signed, for *Domi identity → apps and devices*. It is a record, not
|
||||
a trust list: revocation is v1.1.
|
||||
- **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 |
|
||||
|
||||
The prefix check means 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.
|
||||
|
||||
## 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.
|
||||
Reference in New Issue
Block a user