pub trait KeyId:
Debug
+ Clone
+ Copy
+ Hash
+ Eq
+ PartialEq
+ Ord
+ PartialOrd
+ Send
+ Sync
+ 'static {
type KeyValue: CryptoKey + Send + Sync + ZeroizeOnDrop;
// Required method
fn is_local(&self) -> bool;
}
Expand description
Represents a key identifier that can be used to identify cryptographic keys in the key store. It is used to avoid exposing the key material directly in the public API.
This trait is user-implemented, and the recommended implementation is using enums with variants for each expected key purpose. We provide a macro (crate::key_ids) that simplifies the trait implementation
To implement it manually, note that you need a few types:
- One implementing [KeyId<KeyValue = SymmetricCryptoKey>]
- One implementing [KeyId<KeyValue = AsymmetricCryptoKey>]
- One implementing KeyIds
Required Associated Types§
Required Methods§
Sourcefn is_local(&self) -> bool
fn is_local(&self) -> bool
Returns whether the key is local to the current context or shared globally by the key store. See crate::store::KeyStoreContext for more information.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.