Expand description
A portable user’s identity: the public half of a root signing key the user owns, not an account any server hosts; and what that root signs: a credential for each of the user’s devices, and the state that revokes them; and the proof that ties a local account to the identity.
Only public things live here. The root’s secret, and the recovery
phrase it comes from, are the client SDK’s (spoolframe_client_sdk:: portable) and never travel: a server checks what the root signed with
PortableUserId::verify and holds nothing it could sign with.
Structs§
- Added
Root - A root added to an identity, self-certifying: who added it and when,
that root’s endorsement over
root_endorse_message, and the new root’s proof that it is held, overroot_add_message. A state lists every one so far, so any state carries the whole chain. - Device
Public Key - One device’s key for acting as a portable user: its own Ed25519 keypair, apart from both the user’s root and the device’s Iroh endpoint key. Written, and serialized, as 64 lowercase hex digits.
- Identity
Genesis - How an identity begins: its handle, its first roots, and each
root’s signature over both, so every root proves it is held. For a
security key identity the handle is random and is also the key’s
resident credential’s
user.id, so a key put into a device that has never seen it says which identity it roots. - Identity
Record - What a device or server keeps of an identity to check it, and hands on so another can: its genesis, absent for a phrase identity (its one root is its id), and its newest state, if any. Recovery with a root needs it from anywhere that has it.
- Invalid
Device Public Key - Not a device key: not 64 hex digits, or not an Ed25519 public key.
- Invalid
Portable User Id - Not a portable user id: not 64 hex digits.
- Portable
Identity State - A user’s root’s list of revoked device keys, at a revision, and the roots it has added and removed. Revocation only grows: a verifier checks credentials against the union of every valid state it has seen for the user, and keeps the newest (by revision) to hand on. A credential is good unless that union revokes its device key: adding a device needs no new state, so it lists no authorized keys.
- Portable
User Id - Who a portable user is. For an identity begun with one phrase root, its
root’s Ed25519 public key; for any other, derived from its
genesis (
IdentityGenesis::user). Written as 64 lowercase hex digits, as iroh writes anEndpointId; serialized the same way. - Removed
Root - A root a state removes, and when (Unix seconds). A removed root never comes back.
- Revoked
Key - One revoked device key, and when the root revoked it (Unix seconds).
- Root
Changes - A state as the root set reads it: who signed it, what it adds and removes. Its signatures are assumed checked.
- RootSet
- The roots that may act for an identity, as a verifier works them out from its genesis and every valid state it holds:
- Signature
- Ed25519 signature.
- State
Changes - What a state changes, for
PortableIdentityState::signed_by: revocations and roots, each cumulative. - User
Device Credential - A user’s root’s word that a device key may act as them, until
expires_at. The server checks it alone, with no account server: the root signed it, it is in date, the device holds its key (verify_device_proof) and no state the server has seen revokes the key (PortableIdentityState::revokes).
Enums§
- Credential
Error - Why a credential, or a device’s proof with it, does not authenticate.
- Genesis
Error - Why a genesis is not one.
- RootKey
- A key that may act for an identity.
- Root
Registration - How a security key made a root’s credential, as a device’s
key API returns it: what
Self::rootreads the root from. - Root
Signature - A root’s signature: a phrase root’s Ed25519 one, or a security key’s
assertion: raw CTAP2 (its
authenticatorDataand DER ECDSA signature), or WebAuthn (the same, and theclientDataJSONthe platform wrote and the key signed the hash of). - State
Error - Why an identity state is not one.
- TieProof
- Who signed a
tie_messagefor a portable user: their root, on the phone that holds it, or one of their device keys, with the credential the root gave it. Either way the root itself never travels. - TieProof
Error - Why a
TieProofdoes not prove its user. - WebAuthn
Error - Why a WebAuthn assertion or registration is refused.
Constants§
- CLOCK_
SKEW - How far ahead of a verifier’s clock a credential’s
issued_atmay be: the phone’s clock and the server’s need not agree to the second. - CREDENTIAL_
DOMAIN - The domain the root’s signature over a credential is made in, ahead of
the bytes
UserDeviceCredential::messagelays out. Fixed forever: a new layout takes a new string. - DEVICE_
PROOF_ DOMAIN - The domain of a device key’s proof of possession to one server.
- DEVICE_
PUBLIC_ KEY_ LEN - Bytes in a
DevicePublicKey: an Ed25519 public key. - GENESIS_
DOMAIN - The domain of each root’s signature over its identity’s genesis.
- HANDLE_
LEN - Bytes in an identity’s handle.
- MAX_
ATTESTATION_ OBJECT - The longest WebAuthn
attestationObjecta registration may carry, refused before it is parsed. Room for an attestation certificate chain, which is carried but not checked. - MAX_
AUTHENTICATOR_ DATA - The longest
authenticatorDataa root signature may carry. An assertion’s is 37 bytes and its extensions; this leaves room for them. - MAX_
CLIENT_ DATA_ JSON - The longest
clientDataJSONa WebAuthn root signature or registration may carry, refused before it is parsed. A platform’s is a few hundred bytes. - MAX_
CREDENTIAL_ ID - The longest credential id a security key root may have, in bytes.
- MAX_
CREDENTIAL_ VALIDITY - The longest a credential may be good for: 90 days from its
issued_at. A stale device ages out within that, even where no revocation ever reaches. - MAX_
DER_ SIGNATURE - The longest DER ECDSA P-256 signature.
- MAX_
REVOKED - The most device keys an identity state may revoke. Revocations older
than
REVOCATION_WINDOWmay be dropped, so this bounds the live ones only. - MAX_
ROOTS - The most roots an identity has at once, and in its genesis.
- MAX_
ROOT_ CHANGES - The most root changes a state lists: roots added, and roots removed, each. Changes are cumulative, as revocations are, so a state carries them all.
- P256_
PUBLIC_ KEY_ LEN - Bytes in a P-256 public key, SEC1 uncompressed:
04 ‖ x ‖ y. - PORTABLE_
RP - The relying party a security key root signs under. Domain-shaped and
under
*.spoolframe.app, so no server’s passkey sign-in (under that server’s own RP) can pass as a root’s signature. - PORTABLE_
USER_ ID_ LEN - Bytes in a
PortableUserId: an Ed25519 public key. - REVOCATION_
WINDOW - How long a revocation matters: a key revoked longer ago than this has
no credential left that holds. Every credential expires within
MAX_CREDENTIAL_VALIDITYof itsissued_at, which is at mostCLOCK_SKEWahead of the clock it was revoked by, and the root issues none to a key it has revoked. - ROOT_
ADD_ DOMAIN - The domain of an added root’s proof that it is held, over its addition.
- ROOT_
ENDORSE_ DOMAIN - The domain of the adding root’s endorsement of a root it adds.
- STATE_
DOMAIN - The domain of the root’s signature over an identity state. v2 added
each key’s
revoked_at; v1 was never sent anywhere. - STATE_
V3_ DOMAIN - The domain of a state that names its signer or changes roots.
One that does neither signs
STATE_DOMAIN’s layout, as before. - TIE_
DOMAIN - The domain of the signature that ties a local account to a portable identity.
- USER_
ID_ CONTEXT - The context the id of an identity with a security key root is derived in, from its genesis.
Functions§
- device_
proof_ message - What a device signs to prove to one server that it holds its key:
DEVICE_PROOF_DOMAIN, the server’s endpoint id (32 bytes), then the server’s nonce (32). Naming the server keeps a proof made for one from being replayed to another; the nonce, one the server just chose, keeps it from being replayed to the same one. - newest_
first - Newest first: the higher revision, then the lower
PortableIdentityState::digest. How a verifier picks the newest of rival states, the same everywhere. - portable_
rp_ id_ hash - SHA-256 of
PORTABLE_RP: what an assertion’sauthenticatorDatastarts with. - revocation_
lapsed - Whether a revocation made at
revoked_atis pastREVOCATION_WINDOWatnow, and so may be dropped: it can stop no credential that would otherwise hold. - root_
add_ message - What an added root signs to prove it is held, for
user:ROOT_ADD_DOMAIN, the user (32 bytes), then the root (RootKey::bytes). - root_
endorse_ message - What the root that adds another signs, for
user:ROOT_ENDORSE_DOMAIN, the user (32 bytes), the added root (RootKey::bytes), then when it was added (i64, big-endian). - root_
set - The roots of
user, from its genesis (none for a phrase identity whose genesis the verifier has not seen: its one root is the phrase root its id is) andstates, each already checked (PortableIdentityState::verify) and ofuser. - tie_
message - What a portable user signs to tie their identity to the local account
usernameon the server whose endpoint id isserver, answering the server’snonce:TIE_DOMAIN, the server’s id (32 bytes), the nonce (32), the user (32), then the username’s length in bytes (u16, big-endian) and its UTF-8. Each part keeps a proof from being used elsewhere: on another server, again on this one, for another identity, or onto another account here. - verify_
device_ proof - Whether
signatureiscredential’s device key’s overdevice_proof_message(server, nonce). Checks the proof only: the credential itself isUserDeviceCredential::verify’s.