Actions
Bug #3837
openFix PEM-to-DER double-encoding in credential reload and add persistence integration test
Start date:
07/05/2026
Due date:
% Done:
100%
Estimated time:
Description
Bug fixed¶
`loadCredentialsForRp` and `loadAllCredentials` in cdp-webauthn.ts used `Buffer.from(cred.privateKeyPem).toString('base64')` which base64-encodes the entire PEM string (including headers). CDP expects base64-encoded DER only. Added `pemToDerBase64` helper that strips PEM headers/footers.
Tests added¶
- Unit test: round-trip privateKey through PEM storage verifies the loaded key matches the original DER
- Integration test: register passkey on webauthn.io via CdpWebAuthnManager, verify credential persisted to store, disable/re-enable with new authenticator, load from store, authenticate with reloaded credential
Files¶
- `src/cdp-webauthn.ts` — pemToDerBase64 helper, fixed both load methods
- `src/cdp-webauthn.test.ts` — round-trip test, sendCalls tracking in mock
- `src/integration/webauthn-io.test.ts` — persistence + reload integration test
Actions