Appearance
@pqc-sdk/core / verify
Function: verify()
verify<
A>(data,signature,publicKey,options?):Promise<boolean>
Verifies an ML-DSA signature. Returns false for invalid or malformed signatures, and — per FIPS 204 §3.6.2 — for a public key of the wrong length. It never throws because of a corrupted signature or a mis-sized key; it throws only when the key is not an ML-DSA public key at all (wrong algorithm, wrong use, unknown algorithm) or when the context string exceeds 255 bytes.
Type Parameters
A
A extends SignatureAlgorithm
Parameters
data
string | Uint8Array<ArrayBufferLike>
signature
Uint8Array
publicKey
PublicKey<A>
options?
Returns
Promise<boolean>
Example
ts
import { pqc } from '@pqc-sdk/core';
const valid = await pqc.verify(document, signature, pair.publicKey);
if (!valid) throw new Error('invalid signature');