pub struct SecretKeyring { /* private fields */ }encryption only.Expand description
A lock-free and thread-safe container for a set of encryption keys. The keyring contains all key data used internally by memberlist.
If creating a keyring with multiple keys, one key must be designated primary by passing it as the primaryKey. If the primaryKey does not exist in the list of secondary keys, it will be automatically added at position 0.
Implementations§
Source§impl SecretKeyring
impl SecretKeyring
Sourcepub fn new(primary_key: SecretKey) -> Self
pub fn new(primary_key: SecretKey) -> Self
Constructs a new container for a primary key. The keyring contains all key data used internally by memberlist.
If only a primary key is passed, then it will be automatically added to the keyring.
A key should be either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256.
Sourcepub fn with_keys(
primary_key: SecretKey,
keys: impl Iterator<Item = impl Into<SecretKey>>,
) -> Self
pub fn with_keys( primary_key: SecretKey, keys: impl Iterator<Item = impl Into<SecretKey>>, ) -> Self
Constructs a new container for a set of encryption keys. The keyring contains all key data used internally by memberlist.
If only a primary key is passed, then it will be automatically added to the keyring. If creating a keyring with multiple keys, one key must be designated primary by passing it as the primaryKey. If the primaryKey does not exist in the list of secondary keys, it will be automatically added.
A key should be either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256.
Sourcepub async fn primary_key(&self) -> SecretKey
pub async fn primary_key(&self) -> SecretKey
Returns the key on the ring at position 0. This is the key used for encrypting messages, and is the first key tried for decrypting messages.
Sourcepub async fn remove(&self, key: &[u8]) -> Result<(), SecretKeyringError>
pub async fn remove(&self, key: &[u8]) -> Result<(), SecretKeyringError>
Drops a key from the keyring. This will return an error if the key requested for removal is currently at position 0 (primary key).
Sourcepub async fn insert(&self, key: SecretKey)
pub async fn insert(&self, key: SecretKey)
Install a new key on the ring. Adding a key to the ring will make it available for use in decryption. If the key already exists on the ring, this function will just return noop.
key should be either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256.
Trait Implementations§
Source§impl Clone for SecretKeyring
impl Clone for SecretKeyring
Source§fn clone(&self) -> SecretKeyring
fn clone(&self) -> SecretKeyring
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SecretKeyring
impl !RefUnwindSafe for SecretKeyring
impl Send for SecretKeyring
impl Sync for SecretKeyring
impl Unpin for SecretKeyring
impl !UnwindSafe for SecretKeyring
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<K, Q> Comparable<Q> for K
impl<K, Q> Comparable<Q> for K
Source§impl<K, Q> Equivalent<Q> for K
impl<K, Q> Equivalent<Q> for K
Source§fn equivalent(&self, key: &Q) -> bool
fn equivalent(&self, key: &Q) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.