Skip to main content
Version: 11.x

Function: verifyMessage()

Call Signature​

verifyMessage(message, signature, fullPublicKey, accountAddress?): boolean

Defined in: verify.ts:82

Checks a SNIP-12 message signed by a Falcon-512 account. Same shapes as typedData.verifyMessage.

Parameters​

message​

TypedData

a TypedData message, or its hash (SNIP-12)

signature​

Signature

the 61 felts of a Falcon-512 signature

fullPublicKey​

string | Uint8Array<ArrayBufferLike>

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

accountAddress?​

BigNumberish

address of the account that signed the message. Needed only when message is a TypedData

Returns​

boolean

true if the message is verified

Throws​

when message is a TypedData and accountAddress is missing, or when the public key is invalid

Example​

const signature = await mySigner.signMessage(myTypedData, accountAddress);
const msgHash = typedData.getMessageHash(myTypedData, accountAddress);
const result1 = falcon512.verifyMessage(myTypedData, signature, publicKey, accountAddress);
const result2 = falcon512.verifyMessage(msgHash, signature, publicKey);
// result1 = result2 = true

Call Signature​

verifyMessage(message, signature, fullPublicKey): boolean

Defined in: verify.ts:88

Checks a SNIP-12 message signed by a Falcon-512 account. Same shapes as typedData.verifyMessage.

Parameters​

message​

BigNumberish

a TypedData message, or its hash (SNIP-12)

signature​

Signature

the 61 felts of a Falcon-512 signature

fullPublicKey​

string | Uint8Array<ArrayBufferLike>

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

Returns​

boolean

true if the message is verified

Throws​

when message is a TypedData and accountAddress is missing, or when the public key is invalid

Example​

const signature = await mySigner.signMessage(myTypedData, accountAddress);
const msgHash = typedData.getMessageHash(myTypedData, accountAddress);
const result1 = falcon512.verifyMessage(myTypedData, signature, publicKey, accountAddress);
const result2 = falcon512.verifyMessage(msgHash, signature, publicKey);
// result1 = result2 = true