codeburn/src/plugins/keys.ts
iamtoruk c01b7be4b0 fix(plugins): derive keygen keyId identically to sign; pin release-key ids in tests
Fixes critical bug where keygen() used random keyId but sign() derived it from sha256 of public key PEM. This caused embedded release key (f40248d0) to not match actual derived id (499923ae), breaking plugin verification.

Now both keygen and sign derive keyId consistently from sha256(publicKeyPem).slice(0,4).hex.

Added tests:
- keygen and sign derive identical keyIds from same ephemeral key
- RELEASE_PUBLIC_KEYS map keys match their derived keyIds from embedded PEM values

End-to-end verified: signing with private key and verifying with embedded public key now works without CODEBURN_PLUGIN_DEV.
2026-08-28 00:35:36 -07:00

6 lines
408 B
TypeScript

/// Release public keys for ed25519 plugin signature verification.
/// Maps keyId (8 hex chars, derived from sha256 of PEM) to base64-encoded PEM public key.
export const RELEASE_PUBLIC_KEYS: ReadonlyMap<string, string> = new Map([
['499923ae', 'LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUNvd0JRWURLMlZ3QXlFQTU1QTAvMUpLTlBoMGFsL2xMN2xhWFBobWVnZVhzUENqK3RoM1B4LzNWM0U9Ci0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQo='],
])