Type Alias dryoc::kx::StackSession

source ·
pub type StackSession = Session<SessionKey>;
Expand description

Stack-allocated type alias for Session. Provided for convenience.

Aliased Type§

struct StackSession { /* private fields */ }

Implementations

source§

impl<SessionKey: NewByteArray<CRYPTO_KX_SESSIONKEYBYTES> + Zeroize> Session<SessionKey>

source

pub fn new_client<PublicKey: ByteArray<CRYPTO_KX_PUBLICKEYBYTES> + Zeroize, SecretKey: ByteArray<CRYPTO_KX_SECRETKEYBYTES> + Zeroize>( client_keypair: &KeyPair<PublicKey, SecretKey>, server_public_key: &PublicKey ) -> Result<Self, Error>

Computes client session keys, given client_keypair and server_public_key, returning a new session upon success.

source

pub fn new_server<PublicKey: ByteArray<CRYPTO_KX_PUBLICKEYBYTES> + Zeroize, SecretKey: ByteArray<CRYPTO_KX_SECRETKEYBYTES> + Zeroize>( server_keypair: &KeyPair<PublicKey, SecretKey>, client_public_key: &PublicKey ) -> Result<Self, Error>

Computes server session keys, given server_keypair and client_public_key, returning a new session upon success.

source§

impl Session<SessionKey>

source

pub fn new_client_with_defaults<PublicKey: ByteArray<CRYPTO_KX_PUBLICKEYBYTES> + Zeroize, SecretKey: ByteArray<CRYPTO_KX_SECRETKEYBYTES> + Zeroize>( client_keypair: &KeyPair<PublicKey, SecretKey>, server_public_key: &PublicKey ) -> Result<Self, Error>

Returns a new client session upon success using the default types for the given client_keypair and server_public_key. Wraps Session::new_client, provided for convenience.

source

pub fn new_server_with_defaults<PublicKey: ByteArray<CRYPTO_KX_PUBLICKEYBYTES> + Zeroize, SecretKey: ByteArray<CRYPTO_KX_SECRETKEYBYTES> + Zeroize>( server_keypair: &KeyPair<PublicKey, SecretKey>, client_public_key: &PublicKey ) -> Result<Self, Error>

Returns a new server session upon success using the default types for the given server_keypair and client_public_key. Wraps Session::new_server, provided for convenience.

source§

impl<SessionKey: ByteArray<CRYPTO_KX_SESSIONKEYBYTES> + Zeroize> Session<SessionKey>

source

pub fn into_parts(self) -> (SessionKey, SessionKey)

Moves the rx_key and tx_key out of this instance, returning them as a tuple with (rx_key, tx_key).

source

pub fn rx_as_slice(&self) -> &[u8]

Returns a reference to a slice of the Rx session key.

source

pub fn tx_as_slice(&self) -> &[u8]

Returns a reference to a slice of the Tx session key.

source

pub fn rx_as_array(&self) -> &[u8; 32]

Returns a reference to an array of the Rx session key.

source

pub fn tx_as_array(&self) -> &[u8; 32]

Returns a reference to an array of the Tx session key.

Trait Implementations

source§

impl<SessionKey: Clone + ByteArray<CRYPTO_KX_SESSIONKEYBYTES> + Zeroize> Clone for Session<SessionKey>

source§

fn clone(&self) -> Session<SessionKey>

Returns a copy 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<'de, SessionKey> Deserialize<'de> for Session<SessionKey>
where SessionKey: Deserialize<'de> + ByteArray<CRYPTO_KX_SESSIONKEYBYTES> + Zeroize,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

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

impl<SessionKey: Debug + ByteArray<CRYPTO_KX_SESSIONKEYBYTES> + Zeroize> Debug for Session<SessionKey>

source§

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

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

impl<SessionKey> Zeroize for Session<SessionKey>
where SessionKey: Zeroize + ByteArray<CRYPTO_KX_SESSIONKEYBYTES>,

source§

fn zeroize(&mut self)

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

impl<SessionKey> Serialize for Session<SessionKey>
where SessionKey: Serialize + ByteArray<CRYPTO_KX_SESSIONKEYBYTES> + Zeroize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more