signatureBytes

function signatureBytes(putativeSignatureBytes): SignatureBytes;

This helper combines asserting that a ReadonlyUint8Array is an Ed25519 signature with coercing it to the SignatureBytes type. It's best used with untrusted input.

Parameters

ParameterType
putativeSignatureBytesReadonlyUint8Array

Returns

SignatureBytes

Example

import { signatureBytes } from '@solana/keys';
 
const signature = signatureBytes(userSuppliedSignatureBytes);
if (!(await verifySignature(publicKey, signature, data))) {
    throw new Error('The data were *not* signed by the private key associated with `publicKey`');
}

On this page