Skip to content

feat(sdk): add Mnc preset for World ID 4.0 MNC credential#270

Merged
Grimald merged 3 commits into
mainfrom
feature/add-mnc-preset
May 29, 2026
Merged

feat(sdk): add Mnc preset for World ID 4.0 MNC credential#270
Grimald merged 3 commits into
mainfrom
feature/add-mnc-preset

Conversation

@Grimald
Copy link
Copy Markdown
Contributor

@Grimald Grimald commented May 25, 2026

Description

  • MNC requests currently fall through to the generic constraints() path in the Next.js example, which causes two issues:
    • verification_level defaults to "device" instead of "document" (correct for a document credential)
    • signal is not passed to CredentialRequest, so it's omitted from the bridge payload's proof_requests
  • This PR adds a dedicated Mnc preset mirroring the existing Passport preset pattern.

Changes

  • Rust core (preset.rs): Add Mnc variant to Preset enum with constructor, into_bridge_params match arm (uses CredentialType::Mnc, VerificationLevel::Document, allow_legacy_proofs: true), and unit test
  • Rust WASM (wasm_bindings.rs): Add MncPreset TypeScript interface, update Preset union type, add mnc() function export
  • JS core (wasm.ts, request.ts, index.ts): Re-export MncPreset type, add mnc() helper function, add to IDKit namespace
  • React package (index.ts): Re-export mnc function and MncPreset type
  • Next.js example (ui.tsx): Use mncPreset({ signal }) instead of falling through to CredentialRequest without signal

Testing Instructions

  1. Run Rust tests: cargo test -p idkit-core mnc_preset — verify the new test passes
  2. Build WASM: verify MncPreset type appears in generated .d.ts
  3. In the Next.js example, select MNC as v4 credential type and verify:
    • Bridge payload has verification_level: "document" (not "device")
    • proof_requests[0] includes the signal field
    • identifier: "mnc" and issuer_schema_id: 9310 are correct

@vercel
Copy link
Copy Markdown

vercel Bot commented May 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
idkit-js-example Ready Ready Preview, Comment May 29, 2026 7:21am

Request Review

Copy link
Copy Markdown
Contributor

@Guardiola31337 Guardiola31337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question on the MNC preset path.

Comment thread js/examples/nextjs/app/ui.tsx Outdated
}),
}
: v4CredentialType === "mnc"
? { preset: mncPreset({ signal: widgetSignal }) }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should MNC also be treated as a preset credential for the genesis-date UI? With mncPreset(), genesisIssuedAtMin is no longer included in the request.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Fixed

Copy link
Copy Markdown
Contributor

@Guardiola31337 Guardiola31337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One follow-up on the MNC genesis path.

Comment thread js/examples/nextjs/app/ui.tsx Outdated
? genesisIssuedAtMin == null
? { preset: mncPreset({ signal: widgetSignal }) }
: {
constraints: CredentialRequest("mnc", {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this branch still need a document legacy fallback? Since it uses constraints(), the bridge params appear to fall back to verification_level: "device" again when genesis is enabled.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right. For mnc + genesis we now build a v4 constraints request and explicitly keep that branch v4-only (allow_legacy_proofs=false) in the example UI. This avoids falling back to legacy verification_level=device for a document-scoped request. mncPreset() still keeps the document legacy fallback for the non-genesis path.

Guardiola31337
Guardiola31337 previously approved these changes May 27, 2026
Copy link
Copy Markdown
Contributor

@Guardiola31337 Guardiola31337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the feedback @Grimald 🚢

Gleb Okunev added 2 commits May 29, 2026 09:56
Add a dedicated Mnc preset mirroring the Passport preset pattern, so MNC
requests get the correct legacy verification_level (document) and signal
propagation instead of falling through the generic constraints path
which defaults to device level and omits the signal.
Copy link
Copy Markdown
Contributor

@Guardiola31337 Guardiola31337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Triple-confirmed after the conflict resolution. Good to land.

@Grimald Grimald merged commit 652c0c9 into main May 29, 2026
18 checks passed
@Grimald Grimald deleted the feature/add-mnc-preset branch May 29, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants