@reclaimprotocol/client 0.1.23 → 0.1.24

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
@@ -1,6 +1,6 @@
1
1
  # @reclaimprotocol/client
2
2
 
3
- Typed SDK/HTTP client SDK for the Reclaim Protocol — the programmatic way to use Reclaim Protocol to verify **data points** about your users (a follower count, an account balance, an order). Can be directly integrated by apps to request verification for their users using Reclaim Protocol and verify the results.
3
+ The typed HTTP client and SDK for Reclaim Protocol — the programmatic way to verify **data points** about your users, such as a follower count, an account balance, or an order. Integrate it directly into your app to request a verification and to verify the result you get back.
4
4
 
5
5
  One package gives you:
6
6
 
@@ -96,7 +96,7 @@ curl -X POST "$BUILDER_URL/verifications/sessions" \
96
96
  # → 201 { "id": "…", "verificationUrl": "…", "status": "pending", "mode": "…", … }
97
97
  ```
98
98
 
99
- ### 4. Receive & verify the result
99
+ ### 4. Receive and verify the result
100
100
 
101
101
  When the end-user finishes, the Builder POSTs to your `callbackUrl`. Pass the request body to `results.receive`. It decrypts (if encrypted) and verifies the signature + nested proofs, and **throws if the result is invalid** — so reaching the `result` branch means it's verified.
102
102
 
@@ -129,7 +129,7 @@ Whichever you use, at runtime your backend needs only the org secret (to authent
129
129
 
130
130
  ### `createReclaim(config)`
131
131
 
132
- Returns a `Reclaim` with four namespaces (`sessions`, `callbacks`, `keypair`, `results`) plus an `api` escape hatch.
132
+ Returns a `Reclaim` with four namespaces — `sessions`, `callbacks`, `keypair`, and `results` — plus an `api` escape hatch.
133
133
 
134
134
  | `ReclaimConfig` field | type | required | notes |
135
135
  |---|---|---|---|
@@ -198,7 +198,7 @@ try {
198
198
  // result.payload is verified
199
199
  } catch (err) {
200
200
  if (err instanceof ResultVerificationError) {
201
- console.error(err.reason, err.outcome) // e.g. 'expired' / 'bad-signature' / 'invalid-proof'
201
+ console.error(err.reason, err.outcome) // 'expired', 'bad-signature', 'invalid-proof', …
202
202
  } else {
203
203
  throw err
204
204
  }
@@ -214,7 +214,7 @@ A non-terminal `event` delivery is not a result and never throws — it returns
214
214
  const { data } = await reclaim.api('GetVerificationSession', { params: { sessionId } })
215
215
  ```
216
216
 
217
- ## Crypto & key helpers
217
+ ## Crypto and key helpers
218
218
 
219
219
  ```ts
220
220
  // Eth encryption keys (consumer side)
package/lib/client.d.ts CHANGED
@@ -11,7 +11,7 @@ export type ReclaimClientOptions = {
11
11
  };
12
12
  /**
13
13
  * Core HTTP client. Shared by the SDK entrypoint, MCP server, and CLI —
14
- * extend behaviour here rather than duplicating it across surfaces.
14
+ * extend behavior here rather than duplicating it across surfaces.
15
15
  *
16
16
  * Per @reclaimprotocol/app conventions, validation lives in the openapi
17
17
  * spec; this client forwards requests and maps RFC 9457 problem responses
package/lib/client.js CHANGED
@@ -21,7 +21,7 @@ import { throwProblemError } from "./errors.js";
21
21
  import { ROUTES } from "./routes.gen.js";
22
22
  /**
23
23
  * Core HTTP client. Shared by the SDK entrypoint, MCP server, and CLI —
24
- * extend behaviour here rather than duplicating it across surfaces.
24
+ * extend behavior here rather than duplicating it across surfaces.
25
25
  *
26
26
  * Per @reclaimprotocol/app conventions, validation lives in the openapi
27
27
  * spec; this client forwards requests and maps RFC 9457 problem responses
@@ -81,7 +81,7 @@ export class ReclaimClient {
81
81
  if (__classPrivateFieldGet(this, _ReclaimClient_token, "f")) {
82
82
  headers['Authorization'] = `Bearer ${__classPrivateFieldGet(this, _ReclaimClient_token, "f")}`;
83
83
  }
84
- // Per-request header parameters (e.g. `If-Match` for optimistic
84
+ // Per-request header parameters (for example, `If-Match` for optimistic
85
85
  // concurrency). Applied last so spec-declared headers win over the
86
86
  // client-wide defaults, but never override Authorization.
87
87
  if (args.headers) {
@@ -97,9 +97,9 @@ export class ReclaimClient {
97
97
  headers,
98
98
  };
99
99
  // Write methods always carry a JSON body (defaulting to `{}`) plus a
100
- // Content-Type. Some endpoints — e.g. the auth-only attach session —
101
- // take an empty body, and omitting Content-Type makes the server
102
- // reject the request with `415 unsupported media type`.
100
+ // Content-Type. Some endpoints — for example, the auth-only attach session
101
+ // — take an empty body, and omitting Content-Type makes the server reject
102
+ // the request with `415 unsupported media type`.
103
103
  const method = op.method.toLowerCase();
104
104
  if (method !== 'get' && method !== 'head') {
105
105
  init.body = JSON.stringify(args.body ?? {});
package/lib/eip191.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * EIP-191 / `personal_sign` primitives shared by the verification paths
3
3
  * (attestor-proof recovery) and by callers that need to *produce* a
4
- * personal_sign signature with a raw eth key (e.g. the old-devtools
4
+ * personal_sign signature with a raw eth key (for example, the old-devtools
5
5
  * link-app flow) — without pulling in a full wallet library.
6
6
  */
7
7
  import { keccak_256 } from '@noble/hashes/sha3.js';
package/lib/result.d.ts CHANGED
@@ -31,9 +31,10 @@ export interface VerifyResultOutcome {
31
31
  * (which only relays the ciphertext). Consumers never call this — they only
32
32
  * {@link decryptCallback}.
33
33
  *
34
- * `plaintext` is bytes (e.g. `new TextEncoder().encode(JSON.stringify(jws))`);
35
- * returns the ciphertext as a base64url string (single token, never starts with
36
- * `{`, so {@link decryptCallback} can tell it apart from a plaintext JWS JSON).
34
+ * `plaintext` is bytes (for example, `new
35
+ * TextEncoder().encode(JSON.stringify(jws))`); returns the ciphertext as a
36
+ * base64url string (single token, never starts with `{`, so {@link
37
+ * decryptCallback} can tell it apart from a plaintext JWS JSON).
37
38
  */
38
39
  export declare function encryptForEthPublicKey(publicJwk: Jwk, plaintext: Uint8Array): Promise<string>;
39
40
  /**
@@ -110,7 +111,7 @@ export interface VerifyResultFullOutcome extends VerifyResultOutcome {
110
111
  * // result is verified — use result.payload
111
112
  * } catch (err) {
112
113
  * if (err instanceof ResultVerificationError) {
113
- * // e.g. 'expired', { payload, … }
114
+ * // for example, 'expired', { payload, … }
114
115
  * console.error(err.reason, err.outcome)
115
116
  * }
116
117
  * }
package/lib/result.js CHANGED
@@ -25,9 +25,10 @@ import { addressFromUncompressedPubkey, secp } from "./secp.js";
25
25
  * (which only relays the ciphertext). Consumers never call this — they only
26
26
  * {@link decryptCallback}.
27
27
  *
28
- * `plaintext` is bytes (e.g. `new TextEncoder().encode(JSON.stringify(jws))`);
29
- * returns the ciphertext as a base64url string (single token, never starts with
30
- * `{`, so {@link decryptCallback} can tell it apart from a plaintext JWS JSON).
28
+ * `plaintext` is bytes (for example, `new
29
+ * TextEncoder().encode(JSON.stringify(jws))`); returns the ciphertext as a
30
+ * base64url string (single token, never starts with `{`, so {@link
31
+ * decryptCallback} can tell it apart from a plaintext JWS JSON).
31
32
  */
32
33
  export async function encryptForEthPublicKey(publicJwk, plaintext) {
33
34
  // Uncompressed `0x04`‖X‖Y bytes — what eciesjs accepts as the recipient key.
@@ -150,7 +151,7 @@ function contentHash(params) {
150
151
  * // result is verified — use result.payload
151
152
  * } catch (err) {
152
153
  * if (err instanceof ResultVerificationError) {
153
- * // e.g. 'expired', { payload, … }
154
+ * // for example, 'expired', { payload, … }
154
155
  * console.error(err.reason, err.outcome)
155
156
  * }
156
157
  * }
@@ -3,6 +3,10 @@ export declare const ROUTES: {
3
3
  readonly method: "post";
4
4
  readonly path: "/orgs/{orgId}/invite";
5
5
  };
6
+ readonly ActivateFixWithAiRepair: {
7
+ readonly method: "post";
8
+ readonly path: "/v/{sessionId}/fix-with-ai/activate";
9
+ };
6
10
  readonly AddOrgMember: {
7
11
  readonly method: "post";
8
12
  readonly path: "/orgs/{orgId}/members";
@@ -51,6 +55,10 @@ export declare const ROUTES: {
51
55
  readonly method: "get";
52
56
  readonly path: "/admin/sessions";
53
57
  };
58
+ readonly AdminSetProviderFixWithAi: {
59
+ readonly method: "put";
60
+ readonly path: "/admin/providers/{providerId}/fix-with-ai";
61
+ };
54
62
  readonly AdminSetUserOrgLimit: {
55
63
  readonly method: "put";
56
64
  readonly path: "/users/{userId}/org-limit";
@@ -115,6 +123,10 @@ export declare const ROUTES: {
115
123
  readonly method: "post";
116
124
  readonly path: "/orgs/{orgId}/billing/credits/checkout";
117
125
  };
126
+ readonly CreateFixWithAiSession: {
127
+ readonly method: "post";
128
+ readonly path: "/v/{sessionId}/fix-with-ai";
129
+ };
118
130
  readonly CreateManualTransaction: {
119
131
  readonly method: "post";
120
132
  readonly path: "/admin/billing/transactions";
@@ -219,6 +231,10 @@ export declare const ROUTES: {
219
231
  readonly method: "get";
220
232
  readonly path: "/og/explore.png";
221
233
  };
234
+ readonly FixWithAiRecovery: {
235
+ readonly method: "get";
236
+ readonly path: "/v/{sessionId}/fix-with-ai";
237
+ };
222
238
  readonly GetImage: {
223
239
  readonly method: "get";
224
240
  readonly path: "/images/{imageId}";
package/lib/routes.gen.js CHANGED
@@ -4,6 +4,7 @@
4
4
  // to regenerate. Do not edit by hand.
5
5
  export const ROUTES = {
6
6
  "AcceptOrgInvite": { "method": "post", "path": "/orgs/{orgId}/invite" },
7
+ "ActivateFixWithAiRepair": { "method": "post", "path": "/v/{sessionId}/fix-with-ai/activate" },
7
8
  "AddOrgMember": { "method": "post", "path": "/orgs/{orgId}/members" },
8
9
  "AddStaffMember": { "method": "post", "path": "/admin/staff" },
9
10
  "AddVerificationClientKey": { "method": "post", "path": "/admin/verification-clients/{clientId}/keys" },
@@ -16,6 +17,7 @@ export const ROUTES = {
16
17
  "AdminProviders": { "method": "get", "path": "/admin/providers" },
17
18
  "AdminReviews": { "method": "get", "path": "/admin/reviews" },
18
19
  "AdminSessions": { "method": "get", "path": "/admin/sessions" },
20
+ "AdminSetProviderFixWithAi": { "method": "put", "path": "/admin/providers/{providerId}/fix-with-ai" },
19
21
  "AdminSetUserOrgLimit": { "method": "put", "path": "/users/{userId}/org-limit" },
20
22
  "AdminSubscribeOrgPlan": { "method": "post", "path": "/admin/orgs/{orgId}/billing/subscribe" },
21
23
  "AdminThemes": { "method": "get", "path": "/admin/themes" },
@@ -32,6 +34,7 @@ export const ROUTES = {
32
34
  "CreateBillingPortalSession": { "method": "post", "path": "/orgs/{orgId}/billing/portal" },
33
35
  "CreateCallbackSubscription": { "method": "post", "path": "/verifications/callback-subscriptions" },
34
36
  "CreateCreditCheckoutSession": { "method": "post", "path": "/orgs/{orgId}/billing/credits/checkout" },
37
+ "CreateFixWithAiSession": { "method": "post", "path": "/v/{sessionId}/fix-with-ai" },
35
38
  "CreateManualTransaction": { "method": "post", "path": "/admin/billing/transactions" },
36
39
  "CreateOrg": { "method": "post", "path": "/orgs" },
37
40
  "CreateOrgCallbackSubscription": { "method": "post", "path": "/orgs/{orgId}/callback-subscriptions" },
@@ -58,6 +61,7 @@ export const ROUTES = {
58
61
  "DisposeVerificationSession": { "method": "post", "path": "/v/{sessionId}/dispose" },
59
62
  "Docs": { "method": "get", "path": "/docs" },
60
63
  "ExplorePreviewImage": { "method": "get", "path": "/og/explore.png" },
64
+ "FixWithAiRecovery": { "method": "get", "path": "/v/{sessionId}/fix-with-ai" },
61
65
  "GetImage": { "method": "get", "path": "/images/{imageId}" },
62
66
  "GetMe": { "method": "get", "path": "/me" },
63
67
  "GetOrg": { "method": "get", "path": "/orgs/{orgId}" },
package/lib/secp.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Shared `@noble/secp256k1` instance with the v3 hash hooks wired once
3
3
  * (sign + recover need SHA-256 / HMAC-SHA256). Import `secp` from here — never
4
- * set `secp.hashes` ad-hoc — so the hooks are guaranteed initialised before any
4
+ * set `secp.hashes` ad-hoc — so the hooks are guaranteed initialized before any
5
5
  * sign/verify/recover call, regardless of import order.
6
6
  */
7
7
  import { hmac } from '@noble/hashes/hmac.js';