InMemoryIdentityKeyStore class
In-memory implementation of IdentityKeyStore.
This implementation stores identity keys in memory and is suitable for testing and prototyping. For production use, implement a persistent store backed by secure storage.
Warning: Trust-On-First-Use (TOFU) applies whatever the store: the ciphers in this package trust a new identity automatically and reject only one that differs from what getIdentity returns. They never call isTrustedIdentity, which here implements the same rule for code that asks it directly (see IdentityKeyStore.isTrustedIdentity). That may not be appropriate for all security contexts. Production implementations should consider:
- Notifying users when a contact's identity key changes
- Requiring explicit user verification for new contacts
- Implementing key verification UI (e.g., safety numbers)
Note: This implementation does NOT persist data across app restarts.
- Implemented types
Constructors
- InMemoryIdentityKeyStore(IdentityKeyPair _identityKeyPair, int _localRegistrationId)
- Creates an in-memory identity key store.
Properties
Methods
-
clear(
) → void - Clears all stored identities.
-
getIdentity(
ProtocolAddress address) → Future< PublicKey?> -
Gets the stored identity key for a remote user.
override
-
getIdentityKeyPair(
) → Future< IdentityKeyPair> -
Gets our own identity key pair.
override
-
getLocalRegistrationId(
) → Future< int> -
Gets our local registration ID.
override
-
isTrustedIdentity(
ProtocolAddress address, PublicKey identityKey, Direction direction) → Future< bool> -
Checks if the given identity key is trusted for the given address.
override
-
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.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited