Skip to content

@pumpkin-plugins/signing API / sign / verifyWasm

Function: verifyWasm() ​

verifyWasm(wasm, expectedPublicKeyHex?): VerifyResult

Defined in: sign.ts:244

Checks the signature of a wasm binary. Never throws: problems are reported in the result.

Like Pumpkin, it reads the signature from a wasm_signature or pumpkin.signature section and accepts hex in either case. It still differs from Pumpkin in three ways: it reads only the signing sections at the end of the file, it requires a version 1 Ed25519 JSON envelope where Pumpkin also accepts raw signature bytes, and it keeps the last value of a repeated JSON key where Pumpkin rejects the section.

Parameters ​

wasm ​

Uint8Array

The binary to check.

expectedPublicKeyHex? ​

string

The trusted signer's public key in hex. When set, a file signed by any other key is reported as invalid. Without it, a valid result only means the file agrees with its own envelope, so compare publicKeyHex with a key you trust.

Returns ​

VerifyResult

Whether it is signed, whether the signature is valid, and what it says.

pumpkin-plugins documentation