Skip to main content

Module portable

Module portable 

Source
Expand description

A portable user’s identity (P7-01, ARCHITECTURE §42–§43): the public half of a root signing key the user owns, not an account any server hosts; and what that root signs (P7-02, §45, §48): 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 (P7-04).

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§

AddedRoot
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, over root_add_message. A state lists every one so far, so any state carries the whole chain.
DevicePublicKey
One device’s key for acting as a portable user (§45): 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.
IdentityGenesis
How an identity begins (P7-08): 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.
IdentityRecord
What a device or server keeps of an identity to check it, and hands on so another can (P7-08): 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.
InvalidDevicePublicKey
Not a device key: not 64 hex digits, or not an Ed25519 public key.
InvalidPortableUserId
Not a portable user id: not 64 hex digits.
PortableIdentityState
A user’s root’s list of revoked device keys, at a revision (§48), and (P7-08) 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 (the user’s choice, 2026-10-09), so it lists no authorized keys.
PortableUserId
Who a portable user is. For an identity begun with one phrase root, its root’s Ed25519 public key (P7-01); for any other, derived from its genesis (IdentityGenesis::user, P7-08). Written as 64 lowercase hex digits, as iroh writes an EndpointId; serialized the same way.
RemovedRoot
A root a state removes, and when (Unix seconds). A removed root never comes back.
RevokedKey
One revoked device key, and when the root revoked it (Unix seconds).
RootChanges
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 (P7-08):
Signature
Ed25519 signature.
StateChanges
What a state changes, for PortableIdentityState::signed_by: revocations and roots, each cumulative.
UserDeviceCredential
A user’s root’s word that a device key may act as them (§45), 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§

CredentialError
Why a credential, or a device’s proof with it, does not authenticate.
GenesisError
Why a genesis is not one.
RootKey
A key that may act for an identity.
RootRegistration
How a security key made a root’s credential (P7-08), as a device’s key API returns it: what Self::root reads the root from.
RootSignature
A root’s signature: a phrase root’s Ed25519 one, or a security key’s assertion: raw CTAP2 (its authenticatorData and DER ECDSA signature), or WebAuthn (the same, and the clientDataJSON the platform wrote and the key signed the hash of).
StateError
Why an identity state is not one.
TieProof
Who signed a tie_message for a portable user: their root, on the phone that holds it, or one of their device keys, with the credential the root gave it (P7-04). Either way the root itself never travels.
TieProofError
Why a TieProof does not prove its user.
WebAuthnError
Why a WebAuthn assertion or registration is refused.

Constants§

CLOCK_SKEW
How far ahead of a verifier’s clock a credential’s issued_at may 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::message lays 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 attestationObject a 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 authenticatorData a root signature may carry. An assertion’s is 37 bytes and its extensions; this leaves room for them.
MAX_CLIENT_DATA_JSON
The longest clientDataJSON a 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 (the user’s choice, 2026-10-09). A stale device ages out within that, even where no revocation ever reaches (§45, §48).
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_WINDOW may 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 PX-14’s *.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_VALIDITY of its issued_at, which is at most CLOCK_SKEW ahead 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 (P7-08). 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 (P7-04).
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’s authenticatorData starts with.
revocation_lapsed
Whether a revocation made at revoked_at is past REVOCATION_WINDOW at now, 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) and states, each already checked (PortableIdentityState::verify) and of user.
tie_message
What a portable user signs to tie their identity to the local account username on the server whose endpoint id is server, answering the server’s nonce (P7-04): 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 signature is credential’s device key’s over device_proof_message(server, nonce). Checks the proof only: the credential itself is UserDeviceCredential::verify’s.