Struct libsignal_protocol::IdentityKeyPair
source · pub struct IdentityKeyPair { /* private fields */ }
Expand description
The private identity of a user.
Can be converted to and from KeyPair
.
Implementations§
source§impl IdentityKeyPair
impl IdentityKeyPair
sourcepub fn new(identity_key: IdentityKey, private_key: PrivateKey) -> Self
pub fn new(identity_key: IdentityKey, private_key: PrivateKey) -> Self
Create a key pair from a public identity_key
and a private private_key
.
sourcepub fn generate<R: CryptoRng + Rng>(csprng: &mut R) -> Self
pub fn generate<R: CryptoRng + Rng>(csprng: &mut R) -> Self
Generate a random new identity from randomness in csprng
.
sourcepub fn identity_key(&self) -> &IdentityKey
pub fn identity_key(&self) -> &IdentityKey
Return the public identity of this user.
sourcepub fn public_key(&self) -> &PublicKey
pub fn public_key(&self) -> &PublicKey
Return the public key that defines this identity.
sourcepub fn private_key(&self) -> &PrivateKey
pub fn private_key(&self) -> &PrivateKey
Return the private key that defines this identity.
sourcepub fn serialize(&self) -> Box<[u8]>
pub fn serialize(&self) -> Box<[u8]>
Return a byte slice which can later be deserialized with Self::try_from
.
sourcepub fn sign_alternate_identity<R: Rng + CryptoRng>(
&self,
other: &IdentityKey,
rng: &mut R,
) -> Result<Box<[u8]>>
pub fn sign_alternate_identity<R: Rng + CryptoRng>( &self, other: &IdentityKey, rng: &mut R, ) -> Result<Box<[u8]>>
Generate a signature claiming that other
represents the same user as self
.
Trait Implementations§
source§impl Clone for IdentityKeyPair
impl Clone for IdentityKeyPair
source§fn clone(&self) -> IdentityKeyPair
fn clone(&self) -> IdentityKeyPair
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl From<IdentityKeyPair> for KeyPair
impl From<IdentityKeyPair> for KeyPair
source§fn from(value: IdentityKeyPair) -> Self
fn from(value: IdentityKeyPair) -> Self
Converts to this type from the input type.
source§impl From<KeyPair> for IdentityKeyPair
impl From<KeyPair> for IdentityKeyPair
source§impl TryFrom<&[u8]> for IdentityKeyPair
impl TryFrom<&[u8]> for IdentityKeyPair
source§impl TryFrom<PrivateKey> for IdentityKeyPair
impl TryFrom<PrivateKey> for IdentityKeyPair
§type Error = SignalProtocolError
type Error = SignalProtocolError
The type returned in the event of a conversion error.
source§fn try_from(private_key: PrivateKey) -> Result<Self>
fn try_from(private_key: PrivateKey) -> Result<Self>
Performs the conversion.
impl Copy for IdentityKeyPair
Auto Trait Implementations§
impl Freeze for IdentityKeyPair
impl RefUnwindSafe for IdentityKeyPair
impl Send for IdentityKeyPair
impl Sync for IdentityKeyPair
impl Unpin for IdentityKeyPair
impl UnwindSafe for IdentityKeyPair
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more