pub struct BareIdKey { /* private fields */ }Expand description
A self-contained implementor of SignInterface. It’s expected this will be used unless the key
is being managed by the OS or a hardware module.
In general, you do not want to use this directly - IdentityKey is
strongly preferred. This exists only so raw signing keys can be passed out
without having a target LockKey or StreamKey -
a specialized requirement needed to implement things like invite tokens.
Implementations§
Source§impl BareIdKey
impl BareIdKey
Sourcepub fn with_rng<R>(csprng: &mut R) -> BareIdKey
pub fn with_rng<R>(csprng: &mut R) -> BareIdKey
Generate a new key given a cryptographic random number generator.
Sourcepub fn with_rng_and_version<R>(
csprng: &mut R,
version: u8,
) -> Result<BareIdKey, CryptoError>
pub fn with_rng_and_version<R>( csprng: &mut R, version: u8, ) -> Result<BareIdKey, CryptoError>
Generate a new key with a specific version, given a cryptographic random number generator. Fails if the version isn’t supported.
Sourcepub fn from_base58(s: &str) -> Result<BareIdKey, CryptoError>
pub fn from_base58(s: &str) -> Result<BareIdKey, CryptoError>
Attempt to parse a base58-encoded BareIdKey.
pub fn size(&self) -> usize
Sourcepub fn encode_vec(&self, buf: &mut Vec<u8>)
pub fn encode_vec(&self, buf: &mut Vec<u8>)
Encode the raw key, prepended with the version byte. The output vector must be either zeroized or encrypted before being dropped.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for BareIdKey
impl<'de> Deserialize<'de> for BareIdKey
Source§fn deserialize<D>(
deserializer: D,
) -> Result<BareIdKey, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<BareIdKey, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl Serialize for BareIdKey
impl Serialize for BareIdKey
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Source§impl SignInterface for BareIdKey
impl SignInterface for BareIdKey
Source§fn self_export_lock(
&self,
csprng: &mut dyn CryptoSrc,
receive_lock: &LockId,
) -> Option<IdentityLockbox>
fn self_export_lock( &self, csprng: &mut dyn CryptoSrc, receive_lock: &LockId, ) -> Option<IdentityLockbox>
IdentityLockbox, with receive_lock as the recipient. If
the key cannot be exported, this should return None.Source§fn self_export_stream(
&self,
csprng: &mut dyn CryptoSrc,
receive_stream: &StreamKey,
) -> Option<IdentityLockbox>
fn self_export_stream( &self, csprng: &mut dyn CryptoSrc, receive_stream: &StreamKey, ) -> Option<IdentityLockbox>
IdentityLockbox, with receive_stream as the recipient. If
the key cannot be exported, this should return None. Additionally, if the underlying
implementation does not allow moving the raw key into memory (i.e. it cannot call
StreamInterface::encrypt or lock_id_encrypt) then None
can also be returned.