Expose RedPallas rerandomization

This commit is contained in:
Jack Grigg 2021-04-15 16:33:15 +12:00
parent 0ccb0101df
commit 35f65bb26a
2 changed files with 18 additions and 0 deletions

View File

@ -109,6 +109,13 @@ impl From<&SpendAuthorizingKey> for SpendValidatingKey {
}
}
impl SpendValidatingKey {
/// Randomizes this spend validating key with the given `randomizer`.
pub fn randomize(&self, randomizer: &pallas::Scalar) -> redpallas::VerificationKey<SpendAuth> {
self.0.randomize(randomizer)
}
}
/// A key used to derive [`Nullifier`]s from [`Note`]s.
///
/// Defined in [Zcash Protocol Spec § 4.2.3: Orchard Key Components][orchardkeycomponents].

View File

@ -2,6 +2,8 @@
use std::convert::{TryFrom, TryInto};
use pasta_curves::pallas;
/// A RedPallas signature type.
pub trait SigType: reddsa::SigType + private::Sealed {}
@ -73,6 +75,15 @@ impl<T: SigType> PartialEq for VerificationKey<T> {
}
}
impl VerificationKey<SpendAuth> {
/// Randomizes this verification key with the given `randomizer`.
///
/// Randomization is only supported for `SpendAuth` keys.
pub fn randomize(&self, randomizer: &pallas::Scalar) -> Self {
VerificationKey(self.0.randomize(randomizer))
}
}
/// A RedPallas signature.
#[derive(Debug)]
pub struct Signature<T: SigType>(reddsa::Signature<T>);