[−][src]Trait sp_core::traits::BareCryptoStore
Something that generates, stores and provides access to keys.
Required methods
fn sr25519_public_keys(&self, id: KeyTypeId) -> Vec<Public>
Returns all sr25519 public keys for the given key type.
fn sr25519_generate_new(
&mut self,
id: KeyTypeId,
seed: Option<&str>
) -> Result<Public, BareCryptoStoreError>
&mut self,
id: KeyTypeId,
seed: Option<&str>
) -> Result<Public, BareCryptoStoreError>
Generate a new sr25519 key pair for the given key type and an optional seed.
If the given seed is Some(_)
, the key pair will only be stored in memory.
Returns the public key of the generated key pair.
fn ed25519_public_keys(&self, id: KeyTypeId) -> Vec<Public>
Returns all ed25519 public keys for the given key type.
fn ed25519_generate_new(
&mut self,
id: KeyTypeId,
seed: Option<&str>
) -> Result<Public, BareCryptoStoreError>
&mut self,
id: KeyTypeId,
seed: Option<&str>
) -> Result<Public, BareCryptoStoreError>
Generate a new ed25519 key pair for the given key type and an optional seed.
If the given seed is Some(_)
, the key pair will only be stored in memory.
Returns the public key of the generated key pair.
fn ecdsa_public_keys(&self, id: KeyTypeId) -> Vec<Public>
Returns all ecdsa public keys for the given key type.
fn ecdsa_generate_new(
&mut self,
id: KeyTypeId,
seed: Option<&str>
) -> Result<Public, BareCryptoStoreError>
&mut self,
id: KeyTypeId,
seed: Option<&str>
) -> Result<Public, BareCryptoStoreError>
Generate a new ecdsa key pair for the given key type and an optional seed.
If the given seed is Some(_)
, the key pair will only be stored in memory.
Returns the public key of the generated key pair.
fn insert_unknown(
&mut self,
_key_type: KeyTypeId,
_suri: &str,
_public: &[u8]
) -> Result<(), ()>
&mut self,
_key_type: KeyTypeId,
_suri: &str,
_public: &[u8]
) -> Result<(), ()>
Insert a new key. This doesn't require any known of the crypto; but a public key must be manually provided.
Places it into the file system store.
Err
if there's some sort of weird filesystem error, but should generally be Ok
.
fn password(&self) -> Option<&str>
Get the password for this store.
fn supported_keys(
&self,
id: KeyTypeId,
keys: Vec<CryptoTypePublicPair>
) -> Result<Vec<CryptoTypePublicPair>, BareCryptoStoreError>
&self,
id: KeyTypeId,
keys: Vec<CryptoTypePublicPair>
) -> Result<Vec<CryptoTypePublicPair>, BareCryptoStoreError>
Find intersection between provided keys and supported keys
Provided a list of (CryptoTypeId,u8) pairs, this would return a filtered set of public keys which are supported by the keystore.
fn keys(
&self,
id: KeyTypeId
) -> Result<Vec<CryptoTypePublicPair>, BareCryptoStoreError>
&self,
id: KeyTypeId
) -> Result<Vec<CryptoTypePublicPair>, BareCryptoStoreError>
List all supported keys
Returns a set of public keys the signer supports.
fn has_keys(&self, public_keys: &[(Vec<u8>, KeyTypeId)]) -> bool
Checks if the private keys for the given public key and key type combinations exist.
Returns true
iff all private keys could be found.
fn sign_with(
&self,
id: KeyTypeId,
key: &CryptoTypePublicPair,
msg: &[u8]
) -> Result<Vec<u8>, BareCryptoStoreError>
&self,
id: KeyTypeId,
key: &CryptoTypePublicPair,
msg: &[u8]
) -> Result<Vec<u8>, BareCryptoStoreError>
Sign with key
Signs a message with the private key that matches the public key passed.
Returns the SCALE encoded signature if key is found & supported, an error otherwise.
Provided methods
fn sign_with_any(
&self,
id: KeyTypeId,
keys: Vec<CryptoTypePublicPair>,
msg: &[u8]
) -> Result<(CryptoTypePublicPair, Vec<u8>), BareCryptoStoreError>
&self,
id: KeyTypeId,
keys: Vec<CryptoTypePublicPair>,
msg: &[u8]
) -> Result<(CryptoTypePublicPair, Vec<u8>), BareCryptoStoreError>
Sign with any key
Given a list of public keys, find the first supported key and sign the provided message with that key.
Returns a tuple of the used key and the SCALE encoded signature.
fn sign_with_all(
&self,
id: KeyTypeId,
keys: Vec<CryptoTypePublicPair>,
msg: &[u8]
) -> Result<Vec<Result<Vec<u8>, BareCryptoStoreError>>, ()>
&self,
id: KeyTypeId,
keys: Vec<CryptoTypePublicPair>,
msg: &[u8]
) -> Result<Vec<Result<Vec<u8>, BareCryptoStoreError>>, ()>
Sign with all keys
Provided a list of public keys, sign a message with each key given that the key is supported.
Returns a list of Result
s each representing the SCALE encoded
signature of each key or a BareCryptoStoreError for non-supported keys.
Implementors
impl BareCryptoStore for KeyStore
[src]
fn keys(
&self,
id: KeyTypeId
) -> Result<Vec<CryptoTypePublicPair>, BareCryptoStoreError>
[src]
&self,
id: KeyTypeId
) -> Result<Vec<CryptoTypePublicPair>, BareCryptoStoreError>
fn sr25519_public_keys(&self, id: KeyTypeId) -> Vec<Public>
[src]
fn sr25519_generate_new(
&mut self,
id: KeyTypeId,
seed: Option<&str>
) -> Result<Public, BareCryptoStoreError>
[src]
&mut self,
id: KeyTypeId,
seed: Option<&str>
) -> Result<Public, BareCryptoStoreError>
fn ed25519_public_keys(&self, id: KeyTypeId) -> Vec<Public>
[src]
fn ed25519_generate_new(
&mut self,
id: KeyTypeId,
seed: Option<&str>
) -> Result<Public, BareCryptoStoreError>
[src]
&mut self,
id: KeyTypeId,
seed: Option<&str>
) -> Result<Public, BareCryptoStoreError>
fn ecdsa_public_keys(&self, id: KeyTypeId) -> Vec<Public>
[src]
fn ecdsa_generate_new(
&mut self,
id: KeyTypeId,
seed: Option<&str>
) -> Result<Public, BareCryptoStoreError>
[src]
&mut self,
id: KeyTypeId,
seed: Option<&str>
) -> Result<Public, BareCryptoStoreError>
fn insert_unknown(
&mut self,
id: KeyTypeId,
suri: &str,
public: &[u8]
) -> Result<(), ()>
[src]
&mut self,
id: KeyTypeId,
suri: &str,
public: &[u8]
) -> Result<(), ()>
fn password(&self) -> Option<&str>
[src]
fn has_keys(&self, public_keys: &[(Vec<u8>, KeyTypeId)]) -> bool
[src]
fn supported_keys(
&self,
id: KeyTypeId,
keys: Vec<CryptoTypePublicPair>
) -> Result<Vec<CryptoTypePublicPair>, BareCryptoStoreError>
[src]
&self,
id: KeyTypeId,
keys: Vec<CryptoTypePublicPair>
) -> Result<Vec<CryptoTypePublicPair>, BareCryptoStoreError>
fn sign_with(
&self,
id: KeyTypeId,
key: &CryptoTypePublicPair,
msg: &[u8]
) -> Result<Vec<u8>, BareCryptoStoreError>
[src]
&self,
id: KeyTypeId,
key: &CryptoTypePublicPair,
msg: &[u8]
) -> Result<Vec<u8>, BareCryptoStoreError>