pub struct Protocol<SK, ESK, SIG, S, KDF, CIPHER> where
SK: SecretKey,
ESK: SecretKey,
SIG: Signature,
S: ProtocolStorage<SK, SK::PK, SIG>,
KDF: Kdf,
CIPHER: Aead, {
pub storage: S,
/* private fields */
}
Expand description
X3DH Protocol.
Fields
storage: S
Protocol
key storage.
Implementations
sourceimpl<SK, ESK, SIG, S, KDF, CIPHER> Protocol<SK, ESK, SIG, S, KDF, CIPHER> where
SK: SecretKey + DiffieHellman<PK = <SK as SecretKey>::PK> + From<ESK>,
<SK as SecretKey>::PK: ToVec + Verify<SIG = SIG>,
ESK: SecretKey + Generate,
SIG: Signature,
S: ProtocolStorage<SK, <SK as SecretKey>::PK, SIG>,
KDF: Kdf,
<SK as DiffieHellman>::SSK: ToVec,
CIPHER: Aead,
XxxDhError: From<<<SK as SecretKey>::PK as Verify>::E> + From<<CIPHER as Aead>::E> + From<<KDF as Kdf>::E>,
impl<SK, ESK, SIG, S, KDF, CIPHER> Protocol<SK, ESK, SIG, S, KDF, CIPHER> where
SK: SecretKey + DiffieHellman<PK = <SK as SecretKey>::PK> + From<ESK>,
<SK as SecretKey>::PK: ToVec + Verify<SIG = SIG>,
ESK: SecretKey + Generate,
SIG: Signature,
S: ProtocolStorage<SK, <SK as SecretKey>::PK, SIG>,
KDF: Kdf,
<SK as DiffieHellman>::SSK: ToVec,
CIPHER: Aead,
XxxDhError: From<<<SK as SecretKey>::PK as Verify>::E> + From<<CIPHER as Aead>::E> + From<<KDF as Kdf>::E>,
pub fn new(
identity_keypair: KeyPair<SK>,
prekey_keypair: KeyPair<SK>,
prekey_signature: SIG,
onetime_keypairs: Option<Vec<KeyPair<SK>>>
) -> Self
sourcepub fn prepare_init_msg(
&mut self,
receiver_identity: &<SK as SecretKey>::PK,
receiver_prekey: &<SK as SecretKey>::PK,
receiver_prekey_signature: &SIG,
receiver_onetime_key: &<SK as SecretKey>::PK
) -> Result<(<SK as SecretKey>::PK, <SK as SecretKey>::PK, <SK as SecretKey>::PK, Vec<u8>, Vec<u8>, Vec<u8>), XxxDhError>
pub fn prepare_init_msg(
&mut self,
receiver_identity: &<SK as SecretKey>::PK,
receiver_prekey: &<SK as SecretKey>::PK,
receiver_prekey_signature: &SIG,
receiver_onetime_key: &<SK as SecretKey>::PK
) -> Result<(<SK as SecretKey>::PK, <SK as SecretKey>::PK, <SK as SecretKey>::PK, Vec<u8>, Vec<u8>, Vec<u8>), XxxDhError>
Derive secret key and create initial message using receiver’s keys.
Derive secret key from sender’s message.
Auto Trait Implementations
impl<SK, ESK, SIG, S, KDF, CIPHER> RefUnwindSafe for Protocol<SK, ESK, SIG, S, KDF, CIPHER> where
CIPHER: RefUnwindSafe,
ESK: RefUnwindSafe,
KDF: RefUnwindSafe,
S: RefUnwindSafe,
SIG: RefUnwindSafe,
SK: RefUnwindSafe,
impl<SK, ESK, SIG, S, KDF, CIPHER> Send for Protocol<SK, ESK, SIG, S, KDF, CIPHER> where
CIPHER: Send,
ESK: Send,
KDF: Send,
S: Send,
SIG: Send,
SK: Send,
impl<SK, ESK, SIG, S, KDF, CIPHER> Sync for Protocol<SK, ESK, SIG, S, KDF, CIPHER> where
CIPHER: Sync,
ESK: Sync,
KDF: Sync,
S: Sync,
SIG: Sync,
SK: Sync,
impl<SK, ESK, SIG, S, KDF, CIPHER> Unpin for Protocol<SK, ESK, SIG, S, KDF, CIPHER> where
CIPHER: Unpin,
ESK: Unpin,
KDF: Unpin,
S: Unpin,
SIG: Unpin,
SK: Unpin,
impl<SK, ESK, SIG, S, KDF, CIPHER> UnwindSafe for Protocol<SK, ESK, SIG, S, KDF, CIPHER> where
CIPHER: UnwindSafe,
ESK: UnwindSafe,
KDF: UnwindSafe,
S: UnwindSafe,
SIG: UnwindSafe,
SK: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more