Skip to main content

Store

Struct Store 

Source
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

Source

pub fn open(dir: impl AsRef<Path>) -> Result<Self, KeyError>

Opens or creates a keystore at dir.

Source

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.

Source

pub fn default_signer(&self) -> Result<Box<dyn Signer>, KeyError>

Returns a boxed Signer for the current default key.

Source

pub fn signer(&self, id: &str) -> Result<Box<dyn Signer>, KeyError>

Returns a boxed Signer for a specific key ID.

Source

pub fn default_key_id(&self) -> Result<KeyId, KeyError>

Returns the default key ID.

Source

pub fn list(&self) -> Result<Vec<KeyInfo>, KeyError>

Lists all keys.

Source

pub fn set_default(&self, id: &str) -> Result<(), KeyError>

Sets the default signing key.

Source

pub fn public_key(&self, id: &str) -> Result<Vec<u8>, KeyError>

Returns the public key bytes for a 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V