SenderKeyStore class abstract interface

Abstract interface for storing sender keys for group messaging.

Sender keys enable efficient group messaging by using symmetric encryption within a group. Each group member distributes their sender key to other members, allowing them to decrypt messages from that sender.

Example implementation:

class MySenderKeyStore implements SenderKeyStore {
  final _senderKeys = <String, Uint8List>{};

  String _key(SenderKeyName name) =>
    '${name.sender.name}:${name.sender.deviceId}:${name.distributionId}';

  @override
  Future<Uint8List?> loadSenderKey(SenderKeyName senderKeyName) async {
    return _senderKeys[_key(senderKeyName)];
  }
  // ... other methods
}

Durability, ordering and rollback (critical)

A sender key record holds a symmetric chain key plus its iteration counter, and the message key for each group message is derived from them deterministically. This store therefore carries exactly the same risk as SessionStore: if a record is lost or rolled back, the next GroupCipher.encrypt re-derives a message key and IV that were already used, so two different group messages are encrypted in the same slot — see SessionStore for what that costs.

The same three requirements apply — persist durably before the ciphertext leaves the device (the library awaits storeSenderKey before returning it), keep deletes as durable as writes, and serialize GroupCipher operations per (sender, distribution ID) so that two concurrent sends cannot both consume the same iteration. See SessionStore and SECURITY.md for the full contract.

Implementers

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

loadSenderKey(SenderKeyName senderKeyName) → Future<Uint8List?>
Loads a sender key record.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
storeSenderKey(SenderKeyName senderKeyName, Uint8List record) → Future<void>
Stores a sender key record.
toString() → String
A string representation of this object.
inherited

Operators

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