pub struct PrimitiveSet {
pub primary: Option<Entry>,
pub entries: HashMap<Vec<u8>, Vec<Entry>>,
}
Expand description
PrimitiveSet
is used for supporting key rotation: primitives in a set correspond to keys in a
keyset.
Users will usually work with primitive instances, which essentially wrap primitive sets. For example an instance of an AEAD-primitive for a given keyset holds a set of AEAD-primitives corresponding to the keys in the keyset, and uses the set members to do the actual crypto operations: to encrypt data the primary AEAD-primitive from the set is used, and upon decryption the ciphertext’s prefix determines the id of the primitive from the set.
PrimitiveSet
is public to allow its use in implementations of custom primitives.
Fields§
§primary: Option<Entry>
§entries: HashMap<Vec<u8>, Vec<Entry>>
Implementations§
Source§impl PrimitiveSet
impl PrimitiveSet
Sourcepub fn new() -> Self
pub fn new() -> Self
Return an empty instance of PrimitiveSet
.
Sourcepub fn raw_entries(&self) -> Vec<Entry>
pub fn raw_entries(&self) -> Vec<Entry>
Return all primitives in the set that have RAW prefix.
Sourcepub fn entries_for_prefix(&self, prefix: &[u8]) -> Vec<Entry>
pub fn entries_for_prefix(&self, prefix: &[u8]) -> Vec<Entry>
Return all primitives in the set that have the given prefix.
Trait Implementations§
Source§impl Clone for PrimitiveSet
impl Clone for PrimitiveSet
Source§fn clone(&self) -> PrimitiveSet
fn clone(&self) -> PrimitiveSet
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Default for PrimitiveSet
impl Default for PrimitiveSet
Source§fn default() -> PrimitiveSet
fn default() -> PrimitiveSet
Source§impl<P: From<Primitive>> From<PrimitiveSet> for TypedPrimitiveSet<P>
Convert an untyped PrimitiveSet
into a TypedPrimitiveSet
. This will
panic if any of the primitives are not of the correct type.
impl<P: From<Primitive>> From<PrimitiveSet> for TypedPrimitiveSet<P>
Convert an untyped PrimitiveSet
into a TypedPrimitiveSet
. This will
panic if any of the primitives are not of the correct type.