pub trait IdentityKeyStore: RefUnwindSafe {
// Required methods
fn identity_key_pair(&self) -> Result<(Buffer, Buffer), InternalError>;
fn local_registration_id(&self) -> Result<u32, InternalError>;
fn is_trusted_identity(
&self,
address: Address,
identity_key: &[u8],
) -> Result<bool, InternalError>;
fn save_identity(
&self,
address: Address,
identity_key: &[u8],
) -> Result<(), InternalError>;
}
Expand description
Something used to store identity keys and track trusted identities.
Required Methods§
Sourcefn identity_key_pair(&self) -> Result<(Buffer, Buffer), InternalError>
fn identity_key_pair(&self) -> Result<(Buffer, Buffer), InternalError>
Get the local client’s identity key pair as the tuple (public, private)
.
Sourcefn local_registration_id(&self) -> Result<u32, InternalError>
fn local_registration_id(&self) -> Result<u32, InternalError>
Get the local client’s registration ID.
Clients should maintain a registration ID, a random number between 1 and 16380 that’s generated once at install time.
Sourcefn is_trusted_identity(
&self,
address: Address,
identity_key: &[u8],
) -> Result<bool, InternalError>
fn is_trusted_identity( &self, address: Address, identity_key: &[u8], ) -> Result<bool, InternalError>
Verify a remote client’s identity key.
Determine whether a remote client’s identity is trusted. Convention is that the TextSecure protocol is trust on first use. This means that an identity key is considered trusted if there is no entry for the recipient in the local store, or if it matches the saved key for a recipient in the local store. Only if it mismatches an entry in the local store is it considered untrusted.
Sourcefn save_identity(
&self,
address: Address,
identity_key: &[u8],
) -> Result<(), InternalError>
fn save_identity( &self, address: Address, identity_key: &[u8], ) -> Result<(), InternalError>
Save a remote client’s identity key as trusted.
The value of identity_key
may be empty. In this case remove the key
data from the identity store, but retain any metadata that may be
kept alongside it.