[−][src]Trait radicle_keystore::Keystore
Abstraction over secure storage for private key material.
Associated Types
type PublicKey: From<Self::SecretKey>
type SecretKey: SecretKeyExt<Metadata = Self::Metadata>
type Metadata
type Error: Error
Required methods
fn put_key(&mut self, key: Self::SecretKey) -> Result<(), Self::Error>
Securely store secret key key
in the keystore.
The key may carry Keystore::Metadata
, which is stored alongside the
key material. The metadata, as well as the public portion of the
key, may be stored in clear, so as to not require prompting the user
when retrieving those values.
Key rotation is not (yet) part of this API, thus put_key
MUST return
an error if an equivalent key is already present in the storage
backend.
fn get_key(
&self
) -> Result<Keypair<Self::PublicKey, Self::SecretKey>, Self::Error>
&self
) -> Result<Keypair<Self::PublicKey, Self::SecretKey>, Self::Error>
Retrieve both the secret and public parts of the stored key material.
fn show_key(&self) -> Result<(Self::PublicKey, Self::Metadata), Self::Error>
Retrieve only the public part of the key material, along with any metadata.
Implementors
impl<C, PK, SK, M> Keystore for FileStorage<C, PK, SK, M> where
C: Crypto,
C::Error: Display + Debug,
C::SecretBox: Serialize + DeserializeOwned,
SK: AsRef<[u8]> + SecretKeyExt<Metadata = M>,
<SK as SecretKeyExt>::Error: Display + Debug,
PK: Clone + From<SK> + Serialize + DeserializeOwned,
M: Clone + Serialize + DeserializeOwned,
[src]
C: Crypto,
C::Error: Display + Debug,
C::SecretBox: Serialize + DeserializeOwned,
SK: AsRef<[u8]> + SecretKeyExt<Metadata = M>,
<SK as SecretKeyExt>::Error: Display + Debug,
PK: Clone + From<SK> + Serialize + DeserializeOwned,
M: Clone + Serialize + DeserializeOwned,
type PublicKey = PK
type SecretKey = SK
type Metadata = M
type Error = Error<C::Error, <SK as SecretKeyExt>::Error>
fn put_key(&mut self, key: Self::SecretKey) -> Result<(), Self::Error>
[src]
fn get_key(
&self
) -> Result<Keypair<Self::PublicKey, Self::SecretKey>, Self::Error>
[src]
&self
) -> Result<Keypair<Self::PublicKey, Self::SecretKey>, Self::Error>
fn show_key(&self) -> Result<(Self::PublicKey, Self::Metadata), Self::Error>
[src]
impl<C, PK, SK, M> Keystore for MemoryStorage<C, PK, SK, M> where
C: Crypto,
C::Error: Display + Debug,
C::SecretBox: Clone,
SK: AsRef<[u8]> + SecretKeyExt<Metadata = M>,
<SK as SecretKeyExt>::Error: Display + Debug,
PK: Clone + From<SK>,
M: Clone,
[src]
C: Crypto,
C::Error: Display + Debug,
C::SecretBox: Clone,
SK: AsRef<[u8]> + SecretKeyExt<Metadata = M>,
<SK as SecretKeyExt>::Error: Display + Debug,
PK: Clone + From<SK>,
M: Clone,
type PublicKey = PK
type SecretKey = SK
type Metadata = M
type Error = Error<C::Error, <SK as SecretKeyExt>::Error>
fn put_key(&mut self, key: Self::SecretKey) -> Result<(), Self::Error>
[src]
fn get_key(
&self
) -> Result<Keypair<Self::PublicKey, Self::SecretKey>, Self::Error>
[src]
&self
) -> Result<Keypair<Self::PublicKey, Self::SecretKey>, Self::Error>