pub struct LockId { /* private fields */ }
Expand description

An identifier for a corresponding LockKey that can be used to encrypt data for that key.

This contains a cryptographic public encryption key.

Example


// We've been given a LockId that we're sending encrypted data to.
println!("LockId(Base58): {}", key.id());

// Encrypt some data for that LockId
let data = b"I am sensitive information, about to be encrypted";
let lockbox = id.encrypt_data(&mut csprng, data.as_ref());

// The lockbox can be encoded onto a vec or used as raw bytes.
let mut to_send = Vec::new();
to_send.extend_from_slice(lockbox.as_bytes());

Implementations

Encrypt a byte slice into a DataLockbox. Requires a cryptographic RNG to generate the needed nonce.

Get the cryptographic algorithm version used for this ID.

Get the raw public encryption key contained within.

Convert into a byte vector. For extending an existing byte vector, see encode_vec.

Attempt to parse a base58-encoded LockId.

Convert into a base58-encoded LockId.

Encode onto an existing byte vector. Writes out the version followed by the public signing key. It does not include any length information in the encoding.

Get the length of this Identity once encoded as bytes.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Display as a base58-encoded string.

Feeds this value into the given Hasher. Read more

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

Formats the value using the given formatter.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

Formats the value using the given formatter.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.