feat(cli): accept a DPoP signing key and algorithm (DSPX-3397) - #991
feat(cli): accept a DPoP signing key and algorithm (DSPX-3397)#991dmihalcik-virtru wants to merge 1 commit into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
3ae0223 to
45582fe
Compare
e6accca to
435b290
Compare
|
X-Test Failure Report |
`--dpop` was a boolean that always generated an ephemeral RSA key, so the CLI could not exercise ECDSA proofs or reuse a key across invocations. Both are needed to test DPoP against a real IdP. - `--dpop[=ALG]` now optionally takes ES256, ES384, ES512 or RS256 and generates an ephemeral key of that type; bare `--dpop` defaults to ES256. - `--dpopKey <file>` loads a PEM private key and infers its algorithm. Combined with an explicit `--dpop=ALG`, the key is checked against the requested alg so a mismatch fails with a clear message instead of an opaque WebCrypto error at signing time. - `supports <feature>` reports whether this build implements a feature (currently just `dpop`), exiting non-zero when it does not. Cross-SDK test harnesses use this to skip cases a given SDK build cannot run, rather than hard-coding version checks. Replaces the `console.assert` calls in argument validation with thrown CLIErrors. `console.assert` only prints -- it does not halt -- so invalid input was being logged and then used anyway. Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com>
435b290 to
e307560
Compare
45582fe to
41dad28
Compare



Stack 4/6, split out of #939. Base: #990.
What
--dpopwas a boolean that always generated an ephemeral RSA key, so the CLI could not exercise ECDSA proofs or reuse a key across invocations. Both are needed to test DPoP against a real IdP, and by the cross-SDK harness.Changes
--dpop[=ALG]optionally takesES256,ES384,ES512orRS256and generates an ephemeral key of that type. Bare--dpopdefaults toES256.--dpopKey <file>loads a PEM private key and infers its algorithm. Combined with an explicit--dpop=ALG, the key is checked against the requested alg, so a mismatch fails with a clear message instead of an opaque WebCrypto error at signing time. Bare--dpop --dpopKey k.peminfers from the key and does not conflict.supports <feature>reports whether this build implements a feature (currently justdpop), exiting non-zero when it does not. Cross-SDK test harnesses use this to skip cases a given SDK build cannot run, rather than hard-coding version checks. Nothing in this repo calls it — the consumer is the xtest harness.cli/src/dpop-helpers.tsholds the key generation/loading/validation, kept out ofcli.tsso it is directly unit-testable.Also
Replaces the
console.assertcalls in argument validation with thrownCLIErrors.console.assertonly prints — it does not halt — so invalid input was being logged and then used anyway.Tests
cli/tests/dpop-helpers.spec.ts— 30 cases covering generation per alg, PEM loading, algorithm inference, explicit/inferred conflict resolution, and the--no-dpop/ bare---dpopargument shapes.How to test
cd cli && npm test