• Given a public CryptoKey, some SignatureBytes, and a Uint8Array of data, this method will return true if the signature was produced by signing the data using the private key associated with the public key, and false otherwise.

    Parameters

    • key: CryptoKey
    • signature: SignatureBytes
    • data: ReadonlyUint8Array<ArrayBufferLike>

    Returns Promise<boolean>

    import { verifySignature } from '@solana/keys';

    const data = new Uint8Array([1, 2, 3]);
    if (!(await verifySignature(publicKey, signature, data))) {
    throw new Error('The data were *not* signed by the private key associated with `publicKey`');
    }