mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-18 08:21:03 +00:00
Bandersnatch VRF (#14412)
* Introduce bandersnatch vrf * Some documentation * Fix tests * Fix docs refs * Some more docs * Comments about key derivation * Make clippy happy * Fix ring context enc/dec test * Fix docs * Switch to upstream ring-vrf * Use sub-domains to construct VrfInput * Bandersnatch VRF experimental feature * Restore upstream dep * Fix feature flags * Apply typo fix Co-authored-by: Anton <anton.kalyaev@gmail.com> * Bump bandersnatch-vrfs * Weiestrass form has been selected * Rename bandersnatch testing app crypto id * Support for seed recovery * Clarified domain size <-> key size relationship * cargo fmt * Trigger CI * Some required tweaks to crypto types * Remove leftovers from Cargo.toml * Remove some TODO notes * Simplification of structs construction * Trigger CI * Apply review suggestion Co-authored-by: Koute <koute@users.noreply.github.com> * Docs typo * Fix keystore tests * Consistence * Add ref to git rependency * Static check of MAX_VRF_IOS value * Clarify behavior for out of ring keys signatures * Add test for ring-vrf to the keystore * Fix docs --------- Co-authored-by: Anton <anton.kalyaev@gmail.com> Co-authored-by: Koute <koute@users.noreply.github.com>
This commit is contained in:
@@ -504,7 +504,7 @@ impl TraitPair for Pair {
|
||||
self.0.sign(context.bytes(message)).into()
|
||||
}
|
||||
|
||||
fn verify<M: AsRef<[u8]>>(sig: &Self::Signature, message: M, pubkey: &Self::Public) -> bool {
|
||||
fn verify<M: AsRef<[u8]>>(sig: &Signature, message: M, pubkey: &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 };
|
||||
public.verify_simple(SIGNING_CTX, message.as_ref(), &signature).is_ok()
|
||||
@@ -568,7 +568,7 @@ pub mod vrf {
|
||||
impl VrfTranscript {
|
||||
/// Build a new transcript instance.
|
||||
///
|
||||
/// Each `data` element is a tuple `(domain, message)` composing the transcipt.
|
||||
/// Each `data` element is a tuple `(domain, message)` used to build the transcript.
|
||||
pub fn new(label: &'static [u8], data: &[(&'static [u8], &[u8])]) -> Self {
|
||||
let mut transcript = merlin::Transcript::new(label);
|
||||
data.iter().for_each(|(l, b)| transcript.append_message(l, b));
|
||||
|
||||
Reference in New Issue
Block a user