@reclaimprotocol/client 0.1.34 → 0.1.36
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 +57 -10
- package/lib/errors.d.ts +15 -0
- package/lib/errors.js +44 -0
- package/lib/jwks.js +2 -1
- package/lib/request-proof.d.ts +10 -0
- package/lib/request-proof.js +17 -10
- package/lib/result.d.ts +20 -1
- package/lib/result.js +32 -7
- package/lib/routes.gen.d.ts +16 -0
- package/lib/routes.gen.js +5 -1
- package/lib/types/openapi.gen.d.ts +318 -23
- package/lib/types/openapi.gen.js +1 -1
- package/lib/verify-attestor-tee.d.ts +19 -4
- package/lib/verify-attestor-tee.js +10 -4
- package/package.json +1 -1
- package/src/errors.ts +52 -0
- package/src/jwks.ts +5 -1
- package/src/request-proof.ts +31 -17
- package/src/result.ts +47 -7
- package/src/routes.gen.ts +5 -1
- package/src/types/openapi.gen.ts +319 -24
- package/src/verify-attestor-tee.ts +33 -5
package/src/types/openapi.gen.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// AUTO-GENERATED by packages/app/scripts/openapi-typegen.ts
|
|
2
|
-
// from packages/app/openapi.yaml (spec v0.1.0, source sha256:
|
|
2
|
+
// from packages/app/openapi.yaml (spec v0.1.0, source sha256:96339e8dff91).
|
|
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.
|
|
@@ -1353,6 +1353,26 @@ export interface paths {
|
|
|
1353
1353
|
patch?: never;
|
|
1354
1354
|
trace?: never;
|
|
1355
1355
|
};
|
|
1356
|
+
"/docs/agent-installation.md": {
|
|
1357
|
+
parameters: {
|
|
1358
|
+
query?: never;
|
|
1359
|
+
header?: never;
|
|
1360
|
+
path?: never;
|
|
1361
|
+
cookie?: never;
|
|
1362
|
+
};
|
|
1363
|
+
/**
|
|
1364
|
+
* Agent installation instructions
|
|
1365
|
+
* @description How to install the Reclaim MCP server in each supported coding agent, as Markdown for a coding agent to read: the exact commands or configuration per agent, how to verify the installation, and troubleshooting. It tells the agent to follow only the section for the client it runs in. Public.
|
|
1366
|
+
*/
|
|
1367
|
+
get: operations["AgentInstallationMarkdown"];
|
|
1368
|
+
put?: never;
|
|
1369
|
+
post?: never;
|
|
1370
|
+
delete?: never;
|
|
1371
|
+
options?: never;
|
|
1372
|
+
head?: never;
|
|
1373
|
+
patch?: never;
|
|
1374
|
+
trace?: never;
|
|
1375
|
+
};
|
|
1356
1376
|
"/login": {
|
|
1357
1377
|
parameters: {
|
|
1358
1378
|
query?: never;
|
|
@@ -2498,12 +2518,26 @@ export interface paths {
|
|
|
2498
2518
|
/**
|
|
2499
2519
|
* Register a callback subscription
|
|
2500
2520
|
* @description Registers a destination for verification results on the organization
|
|
2501
|
-
* the presented `OrgToken` resolves to.
|
|
2502
|
-
*
|
|
2503
|
-
*
|
|
2504
|
-
*
|
|
2505
|
-
* `
|
|
2506
|
-
*
|
|
2521
|
+
* the presented `OrgToken` resolves to. At least one subscription must
|
|
2522
|
+
* exist for the org before you can create a verification session.
|
|
2523
|
+
* Delivery is scoped by org: terminal results are ECIES-encrypted to the
|
|
2524
|
+
* org's eth public key when its `canEncryptResult` is enabled (see
|
|
2525
|
+
* `PUT /orgs/{orgId}/keypair`), else delivered as plaintext.
|
|
2526
|
+
*
|
|
2527
|
+
* To receive results at a URL, send `callbackUrl` and `events`. Builder
|
|
2528
|
+
* POSTs each delivery to that URL.
|
|
2529
|
+
*
|
|
2530
|
+
* To read results without a public URL during local development, send
|
|
2531
|
+
* `deliveryMode: "pull"`. Builder keeps the deliveries and you read them
|
|
2532
|
+
* with `GET /verifications/callback-events`. A pull subscription is a
|
|
2533
|
+
* 90-second lease: it receives events and satisfies the session-creation
|
|
2534
|
+
* check only while the lease is unexpired. Send the same request about
|
|
2535
|
+
* every 30 seconds to renew it, and call
|
|
2536
|
+
* `POST /verifications/callback-listener/release` when you stop. Production
|
|
2537
|
+
* needs a webhook subscription. An org has at most one pull subscription.
|
|
2538
|
+
* If it already exists, Builder renews it and returns it with status 200.
|
|
2539
|
+
* If the body includes `events`, they replace the subscription's events;
|
|
2540
|
+
* if it omits them, the existing events are kept.
|
|
2507
2541
|
*/
|
|
2508
2542
|
post: operations["CreateCallbackSubscription"];
|
|
2509
2543
|
delete?: never;
|
|
@@ -2512,6 +2546,86 @@ export interface paths {
|
|
|
2512
2546
|
patch?: never;
|
|
2513
2547
|
trace?: never;
|
|
2514
2548
|
};
|
|
2549
|
+
"/verifications/callback-listener/release": {
|
|
2550
|
+
parameters: {
|
|
2551
|
+
query?: never;
|
|
2552
|
+
header?: never;
|
|
2553
|
+
path?: never;
|
|
2554
|
+
cookie?: never;
|
|
2555
|
+
};
|
|
2556
|
+
get?: never;
|
|
2557
|
+
put?: never;
|
|
2558
|
+
/**
|
|
2559
|
+
* Release the pull listener
|
|
2560
|
+
* @description Expires the organization's pull subscription lease immediately, so it stops receiving events and no longer satisfies the session-creation check. Stored events stay readable. Call it when the coding agent stops. It succeeds when no pull subscription exists or the lease has already expired.
|
|
2561
|
+
*/
|
|
2562
|
+
post: operations["ReleaseCallbackListener"];
|
|
2563
|
+
delete?: never;
|
|
2564
|
+
options?: never;
|
|
2565
|
+
head?: never;
|
|
2566
|
+
patch?: never;
|
|
2567
|
+
trace?: never;
|
|
2568
|
+
};
|
|
2569
|
+
"/verifications/callback-events": {
|
|
2570
|
+
parameters: {
|
|
2571
|
+
query?: never;
|
|
2572
|
+
header?: never;
|
|
2573
|
+
path?: never;
|
|
2574
|
+
cookie?: never;
|
|
2575
|
+
};
|
|
2576
|
+
/**
|
|
2577
|
+
* List events from the pull subscription
|
|
2578
|
+
* @description Lists the deliveries of the organization's pull subscription, oldest
|
|
2579
|
+
* first. Use it to read verification results without a public URL.
|
|
2580
|
+
* Create the pull subscription with `POST /verifications/callback-subscriptions`
|
|
2581
|
+
* and `deliveryMode: "pull"`.
|
|
2582
|
+
*
|
|
2583
|
+
* Each item's `envelope` is the body that Builder POSTs to a webhook
|
|
2584
|
+
* subscription, so you handle both the same way. For a pull
|
|
2585
|
+
* subscription, `envelope.timestamp` is the time Builder created the
|
|
2586
|
+
* delivery.
|
|
2587
|
+
*
|
|
2588
|
+
* To poll, pass the previous response's `next` as `after`. `next` is
|
|
2589
|
+
* always set, and equals `after` when no new events exist. Treat cursors
|
|
2590
|
+
* as opaque. A cursor read is not complete: a delivery that commits after
|
|
2591
|
+
* a later one can be missed, because the cursor has already moved past
|
|
2592
|
+
* it. The reliable path is `pending=true` plus
|
|
2593
|
+
* `POST /verifications/callback-events/acknowledge`: acknowledge each
|
|
2594
|
+
* event you handled, and read `pending=true` without `after` so anything
|
|
2595
|
+
* missed shows up on the next read.
|
|
2596
|
+
*
|
|
2597
|
+
* Builder keeps result payloads for seven days. Acknowledged events stay
|
|
2598
|
+
* readable until then.
|
|
2599
|
+
*/
|
|
2600
|
+
get: operations["ListCallbackEvents"];
|
|
2601
|
+
put?: never;
|
|
2602
|
+
post?: never;
|
|
2603
|
+
delete?: never;
|
|
2604
|
+
options?: never;
|
|
2605
|
+
head?: never;
|
|
2606
|
+
patch?: never;
|
|
2607
|
+
trace?: never;
|
|
2608
|
+
};
|
|
2609
|
+
"/verifications/callback-events/acknowledge": {
|
|
2610
|
+
parameters: {
|
|
2611
|
+
query?: never;
|
|
2612
|
+
header?: never;
|
|
2613
|
+
path?: never;
|
|
2614
|
+
cookie?: never;
|
|
2615
|
+
};
|
|
2616
|
+
get?: never;
|
|
2617
|
+
put?: never;
|
|
2618
|
+
/**
|
|
2619
|
+
* Acknowledge events from the pull subscription
|
|
2620
|
+
* @description Marks pull deliveries as `delivered` so `GET /verifications/callback-events` with `pending=true` stops returning them. Builder keeps the payloads until the seven-day retention limit. Ids that are unknown, belong to another organization, or are already acknowledged are ignored.
|
|
2621
|
+
*/
|
|
2622
|
+
post: operations["AcknowledgeCallbackEvents"];
|
|
2623
|
+
delete?: never;
|
|
2624
|
+
options?: never;
|
|
2625
|
+
head?: never;
|
|
2626
|
+
patch?: never;
|
|
2627
|
+
trace?: never;
|
|
2628
|
+
};
|
|
2515
2629
|
"/verifications/callback-subscriptions/{subscriptionId}": {
|
|
2516
2630
|
parameters: {
|
|
2517
2631
|
query?: never;
|
|
@@ -2547,7 +2661,8 @@ export interface paths {
|
|
|
2547
2661
|
put?: never;
|
|
2548
2662
|
/**
|
|
2549
2663
|
* Register a callback subscription on an organization
|
|
2550
|
-
* @description Registers a destination for verification results on the organization. Caller must be an active member of the org.
|
|
2664
|
+
* @description Registers a destination for verification results on the organization. Caller must be an active member of the org. Delivery is scoped to the org and encrypted as an ECIES ciphertext (base64url) to the org's encryption credential when set, else delivered as plaintext.
|
|
2665
|
+
* Send `callbackUrl` and `events` to receive results at a URL. Send `deliveryMode: "pull"` to keep results for reading with `GET /verifications/callback-events`. A pull subscription works only while its 90-second lease is unexpired, and each repeated request renews it. An org has at most one pull subscription. If it already exists, Builder returns it with status 200.
|
|
2551
2666
|
*/
|
|
2552
2667
|
post: operations["CreateOrgCallbackSubscription"];
|
|
2553
2668
|
delete?: never;
|
|
@@ -2995,6 +3110,7 @@ export interface paths {
|
|
|
2995
3110
|
/**
|
|
2996
3111
|
* Submit exact proofs as a managed Builder result
|
|
2997
3112
|
* @description Accepts exact `Proof` objects from a claimant-facing `api=2` client. Builder atomically records the first terminal outcome, checks it against the submitted status, signs the outer Builder JWS with its managed key, optionally encrypts it for matching callback subscriptions, and enqueues delivery. Retrying the same terminal outcome is idempotent. This is the only result-submission endpoint; Verification Clients never receive signing or encryption keys.
|
|
3113
|
+
* Before it accepts a `success` result, Builder verifies every proof with the same trust a default `@reclaimprotocol/client` consumer uses: Builder's attestor addresses and image digests, the session recipe's provider hashes, and the session binding. If a proof fails, Builder records the session as a terminal `error` with a `problem` whose `reasonCode` is `invalid-proof`, enqueues the `verification_error` delivery, and returns `422`. Don't retry a `422`; the session is already terminal.
|
|
2998
3114
|
*/
|
|
2999
3115
|
post: operations["SubmitVerificationClientResult"];
|
|
3000
3116
|
delete?: never;
|
|
@@ -5804,24 +5920,59 @@ export interface components {
|
|
|
5804
5920
|
* @description The organization that owns this callback subscription.
|
|
5805
5921
|
*/
|
|
5806
5922
|
orgId: string;
|
|
5807
|
-
|
|
5808
|
-
|
|
5923
|
+
deliveryMode: components["schemas"]["CallbackDeliveryMode"];
|
|
5924
|
+
/** @description HTTP(S) endpoint that receives the event. It may contain `{{sessionId}}` and top-level session-context placeholders such as `{{orderId}}`. The Builder URI-encodes each value and stores the expanded URL when it creates the delivery. Absent when `deliveryMode` is `pull`. */
|
|
5925
|
+
callbackUrl?: string;
|
|
5926
|
+
/** @description Present when `deliveryMode` is `pull`. The pull subscription receives events and satisfies the session-creation check only until this time. Renew it by repeating the create request. */
|
|
5927
|
+
listenerExpiresAt?: components["schemas"]["Timestamp"];
|
|
5809
5928
|
/** @description Events this subscription wants delivered — any subset of `VerificationEvent`. Builder terminal events are `verification_success`, `verification_rejected`, `verification_error`, `verification_cancelled`, and `session_expired`. Terminal result deliveries contain the signed result when one is available; non-terminal events deliver a plaintext notification. */
|
|
5810
5929
|
events: components["schemas"]["VerificationEvent"][];
|
|
5811
5930
|
createdAt: components["schemas"]["Timestamp"];
|
|
5812
5931
|
updatedAt: components["schemas"]["Timestamp"];
|
|
5813
5932
|
};
|
|
5814
|
-
/**
|
|
5815
|
-
|
|
5933
|
+
/**
|
|
5934
|
+
* @description How Builder delivers events. `webhook` POSTs each one to `callbackUrl`. `pull` keeps them for you to read with `GET /verifications/callback-events`.
|
|
5935
|
+
* @enum {string}
|
|
5936
|
+
*/
|
|
5937
|
+
CallbackDeliveryMode: "webhook" | "pull";
|
|
5938
|
+
/** @description A subscription that Builder POSTs each delivery to. */
|
|
5939
|
+
WebhookCallbackSubscriptionRequest: {
|
|
5940
|
+
/**
|
|
5941
|
+
* @description Omit it or send `webhook`.
|
|
5942
|
+
* @enum {string}
|
|
5943
|
+
*/
|
|
5944
|
+
deliveryMode?: "webhook";
|
|
5816
5945
|
/** @description Callback URL or template. Supported placeholders are `{{sessionId}}` and top-level scalar context keys. */
|
|
5817
5946
|
callbackUrl: string;
|
|
5818
5947
|
events: components["schemas"]["VerificationEvent"][];
|
|
5819
5948
|
};
|
|
5820
|
-
/** @description
|
|
5821
|
-
|
|
5822
|
-
/** @
|
|
5823
|
-
|
|
5824
|
-
|
|
5949
|
+
/** @description A subscription whose deliveries wait for you to read them. It has no URL. An org has at most one. */
|
|
5950
|
+
PullCallbackSubscriptionRequest: {
|
|
5951
|
+
/** @enum {string} */
|
|
5952
|
+
deliveryMode: "pull";
|
|
5953
|
+
/** @description Not allowed. A pull subscription has no URL. */
|
|
5954
|
+
callbackUrl?: unknown;
|
|
5955
|
+
/** @description Events to keep. Defaults to every event. */
|
|
5956
|
+
events?: components["schemas"]["VerificationEvent"][];
|
|
5957
|
+
};
|
|
5958
|
+
/** @description Body for `POST /verifications/callback-subscriptions`. The owning organization is resolved from the presented `OrgToken`; delivery is scoped to that org and encrypted to its credential when set. Send `callbackUrl` for a webhook, or `deliveryMode: "pull"` for a subscription you read. */
|
|
5959
|
+
CreateCallbackSubscriptionRequest: components["schemas"]["WebhookCallbackSubscriptionRequest"] | components["schemas"]["PullCallbackSubscriptionRequest"];
|
|
5960
|
+
/** @description Body for `POST /orgs/{orgId}/callback-subscriptions`. The owning organization comes from the path; bearer-authenticated and gated on org membership. Delivery is scoped to the org and encrypted to its credential when set. Send `callbackUrl` for a webhook, or `deliveryMode: "pull"` for a subscription you read. */
|
|
5961
|
+
CreateOrgCallbackSubscriptionRequest: components["schemas"]["WebhookCallbackSubscriptionRequest"] | components["schemas"]["PullCallbackSubscriptionRequest"];
|
|
5962
|
+
/** @description One delivery waiting on the organization's pull subscription. */
|
|
5963
|
+
CallbackEvent: {
|
|
5964
|
+
/**
|
|
5965
|
+
* Format: uuid
|
|
5966
|
+
* @description Pass it to `POST /verifications/callback-events/acknowledge`.
|
|
5967
|
+
*/
|
|
5968
|
+
id: string;
|
|
5969
|
+
subscriptionId: components["schemas"]["SubscriptionID"];
|
|
5970
|
+
sessionId: components["schemas"]["SessionID"];
|
|
5971
|
+
event: components["schemas"]["VerificationEvent"];
|
|
5972
|
+
/** @description `pending` until you acknowledge the event, then `delivered`. */
|
|
5973
|
+
deliveryStatus: components["schemas"]["CallbackDeliveryStatus"];
|
|
5974
|
+
createdAt: components["schemas"]["Timestamp"];
|
|
5975
|
+
envelope: components["schemas"]["VerificationResultDelivery"];
|
|
5825
5976
|
};
|
|
5826
5977
|
/** @description Present only when the session's `mode` is `SANDBOX`. */
|
|
5827
5978
|
SandboxLimits: {
|
|
@@ -6222,7 +6373,7 @@ export interface components {
|
|
|
6222
6373
|
signature: string;
|
|
6223
6374
|
}[];
|
|
6224
6375
|
};
|
|
6225
|
-
/** @description The JSON envelope POSTed to a callback subscription's `callbackUrl` (see the `verificationResult` webhook). `sessionId`, `event` and `timestamp` are unauthenticated plaintext routing hints; branch on `event` for the shape of `data`. **Terminal result events** carry the signed result — an ECIES ciphertext (base64url, secp256k1 + AES-256-GCM) wrapping the signed JWS when the org has an encryption credential, else the plaintext signed JWS — act only on the signature-verified contents. **Non-terminal events** carry a plaintext, **unsigned** progress notification — advisory only; the signed terminal result is the source of truth. */
|
|
6376
|
+
/** @description The JSON envelope POSTed to a callback subscription's `callbackUrl` (see the `verificationResult` webhook), and returned as `envelope` by `GET /verifications/callback-events` for a pull subscription. `sessionId`, `event` and `timestamp` are unauthenticated plaintext routing hints; branch on `event` for the shape of `data`. **Terminal result events** carry the signed result — an ECIES ciphertext (base64url, secp256k1 + AES-256-GCM) wrapping the signed JWS when the org has an encryption credential, else the plaintext signed JWS — act only on the signature-verified contents. **Non-terminal events** carry a plaintext, **unsigned** progress notification — advisory only; the signed terminal result is the source of truth. */
|
|
6226
6377
|
VerificationResultDelivery: {
|
|
6227
6378
|
sessionId: components["schemas"]["SessionID"];
|
|
6228
6379
|
/** @description The event that produced this delivery. */
|
|
@@ -6236,7 +6387,18 @@ export interface components {
|
|
|
6236
6387
|
/** @enum {string} */
|
|
6237
6388
|
status: "success" | "rejected" | "error" | "cancelled";
|
|
6238
6389
|
results: components["schemas"]["VerificationClientProviderResult"][];
|
|
6239
|
-
problem?:
|
|
6390
|
+
problem?: ({
|
|
6391
|
+
/** @description Stable machine-readable failure code. Builder records `invalid-proof` when a submitted proof fails its verification. */
|
|
6392
|
+
reasonCode?: string;
|
|
6393
|
+
retryable?: boolean;
|
|
6394
|
+
/** @description Builder-recorded proof failures, one per provider. Present with `reasonCode: invalid-proof`. */
|
|
6395
|
+
proofs?: {
|
|
6396
|
+
providerId?: string;
|
|
6397
|
+
resolvedVersion?: string;
|
|
6398
|
+
requestIds?: string[];
|
|
6399
|
+
reason?: string;
|
|
6400
|
+
}[];
|
|
6401
|
+
} & components["schemas"]["Problem"]) | null;
|
|
6240
6402
|
};
|
|
6241
6403
|
VerificationClientProviderResult: {
|
|
6242
6404
|
providerId: components["schemas"]["ProviderID"];
|
|
@@ -6370,8 +6532,11 @@ export interface components {
|
|
|
6370
6532
|
VerificationDelivery: {
|
|
6371
6533
|
subscriptionId: components["schemas"]["SubscriptionID"];
|
|
6372
6534
|
event: components["schemas"]["VerificationEvent"];
|
|
6373
|
-
/**
|
|
6374
|
-
|
|
6535
|
+
/**
|
|
6536
|
+
* Format: uri
|
|
6537
|
+
* @description Absent for deliveries to a pull subscription.
|
|
6538
|
+
*/
|
|
6539
|
+
callbackUrl?: string;
|
|
6375
6540
|
deliveryStatus: components["schemas"]["CallbackDeliveryStatus"];
|
|
6376
6541
|
attempts: number;
|
|
6377
6542
|
lastAttemptAt?: components["schemas"]["Timestamp"];
|
|
@@ -8521,6 +8686,27 @@ export interface operations {
|
|
|
8521
8686
|
default: components["responses"]["ProblemResponse"];
|
|
8522
8687
|
};
|
|
8523
8688
|
};
|
|
8689
|
+
AgentInstallationMarkdown: {
|
|
8690
|
+
parameters: {
|
|
8691
|
+
query?: never;
|
|
8692
|
+
header?: never;
|
|
8693
|
+
path?: never;
|
|
8694
|
+
cookie?: never;
|
|
8695
|
+
};
|
|
8696
|
+
requestBody?: never;
|
|
8697
|
+
responses: {
|
|
8698
|
+
/** @description The guide as Markdown. */
|
|
8699
|
+
200: {
|
|
8700
|
+
headers: {
|
|
8701
|
+
[name: string]: unknown;
|
|
8702
|
+
};
|
|
8703
|
+
content: {
|
|
8704
|
+
"text/markdown": string;
|
|
8705
|
+
};
|
|
8706
|
+
};
|
|
8707
|
+
default: components["responses"]["ProblemResponse"];
|
|
8708
|
+
};
|
|
8709
|
+
};
|
|
8524
8710
|
LoginPage: {
|
|
8525
8711
|
parameters: {
|
|
8526
8712
|
query?: {
|
|
@@ -8866,9 +9052,12 @@ export interface operations {
|
|
|
8866
9052
|
tab?: "overview" | "connect" | "integrate" | "providers" | "members" | "themes" | "settings" | "sessions" | "billing";
|
|
8867
9053
|
/** @description Integrate tab only. Which integration path to show: a coding agent over MCP, the client package, or plain HTTP. */
|
|
8868
9054
|
track?: "agent" | "sdk" | "http";
|
|
8869
|
-
/**
|
|
9055
|
+
/**
|
|
9056
|
+
* @deprecated
|
|
9057
|
+
* @description Ignored.
|
|
9058
|
+
*/
|
|
8870
9059
|
agent?: "claude" | "copilot" | "cursor" | "omp" | "opencode" | "codex" | "antigravity" | "others";
|
|
8871
|
-
/** @description Integrate tab, agent track only. What users prove, as typed into the prompt's goal field
|
|
9060
|
+
/** @description Integrate tab, agent track only. What users prove, as typed into the prompt's goal field. */
|
|
8872
9061
|
goal?: string;
|
|
8873
9062
|
/** @description Integrate tab: the providers to show in the examples in place of placeholder ids, for example when arriving from a provider page or a build page. Repeat to pass several. Dashboard tab: scopes the report to sessions that ran this provider (the first one); options come from `GET /orgs/{orgId}/providers/used`. */
|
|
8874
9063
|
providerId?: components["schemas"]["ProviderID"][];
|
|
@@ -10683,6 +10872,15 @@ export interface operations {
|
|
|
10683
10872
|
};
|
|
10684
10873
|
};
|
|
10685
10874
|
responses: {
|
|
10875
|
+
/** @description The org's existing pull subscription */
|
|
10876
|
+
200: {
|
|
10877
|
+
headers: {
|
|
10878
|
+
[name: string]: unknown;
|
|
10879
|
+
};
|
|
10880
|
+
content: {
|
|
10881
|
+
"application/json": components["schemas"]["CallbackSubscription"];
|
|
10882
|
+
};
|
|
10883
|
+
};
|
|
10686
10884
|
/** @description Subscription created */
|
|
10687
10885
|
201: {
|
|
10688
10886
|
headers: {
|
|
@@ -10695,6 +10893,85 @@ export interface operations {
|
|
|
10695
10893
|
default: components["responses"]["ProblemResponse"];
|
|
10696
10894
|
};
|
|
10697
10895
|
};
|
|
10896
|
+
ReleaseCallbackListener: {
|
|
10897
|
+
parameters: {
|
|
10898
|
+
query?: never;
|
|
10899
|
+
header?: never;
|
|
10900
|
+
path?: never;
|
|
10901
|
+
cookie?: never;
|
|
10902
|
+
};
|
|
10903
|
+
requestBody?: never;
|
|
10904
|
+
responses: {
|
|
10905
|
+
/** @description Released */
|
|
10906
|
+
204: {
|
|
10907
|
+
headers: {
|
|
10908
|
+
[name: string]: unknown;
|
|
10909
|
+
};
|
|
10910
|
+
content?: never;
|
|
10911
|
+
};
|
|
10912
|
+
default: components["responses"]["ProblemResponse"];
|
|
10913
|
+
};
|
|
10914
|
+
};
|
|
10915
|
+
ListCallbackEvents: {
|
|
10916
|
+
parameters: {
|
|
10917
|
+
query?: {
|
|
10918
|
+
/** @description Cursor from the `next` field of a previous response. Returns only events after it. Omit it to start from the oldest event. */
|
|
10919
|
+
after?: string;
|
|
10920
|
+
/** @description Maximum number of events to return. Defaults to 50. */
|
|
10921
|
+
limit?: number;
|
|
10922
|
+
/** @description Returns only events of this verification session. */
|
|
10923
|
+
sessionId?: components["schemas"]["SessionID"];
|
|
10924
|
+
/** @description When `true`, returns only events you have not acknowledged. Defaults to `false`. */
|
|
10925
|
+
pending?: boolean;
|
|
10926
|
+
};
|
|
10927
|
+
header?: never;
|
|
10928
|
+
path?: never;
|
|
10929
|
+
cookie?: never;
|
|
10930
|
+
};
|
|
10931
|
+
requestBody?: never;
|
|
10932
|
+
responses: {
|
|
10933
|
+
/** @description Ok */
|
|
10934
|
+
200: {
|
|
10935
|
+
headers: {
|
|
10936
|
+
[name: string]: unknown;
|
|
10937
|
+
};
|
|
10938
|
+
content: {
|
|
10939
|
+
"application/json": {
|
|
10940
|
+
items: components["schemas"]["CallbackEvent"][];
|
|
10941
|
+
/** @description Cursor to pass as `after` on the next request. Equals `after` when `items` is empty, and `0` when you passed no `after`. */
|
|
10942
|
+
next: string;
|
|
10943
|
+
};
|
|
10944
|
+
};
|
|
10945
|
+
};
|
|
10946
|
+
default: components["responses"]["ProblemResponse"];
|
|
10947
|
+
};
|
|
10948
|
+
};
|
|
10949
|
+
AcknowledgeCallbackEvents: {
|
|
10950
|
+
parameters: {
|
|
10951
|
+
query?: never;
|
|
10952
|
+
header?: never;
|
|
10953
|
+
path?: never;
|
|
10954
|
+
cookie?: never;
|
|
10955
|
+
};
|
|
10956
|
+
requestBody: {
|
|
10957
|
+
content: {
|
|
10958
|
+
"application/json": {
|
|
10959
|
+
/** @description The `id` of each `CallbackEvent` to acknowledge. */
|
|
10960
|
+
ids: string[];
|
|
10961
|
+
};
|
|
10962
|
+
};
|
|
10963
|
+
};
|
|
10964
|
+
responses: {
|
|
10965
|
+
/** @description Acknowledged */
|
|
10966
|
+
204: {
|
|
10967
|
+
headers: {
|
|
10968
|
+
[name: string]: unknown;
|
|
10969
|
+
};
|
|
10970
|
+
content?: never;
|
|
10971
|
+
};
|
|
10972
|
+
default: components["responses"]["ProblemResponse"];
|
|
10973
|
+
};
|
|
10974
|
+
};
|
|
10698
10975
|
DeleteCallbackSubscription: {
|
|
10699
10976
|
parameters: {
|
|
10700
10977
|
query?: never;
|
|
@@ -10759,6 +11036,15 @@ export interface operations {
|
|
|
10759
11036
|
};
|
|
10760
11037
|
};
|
|
10761
11038
|
responses: {
|
|
11039
|
+
/** @description The org's existing pull subscription */
|
|
11040
|
+
200: {
|
|
11041
|
+
headers: {
|
|
11042
|
+
[name: string]: unknown;
|
|
11043
|
+
};
|
|
11044
|
+
content: {
|
|
11045
|
+
"application/json": components["schemas"]["CallbackSubscription"];
|
|
11046
|
+
};
|
|
11047
|
+
};
|
|
10762
11048
|
/** @description Subscription created */
|
|
10763
11049
|
201: {
|
|
10764
11050
|
headers: {
|
|
@@ -11033,7 +11319,7 @@ export interface operations {
|
|
|
11033
11319
|
"application/problem+json": components["schemas"]["Problem"];
|
|
11034
11320
|
};
|
|
11035
11321
|
};
|
|
11036
|
-
/** @description No callback subscription exists for the organization. Register one first via `POST /verifications/callback-subscriptions` (or `POST /orgs/{orgId}/callback-subscriptions`). */
|
|
11322
|
+
/** @description No callback subscription exists for the organization. Register one first via `POST /verifications/callback-subscriptions` (or `POST /orgs/{orgId}/callback-subscriptions`). A pull subscription satisfies this check only while its listener lease is unexpired. */
|
|
11037
11323
|
409: {
|
|
11038
11324
|
headers: {
|
|
11039
11325
|
[name: string]: unknown;
|
|
@@ -11295,6 +11581,15 @@ export interface operations {
|
|
|
11295
11581
|
};
|
|
11296
11582
|
400: components["responses"]["ProblemResponse"];
|
|
11297
11583
|
409: components["responses"]["ProblemResponse"];
|
|
11584
|
+
/** @description A submitted proof failed Builder verification. Builder recorded the session as a terminal `error` and enqueued `verification_error`. */
|
|
11585
|
+
422: {
|
|
11586
|
+
headers: {
|
|
11587
|
+
[name: string]: unknown;
|
|
11588
|
+
};
|
|
11589
|
+
content: {
|
|
11590
|
+
"application/problem+json": components["schemas"]["Problem"];
|
|
11591
|
+
};
|
|
11592
|
+
};
|
|
11298
11593
|
default: components["responses"]["ProblemResponse"];
|
|
11299
11594
|
};
|
|
11300
11595
|
};
|
|
@@ -239,6 +239,19 @@ export type AttestorTeeAttestationConfig = {
|
|
|
239
239
|
expectedImageDigests?: string[]
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
+
/** How strictly `runAttestorTeeVerification` treats witnesses without a
|
|
243
|
+
* `claimAttestation`. */
|
|
244
|
+
export interface AttestorTeeVerificationOptions {
|
|
245
|
+
/**
|
|
246
|
+
* Default `true`: every witness must carry a `claimAttestation`. `false`
|
|
247
|
+
* counts a witness without one as unattested, which is how
|
|
248
|
+
* `@reclaimprotocol/js-sdk` verifies by default — its claim signature is
|
|
249
|
+
* still checked against the trusted attestors by the caller. Portal TEE
|
|
250
|
+
* proofs without a bound nonce have no envelope.
|
|
251
|
+
*/
|
|
252
|
+
requireClaimAttestation?: boolean
|
|
253
|
+
}
|
|
254
|
+
|
|
242
255
|
/** A witness's attestation kind. Required: every client sets it explicitly. */
|
|
243
256
|
export function claimAttestationType(
|
|
244
257
|
att: AttestorClaimAttestation,
|
|
@@ -251,8 +264,9 @@ export interface AttestorTeeVerificationSummary {
|
|
|
251
264
|
/** Witnesses whose `attestation_report` was verified (and pinned, when
|
|
252
265
|
* `expectedImageDigests` was set). */
|
|
253
266
|
verified: number
|
|
254
|
-
/** Witnesses that carried no `attestation_report
|
|
255
|
-
*
|
|
267
|
+
/** Witnesses that carried no `attestation_report`, or no
|
|
268
|
+
* `claimAttestation` when it isn't required. Their attestor address and
|
|
269
|
+
* claim signature were still verified. */
|
|
256
270
|
unattested: number
|
|
257
271
|
}
|
|
258
272
|
|
|
@@ -267,6 +281,7 @@ function normalizeSignature(sig: string): string {
|
|
|
267
281
|
async function verifyAttestorTeeForProof(
|
|
268
282
|
proof: Proof,
|
|
269
283
|
config: AttestorTeeAttestationConfig,
|
|
284
|
+
requireClaimAttestation: boolean,
|
|
270
285
|
summary: AttestorTeeVerificationSummary,
|
|
271
286
|
): Promise<void> {
|
|
272
287
|
if(!proof.witnesses || proof.witnesses.length === 0) {
|
|
@@ -282,6 +297,11 @@ async function verifyAttestorTeeForProof(
|
|
|
282
297
|
|
|
283
298
|
for(const witness of proof.witnesses) {
|
|
284
299
|
const att: AttestorClaimAttestation | undefined = witness.claimAttestation
|
|
300
|
+
if(!att && !requireClaimAttestation) {
|
|
301
|
+
summary.unattested++
|
|
302
|
+
continue
|
|
303
|
+
}
|
|
304
|
+
|
|
285
305
|
if(!att) {
|
|
286
306
|
throw new AttestorTeeVerificationError(
|
|
287
307
|
`Witness ${witness.id} is missing claimAttestation`
|
|
@@ -368,7 +388,8 @@ async function verifyAttestorTeeForProof(
|
|
|
368
388
|
* provided proof. Throws `AttestorTeeVerificationError` on the first
|
|
369
389
|
* failure.
|
|
370
390
|
*
|
|
371
|
-
* Each witness must carry a `claimAttestation
|
|
391
|
+
* Each witness must carry a `claimAttestation` unless
|
|
392
|
+
* `options.requireClaimAttestation` is `false`. For each one, this:
|
|
372
393
|
* 1. Asserts `attestor_address` matches `witness.id`.
|
|
373
394
|
* 2. Asserts `claim_signature` is present in `proof.signatures`.
|
|
374
395
|
* 3. Recovers the signer of `claim_signature` from the claim data and
|
|
@@ -390,10 +411,12 @@ async function verifyAttestorTeeForProof(
|
|
|
390
411
|
*
|
|
391
412
|
* @param proofs - The proofs to verify.
|
|
392
413
|
* @param config - Optional config; see {@link AttestorTeeAttestationConfig}.
|
|
414
|
+
* @param options - See {@link AttestorTeeVerificationOptions}.
|
|
393
415
|
*/
|
|
394
416
|
export async function runAttestorTeeVerification(
|
|
395
417
|
proofs: Proof[],
|
|
396
|
-
config: AttestorTeeAttestationConfig = {}
|
|
418
|
+
config: AttestorTeeAttestationConfig = {},
|
|
419
|
+
{ requireClaimAttestation = true }: AttestorTeeVerificationOptions = {},
|
|
397
420
|
): Promise<AttestorTeeVerificationSummary> {
|
|
398
421
|
if(!proofs || proofs.length === 0) {
|
|
399
422
|
throw new AttestorTeeVerificationError('No proofs provided for attestor TEE verification')
|
|
@@ -406,7 +429,12 @@ export async function runAttestorTeeVerification(
|
|
|
406
429
|
|
|
407
430
|
try {
|
|
408
431
|
for(const proof of proofs) {
|
|
409
|
-
await verifyAttestorTeeForProof(
|
|
432
|
+
await verifyAttestorTeeForProof(
|
|
433
|
+
proof,
|
|
434
|
+
config,
|
|
435
|
+
requireClaimAttestation,
|
|
436
|
+
summary,
|
|
437
|
+
)
|
|
410
438
|
}
|
|
411
439
|
|
|
412
440
|
return summary
|