verifyMessage
import { verifyMessage } from "jsr:@ende/http/unstable-message-signatures";function ยท experimental
async function verifyMessage(message: Request | Response, keyLookup: (keyId: string, algorithm?: SignatureAlgorithm) => Promise<CryptoKey | null> | CryptoKey | null, options?: VerifyOptions): Promise<VerifyResult[]>Verify one or more signatures on an HTTP message per RFC 9421.
message: Request | ResponseThe HTTP request or response to verify.
keyLookup: (keyId: string, algorithm?: SignatureAlgorithm) => Promise<CryptoKey | null> | CryptoKey | nullResolves a key identifier to a CryptoKey, or
nullif the key is not found. When the signature has nokeyidparameter, the empty string""is passed.options?: VerifyOptionsOptional verification constraints.
Returns
Array of verified signature results.
Example: Usage
import { verifyMessage } from "@ende/http/unstable-message-signatures";
const results = await verifyMessage(
signedRequest,
async (keyId) => lookupPublicKey(keyId),
{ requiredComponents: ["@method", "@authority"] },
);