Trait tetcore_test_client::SyncCryptoStore[][src]

pub trait SyncCryptoStore: CryptoStore + Send + Sync {
    pub fn sr25519_public_keys(&self, id: KeyTypeId) -> Vec<Public, Global>;
pub fn sr25519_generate_new(
        &self,
        id: KeyTypeId,
        seed: Option<&str>
    ) -> Result<Public, Error>;
pub fn ed25519_public_keys(&self, id: KeyTypeId) -> Vec<Public, Global>;
pub fn ed25519_generate_new(
        &self,
        id: KeyTypeId,
        seed: Option<&str>
    ) -> Result<Public, Error>;
pub fn ecdsa_public_keys(&self, id: KeyTypeId) -> Vec<Public, Global>;
pub fn ecdsa_generate_new(
        &self,
        id: KeyTypeId,
        seed: Option<&str>
    ) -> Result<Public, Error>;
pub fn insert_unknown(
        &self,
        key_type: KeyTypeId,
        suri: &str,
        public: &[u8]
    ) -> Result<(), ()>;
pub fn supported_keys(
        &self,
        id: KeyTypeId,
        keys: Vec<CryptoTypePublicPair, Global>
    ) -> Result<Vec<CryptoTypePublicPair, Global>, Error>;
pub fn has_keys(&self, public_keys: &[(Vec<u8, Global>, KeyTypeId)]) -> bool;
pub fn sign_with(
        &self,
        id: KeyTypeId,
        key: &CryptoTypePublicPair,
        msg: &[u8]
    ) -> Result<Vec<u8, Global>, Error>;
pub fn sr25519_vrf_sign(
        &self,
        key_type: KeyTypeId,
        public: &Public,
        transcript_data: VRFTranscriptData
    ) -> Result<VRFSignature, Error>; pub fn keys(
        &self,
        id: KeyTypeId
    ) -> Result<Vec<CryptoTypePublicPair, Global>, Error> { ... }
pub fn sign_with_any(
        &self,
        id: KeyTypeId,
        keys: Vec<CryptoTypePublicPair, Global>,
        msg: &[u8]
    ) -> Result<(CryptoTypePublicPair, Vec<u8, Global>), Error> { ... }
pub fn sign_with_all(
        &self,
        id: KeyTypeId,
        keys: Vec<CryptoTypePublicPair, Global>,
        msg: &[u8]
    ) -> Result<Vec<Result<Vec<u8, Global>, Error>, Global>, ()> { ... } }

Sync version of the CryptoStore

Some parts of Tetcore still rely on a sync version of the CryptoStore. To make the transition easier this auto trait wraps any async CryptoStore and exposes a sync interface using block_on. Usage of this is deprecated and it will be removed as soon as the internal usage has transitioned successfully. If you are starting out building something new do not use this, instead, use CryptoStore.

Required methods

pub fn sr25519_public_keys(&self, id: KeyTypeId) -> Vec<Public, Global>[src]

Returns all sr25519 public keys for the given key type.

pub fn sr25519_generate_new(
    &self,
    id: KeyTypeId,
    seed: Option<&str>
) -> Result<Public, Error>
[src]

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.

pub fn ed25519_public_keys(&self, id: KeyTypeId) -> Vec<Public, Global>[src]

Returns all ed25519 public keys for the given key type.

pub fn ed25519_generate_new(
    &self,
    id: KeyTypeId,
    seed: Option<&str>
) -> Result<Public, Error>
[src]

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.

pub fn ecdsa_public_keys(&self, id: KeyTypeId) -> Vec<Public, Global>[src]

Returns all ecdsa public keys for the given key type.

pub fn ecdsa_generate_new(
    &self,
    id: KeyTypeId,
    seed: Option<&str>
) -> Result<Public, Error>
[src]

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.

pub fn insert_unknown(
    &self,
    key_type: KeyTypeId,
    suri: &str,
    public: &[u8]
) -> Result<(), ()>
[src]

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.

pub fn supported_keys(
    &self,
    id: KeyTypeId,
    keys: Vec<CryptoTypePublicPair, Global>
) -> Result<Vec<CryptoTypePublicPair, Global>, Error>
[src]

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.

pub fn has_keys(&self, public_keys: &[(Vec<u8, Global>, KeyTypeId)]) -> bool[src]

Checks if the private keys for the given public key and key type combinations exist.

Returns true iff all private keys could be found.

pub fn sign_with(
    &self,
    id: KeyTypeId,
    key: &CryptoTypePublicPair,
    msg: &[u8]
) -> Result<Vec<u8, Global>, Error>
[src]

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.

pub fn sr25519_vrf_sign(
    &self,
    key_type: KeyTypeId,
    public: &Public,
    transcript_data: VRFTranscriptData
) -> Result<VRFSignature, Error>
[src]

Generate VRF signature for given transcript data.

Receives KeyTypeId and Public key to be able to map them to a private key that exists in the keystore which is, in turn, used for signing the provided transcript.

Returns a result containing the signature data. Namely, VRFOutput and VRFProof which are returned inside the VRFSignature container struct.

This function will return an error in the cases where the public key and key type provided do not match a private key in the keystore. Or, in the context of remote signing an error could be a network one.

Loading content...

Provided methods

pub fn keys(
    &self,
    id: KeyTypeId
) -> Result<Vec<CryptoTypePublicPair, Global>, Error>
[src]

List all supported keys

Returns a set of public keys the signer supports.

pub fn sign_with_any(
    &self,
    id: KeyTypeId,
    keys: Vec<CryptoTypePublicPair, Global>,
    msg: &[u8]
) -> Result<(CryptoTypePublicPair, Vec<u8, Global>), Error>
[src]

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.

pub fn sign_with_all(
    &self,
    id: KeyTypeId,
    keys: Vec<CryptoTypePublicPair, Global>,
    msg: &[u8]
) -> Result<Vec<Result<Vec<u8, Global>, Error>, Global>, ()>
[src]

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 Results each representing the SCALE encoded signature of each key or a Error for non-supported keys.

Loading content...

Implementations on Foreign Types

impl SyncCryptoStore for KeyStore[src]

impl SyncCryptoStore for LocalKeystore

Loading content...

Implementors

Loading content...