QubicTypeScript

verify

Verifies a SchnorrQ signature over the FourQ curve, returning true if the signature is valid for the given data and public key.

Signature

verify(data: Uint8Array, signature: Uint8Array, publicKey: Uint8Array): boolean

Purpose

Verifies a SchnorrQ signature against a public key and message. Returns true if the signature is valid for the given data and key. Synchronous — no await needed.

import { sign, verify, publicKeyFromSeed } from "@qubic.org/crypto"
import { toSeed } from "@qubic.org/types"

const seed = toSeed("aaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")
const publicKey = publicKeyFromSeed(seed)
const message = new TextEncoder().encode("hello qubic")

const sig = await sign(message, seed)
const valid = verify(message, sig, publicKey)
// valid === true

Parameters

NameTypeDescription
dataUint8ArrayThe original signed bytes
signatureUint8Array64-byte SchnorrQ signature
publicKeyUint8Array32-byte FourQ public key

Returns

booleantrue if the signature is valid, false otherwise.

On this page