pub struct Store { /* private fields */ }Expand description
Local encrypted keystore.
Private keys are encrypted with AES-256-GCM before writing to disk. The encryption key is derived from a machine-specific secret so key files are useless if copied to another machine.
v2 will delegate to OS credential stores (Secure Enclave / TPM 2.0).
Implementations§
Source§impl Store
impl Store
Sourcepub fn open(dir: impl AsRef<Path>) -> Result<Self, KeyError>
pub fn open(dir: impl AsRef<Path>) -> Result<Self, KeyError>
Opens or creates a keystore at dir.
Sourcepub fn generate(&self, set_default: bool) -> Result<KeyInfo, KeyError>
pub fn generate(&self, set_default: bool) -> Result<KeyInfo, KeyError>
Generates a new Ed25519 keypair, encrypts and stores it.
If set_default is true (or there is no current default), makes
this key the default signing key.
Sourcepub fn default_signer(&self) -> Result<Box<dyn Signer>, KeyError>
pub fn default_signer(&self) -> Result<Box<dyn Signer>, KeyError>
Returns a boxed Signer for the current default key.
Sourcepub fn signer(&self, id: &str) -> Result<Box<dyn Signer>, KeyError>
pub fn signer(&self, id: &str) -> Result<Box<dyn Signer>, KeyError>
Returns a boxed Signer for a specific key ID.
Sourcepub fn default_key_id(&self) -> Result<KeyId, KeyError>
pub fn default_key_id(&self) -> Result<KeyId, KeyError>
Returns the default key ID.
Auto Trait Implementations§
impl Freeze for Store
impl RefUnwindSafe for Store
impl Send for Store
impl Sync for Store
impl Unpin for Store
impl UnsafeUnpin for Store
impl UnwindSafe for Store
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