pub struct KeyManager;
Expand description
Key manager to maintain secret key material (like our identity key) and to generate signed public pre-key bundles.
Implementations§
Source§impl KeyManager
impl KeyManager
Sourcepub fn init(
identity_secret: &SecretKey,
lifetime: Lifetime,
rng: &Rng,
) -> Result<KeyManagerState, KeyManagerError>
pub fn init( identity_secret: &SecretKey, lifetime: Lifetime, rng: &Rng, ) -> Result<KeyManagerState, KeyManagerError>
Returns newly initialised key-manager state, holding our identity secret and a new signed pre-key secret which can be used to generate key-bundles.
Trait Implementations§
Source§impl Clone for KeyManager
impl Clone for KeyManager
Source§fn clone(&self) -> KeyManager
fn clone(&self) -> KeyManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for KeyManager
impl Debug for KeyManager
Source§impl IdentityManager<KeyManagerState> for KeyManager
impl IdentityManager<KeyManagerState> for KeyManager
Source§fn identity_secret(y: &KeyManagerState) -> &SecretKey
fn identity_secret(y: &KeyManagerState) -> &SecretKey
Returns identity key secret.
Source§impl PreKeyManager for KeyManager
impl PreKeyManager for KeyManager
Source§fn prekey_secret(y: &Self::State) -> &SecretKey
fn prekey_secret(y: &Self::State) -> &SecretKey
Returns long-term pre-key secret.
Source§fn rotate_prekey(
y: Self::State,
lifetime: Lifetime,
rng: &Rng,
) -> Result<Self::State, Self::Error>
fn rotate_prekey( y: Self::State, lifetime: Lifetime, rng: &Rng, ) -> Result<Self::State, Self::Error>
Generates a new long-term pre-key secret with the given lifetime.
Source§fn prekey_bundle(y: &Self::State) -> LongTermKeyBundle
fn prekey_bundle(y: &Self::State) -> LongTermKeyBundle
Returns public long-term key-bundle which can be published on the network.
Note that returned key-bundles can be expired and thus invalid. Applications need to check the validity of the bundles and generate new ones when necessary.
Source§fn generate_onetime_bundle(
y: Self::State,
rng: &Rng,
) -> Result<(Self::State, OneTimeKeyBundle), Self::Error>
fn generate_onetime_bundle( y: Self::State, rng: &Rng, ) -> Result<(Self::State, OneTimeKeyBundle), Self::Error>
Creates a new public one-time key-bundle.
Source§fn use_onetime_secret(
y: Self::State,
id: OneTimePreKeyId,
) -> Result<(Self::State, Option<SecretKey>), Self::Error>
fn use_onetime_secret( y: Self::State, id: OneTimePreKeyId, ) -> Result<(Self::State, Option<SecretKey>), Self::Error>
Returns one-time pre-key secret used by a sender during X3DH.
Throws an error when requested pre-key secret is unknown (and thus probably was already used once).
Returns none when this key-manager doesn’t have any one-time pre-keys. New ones can be
created by calling generate_onetime_bundle
.