#[non_exhaustive]#[repr(u8)]pub enum KeySecurity {
Weak = 0,
Strong = 1,
Untracked = 2,
}Available on crate feature
nip49 only.Expand description
Author-declared key-security level, baked into the ciphertext as AEAD additional-authenticated-data so it cannot be forged after the fact.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Weak = 0
0x00 — author admits the key has been handled insecurely
(cut-and-pasted, kept in plaintext, etc.).
Strong = 1
0x01 — author asserts the key has only ever lived inside an
encrypted container.
Untracked = 2
0x02 — author does not track this signal.
Implementations§
Source§impl KeySecurity
impl KeySecurity
Sourcepub const fn from_byte(byte: u8) -> Result<Self, Nip49Error>
pub const fn from_byte(byte: u8) -> Result<Self, Nip49Error>
Round-trip from the u8 byte found on the wire.
§Errors
Returns Nip49Error::InvalidKeySecurity for any byte outside
0x00..=0x02.
Trait Implementations§
Source§impl Clone for KeySecurity
impl Clone for KeySecurity
Source§fn clone(&self) -> KeySecurity
fn clone(&self) -> KeySecurity
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for KeySecurity
Source§impl Debug for KeySecurity
impl Debug for KeySecurity
impl Eq for KeySecurity
Source§impl Hash for KeySecurity
impl Hash for KeySecurity
Source§impl Ord for KeySecurity
impl Ord for KeySecurity
Source§fn cmp(&self, other: &KeySecurity) -> Ordering
fn cmp(&self, other: &KeySecurity) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for KeySecurity
impl PartialEq for KeySecurity
Source§fn eq(&self, other: &KeySecurity) -> bool
fn eq(&self, other: &KeySecurity) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for KeySecurity
impl PartialOrd for KeySecurity
impl StructuralPartialEq for KeySecurity
Auto Trait Implementations§
impl Freeze for KeySecurity
impl RefUnwindSafe for KeySecurity
impl Send for KeySecurity
impl Sync for KeySecurity
impl Unpin for KeySecurity
impl UnsafeUnpin for KeySecurity
impl UnwindSafe for KeySecurity
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.