Struct ssb_crypto::NetworkKey [−][src]
Expand description
The network key, or network identifier, used during the secret handshake to prove that both parties are participating in the same ssb network.
The main ssb network uses a publicly-known key, which is
available as NetworkKey::SSB_MAIN_NET
.
This is an HMAC key; specifically HMAC-SHA-512-256.
Tuple Fields
0: [u8; 32]
Implementations
The NetworkKey for the primary ssb network.
Deserialize from a slice of bytes.
Returns None
if the slice length isn’t 32.
Generate a random network key using the given cryptographically-secure random number generator.
Deserialize from the base-64 representation.
Generate an authentication code for the given byte slice.
Examples
use ssb_crypto::NetworkKey; let netkey = NetworkKey::SSB_MAIN_NET; let bytes = [1, 2, 3, 4]; let auth = netkey.authenticate(&bytes); assert!(netkey.verify(&auth, &bytes));
Verify that an authentication code was generated by this key, given the same byte slice.
Generate a random network key.
Examples
use ssb_crypto::NetworkKey; let key = NetworkKey::generate(); assert_ne!(key, NetworkKey::SSB_MAIN_NET);
Trait Implementations
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for NetworkKey
impl Send for NetworkKey
impl Sync for NetworkKey
impl Unpin for NetworkKey
impl UnwindSafe for NetworkKey
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self