Skip to content

Commit

Permalink
Add derive_inner method for IssuanceAuthorizingKey
Browse files Browse the repository at this point in the history
  • Loading branch information
ConstanceBeguier committed Jun 20, 2023
1 parent 037e278 commit 470591c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ impl IssuanceKey {
pub struct IssuanceAuthorizingKey(redpallas::SigningKey<IssuanceAuth>);

impl IssuanceAuthorizingKey {
/// Derives isk from sk_iss. Internal use only, does not enforce all constraints.
fn derive_inner(sk_iss: &IssuanceKey) -> pallas::Scalar {
to_scalar(PrfExpand::ZsaIsk.expand(&sk_iss.0))
}

/// Sign the provided message using the `IssuanceAuthorizingKey`.
pub fn sign(
&self,
Expand All @@ -310,7 +315,7 @@ impl IssuanceAuthorizingKey {

impl From<&IssuanceKey> for IssuanceAuthorizingKey {
fn from(sk_iss: &IssuanceKey) -> Self {
let isk = to_scalar(PrfExpand::ZsaIsk.expand(&sk_iss.0));
let isk = IssuanceAuthorizingKey::derive_inner(sk_iss);
// IssuanceAuthorizingKey cannot be constructed such that this assertion would fail.
assert!(!bool::from(isk.is_zero()));
IssuanceAuthorizingKey(conditionally_negate(isk))
Expand Down

0 comments on commit 470591c

Please sign in to comment.