Uh oh!
There was an error while loading. Please reload this page.
remote/oidc: PKCE + ephemeral loopback receiver (T1, T2) - #197
Conversation
Two dependency-free local primitives for the browser login flow:
- pkce.js: createPkcePair() -> { verifier, challenge }, S256 over stdlib
crypto. The client's downstream PKCE leg (LLP 0046 D3).
- loopback.js: startLoopbackReceiver({ state, timeoutMs }) binds a
single-shot 127.0.0.1:0 HTTP listener serving /callback, returns its
redirectUri up front, and resolves { code } on a state-matched
callback (rejecting on mismatch, error=, or timeout). RFC 8252
ephemeral redirect (LLP 0046 D2).
Unit tests cover the SHA-256 challenge derivation, fresh randomness,
and the loopback success / state-mismatch / error / timeout paths.platypii
commented
Jun 29, 2026
Review (independent agent review)Verdict: approve-with-nits — PKCE encoding is correct (32-byte verifier, S256 = base64url(SHA-256(verifier)), padding/ Findings
Addressed in this PRFixed both: The state-mismatch-aborts-the-flow behavior is intentional and acceptable under the loopback-only threat model. |
…-listen errors Review follow-ups (PR #197): - close() before a code arrives now rejects an in-flight (or future) waitForCode() instead of leaving it permanently pending. - a post-listen server 'error' now settles a pending waitForCode() and closes the server (via fail()), not a no-op rejectStart. - tests: close()-rejects-pending, and a non-/callback probe 404s without consuming the single shot.
Chunk 1 of the multi-tenant OIDC client login (LLP 0046-0048), milestone 1 local primitives.
What
src/core/remote/pkce.js-createPkcePair(), S256 challenge over stdlibcrypto. Client's downstream PKCE leg (LLP 0046 D3).src/core/remote/loopback.js-startLoopbackReceiver({ state, timeoutMs }), single-shot127.0.0.1:0listener on/callback; resolves{ code }on a state-matched callback, rejects on mismatch /error=/ timeout. RFC 8252 ephemeral redirect (LLP 0046 D2).Tests
test/core/remote-pkce.test.jsandtest/core/remote-loopback.test.js, 7 tests green.npm run typecheckclean.Base is the
oidc-client-loginintegration branch, not master.🤖 Generated with Claude Code