flush method

  1. @override
Future<void> flush(
  1. Atsign atsign,
  2. AtKeys atKeys
)
override

Persists atKeys as the complete new state for atsign.

Use it only for a keyset that was not read from this store, such as a pending enrollment's keys once its approval completes them. Key material is added to keys already stored through update, never by read, mutate and flush. Implementations backed by durable storage must not lose data: when a target already exists, validate that everything in it is preserved in atKeys (see AtKeysAssurance.validateMapUpdate), then rewrite. When no target exists, flush creates it — there is nothing to lose.

The never-lose contract applies to stores of bootstrap key material (the .atKeys file, keychain). A store holding rotating or evictable material defines its own retention policy — deletion there is a feature (forward secrecy), not data loss.

The default implementation throws: pre-existing WrittenAtKeysIo implementations compile unchanged but must override flush to support runtime persistence.

Implementation

@override
Future<void> flush(Atsign atsign, AtKeys atKeys) =>
    _serialized(() => _flush(atsign, atKeys));