Repository navigation
feat(nap-client-web): extension 0002, cross-origin signer (release 0.13.0) - #55
Merged
Merged
Conversation
A sister origin gets a NAP session from a key held on another origin, without the key leaving it. connectCrossOrigin() opens the key origin's signer page as a popup; mountCrossOriginSigner() answers only its opener, only for policy origins (browser-reported, not page-asserted), and signs only kinds and u-tag audiences inside a short-lived grant. Later completion proofs (step-up) must pass onSign. Grants end on lock, logout, identity change, TTL, or popup close. Client-only: servers and nap-java are unchanged. Spec in docs/extensions/0002-cross-origin-signer.md; Chromium e2e behind NAP_BROWSER=1 checks origin, framing and COOP behaviour.
| frame.src = `${key}/nap/signer`; | ||
| document.body.append(frame); | ||
| const heard: unknown[] = []; | ||
| addEventListener('message', (event) => heard.push(event.data)); |
Owner
Author
|
Dependency audit fails for reasons that already exist on master and have nothing to do with this PR. Running the same audit ( |
Closed
11 tasks
Bump every package and the sibling ^ranges to 0.13.0, refresh the lockfile, date the CHANGELOG entry, and add the 0.12.0 -> 0.13.0 notes to UPGRADING.md (bump the range; COOP headers only if adopting the cross-origin signer). Install examples in README, RELEASING, the guide and tutorial 01 now name ^0.13.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #54.
What
NAP extension 0002, cross-origin signer, in
@imani/nap-client-web:connectCrossOrigin()(relying origin): opens the key origin's signer page as a popup and returns a grant whosesigneris an ordinarySessionSignerforcreateNapSession.mountCrossOriginSigner()(key origin,/nap/signer): policy-gated signing grants.createStorageConsentStore(): remembered approvals. Holds no secret.The spec is
docs/extensions/0002-cross-origin-signer.md. It is linked from RFC §22.1 and integration guide §6.2.Security properties (each one tested)
window.opener, and only for policy origins, using the browser-reportedevent.origin. Strangers get silence.utag whose origin is in the grant's audiences (closes §7.1 origin substitution for this path), andcreated_atwithin 300 s (no pre-signing).onSign(step-up is a real prompt, §10.3). WithoutonSignit is refused.expectedPubkeymismatch is refused even after consent.BroadcastChannel), popup close, signer page reload, ordisconnect().*. The relying side verifies the signature and template of every returned event.Client-only
The server sees a byte-identical §11 proof. No wire change, so
nap-javaandsupported_extensionsare untouched.Tests
crossOrigin.test.ts: 47 tests over a fake two-origin window model that enforces target origins, browser-setoriginandsource, and async structured clone. It includes the shared signer conformance suite and an end-to-end login against the realnap-serverissueChallenge/verifyCompletion.crossOrigin.browser.test.ts(opt-in,NAP_BROWSER=1,playwright-coredevDep): real Chromium, two real origins (127.0.0.1vslocalhost). Checks connect and sign, the out-of-policy refusal, silence for an origin outside the policy, iframe silence, and COOP behaviour:same-originandsame-origin-allow-popupson the signer page break it, andsame-origin-allow-popupson the relying page works. All of this is recorded in the spec.npm run typecheck,npm test(830 passed) andrelease:packpass locally. The new files are in thedisttarball.Not in this version (spec §10)
Iframe mode, signed/fetched policy, NIP-98 path/method scoping, and a relay transport.