Skip to content

Commit

Permalink
Multisig: verify the consistency of commitments checksum
Browse files Browse the repository at this point in the history
  • Loading branch information
andiflabs committed Mar 12, 2024
1 parent d2152cc commit e1fc0ba
Show file tree
Hide file tree
Showing 5 changed files with 417 additions and 113 deletions.
1 change: 1 addition & 0 deletions ironfish-rust-nodejs/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export type NativeSigningCommitment = SigningCommitment
export class SigningCommitment {
constructor(jsBytes: Buffer)
identity(): Buffer
verifyChecksum(transactionHash: Buffer, signerIdentities: Array<string>): boolean
}
export type NativeSigningPackage = SigningPackage
export class SigningPackage {
Expand Down
14 changes: 14 additions & 0 deletions ironfish-rust-nodejs/src/frost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,20 @@ impl NativeSigningCommitment {
pub fn identity(&self) -> Buffer {
Buffer::from(self.signing_commitment.identity().serialize().as_slice())
}

#[napi]
pub fn verify_checksum(
&self,
transaction_hash: JsBuffer,
signer_identities: Vec<String>,
) -> Result<bool> {
let transaction_hash = transaction_hash.into_value()?;
let signer_identities = try_deserialize_identities(signer_identities)?;
Ok(self
.signing_commitment
.verify_checksum(&transaction_hash, &signer_identities)
.is_ok())
}
}

#[napi(js_name = "SigningPackage")]
Expand Down
Loading

0 comments on commit e1fc0ba

Please sign in to comment.