libsignal-protocol-c  master
signal_protocol_identity_key_store Struct Reference

Public Attributes

int(* get_identity_key_pair )(signal_buffer **public_data, signal_buffer **private_data, void *user_data)
 
int(* get_local_registration_id )(void *user_data, uint32_t *registration_id)
 
int(* save_identity )(const signal_protocol_address *address, uint8_t *key_data, size_t key_len, void *user_data)
 
int(* is_trusted_identity )(const signal_protocol_address *address, uint8_t *key_data, size_t key_len, void *user_data)
 
void(* destroy_func )(void *user_data)
 
void * user_data
 

Member Data Documentation

◆ destroy_func

void(* signal_protocol_identity_key_store::destroy_func) (void *user_data)

Function called to perform cleanup when the data store context is being destroyed.

◆ get_identity_key_pair

int(* signal_protocol_identity_key_store::get_identity_key_pair) (signal_buffer **public_data, signal_buffer **private_data, void *user_data)

Get the local client's identity key pair.

Parameters
public_datapointer to a newly allocated buffer containing the public key, if found. Unset if no record was found. The Signal Protocol library is responsible for freeing this buffer.
private_datapointer to a newly allocated buffer containing the private key, if found. Unset if no record was found. The Signal Protocol library is responsible for freeing this buffer.
Returns
0 on success, negative on failure

◆ get_local_registration_id

int(* signal_protocol_identity_key_store::get_local_registration_id) (void *user_data, uint32_t *registration_id)

Return 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.

Parameters
registration_idpointer to be set to the local client's registration ID, if it was successfully retrieved.
Returns
0 on success, negative on failure

◆ is_trusted_identity

int(* signal_protocol_identity_key_store::is_trusted_identity) (const signal_protocol_address *address, uint8_t *key_data, size_t key_len, void *user_data)

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.'

Parameters
addressthe address of the remote client
identityKeyThe identity key to verify.
key_dataPointer to the identity key to verify
key_lenLength of the identity key to verify
Returns
1 if trusted, 0 if untrusted, negative on failure

◆ save_identity

int(* signal_protocol_identity_key_store::save_identity) (const signal_protocol_address *address, uint8_t *key_data, size_t key_len, void *user_data)

Save a remote client's identity key

Store a remote client's identity key as trusted. The value of key_data may be null. In this case remove the key data from the identity store, but retain any metadata that may be kept alongside it.

Parameters
addressthe address of the remote client
key_dataPointer to the remote client's identity key, may be null
key_lenLength of the remote client's identity key
Returns
0 on success, negative on failure

◆ user_data

void* signal_protocol_identity_key_store::user_data

User data pointer


The documentation for this struct was generated from the following file: