BareIdKey

Struct BareIdKey 

Source
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

Source

pub fn new() -> BareIdKey

Generate a new self-contained Identity key.

Source

pub fn with_rng<R>(csprng: &mut R) -> BareIdKey
where R: CryptoRng + RngCore,

Generate a new key given a cryptographic random number generator.

Source

pub fn with_rng_and_version<R>( csprng: &mut R, version: u8, ) -> Result<BareIdKey, CryptoError>
where R: CryptoRng + RngCore,

Generate a new key with a specific version, given a cryptographic random number generator. Fails if the version isn’t supported.

Source

pub fn from_base58(s: &str) -> Result<BareIdKey, CryptoError>

Attempt to parse a base58-encoded BareIdKey.

Source

pub fn to_base58(&self) -> String

Convert into a base58-encoded BareIdKey.

Source

pub fn size(&self) -> usize

Source

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 Clone for BareIdKey

Source§

fn clone(&self) -> BareIdKey

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BareIdKey

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for BareIdKey

Source§

fn default() -> BareIdKey

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for BareIdKey

Source§

fn deserialize<D>( deserializer: D, ) -> Result<BareIdKey, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for BareIdKey

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Display as a base58-encoded string.

Source§

impl From<BareIdKey> for Value

Source§

fn from(value: BareIdKey) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<BareIdKey> for ValueRef<'a>

Source§

fn from(value: BareIdKey) -> Self

Converts to this type from the input type.
Source§

impl Hash for BareIdKey

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl LowerHex for BareIdKey

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl PartialEq for BareIdKey

Source§

fn eq(&self, other: &BareIdKey) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for BareIdKey

Source§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl SignInterface for BareIdKey

Source§

fn sign(&self, hash: &Hash) -> Signature

Sign a hash.
Source§

fn id(&self) -> &Identity

Get the corresponding Identity for the private key.
Source§

fn self_export_lock( &self, csprng: &mut dyn CryptoSrc, receive_lock: &LockId, ) -> Option<IdentityLockbox>

Export the signing key in an 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>

Export the signing key in an 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.
Source§

impl TryFrom<&[u8]> for BareIdKey

Source§

type Error = CryptoError

The type returned in the event of a conversion error.
Source§

fn try_from( value: &[u8], ) -> Result<BareIdKey, <BareIdKey as TryFrom<&[u8]>>::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for BareIdKey

Source§

type Error = Value

The type returned in the event of a conversion error.
Source§

fn try_from(v: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<ValueRef<'a>> for BareIdKey

Source§

type Error = ValueRef<'a>

The type returned in the event of a conversion error.
Source§

fn try_from(v: ValueRef<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl UpperHex for BareIdKey

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for BareIdKey

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,