botshield-sdk 4.0.0 → 4.0.3
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 +17 -5
- package/bin/mcp-server.js +395 -22
- package/bin/mcp-server.js.map +25 -21
- package/dist/commonjs/funcs/census-confirm-link.d.ts +1 -1
- package/dist/commonjs/funcs/census-confirm-link.js +1 -1
- package/dist/commonjs/funcs/census-send-by-number.d.ts +1 -1
- package/dist/commonjs/funcs/census-send-by-number.js +1 -1
- package/dist/commonjs/funcs/census-verify-token.d.ts +1 -1
- package/dist/commonjs/funcs/census-verify-token.js +1 -1
- package/dist/commonjs/funcs/recovery-exchange.d.ts +18 -0
- package/dist/commonjs/funcs/recovery-exchange.d.ts.map +1 -0
- package/dist/commonjs/funcs/recovery-exchange.js +123 -0
- package/dist/commonjs/funcs/recovery-exchange.js.map +1 -0
- package/dist/commonjs/funcs/recovery-other-route.d.ts +18 -0
- package/dist/commonjs/funcs/recovery-other-route.d.ts.map +1 -0
- package/dist/commonjs/funcs/recovery-other-route.js +123 -0
- package/dist/commonjs/funcs/recovery-other-route.js.map +1 -0
- package/dist/commonjs/funcs/sign-in-confirm.d.ts +18 -0
- package/dist/commonjs/funcs/sign-in-confirm.d.ts.map +1 -0
- package/dist/commonjs/funcs/sign-in-confirm.js +123 -0
- package/dist/commonjs/funcs/sign-in-confirm.js.map +1 -0
- package/dist/commonjs/funcs/sign-in-request.d.ts +18 -0
- package/dist/commonjs/funcs/sign-in-request.d.ts.map +1 -0
- package/dist/commonjs/funcs/sign-in-request.js +123 -0
- package/dist/commonjs/funcs/sign-in-request.js.map +1 -0
- package/dist/commonjs/funcs/verification-get-status.d.ts +1 -1
- package/dist/commonjs/funcs/verification-get-status.js +2 -1
- package/dist/commonjs/funcs/verification-get-status.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +2 -12
- package/dist/commonjs/lib/config.d.ts.map +1 -1
- package/dist/commonjs/lib/config.js +3 -13
- package/dist/commonjs/lib/config.js.map +1 -1
- package/dist/commonjs/mcp-server/mcp-server.js +1 -1
- package/dist/commonjs/mcp-server/server.js +1 -1
- package/dist/commonjs/models/bot-shield-action.d.ts +37 -1
- package/dist/commonjs/models/bot-shield-action.d.ts.map +1 -1
- package/dist/commonjs/models/bot-shield-action.js +28 -1
- package/dist/commonjs/models/bot-shield-action.js.map +1 -1
- package/dist/commonjs/models/error-body.d.ts +1 -1
- package/dist/commonjs/models/operations/actions-propose.d.ts +1 -1
- package/dist/commonjs/models/operations/gates-api-actions-create.d.ts +2 -2
- package/dist/commonjs/models/operations/gates-api-actions-list.d.ts +1 -1
- package/dist/commonjs/models/operations/gates-api-actions-request.d.ts +2 -2
- package/dist/commonjs/models/operations/gates-api-actions-set-state.d.ts +1 -1
- package/dist/commonjs/models/operations/gates-api-actions-update.d.ts +2 -2
- package/dist/commonjs/models/operations/index.d.ts +4 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +4 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/recovery-exchange.d.ts +114 -0
- package/dist/commonjs/models/operations/recovery-exchange.d.ts.map +1 -0
- package/dist/commonjs/models/operations/recovery-exchange.js +164 -0
- package/dist/commonjs/models/operations/recovery-exchange.js.map +1 -0
- package/dist/commonjs/models/operations/recovery-other-route.d.ts +86 -0
- package/dist/commonjs/models/operations/recovery-other-route.d.ts.map +1 -0
- package/dist/commonjs/models/operations/recovery-other-route.js +145 -0
- package/dist/commonjs/models/operations/recovery-other-route.js.map +1 -0
- package/dist/commonjs/models/operations/sdk-create-verification-link.d.ts +6 -1
- package/dist/commonjs/models/operations/sdk-create-verification-link.d.ts.map +1 -1
- package/dist/commonjs/models/operations/sdk-create-verification-link.js +4 -0
- package/dist/commonjs/models/operations/sdk-create-verification-link.js.map +1 -1
- package/dist/commonjs/models/operations/sdk-send-by-number.d.ts +1 -1
- package/dist/commonjs/models/operations/sdk-verify-token.d.ts +19 -4
- package/dist/commonjs/models/operations/sdk-verify-token.d.ts.map +1 -1
- package/dist/commonjs/models/operations/sdk-verify-token.js +10 -0
- package/dist/commonjs/models/operations/sdk-verify-token.js.map +1 -1
- package/dist/commonjs/models/operations/secured-accounts-list.d.ts +5 -0
- package/dist/commonjs/models/operations/secured-accounts-list.d.ts.map +1 -1
- package/dist/commonjs/models/operations/secured-accounts-list.js +2 -0
- package/dist/commonjs/models/operations/secured-accounts-list.js.map +1 -1
- package/dist/commonjs/models/operations/secured-accounts-status.d.ts +5 -0
- package/dist/commonjs/models/operations/secured-accounts-status.d.ts.map +1 -1
- package/dist/commonjs/models/operations/secured-accounts-status.js +2 -0
- package/dist/commonjs/models/operations/secured-accounts-status.js.map +1 -1
- package/dist/commonjs/models/operations/signin-confirm.d.ts +148 -0
- package/dist/commonjs/models/operations/signin-confirm.d.ts.map +1 -0
- package/dist/commonjs/models/operations/signin-confirm.js +202 -0
- package/dist/commonjs/models/operations/signin-confirm.js.map +1 -0
- package/dist/commonjs/models/operations/signin-request.d.ts +115 -0
- package/dist/commonjs/models/operations/signin-request.d.ts.map +1 -0
- package/dist/commonjs/models/operations/signin-request.js +174 -0
- package/dist/commonjs/models/operations/signin-request.js.map +1 -0
- package/dist/commonjs/models/operations/verification-get-status.d.ts +10 -5
- package/dist/commonjs/models/operations/verification-get-status.d.ts.map +1 -1
- package/dist/commonjs/models/operations/verification-get-status.js +5 -1
- package/dist/commonjs/models/operations/verification-get-status.js.map +1 -1
- package/dist/commonjs/sdk/census.d.ts +3 -3
- package/dist/commonjs/sdk/census.js +3 -3
- package/dist/commonjs/sdk/recovery.d.ts +19 -0
- package/dist/commonjs/sdk/recovery.d.ts.map +1 -0
- package/dist/commonjs/sdk/recovery.js +32 -0
- package/dist/commonjs/sdk/recovery.js.map +1 -0
- package/dist/commonjs/sdk/sdk.d.ts +6 -0
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +10 -0
- package/dist/commonjs/sdk/sdk.js.map +1 -1
- package/dist/commonjs/sdk/sign-in.d.ts +19 -0
- package/dist/commonjs/sdk/sign-in.d.ts.map +1 -0
- package/dist/commonjs/sdk/sign-in.js +32 -0
- package/dist/commonjs/sdk/sign-in.js.map +1 -0
- package/dist/commonjs/sdk/verification.d.ts +1 -1
- package/dist/commonjs/sdk/verification.js +1 -1
- package/dist/esm/funcs/census-confirm-link.d.ts +1 -1
- package/dist/esm/funcs/census-confirm-link.js +1 -1
- package/dist/esm/funcs/census-send-by-number.d.ts +1 -1
- package/dist/esm/funcs/census-send-by-number.js +1 -1
- package/dist/esm/funcs/census-verify-token.d.ts +1 -1
- package/dist/esm/funcs/census-verify-token.js +1 -1
- package/dist/esm/funcs/recovery-exchange.d.ts +18 -0
- package/dist/esm/funcs/recovery-exchange.d.ts.map +1 -0
- package/dist/esm/funcs/recovery-exchange.js +87 -0
- package/dist/esm/funcs/recovery-exchange.js.map +1 -0
- package/dist/esm/funcs/recovery-other-route.d.ts +18 -0
- package/dist/esm/funcs/recovery-other-route.d.ts.map +1 -0
- package/dist/esm/funcs/recovery-other-route.js +87 -0
- package/dist/esm/funcs/recovery-other-route.js.map +1 -0
- package/dist/esm/funcs/sign-in-confirm.d.ts +18 -0
- package/dist/esm/funcs/sign-in-confirm.d.ts.map +1 -0
- package/dist/esm/funcs/sign-in-confirm.js +87 -0
- package/dist/esm/funcs/sign-in-confirm.js.map +1 -0
- package/dist/esm/funcs/sign-in-request.d.ts +18 -0
- package/dist/esm/funcs/sign-in-request.d.ts.map +1 -0
- package/dist/esm/funcs/sign-in-request.js +87 -0
- package/dist/esm/funcs/sign-in-request.js.map +1 -0
- package/dist/esm/funcs/verification-get-status.d.ts +1 -1
- package/dist/esm/funcs/verification-get-status.js +3 -2
- package/dist/esm/funcs/verification-get-status.js.map +1 -1
- package/dist/esm/lib/config.d.ts +2 -12
- package/dist/esm/lib/config.d.ts.map +1 -1
- package/dist/esm/lib/config.js +2 -12
- package/dist/esm/lib/config.js.map +1 -1
- package/dist/esm/mcp-server/mcp-server.js +1 -1
- package/dist/esm/mcp-server/server.js +1 -1
- package/dist/esm/models/bot-shield-action.d.ts +37 -1
- package/dist/esm/models/bot-shield-action.d.ts.map +1 -1
- package/dist/esm/models/bot-shield-action.js +27 -0
- package/dist/esm/models/bot-shield-action.js.map +1 -1
- package/dist/esm/models/error-body.d.ts +1 -1
- package/dist/esm/models/operations/actions-propose.d.ts +1 -1
- package/dist/esm/models/operations/gates-api-actions-create.d.ts +2 -2
- package/dist/esm/models/operations/gates-api-actions-list.d.ts +1 -1
- package/dist/esm/models/operations/gates-api-actions-request.d.ts +2 -2
- package/dist/esm/models/operations/gates-api-actions-set-state.d.ts +1 -1
- package/dist/esm/models/operations/gates-api-actions-update.d.ts +2 -2
- package/dist/esm/models/operations/index.d.ts +4 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +4 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/recovery-exchange.d.ts +114 -0
- package/dist/esm/models/operations/recovery-exchange.d.ts.map +1 -0
- package/dist/esm/models/operations/recovery-exchange.js +118 -0
- package/dist/esm/models/operations/recovery-exchange.js.map +1 -0
- package/dist/esm/models/operations/recovery-other-route.d.ts +86 -0
- package/dist/esm/models/operations/recovery-other-route.d.ts.map +1 -0
- package/dist/esm/models/operations/recovery-other-route.js +99 -0
- package/dist/esm/models/operations/recovery-other-route.js.map +1 -0
- package/dist/esm/models/operations/sdk-create-verification-link.d.ts +6 -1
- package/dist/esm/models/operations/sdk-create-verification-link.d.ts.map +1 -1
- package/dist/esm/models/operations/sdk-create-verification-link.js +4 -0
- package/dist/esm/models/operations/sdk-create-verification-link.js.map +1 -1
- package/dist/esm/models/operations/sdk-send-by-number.d.ts +1 -1
- package/dist/esm/models/operations/sdk-verify-token.d.ts +19 -4
- package/dist/esm/models/operations/sdk-verify-token.d.ts.map +1 -1
- package/dist/esm/models/operations/sdk-verify-token.js +10 -0
- package/dist/esm/models/operations/sdk-verify-token.js.map +1 -1
- package/dist/esm/models/operations/secured-accounts-list.d.ts +5 -0
- package/dist/esm/models/operations/secured-accounts-list.d.ts.map +1 -1
- package/dist/esm/models/operations/secured-accounts-list.js +2 -0
- package/dist/esm/models/operations/secured-accounts-list.js.map +1 -1
- package/dist/esm/models/operations/secured-accounts-status.d.ts +5 -0
- package/dist/esm/models/operations/secured-accounts-status.d.ts.map +1 -1
- package/dist/esm/models/operations/secured-accounts-status.js +2 -0
- package/dist/esm/models/operations/secured-accounts-status.js.map +1 -1
- package/dist/esm/models/operations/signin-confirm.d.ts +148 -0
- package/dist/esm/models/operations/signin-confirm.d.ts.map +1 -0
- package/dist/esm/models/operations/signin-confirm.js +156 -0
- package/dist/esm/models/operations/signin-confirm.js.map +1 -0
- package/dist/esm/models/operations/signin-request.d.ts +115 -0
- package/dist/esm/models/operations/signin-request.d.ts.map +1 -0
- package/dist/esm/models/operations/signin-request.js +128 -0
- package/dist/esm/models/operations/signin-request.js.map +1 -0
- package/dist/esm/models/operations/verification-get-status.d.ts +10 -5
- package/dist/esm/models/operations/verification-get-status.d.ts.map +1 -1
- package/dist/esm/models/operations/verification-get-status.js +5 -1
- package/dist/esm/models/operations/verification-get-status.js.map +1 -1
- package/dist/esm/sdk/census.d.ts +3 -3
- package/dist/esm/sdk/census.js +3 -3
- package/dist/esm/sdk/recovery.d.ts +19 -0
- package/dist/esm/sdk/recovery.d.ts.map +1 -0
- package/dist/esm/sdk/recovery.js +28 -0
- package/dist/esm/sdk/recovery.js.map +1 -0
- package/dist/esm/sdk/sdk.d.ts +6 -0
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +10 -0
- package/dist/esm/sdk/sdk.js.map +1 -1
- package/dist/esm/sdk/sign-in.d.ts +19 -0
- package/dist/esm/sdk/sign-in.d.ts.map +1 -0
- package/dist/esm/sdk/sign-in.js +28 -0
- package/dist/esm/sdk/sign-in.js.map +1 -0
- package/dist/esm/sdk/verification.d.ts +1 -1
- package/dist/esm/sdk/verification.js +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/census-confirm-link.ts +1 -1
- package/src/funcs/census-send-by-number.ts +1 -1
- package/src/funcs/census-verify-token.ts +1 -1
- package/src/funcs/recovery-exchange.ts +184 -0
- package/src/funcs/recovery-other-route.ts +184 -0
- package/src/funcs/sign-in-confirm.ts +184 -0
- package/src/funcs/sign-in-request.ts +184 -0
- package/src/funcs/verification-get-status.ts +7 -2
- package/src/lib/config.ts +2 -12
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +1 -1
- package/src/models/bot-shield-action.ts +62 -1
- package/src/models/error-body.ts +1 -1
- package/src/models/operations/actions-propose.ts +1 -1
- package/src/models/operations/gates-api-actions-create.ts +2 -2
- package/src/models/operations/gates-api-actions-list.ts +1 -1
- package/src/models/operations/gates-api-actions-request.ts +2 -2
- package/src/models/operations/gates-api-actions-set-state.ts +1 -1
- package/src/models/operations/gates-api-actions-update.ts +2 -2
- package/src/models/operations/index.ts +4 -0
- package/src/models/operations/recovery-exchange.ts +308 -0
- package/src/models/operations/recovery-other-route.ts +262 -0
- package/src/models/operations/sdk-create-verification-link.ts +10 -1
- package/src/models/operations/sdk-send-by-number.ts +1 -1
- package/src/models/operations/sdk-verify-token.ts +29 -4
- package/src/models/operations/secured-accounts-list.ts +7 -0
- package/src/models/operations/secured-accounts-status.ts +7 -0
- package/src/models/operations/signin-confirm.ts +383 -0
- package/src/models/operations/signin-request.ts +319 -0
- package/src/models/operations/verification-get-status.ts +14 -5
- package/src/sdk/census.ts +3 -3
- package/src/sdk/recovery.ts +49 -0
- package/src/sdk/sdk.ts +12 -0
- package/src/sdk/sign-in.ts +49 -0
- package/src/sdk/verification.ts +1 -1
|
@@ -19,6 +19,10 @@ export type VerificationGetStatusSecurity = {
|
|
|
19
19
|
|
|
20
20
|
export type VerificationGetStatusRequest = {
|
|
21
21
|
requestId: string;
|
|
22
|
+
/**
|
|
23
|
+
* The `read_secret` create-verification-link returned for a request started with your site key. Without it such a request's `verification_token` / `signed_token` are never returned. A request your server started reads them with your secret key (`Authorization: Bearer bs_…`) instead. A passkey sign-in's answer is never returned here (use signin/confirm).
|
|
24
|
+
*/
|
|
25
|
+
xBotShieldRequestSecret?: string | undefined;
|
|
22
26
|
};
|
|
23
27
|
|
|
24
28
|
/**
|
|
@@ -168,7 +172,7 @@ export type VerificationGetStatusGateType = OpenEnum<
|
|
|
168
172
|
>;
|
|
169
173
|
|
|
170
174
|
/**
|
|
171
|
-
*
|
|
175
|
+
* Where the link stands on this request. Null on a plain check and on a link from before 4.0. A pass whose link is not live carries no destination.
|
|
172
176
|
*/
|
|
173
177
|
export const LinkState = {
|
|
174
178
|
Pending: "pending",
|
|
@@ -177,7 +181,7 @@ export const LinkState = {
|
|
|
177
181
|
Refused: "refused",
|
|
178
182
|
} as const;
|
|
179
183
|
/**
|
|
180
|
-
*
|
|
184
|
+
* Where the link stands on this request. Null on a plain check and on a link from before 4.0. A pass whose link is not live carries no destination.
|
|
181
185
|
*/
|
|
182
186
|
export type LinkState = OpenEnum<typeof LinkState>;
|
|
183
187
|
|
|
@@ -266,15 +270,15 @@ export type VerificationGetStatusData = {
|
|
|
266
270
|
*/
|
|
267
271
|
ageSource?: string | null | undefined;
|
|
268
272
|
/**
|
|
269
|
-
*
|
|
273
|
+
* Where the link stands on this request. Null on a plain check and on a link from before 4.0. A pass whose link is not live carries no destination.
|
|
270
274
|
*/
|
|
271
275
|
linkState?: LinkState | null | undefined;
|
|
272
276
|
/**
|
|
273
|
-
*
|
|
277
|
+
* When a pending link expires (24 hours after the tap). Null unless `link_state` is `pending`.
|
|
274
278
|
*/
|
|
275
279
|
linkExpiresAt?: Date | null | undefined;
|
|
276
280
|
/**
|
|
277
|
-
*
|
|
281
|
+
* `link_pending` while the link waits for your server.
|
|
278
282
|
*/
|
|
279
283
|
linkCode?: string | undefined;
|
|
280
284
|
linkMessage?: string | undefined;
|
|
@@ -338,14 +342,17 @@ export const VerificationGetStatusRequest$inboundSchema: z.ZodType<
|
|
|
338
342
|
unknown
|
|
339
343
|
> = z.object({
|
|
340
344
|
request_id: types.string(),
|
|
345
|
+
"X-BotShield-Request-Secret": types.optional(types.string()),
|
|
341
346
|
}).transform((v) => {
|
|
342
347
|
return remap$(v, {
|
|
343
348
|
"request_id": "requestId",
|
|
349
|
+
"X-BotShield-Request-Secret": "xBotShieldRequestSecret",
|
|
344
350
|
});
|
|
345
351
|
});
|
|
346
352
|
/** @internal */
|
|
347
353
|
export type VerificationGetStatusRequest$Outbound = {
|
|
348
354
|
request_id: string;
|
|
355
|
+
"X-BotShield-Request-Secret"?: string | undefined;
|
|
349
356
|
};
|
|
350
357
|
|
|
351
358
|
/** @internal */
|
|
@@ -355,9 +362,11 @@ export const VerificationGetStatusRequest$outboundSchema: z.ZodType<
|
|
|
355
362
|
VerificationGetStatusRequest
|
|
356
363
|
> = z.object({
|
|
357
364
|
requestId: z.string(),
|
|
365
|
+
xBotShieldRequestSecret: z.string().optional(),
|
|
358
366
|
}).transform((v) => {
|
|
359
367
|
return remap$(v, {
|
|
360
368
|
requestId: "request_id",
|
|
369
|
+
xBotShieldRequestSecret: "X-BotShield-Request-Secret",
|
|
361
370
|
});
|
|
362
371
|
});
|
|
363
372
|
|
package/src/sdk/census.ts
CHANGED
|
@@ -61,7 +61,7 @@ export class Census extends ClientSDK {
|
|
|
61
61
|
* Validate a verification token
|
|
62
62
|
*
|
|
63
63
|
* @remarks
|
|
64
|
-
* Validates a BotShield attestation JWT — the primary server-side check. Attestations are ES256-signed; the public key is published at /.well-known/jwks.json (kid in the header), so you may also verify locally with any JWT library. Claims are anonymous by construction: the token attests the event, never the person. Each attestation is for one organization (aud = its organization_id; pass `audience` to enforce it) and one check: a repeat check is refused (`valid: false`, `replayed: true`). Check it once, on your server. Each token names its `kind` (`verification` or `action`) and the `environment` it was issued in. A token of any other kind is refused, and when you call with your secret key (`Authorization: Bearer bs_…`) a token from the other environment is refused (a development token never passes a production check). A refused token is not spent.
|
|
64
|
+
* Validates a BotShield attestation JWT — the primary server-side check. Attestations are ES256-signed; the public key is published at /.well-known/jwks.json (kid in the header), so you may also verify locally with any JWT library. Claims are anonymous by construction: the token attests the event, never the person. Each attestation is for one organization (aud = its organization_id; pass `audience` to enforce it) and one check: a repeat check is refused (`valid: false`, `replayed: true`). Check it once, on your server. Each token names its `kind` (`verification` or `action`) and the `environment` it was issued in. A token of any other kind is refused, and when you call with your secret key (`Authorization: Bearer bs_…`) a token from the other environment is refused (a development token never passes a production check). A refused token is not spent. The check needs your secret key (`Authorization: Bearer bs_…`); without it the answer is `valid: false, code: secret_key_required` and the token is not spent. Send `expected_request_id` (the request your server made) and a token for any other request is refused (`code: request_mismatch`), unspent. A passkey sign-in's token is refused here: redeem a sign-in with signin/confirm.
|
|
65
65
|
*/
|
|
66
66
|
async verifyToken(
|
|
67
67
|
security: operations.SDKVerifyTokenSecurity,
|
|
@@ -168,7 +168,7 @@ export class Census extends ClientSDK {
|
|
|
168
168
|
* Confirm a pending link
|
|
169
169
|
*
|
|
170
170
|
* @remarks
|
|
171
|
-
*
|
|
171
|
+
* On a key with “Pending until your server confirms” on, a link waits after the person's tap (account.link_pending). Confirm it from your server with your SECRET key, sending the account your own session shows. The same account makes the link live (account.link_live, account.secured) and returns the finished token on this response only. Another account is refused and the waiting link is dropped. A link not confirmed within 24 hours expires. You can also confirm by passing `partner_user_ref` to sdk/verify-token with your secret key.
|
|
172
172
|
*/
|
|
173
173
|
async confirmLink(
|
|
174
174
|
security: operations.SDKConfirmLinkSecurity,
|
|
@@ -187,7 +187,7 @@ export class Census extends ClientSDK {
|
|
|
187
187
|
* Send a request to verify by phone number
|
|
188
188
|
*
|
|
189
189
|
* @remarks
|
|
190
|
-
*
|
|
190
|
+
* From your server, with your SECRET key, send a request to verify to the person whose BotShield ID carries this phone number. BotShield keeps none of your customer data: the number is used once and is not stored, logged or returned. The answer is the same whether or not anyone holds the number: status `sent`, the request id, its expiry and a two-digit `match_number` — show it to your customer; they pick it in the BotShield app before their passkey. Outcomes arrive as webhooks (or verification/status with this key): verified, declined, or expired. A person who has not linked your company first sees an introduction from you; your request can be answered only after they allow it. Production sends need a verified business. Limits: a cap per key per hour and on unanswered sends per company.
|
|
191
191
|
*/
|
|
192
192
|
async sendByNumber(
|
|
193
193
|
security: operations.SDKSendByNumberSecurity,
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { recoveryExchange } from "../funcs/recovery-exchange.js";
|
|
6
|
+
import { recoveryOtherRoute } from "../funcs/recovery-other-route.js";
|
|
7
|
+
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
8
|
+
import * as operations from "../models/operations/index.js";
|
|
9
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
10
|
+
|
|
11
|
+
export class Recovery extends ClientSDK {
|
|
12
|
+
/**
|
|
13
|
+
* Redeem a recovery code
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Your landing page received `?botshield_recovery_code=…` from the BotShield app. Your SERVER sends the code, your secret key, and the secret it set in that browser's cookie before the tap (the button carried its challenge: SHA-256 of the secret, base64url). BotShield answers only when the secret matches. The first call destroys the code whether or not it matched, so a landing page with no secret must still call this. A second call, a call after 2 minutes, a call with another company's key or the wrong secret all read the same: `recovery_code_invalid`. On success, sign the customer in to the account named by `handle` (the per-company handle given when the account was verified, as on `account.secured`); BotShield tells the person and sends `account.recovered` to your webhook endpoints.
|
|
17
|
+
*/
|
|
18
|
+
async exchange(
|
|
19
|
+
security: operations.RecoveryExchangeSecurity,
|
|
20
|
+
request: operations.RecoveryExchangeRequest,
|
|
21
|
+
options?: RequestOptions,
|
|
22
|
+
): Promise<operations.RecoveryExchangeResponse> {
|
|
23
|
+
return unwrapAsync(recoveryExchange(
|
|
24
|
+
this,
|
|
25
|
+
security,
|
|
26
|
+
request,
|
|
27
|
+
options,
|
|
28
|
+
));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Report another sign-in reset
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* Tell BotShield that your other way to reset sign-in (a link by email, a code by text) was started for a verified account, by its handle. BotShield tells the person ("<Company> sign-in reset by email · It works from <day>. Not you? Open BotShield."), at most once per account in 6 hours. The answer is the same whether or not the handle is a live verified account.
|
|
36
|
+
*/
|
|
37
|
+
async otherRoute(
|
|
38
|
+
security: operations.RecoveryOtherRouteSecurity,
|
|
39
|
+
request: operations.RecoveryOtherRouteRequest,
|
|
40
|
+
options?: RequestOptions,
|
|
41
|
+
): Promise<operations.RecoveryOtherRouteResponse> {
|
|
42
|
+
return unwrapAsync(recoveryOtherRoute(
|
|
43
|
+
this,
|
|
44
|
+
security,
|
|
45
|
+
request,
|
|
46
|
+
options,
|
|
47
|
+
));
|
|
48
|
+
}
|
|
49
|
+
}
|
package/src/sdk/sdk.ts
CHANGED
|
@@ -7,7 +7,9 @@ import { Actions } from "./actions.js";
|
|
|
7
7
|
import { Census } from "./census.js";
|
|
8
8
|
import { Gates } from "./gates.js";
|
|
9
9
|
import { InlinePasskey } from "./inline-passkey.js";
|
|
10
|
+
import { Recovery } from "./recovery.js";
|
|
10
11
|
import { SecuredAccounts } from "./secured-accounts.js";
|
|
12
|
+
import { SignIn } from "./sign-in.js";
|
|
11
13
|
import { Verification } from "./verification.js";
|
|
12
14
|
|
|
13
15
|
export class BotShield extends ClientSDK {
|
|
@@ -40,4 +42,14 @@ export class BotShield extends ClientSDK {
|
|
|
40
42
|
get inlinePasskey(): InlinePasskey {
|
|
41
43
|
return (this._inlinePasskey ??= new InlinePasskey(this._options));
|
|
42
44
|
}
|
|
45
|
+
|
|
46
|
+
private _recovery?: Recovery;
|
|
47
|
+
get recovery(): Recovery {
|
|
48
|
+
return (this._recovery ??= new Recovery(this._options));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private _signIn?: SignIn;
|
|
52
|
+
get signIn(): SignIn {
|
|
53
|
+
return (this._signIn ??= new SignIn(this._options));
|
|
54
|
+
}
|
|
43
55
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { signInConfirm } from "../funcs/sign-in-confirm.js";
|
|
6
|
+
import { signInRequest } from "../funcs/sign-in-request.js";
|
|
7
|
+
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
8
|
+
import * as operations from "../models/operations/index.js";
|
|
9
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
10
|
+
|
|
11
|
+
export class SignIn extends ClientSDK {
|
|
12
|
+
/**
|
|
13
|
+
* Ask for a passkey sign-in
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Your SERVER asks for a sign-in for ONE of your accounts, after the password has passed or after the customer named their account. Hand the page only `request_id`. Answers only for an account that is already an active verified account here; otherwise `not_verified`, nothing is started, and you do not show the button. It never links an account. A paused account is refused (`account_paused`). The request lives 2 minutes. Needs a live Sign-on Action with your sign-in page's address (BotShield Console › Verified Accounts › BotShield Actions).
|
|
17
|
+
*/
|
|
18
|
+
async request(
|
|
19
|
+
security: operations.SigninRequestSecurity,
|
|
20
|
+
request: operations.SigninRequestRequest,
|
|
21
|
+
options?: RequestOptions,
|
|
22
|
+
): Promise<operations.SigninRequestResponse> {
|
|
23
|
+
return unwrapAsync(signInRequest(
|
|
24
|
+
this,
|
|
25
|
+
security,
|
|
26
|
+
request,
|
|
27
|
+
options,
|
|
28
|
+
));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Redeem a passkey sign-in
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* Your SERVER redeems a sign-in with your secret key and the `request_id` IT made for this attempt: once, within 2 minutes of the passkey. The page's message from the frame is only a cue to call this. Send `partner_user_ref` to have a sign-in for any other account refused. The sign-in's token is not checked with verify-token (which refuses it), and verification/status never returns it.
|
|
36
|
+
*/
|
|
37
|
+
async confirm(
|
|
38
|
+
security: operations.SigninConfirmSecurity,
|
|
39
|
+
request: operations.SigninConfirmRequest,
|
|
40
|
+
options?: RequestOptions,
|
|
41
|
+
): Promise<operations.SigninConfirmResponse> {
|
|
42
|
+
return unwrapAsync(signInConfirm(
|
|
43
|
+
this,
|
|
44
|
+
security,
|
|
45
|
+
request,
|
|
46
|
+
options,
|
|
47
|
+
));
|
|
48
|
+
}
|
|
49
|
+
}
|
package/src/sdk/verification.ts
CHANGED
|
@@ -12,7 +12,7 @@ export class Verification extends ClientSDK {
|
|
|
12
12
|
* Check verification status
|
|
13
13
|
*
|
|
14
14
|
* @remarks
|
|
15
|
-
* Poll a verification request. Carries the signed attestation on completion and NO identity — no user_email, partner_user_id, auth_mode, or botshield_user_id ever cross this boundary. Called without a key, it is rate-limited per client address (a page polling every 2 seconds stays well inside it); over the limit the call is refused with HTTP 403 and `errors[0].code = "RATE_LIMITED"`.
|
|
15
|
+
* Poll a verification request. Carries the signed attestation on completion and NO identity — no user_email, partner_user_id, auth_mode, or botshield_user_id ever cross this boundary. Called without a key, it is rate-limited per client address (a page polling every 2 seconds stays well inside it); over the limit the call is refused with HTTP 403 and `errors[0].code = "RATE_LIMITED"`. Knowing the request id is not enough to read the finished tokens. A request started with a site key returns them only with its `read_secret` (`X-BotShield-Request-Secret`); a request your server started, only to your secret key. A passkey sign-in's tokens are never returned here.
|
|
16
16
|
*/
|
|
17
17
|
async getStatus(
|
|
18
18
|
security: operations.VerificationGetStatusSecurity,
|