Skip to main content
Version: 11.x

Function: verify()

verify(signature, msgHash, fullPublicKey): boolean

Defined in: verify.ts:50

Low-level verification, same shape as ec.starkCurve.verify(signature, msgHash, fullPublicKey).

Parameters​

signature​

Signature

the 61 felts of a Falcon-512 signature

msgHash​

BigNumberish

the signed hash (a transaction hash, or the hash of a SNIP-12 message)

fullPublicKey​

string | Uint8Array<ArrayBufferLike>

NIST Falcon-512 public key (897 bytes), as returned by getPubKey()

Returns​

boolean

true for a valid signature of msgHash; false for an invalid or malformed signature, or a malformed hash

Throws​

when the public key is invalid

Example​

const { secretKey, publicKey } = falcon512.generateKeyPair();
const mySigner = new Falcon512Signer(secretKey);
const signature = await mySigner.signMessage(myTypedData, accountAddress);
const msgHash = typedData.getMessageHash(myTypedData, accountAddress);
const result = falcon512.verify(signature, msgHash, publicKey);
// result = true
const result2 = falcon512.verify(signature, '0x1234', publicKey);
// result2 = false
falcon512.verify(signature, msgHash, '0x1234');
// throws Error("Falcon512: public key must have 1794 hex digits, got 4")