passkey library
The passkey custody surface: onboarding an atSign with a passkey, opening it again, the session either returns, and the enrollment gateway, stores and @keys IO they run on.
Classes
- AtAuthEnrollmentGateway
- The production EnrollmentGateway: at_auth enrollment and at_client activation, with the APKAM key pair the passkey derives.
- AtServerAtKeysIo
- An enrollment's @keys, held as one sealed document on the atServer.
- EnrollmentDocumentStore
- Reads and writes an enrollment's sealed @keys document over that enrollment's authenticated connection.
- EnrollmentGateway
- Enrolls and authenticates with an ML-DSA-65 APKAM key pair derived from a passkey.
- EnrollmentPointerReader
- Reads a passkey's enrollment pointer by its lookup id and namespace.
- EnrollmentPointerStore
- Reads and writes enrollment pointers.
- EnrollmentSession
- A PKAM-authenticated enrollment on the atServer.
- LookupEnrollmentPointerReader
-
Reads pointers with an unauthenticated
lookup:on a connection of its own from lookUps, closed after each read. - PasskeyCustody
- Onboards and opens the passkey-held @keys of an atSign.
- PasskeySession
- A client opened with a passkey, with the key store it runs on and the passkey vault that store seals with.
- StoragePersistence
- Asks the platform to keep this application's stored data rather than evict it.
Enums
- CompletionDue
- What an enrollment's completion-due record says: that the completion of the activation that created the enrollment is due, and how far the onboarding got.
- PublishedEncryptionKey
- How the encryption public key the atServer publishes for an atSign stands against the one an @keys document holds.
Typedefs
-
Activator
= Future<
AtKeys> Function({required ApkamKeyPair apkamKeyPair, required String atSign, required String cram}) -
Activates a fresh atSign with
cramandapkamKeyPairas its first enrollment's APKAM key, leaving the activation to be completed, and returns the keys it minted. - ApkamKeyPair = ({String privateKey, String publicKey})
- An ML-DSA-65 APKAM key pair as base64 text, the form at_auth takes.
-
ClientOpener
= Future<
AtClient> Function({required String atSign, required String enrollmentId, required WrittenAtKeysIo keysIo, required AtLookupMuxable lookUp}) -
Opens the client that runs as
enrollmentIdonlookUp: the connection that already authenticated as it. The client reads its @keys fromkeysIoand persists every change through it. It takes overlookUpand stops it when the client stops; it never closeskeysIo. If this throws,lookUpis still the caller's to release.
Exceptions / Errors
- AtServerAtKeysLockedException
- Thrown when a write could not take the enrollment's @keys lock within the store's bound, or kept losing it before the put. Nothing was put, and the store stays usable.
- AtServerAtKeysWriteException
- Thrown when the document read back after a write is not the one written or cannot be opened, when a write is attempted after the store refused one, or when the keys to write belong to another atSign. Nothing was overwritten to repair it.
- MissingAtKeysDocumentException
- Thrown when an authenticated enrollment has no @keys document.
- PasskeyLostException
- Thrown by PasskeyCustody.open when the passkey cannot open atSign's @keys: the ceremony returned no credential, the passkey's enrollment pointer does not exist, or the atServer refused PKAM for the key derived from it. The caller decides the screen; re-enrolling takes an OTP.
- PasskeyOnboardingIncompleteException
- Thrown by PasskeyCustody.onboard when an Exception stops it once the new enrollment's pointer is written. PasskeyCustody.open with the passkey then finishes the onboarding, unless its enrollment has been revoked since or PasskeyCustody.open refuses another published encryption public key with PublicKeyMismatchException; it opens the onboarding's enrollment and saves the passkey hints if they are not saved. Another onboarding with the same CRAM secret while that secret is still live, or a login that finishes another attempt, revokes that enrollment, and PasskeyCustody.open with this passkey then throws PasskeyLostException.
- PkamRefusedException
-
Thrown when the atServer's reply to an enrollment's
pkam:is, asclassifyConnectionFailurereads it, a refusal whose cause isunauthenticated,revoked,enrollmentDeniedorinvalidEnrollment: the key derived from the passkey is not that enrollment's key, or the enrollment no longer serves. A pending enrollment (enrollmentNotApproved), a failure classified any other way or not at all, and any failure before thepkam:is sent are not this. - PublicKeyMismatchException
- Thrown when the restored public keys differ from the published ones.