JuliusBrussee/caveman · error

${label} has unsupported algorithm ${String(info.alg)}

Error message

${label} has unsupported algorithm ${String(info.alg)}

What it means

The receipt verifier only supports Ed25519 signatures. A keyring entry whose alg is not exactly the string 'Ed25519' (e.g. 'ES256', 'RSA', or a case variant like 'ed25519') is rejected so verification never silently proceeds with an algorithm it cannot check.

Source

Thrown at packages/cli/src/index.ts:17393

  let prev: Receipt | undefined;
  for (const r of sorted) {
    const decoded = keys.get(r.signature?.key_id);
    if (!decoded) return `seq ${r.seq}: no trusted public key for key_id ${String(r.signature?.key_id)}`;
    const err = verifyReceipt(r, decoded.key, decoded.info.key_id);
    if (err) return err;
    if (prev) {
      if (r.seq !== prev.seq + 1) return `seq ${r.seq}: not strictly after ${prev.seq}`;
      if (r.prev_receipt_hash !== prev.receipt_hash) return `seq ${r.seq}: prev_receipt_hash does not link to seq ${prev.seq}`;
      if (r.day <= prev.day) return `seq ${r.seq}: day ${r.day} does not follow ${prev.day}`;
    }
    prev = r;
  }
  return null;
}

function decodeReceiptKey(info: ReceiptPublicKey, label: string): DecodedReceiptKey {
  if (!info || typeof info.key_id !== "string" || !info.key_id.trim()) throw new Error(`${label} key_id is required`);
  if (info.alg !== "Ed25519") throw new Error(`${label} has unsupported algorithm ${String(info.alg)}`);
  if (typeof info.key !== "string" || !info.key.trim()) throw new Error(`${label} key is required`);
  const raw = Buffer.from(info.key, "base64");
  if (raw.length !== 32 || raw.toString("base64") !== info.key) throw new Error(`${label} must be a canonical base64 Ed25519 public key`);
  return { info, raw, key: ed25519PublicKey(raw) };
}

function decodeUniqueKeyring(infos: ReceiptPublicKey[], label: string): Map<string, DecodedReceiptKey> {
  const keys = new Map<string, DecodedReceiptKey>();
  for (const [index, info] of infos.entries()) {
    const decoded = decodeReceiptKey(info, `${label}[${index}]`);
    if (keys.has(decoded.info.key_id)) throw new Error(`${label} contains duplicate key_id ${decoded.info.key_id}`);
    keys.set(decoded.info.key_id, decoded);
  }
  return keys;
}

function embeddedReceiptKeys(bundle: ReceiptBundle): { current: DecodedReceiptKey; keys: Map<string, DecodedReceiptKey> } {
  if (bundle.schema !== RECEIPT_BUNDLE_V1 && bundle.schema !== RECEIPT_BUNDLE_V2) throw new Error(`unsupported bundle schema ${String(bundle.schema)}`);

View on GitHub (pinned to 5184b3d11a)

Solutions

  1. Set alg exactly to "Ed25519" — the comparison is case-sensitive
  2. If the issuer signed with another algorithm, request an Ed25519 public key entry from them
  3. Re-download the canonical keyring instead of merging entries manually

Example fix

// before
{ "key_id": "k1", "alg": "ES256", "key": "MCowBQYDK2VwAyEA..." }
// after
{ "key_id": "k1", "alg": "Ed25519", "key": "MCowBQYDK2VwAyEA..." }
Defensive patterns

Strategy: type-guard

Validate before calling

const ok = keyring.every((k) => k?.alg === 'Ed25519');
if (!ok) throw new Error('keyring contains non-Ed25519 entries — fetch the canonical Caveman keyring');

Type guard

const isEd25519KeyInfo = (k: unknown): k is ReceiptPublicKey =>
  typeof k === 'object' && k !== null && (k as ReceiptPublicKey).alg === 'Ed25519';

Prevention

When it happens

Trigger: Keyring generated for a different signing scheme; algorithm strings with case differences or trailing whitespace; mixed keyrings where only some entries were migrated to Ed25519.

Common situations: Issuers migrating between algorithms; hand-merged keyrings from multiple sources; specs written with lowercase algorithm names.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@5184b3d11a (2026-08-18). Data as JSON: /api/errors/0d5324862ca19811. Report an issue: GitHub.