@reclaimprotocol/client 0.1.42 → 0.1.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -341,7 +341,8 @@ const verifierApp = await reclaim.sessions.create({
341
341
  verificationClientUrl: VerificationClient.verifierApp,
342
342
  })
343
343
 
344
- // 4. In-app SDK or add-to-app host.
344
+ // 4. In-app SDK or add-to-app host. Required for these apps: pass
345
+ // inApp.verificationUrl to the app's startVerificationFromUrl.
345
346
  const inApp = await reclaim.sessions.create({
346
347
  providers: [{ providerId }],
347
348
  context,
@@ -372,6 +373,22 @@ const custom = await reclaim.sessions.create({
372
373
  })
373
374
  ```
374
375
 
376
+ A session works only in the client it was created for. Builder fixes the
377
+ session's client at creation, and every Verification Client request must carry
378
+ that client's `x-reclaim-vc-id`, or it gets
379
+ `403 x-reclaim-vc-id does not match this session`. Opening the link in another
380
+ client first doesn't change this. So a mobile app using the in-app SDK or the
381
+ add-to-app module needs sessions created with `VerificationClient.inAppSdk`
382
+ (`https://build.reclaimprotocol.org/share/inapp-sdk`). A session created
383
+ without `verificationClientUrl` is a Portal session, and those apps can't open
384
+ it.
385
+
386
+ Those apps start Builder mode from either value of the response:
387
+ - `startVerificationFromUrl(inApp.verificationUrl)`;
388
+ - `startVerificationFromJson({ api: '2', sessionId: inApp.id })`.
389
+ Add `diag: '1'` only when `verificationUrl` contains `diag=1`. Other keys
390
+ are ignored, and the Builder URL comes from the app's configuration.
391
+
375
392
  The Consumer supplies a URL, not `verificationClientId` or
376
393
  `x-reclaim-vc-id`. Builder resolves and stores the UUID. The selected
377
394
  Verification Client reads its own configured UUID and sends it only on its
@@ -565,6 +582,10 @@ curl -X POST "$BUILDER_URL/verifications/sessions" \
565
582
  # → 201 { "id": "…", "verificationUrl": "…&api=2", "status": "pending", "mode": "…", … }
566
583
  ```
567
584
 
585
+ For the in-app SDK or add-to-app module, send
586
+ `"verificationClientUrl": "https://build.reclaimprotocol.org/share/inapp-sdk"`.
587
+ Those apps can't open a session created for another client.
588
+
568
589
  For a TEE-bound session, a raw HTTP client must derive the legacy hash nonce
569
590
  with its organization verification private key, sign the exact
570
591
  `RECLAIM_BUILDER_TEE_BINDING_V1:{organizationId}:{sessionId}:{applicationId}:{timestamp}:{attestationVersion}:{attestationNonce}`
@@ -668,7 +689,8 @@ reclaim.sessions.create({ providers, context, verificationClientUrl?, orgEthPriv
668
689
  // providers: { providerId, version? }[] — proved in order, one combined result; all required.
669
690
  // → VerificationSession (has `id`, `verificationUrl`, `status`, `mode`, …)
670
691
  // verificationClientUrl selects a registered Verification Client by URL;
671
- // omitted, it defaults to the Portal.
692
+ // omitted, it defaults to the Portal. The session then only opens in that
693
+ // client: use VerificationClient.inAppSdk for in-app SDK / add-to-app hosts.
672
694
  // orgEthPrivateKey optionally creates the post-create TEE binding locally.
673
695
  // The returned verificationUrl contains sessionId and api=2.
674
696
  reclaim.sessions.bindTeeNonce(reclaimSessionId, { orgEthPrivateKey, timestamp? })
package/lib/result.js CHANGED
@@ -386,6 +386,15 @@ export async function verifyResultFull(jws, opts = {}) {
386
386
  if (hasContentValidation(commonValidation)) {
387
387
  await verifyRequestProofGroup(proofGroups, commonValidation);
388
388
  }
389
+ else if (isProviderlessAiResult(payload, providerResults)) {
390
+ // AI sessions have no provider or recipe, so there is no content to
391
+ // match. Attestor trust, proof signatures, and session binding still
392
+ // apply through `commonValidation`.
393
+ await verifyRequestProofGroup(proofGroups, {
394
+ ...commonValidation,
395
+ dangerouslyDisableContentValidation: true,
396
+ });
397
+ }
389
398
  else {
390
399
  await verifyByResolvedRecipes(commonValidation, expectedSessionId);
391
400
  }
@@ -528,6 +537,23 @@ function hasContentValidation(config) {
528
537
  || config.providerId
529
538
  || config.dangerouslyDisableContentValidation);
530
539
  }
540
+ /**
541
+ * Whether a result comes from an AI session: the session declares no
542
+ * providers, and no `results` entry names a provider or version. Any other
543
+ * shape, including a mix of both kinds of entries, takes the recipe path.
544
+ */
545
+ function isProviderlessAiResult(payload, entries) {
546
+ const session = payload.verification_session;
547
+ if (!session || typeof session !== 'object' || Array.isArray(session)) {
548
+ return false;
549
+ }
550
+ const { providers } = session;
551
+ return Array.isArray(providers)
552
+ && providers.length === 0
553
+ && entries.length > 0
554
+ && entries.every((entry) => (entry.provider_id === undefined
555
+ && entry.resolved_version === undefined));
556
+ }
531
557
  function proofGroupKey(group) {
532
558
  return `${group.providerId ?? ''}\u0000${group.providerVersion ?? ''}`;
533
559
  }
@@ -35,10 +35,18 @@ export declare const ROUTES: {
35
35
  readonly method: "get";
36
36
  readonly path: "/admin/callback-dlq";
37
37
  };
38
+ readonly AdminDisableOrgAiAppKey: {
39
+ readonly method: "post";
40
+ readonly path: "/admin/orgs/{orgId}/ai-app-key/disable";
41
+ };
38
42
  readonly AdminFeatureFlags: {
39
43
  readonly method: "get";
40
44
  readonly path: "/admin/feature-flags";
41
45
  };
46
+ readonly AdminGetOrgAiAppKey: {
47
+ readonly method: "get";
48
+ readonly path: "/admin/orgs/{orgId}/ai-app-key";
49
+ };
42
50
  readonly AdminGrantOrgCredit: {
43
51
  readonly method: "post";
44
52
  readonly path: "/admin/orgs/{orgId}/credits";
@@ -59,6 +67,10 @@ export declare const ROUTES: {
59
67
  readonly method: "get";
60
68
  readonly path: "/admin/reviews";
61
69
  };
70
+ readonly AdminRotateOrgAiAppKey: {
71
+ readonly method: "post";
72
+ readonly path: "/admin/orgs/{orgId}/ai-app-key/rotate";
73
+ };
62
74
  readonly AdminSessions: {
63
75
  readonly method: "get";
64
76
  readonly path: "/admin/sessions";
@@ -503,6 +515,14 @@ export declare const ROUTES: {
503
515
  readonly method: "post";
504
516
  readonly path: "/providers/{providerId}/versions/{version}/publish";
505
517
  };
518
+ readonly ReceiveAiVerificationCancel: {
519
+ readonly method: "post";
520
+ readonly path: "/verifications/ai-sessions/{sessionId}/cancel";
521
+ };
522
+ readonly ReceiveAiVerificationProofs: {
523
+ readonly method: "post";
524
+ readonly path: "/verifications/ai-sessions/{sessionId}/proofs";
525
+ };
506
526
  readonly RefreshBillingPlans: {
507
527
  readonly method: "post";
508
528
  readonly path: "/admin/billing/plans/refresh";
@@ -623,6 +643,10 @@ export declare const ROUTES: {
623
643
  readonly method: "get";
624
644
  readonly path: "/site/{domain}/panel";
625
645
  };
646
+ readonly StartAiVerificationSession: {
647
+ readonly method: "post";
648
+ readonly path: "/verifications/ai-sessions/{sessionId}/start";
649
+ };
626
650
  readonly StartSocialLogin: {
627
651
  readonly method: "get";
628
652
  readonly path: "/login/social/{provider}";
package/lib/routes.gen.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // AUTO-GENERATED by packages/app/scripts/mcp-tools-gen.ts
2
- // from packages/app/openapi.yaml (spec v0.1.0, source sha256:c3421d6bcf76).
2
+ // from packages/app/openapi.yaml (spec v0.1.0, source sha256:cbe3daf2a1f3).
3
3
  // The hash catches drift the version misses (a spec can change without a
4
4
  // version bump) — do not remove it as "redundant" with the version.
5
5
  // Run `npm run openapi:gen --workspace=packages/app` to regenerate. Do not edit by hand.
@@ -13,12 +13,15 @@ export const ROUTES = {
13
13
  "AdminBillingPlans": { "method": "get", "path": "/admin/billing/plans" },
14
14
  "AdminBillingTransactions": { "method": "get", "path": "/admin/billing/transactions" },
15
15
  "AdminCallbackDlq": { "method": "get", "path": "/admin/callback-dlq" },
16
+ "AdminDisableOrgAiAppKey": { "method": "post", "path": "/admin/orgs/{orgId}/ai-app-key/disable" },
16
17
  "AdminFeatureFlags": { "method": "get", "path": "/admin/feature-flags" },
18
+ "AdminGetOrgAiAppKey": { "method": "get", "path": "/admin/orgs/{orgId}/ai-app-key" },
17
19
  "AdminGrantOrgCredit": { "method": "post", "path": "/admin/orgs/{orgId}/credits" },
18
20
  "AdminHome": { "method": "get", "path": "/admin" },
19
21
  "AdminOrgs": { "method": "get", "path": "/admin/orgs" },
20
22
  "AdminProviders": { "method": "get", "path": "/admin/providers" },
21
23
  "AdminReviews": { "method": "get", "path": "/admin/reviews" },
24
+ "AdminRotateOrgAiAppKey": { "method": "post", "path": "/admin/orgs/{orgId}/ai-app-key/rotate" },
22
25
  "AdminSessions": { "method": "get", "path": "/admin/sessions" },
23
26
  "AdminSetProviderFixWithAi": { "method": "put", "path": "/admin/providers/{providerId}/fix-with-ai" },
24
27
  "AdminSetUserOrgLimit": { "method": "put", "path": "/users/{userId}/org-limit" },
@@ -130,6 +133,8 @@ export const ROUTES = {
130
133
  "ProviderPreviewImage": { "method": "get", "path": "/providers/{providerId}/preview.png" },
131
134
  "Providers": { "method": "get", "path": "/providers" },
132
135
  "PublishProviderVersion": { "method": "post", "path": "/providers/{providerId}/versions/{version}/publish" },
136
+ "ReceiveAiVerificationCancel": { "method": "post", "path": "/verifications/ai-sessions/{sessionId}/cancel" },
137
+ "ReceiveAiVerificationProofs": { "method": "post", "path": "/verifications/ai-sessions/{sessionId}/proofs" },
133
138
  "RefreshBillingPlans": { "method": "post", "path": "/admin/billing/plans/refresh" },
134
139
  "RefundTransaction": { "method": "post", "path": "/admin/billing/transactions/{txId}/refund" },
135
140
  "ReleaseCallbackListener": { "method": "post", "path": "/verifications/callback-listener/release" },
@@ -160,6 +165,7 @@ export const ROUTES = {
160
165
  "Sitemap": { "method": "get", "path": "/sitemap.xml" },
161
166
  "SitePage": { "method": "get", "path": "/site/{domain}" },
162
167
  "SitePanel": { "method": "get", "path": "/site/{domain}/panel" },
168
+ "StartAiVerificationSession": { "method": "post", "path": "/verifications/ai-sessions/{sessionId}/start" },
163
169
  "StartSocialLogin": { "method": "get", "path": "/login/social/{provider}" },
164
170
  "StripeWebhook": { "method": "post", "path": "/billing/stripe/webhook" },
165
171
  "SubmitConsent": { "method": "post", "path": "/oauth/consent" },