PublishedNskeyKeyRing class

An NskeyKeyRing that publishes the owner's nskey and discovers other atSigns' by plookup.

Own privates are held in memory here; conveying them per-APKAM over the secret-sharing substrate is what supplies them to an enrollment that did not run mintAndPublish itself.

Implemented types

Constructors

PublishedNskeyKeyRing(AtClient _atClient, {AdvertisedKeyVerifier? verifier, Duration advertisementTtl = const Duration(minutes: 15), Duration advertisementStaleGrace = const Duration(minutes: 15), MintLock? mintLock, Duration lockTtl = mintLockTtl, Duration lockBudgetPerMember = const Duration(seconds: 2), NskeyPrivateFiling? privateFiling, Future<void> requestConveyance(String namespace, String secretName)?, Future<void> fetchConveyance()?, Stream<DataEvent> ownChanges()?, bool askOnReadMiss = true})
ownChanges, when given, is where the ring hears that local storage's copy of this client's own advertisement changed — sync landing a sibling's rotation — so it re-reads at once rather than when advertisementTtl runs out. It is listened to from the first read of an own advertisement, so a client that never reads one subscribes to nothing.

Properties

advertisementStaleGrace → Duration
How far past advertisementTtl a re-fetch that cannot reach an answer may keep serving the advertisement it already has, before the failure is thrown to the caller.
final
advertisementTtl → Duration
How long a fetched advertisement is trusted before it is re-fetched.
final
askCooldown ↔ Duration
How long after an on-miss fetch, an on-miss read of an own advertisement, or an ask about a generation, this ring stays quiet about it.
getter/setter pair
asksOnReadMiss → bool
Whether a read miss on an own generation will broadcast a pull: a ring that answers false cannot heal, however the rest of it is wired.
no setter
fetchOnMissTimeout ↔ Duration
How long a miss on an own private waits for each of the on-miss read of the own advertisement and the fetch of this enrollment's conveyance records.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
lockBudgetPerMember → Duration
What each enrollment listed for a namespace adds to lockTtl for a mint that conveys before it publishes, so the lock outlasts the conveyance.
final
lockTtl → Duration
How long this ring holds a namespace's mint lock once it has taken it.
final
mintLock → MintLock
Serialises minting between this atSign's own enrollments.
final
namespacesAskedRecently → int
How many namespaces this ring asked about within the last askCooldown.
no setter
privateFiling → NskeyPrivateFiling?
Where a minted private is made durable before its public half is published.
no setter
privatesFiled → Stream<FiledNskeyPrivate>
Fires once per private half filed, after it is stored and readable.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
startUpAsksPending → Future<void>?
Completes once the client's start-up has made its asks, or will make none; null when its start-up was never to ask.
no setteroverride
verifier → AdvertisedKeyVerifier
final

Methods

add(String namespace, {Future<void> conveyFirst(List<String> nskeyKids)?, Duration? lockTtl}) → Future<NskeyAdvertisement?>
Adds this client's missing key-establishment material to the current generation, in place; returns the advertisement now published, or null if nothing was added.
currentPublic(String owner, String namespace) → Future<NskeyAdvertisement?>
The generation new conveyances seal to for (owner, namespace).
override
forgetRemote(String owner, String namespace) → void
Drop what this ring cached for (owner, namespace), forcing the next read to go to the atServer.
heldNamespaces(String owner) → Future<Set<String>>
What its privateFiling lists, which every private this ring mints or reads is filed through; only the current atSign's.
override
heldPrivateHalf(String owner, String namespace, String nskeyKid) → Future<NskeyDecapsulationKey?>
What privateHalf answers, without asking the atSign's other enrollments for a private this client does not hold.
heldPublic(String owner, String namespace, String nskeyKid) → Future<PackageKey?>
The public half of a named generation of (owner, namespace) whose private this client holds, taken from what it holds rather than read from an advertisement, or null when it holds no such private.
override
mintAndPublish(String namespace, {Future<void> conveyFirst(List<String> nskeyKids)?, NskeyAfterPublish? afterPublish, Duration? lockTtl}) → Future<NskeyAdvertisement>
Mint a generation for (currentAtSign, namespace) and publish its public half immediately.
missingKeyAlgorithms(NskeyAdvertisement current) → List<String>
Which of this client's configured algorithms current offers no key for, which is what add would mint.
mostSpecificPublic(String owner, List<String> namespaces, {void missed(String namespace)?}) → Future<({NskeyAdvertisement advertisement, String namespace})?>
Asks the atServer about every one of namespaces it holds no fresh copy for, more specific than one it does, in one batch of lookups, and verifies only the advertisement it answers with.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
privateHalf(String owner, String namespace, String nskeyKid, {String? writtenBy}) → Future<NskeyDecapsulationKey?>
A miss on an own generation fetches this enrollment's conveyance records and then asks the other enrollments, when an own advertisement names the generation, or when this atSign wrote the record (writtenBy) in a namespace _knowsOwn accepts.
override
publishedAdvertisement(String owner, String namespace) → Future<NskeyAdvertisement?>
The generation publishedRecord reads, without its record stamp.
publishedRecord(String owner, String namespace) → Future<({NskeyAdvertisement advertisement, DateTime? updatedAt})?>
What (owner, namespace) has published on the atServer, read past local storage and this ring's own caches, and the atServer's own stamp on that record.
rememberOwn(String owner, String namespace, NskeyAdvertisement advertisement) → void
Record a generation as this client's own, without minting one.
rotate(String namespace, {Future<void> conveyFirst(List<String> nskeyKids)?, NskeyAfterPublish? afterPublish, Duration? lockTtl}) → Future<({NskeyAdvertisement rotated, NskeyAdvertisement superseded})>
Rotates (currentAtSign, namespace) onto a fresh generation: mints the next keypair, overwrites the published advertisement with it, and keeps every private this client already held, so records sealed to an earlier generation still open.
startUpAsked() → void
This client's start-up has made its asks, or will make none.
startUpAskFor(String namespace, String nskeyKid) → Future<void>?
Start-up's ask for namespace's generation nskeyKid while its answer is awaited, or null; it completes once the answer is filed or the wait for one ends.
override
startUpWillAsk() → void
This client's start-up is to ask for the own privates it lacks, until startUpAsked.
toString() → String
A string representation of this object.
inherited
wantedKeyAlgorithms() → List<String>
The key-establishment algorithms this client mints for, in the preference's own order.

Operators

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