mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 18:41:05 +00:00
Add CryptoStore::ecdsa_sign_prehashed() (#8838)
* Pair::sign_prehashed() * add CryptoStore::ecdsa_sign_prehashed() * add test for testing keystore * address review comments
This commit is contained in:
@@ -142,6 +142,15 @@ impl CryptoStore for LocalKeystore {
|
||||
) -> std::result::Result<Option<VRFSignature>, TraitError> {
|
||||
SyncCryptoStore::sr25519_vrf_sign(self, key_type, public, transcript_data)
|
||||
}
|
||||
|
||||
async fn ecdsa_sign_prehashed(
|
||||
&self,
|
||||
id: KeyTypeId,
|
||||
public: &ecdsa::Public,
|
||||
msg: &[u8; 32],
|
||||
) -> std::result::Result<Option<ecdsa::Signature>, TraitError> {
|
||||
SyncCryptoStore::ecdsa_sign_prehashed(self, id, public, msg)
|
||||
}
|
||||
}
|
||||
|
||||
impl SyncCryptoStore for LocalKeystore {
|
||||
@@ -301,6 +310,18 @@ impl SyncCryptoStore for LocalKeystore {
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
|
||||
fn ecdsa_sign_prehashed(
|
||||
&self,
|
||||
id: KeyTypeId,
|
||||
public: &ecdsa::Public,
|
||||
msg: &[u8; 32],
|
||||
) -> std::result::Result<Option<ecdsa::Signature>, TraitError> {
|
||||
let pair = self.0.read()
|
||||
.key_pair_by_type::<ecdsa::Pair>(public, id)?;
|
||||
|
||||
pair.map(|k| k.sign_prehashed(msg)).map(Ok).transpose()
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<SyncCryptoStorePtr> for LocalKeystore {
|
||||
|
||||
Reference in New Issue
Block a user