edit documentation for the js package to add session proofs vs request documentation - #320
edit documentation for the js package to add session proofs vs request documentation#320kchaw2005 wants to merge 36 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Removed mention of session constraints in the proof request section.
Removed section on handling the result in the backend, including example code for verifying proof.
Removed backend RP signature generation section and related examples from the README.
…into kartike/add-session-doc
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 255db6a8df
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ```tsx | ||
| import { useIDKitSession, CredentialRequest } from "@worldcoin/idkit"; | ||
|
|
||
| const rp_context = await fetch("/api/rp-signature").then((r) => r.json()); |
There was a problem hiding this comment.
Fetch a fresh RP context for each hook attempt
This module-level fetch reuses one nonce and signature for every flow.open() during the page lifetime; the request example repeats the same pattern. Since signRequest defaults to a five-minute TTL and the nonce is single-use, a user who waits before clicking or retries after a reset will receive rp_signature_expired or duplicate_nonce. Generate a new rp_context for each attempt rather than once when the module loads.
Useful? React with 👍 / 👎.
Remove comment about fresh rp_context for request creation.
| const rp_context = await fetch("/api/rp-signature").then((r) => r.json()); | ||
|
|
||
| function CreateSessionExample() { | ||
| const flow = useIDKitSession({ |
There was a problem hiding this comment.
RPs should default to using the react widgets; otherwise they should use the js core library
…into kartike/add-session-doc
Added fetching of rp_context for session creation and proof.
What
edited the readme in js/packages/core
IDKit.createSessionand how that's different than requests created viaIDKit.requestWhy
the js core package is our most used entrypoint into world ID. The migration documentation from v3.0 to v4.0 is a little unfinished / messy, as parallel documentation exists for legacy proof creation flows and v4.0 in the docs but not necessarily in this github
Note
Low Risk
Documentation-only changes to package READMEs; no runtime or API behavior is modified.
Overview
Expands @worldcoin/idkit-core and @worldcoin/idkit READMEs with a Quickstart that separates session-scoped proofs from action-key uniqueness flows, aligned with v4 migration guidance.
For core, the docs now walk through
IDKit.createSession/IDKit.proveSession(persistsession_id, no action key) versusIDKit.request(action + nullifier anti-replay), plus backend verification via/api/v4/verify/{rp_id}and passing throughrp_contextfrom the signing endpoint instead of hand-assembling fields in every example.For React, the same split is shown with
IDKitSessionWidget(existing_session_idon return visits) versusIDKitRequestWidget, with notes on requiredonSuccess, optionalhandleVerify, andIDKitInviteCodeRequestWidgetfor cross-device flows. Presets and legacy compatibility are reframed as request-only (sessions useconstraints, not presets), and RP signing examples note omittingactionfor session flows.Reviewed by Cursor Bugbot for commit 4af429d. Bugbot is set up for automated code reviews on this repo. Configure here.