SignatureKeyFormat
Format of the public key used for signature verification.
Format of the public key used for signature verification.
Different algorithms support different key formats.
Type
type SignatureKeyFormat = "spki_der" | "spki_pem" | "pkcs1_der" | "pkcs1_pem" | "sec1" | "raw";Examples
import fs from 'fs';
// PEM format (text)
const pemKey = fs.readFileSync('./public-key.pem', 'utf8');
const config1 = {
format: 'spki_pem',
data: pemKey,
};
// DER format (binary)
const derKey = fs.readFileSync('./public-key.der');
const config2 = {
format: 'spki_der',
data: derKey,
};
// Raw bytes (Ed25519 only)
const rawKey = new Uint8Array(32);
const config3 = {
format: 'raw',
data: rawKey,
};