mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 22:51:13 +00:00
Keystore overhaul (#13615)
* Remove 'supported_keys' 'sign_with_any' and 'sign_with_all' from keystore trait * Remove the aync keystore * Renaming: - SyncCryptoStore -> Keystore - SyncCryptoStorePtr -> KeystorePtr - KeyStore -> MemoryKeystore * Fix authority discovery worker and tests * Rename 'insert_unknown' to 'insert' * Remove leftover
This commit is contained in:
@@ -43,7 +43,7 @@ use sp_core::{
|
||||
traits::TaskExecutorExt,
|
||||
};
|
||||
#[cfg(feature = "std")]
|
||||
use sp_keystore::{KeystoreExt, SyncCryptoStore};
|
||||
use sp_keystore::{Keystore, KeystoreExt};
|
||||
|
||||
use sp_core::{
|
||||
crypto::KeyTypeId,
|
||||
@@ -734,7 +734,7 @@ pub trait Crypto {
|
||||
let keystore = &***self
|
||||
.extension::<KeystoreExt>()
|
||||
.expect("No `keystore` associated for the current context!");
|
||||
SyncCryptoStore::ed25519_public_keys(keystore, id)
|
||||
Keystore::ed25519_public_keys(keystore, id)
|
||||
}
|
||||
|
||||
/// Generate an `ed22519` key for the given key type using an optional `seed` and
|
||||
@@ -748,8 +748,7 @@ pub trait Crypto {
|
||||
let keystore = &***self
|
||||
.extension::<KeystoreExt>()
|
||||
.expect("No `keystore` associated for the current context!");
|
||||
SyncCryptoStore::ed25519_generate_new(keystore, id, seed)
|
||||
.expect("`ed25519_generate` failed")
|
||||
Keystore::ed25519_generate_new(keystore, id, seed).expect("`ed25519_generate` failed")
|
||||
}
|
||||
|
||||
/// Sign the given `msg` with the `ed25519` key that corresponds to the given public key and
|
||||
@@ -765,7 +764,7 @@ pub trait Crypto {
|
||||
let keystore = &***self
|
||||
.extension::<KeystoreExt>()
|
||||
.expect("No `keystore` associated for the current context!");
|
||||
SyncCryptoStore::sign_with(keystore, id, &pub_key.into(), msg)
|
||||
Keystore::sign_with(keystore, id, &pub_key.into(), msg)
|
||||
.ok()
|
||||
.flatten()
|
||||
.and_then(|sig| ed25519::Signature::from_slice(&sig))
|
||||
@@ -877,7 +876,7 @@ pub trait Crypto {
|
||||
let keystore = &***self
|
||||
.extension::<KeystoreExt>()
|
||||
.expect("No `keystore` associated for the current context!");
|
||||
SyncCryptoStore::sr25519_public_keys(keystore, id)
|
||||
Keystore::sr25519_public_keys(keystore, id)
|
||||
}
|
||||
|
||||
/// Generate an `sr22519` key for the given key type using an optional seed and
|
||||
@@ -891,8 +890,7 @@ pub trait Crypto {
|
||||
let keystore = &***self
|
||||
.extension::<KeystoreExt>()
|
||||
.expect("No `keystore` associated for the current context!");
|
||||
SyncCryptoStore::sr25519_generate_new(keystore, id, seed)
|
||||
.expect("`sr25519_generate` failed")
|
||||
Keystore::sr25519_generate_new(keystore, id, seed).expect("`sr25519_generate` failed")
|
||||
}
|
||||
|
||||
/// Sign the given `msg` with the `sr25519` key that corresponds to the given public key and
|
||||
@@ -908,7 +906,7 @@ pub trait Crypto {
|
||||
let keystore = &***self
|
||||
.extension::<KeystoreExt>()
|
||||
.expect("No `keystore` associated for the current context!");
|
||||
SyncCryptoStore::sign_with(keystore, id, &pub_key.into(), msg)
|
||||
Keystore::sign_with(keystore, id, &pub_key.into(), msg)
|
||||
.ok()
|
||||
.flatten()
|
||||
.and_then(|sig| sr25519::Signature::from_slice(&sig))
|
||||
@@ -927,7 +925,7 @@ pub trait Crypto {
|
||||
let keystore = &***self
|
||||
.extension::<KeystoreExt>()
|
||||
.expect("No `keystore` associated for the current context!");
|
||||
SyncCryptoStore::ecdsa_public_keys(keystore, id)
|
||||
Keystore::ecdsa_public_keys(keystore, id)
|
||||
}
|
||||
|
||||
/// Generate an `ecdsa` key for the given key type using an optional `seed` and
|
||||
@@ -941,7 +939,7 @@ pub trait Crypto {
|
||||
let keystore = &***self
|
||||
.extension::<KeystoreExt>()
|
||||
.expect("No `keystore` associated for the current context!");
|
||||
SyncCryptoStore::ecdsa_generate_new(keystore, id, seed).expect("`ecdsa_generate` failed")
|
||||
Keystore::ecdsa_generate_new(keystore, id, seed).expect("`ecdsa_generate` failed")
|
||||
}
|
||||
|
||||
/// Sign the given `msg` with the `ecdsa` key that corresponds to the given public key and
|
||||
@@ -957,7 +955,7 @@ pub trait Crypto {
|
||||
let keystore = &***self
|
||||
.extension::<KeystoreExt>()
|
||||
.expect("No `keystore` associated for the current context!");
|
||||
SyncCryptoStore::sign_with(keystore, id, &pub_key.into(), msg)
|
||||
Keystore::sign_with(keystore, id, &pub_key.into(), msg)
|
||||
.ok()
|
||||
.flatten()
|
||||
.and_then(|sig| ecdsa::Signature::from_slice(&sig))
|
||||
@@ -976,7 +974,7 @@ pub trait Crypto {
|
||||
let keystore = &***self
|
||||
.extension::<KeystoreExt>()
|
||||
.expect("No `keystore` associated for the current context!");
|
||||
SyncCryptoStore::ecdsa_sign_prehashed(keystore, id, pub_key, msg).ok().flatten()
|
||||
Keystore::ecdsa_sign_prehashed(keystore, id, pub_key, msg).ok().flatten()
|
||||
}
|
||||
|
||||
/// Verify `ecdsa` signature.
|
||||
|
||||
Reference in New Issue
Block a user