pub struct StaticSecret(_);
Expand description

A Diffie-Hellman secret key that can be used to compute multiple SharedSecrets.

This type is identical to the EphemeralSecret type, except that the StaticSecret::diffie_hellman method does not consume the secret key, and the type provides serialization methods to save and load key material. This means that the secret may be used multiple times (but does not have to be).

Some protocols, such as Noise, already handle the static/ephemeral distinction, so the additional guarantees provided by EphemeralSecret are not helpful or would cause duplicate code paths. In this case, it may be useful to

use x25519_dalek::StaticSecret as SecretKey;

since the only difference between the two is that StaticSecret does not enforce at compile-time that the key is only used once.

Implementations§

Perform a Diffie-Hellman key agreement between self and their_public key to produce a SharedSecret.

Generate an x25519 key.

Extract this key’s bytes for serialization.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Executes the destructor for this type. Read more

Given an x25519 StaticSecret key, compute its corresponding PublicKey.

Load a secret key from a byte array.

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler. Read more

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

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. 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.