KeyStore

Struct KeyStore 

Source
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<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<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 sign_with_any<'life0, 'life1, 'async_trait>( &'life0 self, id: KeyTypeId, keys: Vec<CryptoTypePublicPair>, msg: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<(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<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>> for KeyStore

Source§

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

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

impl Into<Arc<dyn SyncCryptoStore>> 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<Vec<u8>, Error>

Sign with key Read more
Source§

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

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

fn sign_with_any( &self, id: KeyTypeId, keys: Vec<CryptoTypePublicPair>, msg: &[u8], ) -> Result<(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<Vec<u8>, Error>>, ()>

Sign with all keys Read more

Auto Trait Implementations§

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

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.
Source§

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

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

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.
Source§

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.
Source§

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

Source§

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

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

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 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, Outer> IsWrappedBy<Outer> for T
where 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 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<S, T> UncheckedInto<T> for S
where T: UncheckedFrom<S>,

Source§

fn unchecked_into(self) -> T

The counterpart to unchecked_from.
Source§

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

Source§

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