KeyPackageRegistration mixin

Maintains this APKAM keypair's KeyPackage for same-atSign secret sharing.

The recipient unit is the APKAM keypair (1:1:1 — one enrollment, one APKAM keypair, one key package): this client holds one X-Wing enc keypair (its kpid is the SHA-256 prefix of the public key) and publishes its APKAM signing key so peers can verify the envelopes it sends. Its key package is conveyed into the enrollment record by riding enroll:request as opaque EnrollParams.metadata at enrollment time (there is no post-enrollment write); peers discover it via the gated enroll:listns verb.

By default the enc keypair is generated fresh and held in memory; apps that want it stable across restarts supply loadApkamKeys / saveApkamKeys (which persist it to the keyfile/keychain alongside the APKAM keypair).

Superclass constraints
Mixin applications
  1. @experimental

Properties

atClient AtClient
no setterinherited
directory EnrollmentDirectory
The atServer-backed key-package directory. Defaults to a verb-backed implementation; tests assign a fake.
getter/setter pair
enrollmentId String
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
isRegistered bool
no setter
kpid String
This key package's addressing id (KeyPackage.kpid) — the SHA-256 prefix of the X-Wing public key. Throws StateError until register completes.
no setter
loadApkamKeys Future<PersistedApkamKeys?> Function()?
Supply to give this APKAM keypair a stable enc keypair across restarts. Called once, before generating a fresh one; return null to generate fresh.
getter/setter pair
logger → AtSignLogger
no setterinherited
myKeyPackage KeyPackage
This APKAM keypair's key package (the one registered for discovery). Throws StateError until register has generated the enc keypair.
no setter
privateSigningKey String
the private key used to sign things this application sends
no setterinherited
pubKeyCache Map<String, (String, Timer)>
finalinherited
publicKeyCacheSettings → ({Duration cacheExpiry, bool resetOnLookup})?
How to handle caching of public keys used for verification
finalinherited
publicSigningKey String
the public key which can be used to verify signatures made using privateSigningKey
no setterinherited
publicSigningKeyUri String
the uri (e.g. public:apsk.<enrollment_id>.__wa@atsign) of the publicSigningKey
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
saveApkamKeys Future<void> Function(PersistedApkamKeys keys)?
Supply to persist a freshly generated enc keypair (e.g. to the keyfile / platform keystore — the app's concern).
getter/setter pair
xWingPublicKey Uint8List
This APKAM keypair's X-Wing public key (raw bytes). Throws StateError until register has completed.
no setter
xWingSeed Uint8List
This APKAM keypair's X-Wing secret seed — for decapsulation by composing mixins, not for application use.
no setter

Methods

cachePubKey(String atSign, String enrollmentId, String pubKey) → void
inherited
getApkamPublicKey(String atSign, String enrollmentId) Future<String>
Fetch the APKAM public signing key which enrollmentId of atSign has published in its per-enrollment namespace. See ApkamSigning.publicSigningKeyUri.
inherited
lookupPubKey(String atSign, String enrollmentId) String?
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
publishPublicSigningKey() Future
inherited
register() Future<KeyPackage>
Generates (or loads, via loadApkamKeys) this APKAM keypair's X-Wing enc keypair and publishes its APKAM signing key (so peers can verify its envelopes), then returns this client's KeyPackage. Idempotent.
toString() String
A string representation of this object.
inherited
verifyEnvelopeSignature(Map envelope, {required String signerAtSign}) Future<void>
Verify an envelope created by wrapAndSign or wrapAndSignAndJsonEncode.
inherited
wrapAndSign(Object? payload, {Object? toEncodable(Object? nonEncodable)?}) FutureOr<Map<String, Object?>>
Create a json envelope around payload in a format that can be verified by verifyEnvelopeSignature.
inherited
wrapAndSignAndJsonEncode(Object? payload, {Object? toEncodable(Object? nonEncodable)?}) FutureOr<String>
Same as wrapAndSign but we also call jsonEncode for you :)
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited