Encryption support for the statement store (#14440)

* Added ECIES encryption

* tweaks

* fmt

* Make clippy happy

* Use local keystore

* qed
This commit is contained in:
Arkadiy Paronyan
2023-07-17 20:41:41 +02:00
committed by GitHub
parent c761d4c39e
commit d6d9bd9ea3
28 changed files with 351 additions and 71 deletions
-1
View File
@@ -57,7 +57,6 @@ sp-runtime-interface = { version = "17.0.0", default-features = false, path = ".
w3f-bls = { version = "0.1.3", default-features = false, optional = true}
[dev-dependencies]
rand = "0.8.5"
criterion = "0.4.0"
serde_json = "1.0"
sp-core-hashing-proc-macro = { version = "9.0.0", path = "./hashing/proc-macro" }
+2 -6
View File
@@ -422,12 +422,8 @@ impl TraitPair for Pair {
///
/// Returns true if the signature is good.
fn verify<M: AsRef<[u8]>>(sig: &Self::Signature, message: M, public: &Self::Public) -> bool {
let Ok(public) = VerificationKey::try_from(public.as_slice()) else {
return false
};
let Ok(signature) = ed25519_zebra::Signature::try_from(sig.as_ref()) else {
return false
};
let Ok(public) = VerificationKey::try_from(public.as_slice()) else { return false };
let Ok(signature) = ed25519_zebra::Signature::try_from(sig.as_ref()) else { return false };
public.verify(&signature, message.as_ref()).is_ok()
}
+2 -6
View File
@@ -505,12 +505,8 @@ impl TraitPair for Pair {
}
fn verify<M: AsRef<[u8]>>(sig: &Self::Signature, message: M, pubkey: &Self::Public) -> bool {
let Ok(signature) = schnorrkel::Signature::from_bytes(sig.as_ref()) else {
return false
};
let Ok(public) = PublicKey::from_bytes(pubkey.as_ref()) else {
return false
};
let Ok(signature) = schnorrkel::Signature::from_bytes(sig.as_ref()) else { return false };
let Ok(public) = PublicKey::from_bytes(pubkey.as_ref()) else { return false };
public.verify_simple(SIGNING_CTX, message.as_ref(), &signature).is_ok()
}