#[non_exhaustive]pub struct KeyStoreCapabilities {
pub can_generate: bool,
pub can_delete: bool,
pub remote: bool,
pub algorithms: Vec<JwsAlgorithm>,
}Expand description
What a KeyStore can do.
A backend’s declaration must be truthful: every algorithm listed signs, and generate and
delete succeed only when advertised. testsuite checks both directions.
§Examples
use identity_kit::jose::JwsAlgorithm;
use identity_kit::keys::KeyStoreCapabilities;
let hsm = KeyStoreCapabilities::new([JwsAlgorithm::ES256, JwsAlgorithm::RS256]).remote();
assert!(hsm.supports(JwsAlgorithm::ES256));
assert!(!hsm.supports(JwsAlgorithm::EdDSA));
assert!(!hsm.can_generate && !hsm.can_delete && hsm.remote);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.can_generate: boolWhether KeyStore::generate is implemented.
can_delete: boolWhether KeyStore::delete is implemented.
remote: boolWhether signing leaves the process (an HSM, a network service), so that callers should expect latency and transient failures.
algorithms: Vec<JwsAlgorithm>The algorithms the store signs with, without duplicates.
Implementations§
Source§impl KeyStoreCapabilities
impl KeyStoreCapabilities
Sourcepub fn new(algorithms: impl IntoIterator<Item = JwsAlgorithm>) -> Self
pub fn new(algorithms: impl IntoIterator<Item = JwsAlgorithm>) -> Self
A local store that signs with algorithms and can neither generate nor delete.
Sourcepub fn with_generate(self) -> Self
pub fn with_generate(self) -> Self
With can_generate set.
Sourcepub fn with_delete(self) -> Self
pub fn with_delete(self) -> Self
With can_delete set.
Sourcepub fn supports(&self, alg: JwsAlgorithm) -> bool
pub fn supports(&self, alg: JwsAlgorithm) -> bool
Whether the store signs with alg.
Trait Implementations§
Source§impl Clone for KeyStoreCapabilities
impl Clone for KeyStoreCapabilities
Source§impl Debug for KeyStoreCapabilities
impl Debug for KeyStoreCapabilities
impl Eq for KeyStoreCapabilities
Source§impl PartialEq for KeyStoreCapabilities
impl PartialEq for KeyStoreCapabilities
impl StructuralPartialEq for KeyStoreCapabilities
Auto Trait Implementations§
impl Freeze for KeyStoreCapabilities
impl RefUnwindSafe for KeyStoreCapabilities
impl Send for KeyStoreCapabilities
impl Sync for KeyStoreCapabilities
impl Unpin for KeyStoreCapabilities
impl UnsafeUnpin for KeyStoreCapabilities
impl UnwindSafe for KeyStoreCapabilities
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.