Skip to content

Commit

Permalink
[wallet-core]: expose public_key for the account
Browse files Browse the repository at this point in the history
  • Loading branch information
DougAnderson444 committed Jul 29, 2024
1 parent 0fbaf16 commit 639621c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crates/delano-wallet-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,13 @@ pub struct Verifiables {
}

/// Verifies the signature against the given message and public key in G1
///
/// The public key is the compressed public key in G1, and the signature
/// is the G2 signature.
pub fn verify_signature(
signature: Vec<u8>,
message: Vec<u8>,
// The compressed public key in G1
public_key: Vec<u8>,
) -> Result<bool, String> {
let pk = utils::try_decompress_g1(public_key).map_err(|e| e.to_string())?;
Expand Down Expand Up @@ -132,6 +136,12 @@ impl DelanoWallet {
self.account.sign(&message).to_vec()
}

/// Returns the Public Key used for signatures.
/// This is the public key in G1 for BLS12-381.
pub fn public_key(&self) -> Vec<u8> {
self.account.pk_g1().to_compressed().to_vec()
}

/// Return proof of [Nym] given the Nonce
pub fn nym_proof(&self, nonce: Vec<u8>) -> NymProofCompressed {
let nonce = utils::nonce_by_len(&nonce).unwrap_or_default();
Expand Down

0 comments on commit 639621c

Please sign in to comment.