Nod ID quickstart (iOS)

Apps verify that a member is a real adult with a real passport without ever receiving the ID. You never receive an ID, so you can never leak one.

Needs: Xcode 16+, iOS 17+, and for the Simulator a Mac with Apple silicon (there is no Intel Simulator build yet). iOS only; Android is not available yet. The first package download is about 90 MB.

1. Try it in 2 minutes (Simulator, no backend, no iPhone)

  1. Sign in at dashboard.nodid.app, create an app, copy its Test key (nod_pk_test_...).
  2. git clone https://github.com/Nod-ID/nodid-ios-sample
  3. Open Sample.xcodeproj.
  4. In SampleApp.swift, replace PASTE_NODID_TEST_KEY with your test key (or paste it into the field when the app opens).
  5. Run on any iPhone Simulator, tap Verify, choose Sample A.

You see a verified result marked "Test sample".

2. Add it to your app

  1. Xcode, File > Add Package Dependencies: https://github.com/Nod-ID/nodid-ios. Rule: Exact, version 0.4.0 (confirm at release). Product: NodIDKit.
  2. Call it:
import NodIDKit

let outcome = try await NodID.verify(key: "nod_pk_test_REPLACE_WITH_YOUR_TEST_KEY")
// .verified, .notVerified, .cancelled or .technicalError

verify(key:) accepts a test key only. It throws NodIDError.secretKeyInApp if you pass a nod_sk_ key, and badKey if the key is mistyped. Cancel and failures come back as .cancelled and .technicalError, not as errors.

3. Test mode

There is one "Test mode" idea. Whatever its tier, a test result is never a live result.

Test mode Live
Key nod_pk_test_... (safe in the app) Secret key nod_sk_... (your backend only)
Where Simulator or device, Debug builds Real iPhone
Passport Sample A, B or C. Nothing is read, no proof is made Real passport chip, proof made on the phone
Session Made by the SDK Made by your backend, single use
Result Marked mode: "test", assurance test Confirmed by your backend with your secret key

Samples (made from today's date, no names or document numbers):

Sample The member sees Your app gets
A: adult, passport valid Verified, "Test sample" verified
B: under age "Under age" screen notVerified
C: expired "Expired" screen notVerified

Your app gets the outcome only, never the reason or the sample letter. The reason is shown to the member only, as in live.

Every test screen shows a "TEST MODE" banner. The proving step says "No proof made in test mode".

Rules:

  • A test result never counts as live. Your backend must always confirm a live result with your secret key (section 4, step 4). A test result has nothing to confirm against.
  • Test mode is compiled out of Release builds. A Release or TestFlight build with a test key returns .technicalError. Do not ship a test key.
  • Never put a secret key in the app.

To see the test result shape in Debug builds, use NodID.verifyDetailed(key:):

{ "mode": "test", "outcome": "verified", "assurance": "test", "unique": true,
  "personCode": "tst_pc_<12 hex>", "method": "test_sample",
  "versions": { "circuit": "test-sample-1", "vk": "none", "dscTree": "none", "sdk": "0.4.0" } }

Not verified samples return outcome and method only: no assurance, no person code, no reason.

Telemetry in test mode. In Debug builds with a test key, the SDK sends a small ping to Nod ID: event (started or verified), SDK version, and whether it runs in a Simulator. No personal data, no device id, no passport data, no reasons. We use it to measure how long setup takes. It is never sent in live mode. Turn it off with NodID.setTestTelemetry(false), or with no network.

4. Go live (about an hour, real iPhone)

Full steps: the integration guide. In short:

  1. Add the Near Field Communication Tag Reading capability. Info.plist: NFCReaderUsageDescription, NSCameraUsageDescription (say it stays on the phone), and com.apple.developer.nfc.readersession.iso7816.select-identifiers = A0000002471001, A0000002472001, 00000000000000.
  2. Add the App Attest capability and list TEAMID.bundle.id on the dashboard Checks page. Call NodID.prefetch() at launch (the whole set, about 138 MB, the same for every member; first run only, ideally on Wi-Fi).
  3. Your backend creates a session with your secret key and sends only the sessionId to the app:
    POST https://api.nodid.app/v1/sessions     Authorization: Bearer <your secret key>
    
    .sheet(isPresented: $show) {
        NodIDVerifyView(sessionId: id) { outcome in show = false }
    }
    
  4. Before you trust it, your backend confirms:
    GET https://api.nodid.app/v1/sessions/<sessionId>/result     Authorization: Bearer <your secret key>
    
  5. Remove the test key. Do not use verifyDetailed in production.

The live Simulator is not supported: NFC needs a real iPhone.

5. Troubleshooting

In Debug builds, the setup checker prints lines starting [NodID setup]. Wording below is the design draft; confirm against the released SDK.

Message Fix
Secret key (nod_sk_) found in the app Remove it. It belongs on your backend. Use your test key in the app.
Key looks mistyped (checksum) Copy it again from dashboard.nodid.app > your app > Test key.
Placeholder key still in place Paste your test key in SampleApp.swift, or replace the placeholder in your own code.
Info.plist is missing NFCReaderUsageDescription Add a sentence saying the chip is read on the phone and nothing is sent or stored.
Info.plist is missing NSCameraUsageDescription Add a sentence saying the camera view is never recorded.
ISO 7816 identifiers missing Add the three identifiers from section 4.
NFC capability missing Xcode > target > Signing & Capabilities > + Capability > Near Field Communication Tag Reading.
App Attest missing (live only) Add the capability and list TEAMID.bundle.id on the dashboard.

6. Reference

  • Host app outcome: verified, notVerified, cancelled, technicalError. Never a reason (under age, expired, country, already used).
  • Backend result (live): outcome (verified, not_verified, cancelled, technical_error), assurance (only when verified; substantial today), unique, personCode (only when unique), method (passport_nfc), versions (circuit, vk, dscTree, sdk).
  • Person code: per app, not linkable across apps. Treat it as a "likely same person" signal. Do not ban or merge on a match; offer support or account linking.
  • Limits: partial country coverage (country coverage). Android not available yet.
  • Package licence: Apache-2.0. Pin an exact version.