pub struct KeyStore { /* private fields */ }
Expand description

A keystore implementation usable in tests.

Implementations§

source§

impl KeyStore

source

pub fn new() -> Self

Creates a new instance of Self.

Trait Implementations§

source§

impl CryptoStore for KeyStore

source§

fn keys<'life0, 'async_trait>( &'life0 self, id: KeyTypeId ) -> Pin<Box<dyn Future<Output = Result<Vec<CryptoTypePublicPair>, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

List all supported keys Read more
source§

fn sr25519_public_keys<'life0, 'async_trait>( &'life0 self, id: KeyTypeId ) -> Pin<Box<dyn Future<Output = Vec<Public>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Returns all sr25519 public keys for the given key type.
source§

fn sr25519_generate_new<'life0, 'life1, 'async_trait>( &'life0 self, id: KeyTypeId, seed: Option<&'life1 str> ) -> Pin<Box<dyn Future<Output = Result<Public, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Generate a new sr25519 key pair for the given key type and an optional seed. Read more
source§

fn ed25519_public_keys<'life0, 'async_trait>( &'life0 self, id: KeyTypeId ) -> Pin<Box<dyn Future<Output = Vec<Public>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Returns all ed25519 public keys for the given key type.
source§

fn ed25519_generate_new<'life0, 'life1, 'async_trait>( &'life0 self, id: KeyTypeId, seed: Option<&'life1 str> ) -> Pin<Box<dyn Future<Output = Result<Public, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Generate a new ed25519 key pair for the given key type and an optional seed. Read more
source§

fn ecdsa_public_keys<'life0, 'async_trait>( &'life0 self, id: KeyTypeId ) -> Pin<Box<dyn Future<Output = Vec<Public>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Returns all ecdsa public keys for the given key type.
source§

fn ecdsa_generate_new<'life0, 'life1, 'async_trait>( &'life0 self, id: KeyTypeId, seed: Option<&'life1 str> ) -> Pin<Box<dyn Future<Output = Result<Public, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Generate a new ecdsa key pair for the given key type and an optional seed. Read more
source§

fn insert_unknown<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: KeyTypeId, suri: &'life1 str, public: &'life2 [u8] ) -> Pin<Box<dyn Future<Output = Result<(), ()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Insert a new key. This doesn’t require any known of the crypto; but a public key must be manually provided. Read more
source§

fn has_keys<'life0, 'life1, 'async_trait>( &'life0 self, public_keys: &'life1 [(Vec<u8>, KeyTypeId)] ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Checks if the private keys for the given public key and key type combinations exist. Read more
source§

fn supported_keys<'life0, 'async_trait>( &'life0 self, id: KeyTypeId, keys: Vec<CryptoTypePublicPair> ) -> Pin<Box<dyn Future<Output = Result<Vec<CryptoTypePublicPair>, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Find intersection between provided keys and supported keys Read more
source§

fn sign_with<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: KeyTypeId, key: &'life1 CryptoTypePublicPair, msg: &'life2 [u8] ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Sign with key Read more
source§

fn sr25519_vrf_sign<'life0, 'life1, 'async_trait>( &'life0 self, key_type: KeyTypeId, public: &'life1 Public, transcript_data: VRFTranscriptData ) -> Pin<Box<dyn Future<Output = Result<Option<VRFSignature>, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Generate VRF signature for given transcript data. Read more
source§

fn ecdsa_sign_prehashed<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: KeyTypeId, public: &'life1 Public, msg: &'life2 [u8; 32] ) -> Pin<Box<dyn Future<Output = Result<Option<Signature>, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Generate an ECDSA signature for a given pre-hashed message. Read more
source§

fn sign_with_any<'life0, 'life1, 'async_trait>( &'life0 self, id: KeyTypeId, keys: Vec<CryptoTypePublicPair>, msg: &'life1 [u8] ) -> Pin<Box<dyn Future<Output = Result<Option<(CryptoTypePublicPair, Vec<u8>)>, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Sign with any key Read more
source§

fn sign_with_all<'life0, 'life1, 'async_trait>( &'life0 self, id: KeyTypeId, keys: Vec<CryptoTypePublicPair>, msg: &'life1 [u8] ) -> Pin<Box<dyn Future<Output = Result<Vec<Result<Option<Vec<u8>>, Error>>, ()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Sign with all keys Read more
source§

impl Default for KeyStore

source§

fn default() -> KeyStore

Returns the “default value” for a type. Read more
source§

impl Into<Arc<dyn CryptoStore + 'static>> for KeyStore

source§

fn into(self) -> Arc<dyn CryptoStore>

Converts this type into the (usually inferred) input type.
source§

impl Into<Arc<dyn SyncCryptoStore + 'static>> for KeyStore

source§

fn into(self) -> SyncCryptoStorePtr

Converts this type into the (usually inferred) input type.
source§

impl SyncCryptoStore for KeyStore

source§

fn keys(&self, id: KeyTypeId) -> Result<Vec<CryptoTypePublicPair>, Error>

List all supported keys Read more
source§

fn sr25519_public_keys(&self, id: KeyTypeId) -> Vec<Public>

Returns all sr25519 public keys for the given key type.
source§

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

Generate a new sr25519 key pair for the given key type and an optional seed. Read more
source§

fn ed25519_public_keys(&self, id: KeyTypeId) -> Vec<Public>

Returns all ed25519 public keys for the given key type.
source§

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

Generate a new ed25519 key pair for the given key type and an optional seed. Read more
source§

fn ecdsa_public_keys(&self, id: KeyTypeId) -> Vec<Public>

Returns all ecdsa public keys for the given key type.
source§

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

Generate a new ecdsa key pair for the given key type and an optional seed. Read more
source§

fn insert_unknown( &self, id: 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. Read more
source§

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. Read more
source§

fn supported_keys( &self, id: KeyTypeId, keys: Vec<CryptoTypePublicPair> ) -> Result<Vec<CryptoTypePublicPair>, Error>

Find intersection between provided keys and supported keys Read more
source§

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

Sign with key Read more
source§

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

Generate VRF signature for given transcript data. Read more
source§

fn ecdsa_sign_prehashed( &self, id: KeyTypeId, public: &Public, msg: &[u8; 32] ) -> Result<Option<Signature>, Error>

Generate an ECDSA signature for a given pre-hashed message. Read more
source§

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

Sign with any key Read more
source§

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

Sign with all keys Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for Twhere T: Any,

§

fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for Twhere T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync + 'static>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

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

const: unstable · 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, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,

source§

fn from_ref(outer: &Outer) -> &T

Get a reference to the inner from the outer.

source§

fn from_mut(outer: &mut Outer) -> &mut T

Get a mutable reference to the inner from the outer.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<S, T> UncheckedInto<T> for Swhere T: UncheckedFrom<S>,

source§

fn unchecked_into(self) -> T

The counterpart to unchecked_from.
§

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

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more