CkManager class

Keeps a current content key in place for each destination a client writes to.

Content keys are scoped per recipient, and minting one writes a conveyance record, which cannot happen inside encrypt — so this runs before the put pipeline starts, via CryptoProvider.prepareForWrite.

Constructors

CkManager({required ContentKeyCache cache, required NskeyKeyRing keyRing, NskeyResolver? resolver, List<String> sealsToKeyAlgorithms = SecretSharingAlgos.keyAlgos, CkRotationPolicy ckRotationPolicy = rotateCkAfterOneYear, Duration supersededCkGrace = defaultSupersededCkGrace, CurrentCkPointer? pointer = const CurrentCkPointer()})

Properties

cache → ContentKeyCache
final
ckRotationPolicy → CkRotationPolicy
Asked, on the write path, whether the current content key should be replaced before anything else is written under it.
final
hashCode → int
The hash code for this object.
no setterinherited
idle → Future<void>
Completes once every cut and collection begun here so far has finished.
no setter
keyRing → NskeyKeyRing
final
pointer → CurrentCkPointer?
Remembers which CK is current for each destination, so a cold write resumes it rather than cutting another. Null disables that: every cold write then mints, leaving a permanent conveyance record behind each time.
final
resolver → NskeyResolver
Finds which level of a nested namespace holds the nskey to seal to, shared with the data provider so both ends of a write agree on where it lives.
final
rotateOwnNamespaceKeyIfAsked ↔ Future<bool> Function(String namespace)?
Asked, before a content key is conveyed to a namespace key this atSign owns, whether that namespace key should be replaced first.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sealsToKeyAlgorithms → List<String>
Which of a destination's advertised KEM keys this client is willing to seal to, strongest first. Defaults to everything this build can seal under; a narrowed list is a deployment choosing to refuse.
final
startUpSeeding ↔ StartUpSeeding?
The client's start-up seeding, which a write that finds no namespace key waits on while it is still to come. Null waits for nothing.
getter/setter pair
supersededCkGrace → Duration
How long a superseded content key is kept after the key that replaced it was cut, even when nothing in local storage cites it.
final

Methods

collectUnused(CryptoContext context) → Future<int>
Deletes the conveyances of every content key this enrollment cut that is neither current nor cited by a record in local storage, and was superseded at least supersededCkGrace ago, and returns how many keys went.
ensureCurrent(CryptoContext context, AtKey valueKey, {bool? useRemoteAtServer, String? sealToNamespace}) → Future<({String ckNs, String namespace})?>
Ensure (destination, namespace) has a current CK sealed to the destination's live nskey generation, minting and conveying one if not.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rotateContentKey(CryptoContext context, AtKey valueKey, {bool deleteSuperseded = false, bool? useRemoteAtServer}) → Future<ContentKey>
Rotates the content key for the destination valueKey addresses: cuts a fresh CK, conveys it, and makes it what new writes encrypt under.
toString() → String
A string representation of this object.
inherited
tryCollect(CryptoContext context) → Future<int?>
collectUnused, answering null when it was refused because sync had not caught up, the one refusal a later pass can overcome; a pass that does not look for another reason answers 0, as collectUnused does.

Operators

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