IdentityKeyStore class abstract interface

Abstract interface for storing identity keys.

This store manages:

  • Our own identity key pair
  • Our local registration ID
  • Remote identities (public keys of other users)
  • Trust decisions for remote identities

Example implementation:

class MyIdentityKeyStore implements IdentityKeyStore {
  final IdentityKeyPair _identityKeyPair;
  final int _registrationId;
  final _identities = <String, PublicKey>{};

  MyIdentityKeyStore(this._identityKeyPair, this._registrationId);

  @override
  Future<IdentityKeyPair> getIdentityKeyPair() async => _identityKeyPair;
  // ... other methods
}

Durability (critical)

Writes to this store must be durably persisted before the returned future completes, or be part of a transaction committed durably before the ciphertext is sent / the plaintext is acted upon. The failure mode differs from SessionStore: losing a saveIdentity write does not rewind the ratchet, it silently downgrades MITM detection, because an address with no stored identity is trusted on first use. A remote key substituted while the write was missing is then accepted instead of raising UntrustedIdentity.

Note that the library stores the session and the remote identity through two separate callbacks, so a crash between them leaves the pair inconsistent. Wrapping the whole SessionCipher/SessionBuilder call in one transaction avoids that; 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

getIdentity(ProtocolAddress address) Future<PublicKey?>
Gets the stored identity key for a remote user.
getIdentityKeyPair() Future<IdentityKeyPair>
Gets our own identity key pair.
getLocalRegistrationId() Future<int>
Gets our local registration ID.
isTrustedIdentity(ProtocolAddress address, PublicKey identityKey, Direction direction) Future<bool>
Checks if the given identity key is trusted for the given address.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
saveIdentity(ProtocolAddress address, PublicKey identityKey) Future<bool>
Saves the identity key for a remote user.
toString() String
A string representation of this object.
inherited

Operators

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