@noresponse/node 2.0.10 → 2.0.12
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/CHANGELOG.md +12 -0
- package/README.md +22 -0
- package/dist/commonjs/funcs/assessments-create.d.ts +1 -1
- package/dist/commonjs/funcs/assessments-create.js +1 -1
- package/dist/commonjs/index.d.ts +3 -1
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +11 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/issued-credential.d.ts +9 -0
- package/dist/commonjs/issued-credential.d.ts.map +1 -0
- package/dist/commonjs/issued-credential.js +18 -0
- package/dist/commonjs/issued-credential.js.map +1 -0
- package/dist/commonjs/late-results.d.ts +111 -0
- package/dist/commonjs/late-results.d.ts.map +1 -0
- package/dist/commonjs/late-results.js +213 -0
- package/dist/commonjs/late-results.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/assessment-request-issued-credential.d.ts +18 -0
- package/dist/commonjs/models/assessment-request-issued-credential.d.ts.map +1 -0
- package/dist/commonjs/models/assessment-request-issued-credential.js +46 -0
- package/dist/commonjs/models/assessment-request-issued-credential.js.map +1 -0
- package/dist/commonjs/models/assessment-request.d.ts +6 -0
- package/dist/commonjs/models/assessment-request.d.ts.map +1 -1
- package/dist/commonjs/models/assessment-request.js +3 -0
- package/dist/commonjs/models/assessment-request.js.map +1 -1
- package/dist/commonjs/models/index.d.ts +1 -0
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +1 -0
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/risk.d.ts +8 -0
- package/dist/commonjs/models/risk.d.ts.map +1 -1
- package/dist/commonjs/models/risk.js +3 -0
- package/dist/commonjs/models/risk.js.map +1 -1
- package/dist/commonjs/sdk/assessments.d.ts +1 -1
- package/dist/commonjs/sdk/assessments.js +1 -1
- package/dist/esm/funcs/assessments-create.d.ts +1 -1
- package/dist/esm/funcs/assessments-create.js +1 -1
- package/dist/esm/index.d.ts +3 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +3 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/issued-credential.d.ts +9 -0
- package/dist/esm/issued-credential.d.ts.map +1 -0
- package/dist/esm/issued-credential.js +15 -0
- package/dist/esm/issued-credential.js.map +1 -0
- package/dist/esm/late-results.d.ts +111 -0
- package/dist/esm/late-results.d.ts.map +1 -0
- package/dist/esm/late-results.js +204 -0
- package/dist/esm/late-results.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/assessment-request-issued-credential.d.ts +18 -0
- package/dist/esm/models/assessment-request-issued-credential.d.ts.map +1 -0
- package/dist/esm/models/assessment-request-issued-credential.js +9 -0
- package/dist/esm/models/assessment-request-issued-credential.js.map +1 -0
- package/dist/esm/models/assessment-request.d.ts +6 -0
- package/dist/esm/models/assessment-request.d.ts.map +1 -1
- package/dist/esm/models/assessment-request.js +3 -0
- package/dist/esm/models/assessment-request.js.map +1 -1
- package/dist/esm/models/index.d.ts +1 -0
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +1 -0
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/risk.d.ts +8 -0
- package/dist/esm/models/risk.d.ts.map +1 -1
- package/dist/esm/models/risk.js +3 -0
- package/dist/esm/models/risk.js.map +1 -1
- package/dist/esm/sdk/assessments.d.ts +1 -1
- package/dist/esm/sdk/assessments.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.12
|
|
4
|
+
|
|
5
|
+
* `sdk.assessments.create()`:
|
|
6
|
+
* `request.body.issuedCredential` **Added**
|
|
7
|
+
* `response.risk` **Changed**
|
|
8
|
+
* `sdk.assessments.get()`: `response.risk` **Changed**
|
|
9
|
+
* `sdk.assessments.query()`: `response.items[].risk` **Changed**
|
|
10
|
+
|
|
11
|
+
## 2.0.11
|
|
12
|
+
|
|
13
|
+
No changes detected.
|
|
14
|
+
|
|
3
15
|
## 2.0.10
|
|
4
16
|
|
|
5
17
|
No changes detected.
|
package/README.md
CHANGED
|
@@ -173,6 +173,15 @@ Override per client with `retryConfig`, or per call with `{ retries }`:
|
|
|
173
173
|
await nr.assessments.create(params, { retries: { strategy: "none" } });
|
|
174
174
|
```
|
|
175
175
|
|
|
176
|
+
## Issued keys
|
|
177
|
+
|
|
178
|
+
When your signup gate issues an API key to the new account, send only its hash, as `issued_credential.sha256`; the key itself never leaves your backend.
|
|
179
|
+
|
|
180
|
+
```ts
|
|
181
|
+
import { hashIssuedCredential } from "@noresponse/node";
|
|
182
|
+
const sha256 = hashIssuedCredential(issuedKey); // 64 lower-case hex characters
|
|
183
|
+
```
|
|
184
|
+
|
|
176
185
|
## Webhooks
|
|
177
186
|
|
|
178
187
|
Verify the exact bytes you received, then act on the typed event. `secrets` maps each `whk_` key id we give you to its secret; hold both during a rotation.
|
|
@@ -201,6 +210,19 @@ async function handler(req, res) {
|
|
|
201
210
|
|
|
202
211
|
`constructEvent(payload, headers, secrets, { toleranceSeconds })` takes the raw body (a `Buffer`, `Uint8Array` or the exact text), any header object (Fetch `Headers`, Node `IncomingHttpHeaders`, a plain object or entries) and refuses a repeated signature header, a delivery older than 300 seconds, an unknown key id or a bad signature with a `WebhookVerificationError` whose `code` says which. Deliveries are at least once: deduplicate on `event.id`. The same functions are on `NoResponse.webhooks` and `nr.webhooks`. This module uses `node:crypto`.
|
|
203
212
|
|
|
213
|
+
### Late results
|
|
214
|
+
|
|
215
|
+
An assessment can be revised after you allowed the signup. `handleLateResult` verifies the delivery with `constructEvent`, applies your policy and acts through your auth provider's admin API:
|
|
216
|
+
|
|
217
|
+
```ts
|
|
218
|
+
import { clerkActions, handleLateResult } from "@noresponse/node"; // or workosActions, auth0Actions
|
|
219
|
+
|
|
220
|
+
const provider = clerkActions({ secretKey: process.env.CLERK_SECRET_KEY! });
|
|
221
|
+
const result = await handleLateResult(rawBody, request.headers, secrets, provider, { policy: { review: "ban" } });
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
The default policy revokes sessions on `review` and does nothing otherwise. `ban` blocks the user in Clerk and Auth0; WorkOS has no block, so its ban deletes the user permanently. Pass `userId` when the provider's user id is not your `accountId`. A refused provider call throws `ProviderActionError`; answer the webhook with a 5xx so we retry it.
|
|
225
|
+
|
|
204
226
|
## Auth adapters
|
|
205
227
|
|
|
206
228
|
Map a session your backend has already verified into `authContext`:
|
|
@@ -12,7 +12,7 @@ import { Result } from "../types/fp.js";
|
|
|
12
12
|
* Assess identifiers for a signup or gateway decision.
|
|
13
13
|
*
|
|
14
14
|
* @remarks
|
|
15
|
-
* Returns within the deadline (500 ms at most) with a complete, partial or pending assessment: 200 carries complete or partial, 202 carries pending with Location and Retry-After. A pending answer has no recommendation; apply your own fallback for pending, 429, 503 or a timeout. Requires the assess scope. Idempotency-Key is required and is bound to the body for 24 hours: the same key with the same body replays the latest assessment with Idempotent-Replayed: true and starts no new work; the same key with a different body answers 409 idempotency_key_reused. response_mode defaults to standard; detailed needs the detailed scope.
|
|
15
|
+
* Returns within the deadline (500 ms at most) with a complete, partial or pending assessment: 200 carries complete or partial, 202 carries pending with Location and Retry-After. A pending answer has no recommendation; apply your own fallback for pending, 429, 503 or a timeout. risk.block says when your block threshold was reached. Requires the assess scope. Idempotency-Key is required and is bound to the body for 24 hours: the same key with the same body replays the latest assessment with Idempotent-Replayed: true and starts no new work; the same key with a different body answers 409 idempotency_key_reused. response_mode defaults to standard; detailed needs the detailed scope.
|
|
16
16
|
*/
|
|
17
17
|
export declare function assessmentsCreate(client: NoResponseCore, request: operations.CreateAssessmentRequest, options?: RequestOptions): APIPromise<Result<operations.CreateAssessmentResponse, errors.BadRequestError | errors.AuthenticationError | errors.PermissionDeniedError | errors.NotFoundError | errors.ConflictError | errors.RateLimitError | NoResponseError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
18
|
//# sourceMappingURL=assessments-create.d.ts.map
|
|
@@ -49,7 +49,7 @@ const async_js_1 = require("../types/async.js");
|
|
|
49
49
|
* Assess identifiers for a signup or gateway decision.
|
|
50
50
|
*
|
|
51
51
|
* @remarks
|
|
52
|
-
* Returns within the deadline (500 ms at most) with a complete, partial or pending assessment: 200 carries complete or partial, 202 carries pending with Location and Retry-After. A pending answer has no recommendation; apply your own fallback for pending, 429, 503 or a timeout. Requires the assess scope. Idempotency-Key is required and is bound to the body for 24 hours: the same key with the same body replays the latest assessment with Idempotent-Replayed: true and starts no new work; the same key with a different body answers 409 idempotency_key_reused. response_mode defaults to standard; detailed needs the detailed scope.
|
|
52
|
+
* Returns within the deadline (500 ms at most) with a complete, partial or pending assessment: 200 carries complete or partial, 202 carries pending with Location and Retry-After. A pending answer has no recommendation; apply your own fallback for pending, 429, 503 or a timeout. risk.block says when your block threshold was reached. Requires the assess scope. Idempotency-Key is required and is bound to the body for 24 hours: the same key with the same body replays the latest assessment with Idempotent-Replayed: true and starts no new work; the same key with a different body answers 409 idempotency_key_reused. response_mode defaults to standard; detailed needs the detailed scope.
|
|
53
53
|
*/
|
|
54
54
|
function assessmentsCreate(client, request, options) {
|
|
55
55
|
return new async_js_1.APIPromise($do(client, request, options));
|
package/dist/commonjs/index.d.ts
CHANGED
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
export { NoResponse, Assessments, Keys, DEFAULT_BASE_URL, DEFAULT_TIMEOUT_MS, type NoResponseOptions, type CreateOptions, type GetOptions, type AssessmentPage, type ResponseMeta, type WithMeta, type WaitOptions, } from "./client.js";
|
|
6
6
|
export * from "./errors.js";
|
|
7
7
|
export { constructEvent, verificationResponse, isExpiredEvent, WebhookVerificationError, DEFAULT_TOLERANCE_SECONDS, type WebhookEvent, type AssessmentUpdatedEvent, type AssessmentExpiredEvent, type EndpointVerificationEvent, type AssessmentExpired, type EndpointVerification, type ConstructEventOptions, type HeaderInput, type WebhookSecrets, type WebhookErrorCode, } from "./webhooks.js";
|
|
8
|
-
export {
|
|
8
|
+
export { handleLateResult, lateResultAction, clerkActions, workosActions, auth0Actions, ProviderActionError, DEFAULT_LATE_RESULT_POLICY, type LateResult, type LateResultAction, type LateResultOptions, type LateResultPolicy, type LateResultProvider, type ClerkActionsOptions, type WorkOSActionsOptions, type Auth0ActionsOptions, } from "./late-results.js";
|
|
9
|
+
export { fromAuth0, fromClerk, fromCognito, fromEntra, fromFirebase, fromKeycloak, fromOIDC, fromOry, fromOryOAuth2, fromSupabase, fromWorkOS, type VerifiedClaims, type AuthContextOverrides, } from "./auth.js";
|
|
9
10
|
export { DEFAULT_WAIT_TIMEOUT_MS, MIN_POLL_INTERVAL_MS } from "./wait.js";
|
|
11
|
+
export { hashIssuedCredential } from "./issued-credential.js";
|
|
10
12
|
export * from "./models/index.js";
|
|
11
13
|
export type { CreateAssessmentRequest, GetAssessmentRequest, RecordAssessmentOutcomeRequest } from "./models/operations/index.js";
|
|
12
14
|
export { SDK_METADATA, ServerList, type SDKOptions } from "./lib/config.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,UAAU,EACV,WAAW,EACX,IAAI,EACJ,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,WAAW,GACjB,MAAM,aAAa,CAAC;AACrB,cAAc,aAAa,CAAC;AAC5B,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,wBAAwB,EACxB,yBAAyB,EACzB,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,SAAS,EACT,SAAS,EACT,WAAW,EACX,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,aAAa,EACb,YAAY,EACZ,UAAU,EACV,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,UAAU,EACV,WAAW,EACX,IAAI,EACJ,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,WAAW,GACjB,MAAM,aAAa,CAAC;AACrB,cAAc,aAAa,CAAC;AAC5B,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,wBAAwB,EACxB,yBAAyB,EACzB,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,0BAA0B,EAC1B,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,SAAS,EACT,SAAS,EACT,WAAW,EACX,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,aAAa,EACb,YAAY,EACZ,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,oBAAoB,GAC1B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,cAAc,mBAAmB,CAAC;AAClC,YAAY,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AAClI,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,KAAK,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACjF,YAAY,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/commonjs/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.NoResponseCore = exports.HTTPClient = exports.ServerList = exports.SDK_METADATA = exports.MIN_POLL_INTERVAL_MS = exports.DEFAULT_WAIT_TIMEOUT_MS = exports.fromWorkOS = exports.fromSupabase = exports.fromOryOAuth2 = exports.fromOry = exports.fromOIDC = exports.fromKeycloak = exports.fromFirebase = exports.fromEntra = exports.fromCognito = exports.fromClerk = exports.fromAuth0 = exports.DEFAULT_TOLERANCE_SECONDS = exports.WebhookVerificationError = exports.isExpiredEvent = exports.verificationResponse = exports.constructEvent = exports.DEFAULT_TIMEOUT_MS = exports.DEFAULT_BASE_URL = exports.Keys = exports.Assessments = exports.NoResponse = void 0;
|
|
17
|
+
exports.NoResponseCore = exports.HTTPClient = exports.ServerList = exports.SDK_METADATA = exports.hashIssuedCredential = exports.MIN_POLL_INTERVAL_MS = exports.DEFAULT_WAIT_TIMEOUT_MS = exports.fromWorkOS = exports.fromSupabase = exports.fromOryOAuth2 = exports.fromOry = exports.fromOIDC = exports.fromKeycloak = exports.fromFirebase = exports.fromEntra = exports.fromCognito = exports.fromClerk = exports.fromAuth0 = exports.DEFAULT_LATE_RESULT_POLICY = exports.ProviderActionError = exports.auth0Actions = exports.workosActions = exports.clerkActions = exports.lateResultAction = exports.handleLateResult = exports.DEFAULT_TOLERANCE_SECONDS = exports.WebhookVerificationError = exports.isExpiredEvent = exports.verificationResponse = exports.constructEvent = exports.DEFAULT_TIMEOUT_MS = exports.DEFAULT_BASE_URL = exports.Keys = exports.Assessments = exports.NoResponse = void 0;
|
|
18
18
|
/**
|
|
19
19
|
* @noresponse/node entry point. Hand-written (listed in .genignore); the
|
|
20
20
|
* generated client lives under ./sdk, ./funcs, ./models and ./lib.
|
|
@@ -32,6 +32,14 @@ Object.defineProperty(exports, "verificationResponse", { enumerable: true, get:
|
|
|
32
32
|
Object.defineProperty(exports, "isExpiredEvent", { enumerable: true, get: function () { return webhooks_js_1.isExpiredEvent; } });
|
|
33
33
|
Object.defineProperty(exports, "WebhookVerificationError", { enumerable: true, get: function () { return webhooks_js_1.WebhookVerificationError; } });
|
|
34
34
|
Object.defineProperty(exports, "DEFAULT_TOLERANCE_SECONDS", { enumerable: true, get: function () { return webhooks_js_1.DEFAULT_TOLERANCE_SECONDS; } });
|
|
35
|
+
const late_results_js_1 = require("./late-results.js");
|
|
36
|
+
Object.defineProperty(exports, "handleLateResult", { enumerable: true, get: function () { return late_results_js_1.handleLateResult; } });
|
|
37
|
+
Object.defineProperty(exports, "lateResultAction", { enumerable: true, get: function () { return late_results_js_1.lateResultAction; } });
|
|
38
|
+
Object.defineProperty(exports, "clerkActions", { enumerable: true, get: function () { return late_results_js_1.clerkActions; } });
|
|
39
|
+
Object.defineProperty(exports, "workosActions", { enumerable: true, get: function () { return late_results_js_1.workosActions; } });
|
|
40
|
+
Object.defineProperty(exports, "auth0Actions", { enumerable: true, get: function () { return late_results_js_1.auth0Actions; } });
|
|
41
|
+
Object.defineProperty(exports, "ProviderActionError", { enumerable: true, get: function () { return late_results_js_1.ProviderActionError; } });
|
|
42
|
+
Object.defineProperty(exports, "DEFAULT_LATE_RESULT_POLICY", { enumerable: true, get: function () { return late_results_js_1.DEFAULT_LATE_RESULT_POLICY; } });
|
|
35
43
|
const auth_js_1 = require("./auth.js");
|
|
36
44
|
Object.defineProperty(exports, "fromAuth0", { enumerable: true, get: function () { return auth_js_1.fromAuth0; } });
|
|
37
45
|
Object.defineProperty(exports, "fromClerk", { enumerable: true, get: function () { return auth_js_1.fromClerk; } });
|
|
@@ -47,6 +55,8 @@ Object.defineProperty(exports, "fromWorkOS", { enumerable: true, get: function (
|
|
|
47
55
|
const wait_js_1 = require("./wait.js");
|
|
48
56
|
Object.defineProperty(exports, "DEFAULT_WAIT_TIMEOUT_MS", { enumerable: true, get: function () { return wait_js_1.DEFAULT_WAIT_TIMEOUT_MS; } });
|
|
49
57
|
Object.defineProperty(exports, "MIN_POLL_INTERVAL_MS", { enumerable: true, get: function () { return wait_js_1.MIN_POLL_INTERVAL_MS; } });
|
|
58
|
+
const issued_credential_js_1 = require("./issued-credential.js");
|
|
59
|
+
Object.defineProperty(exports, "hashIssuedCredential", { enumerable: true, get: function () { return issued_credential_js_1.hashIssuedCredential; } });
|
|
50
60
|
__exportStar(require("./models/index.js"), exports);
|
|
51
61
|
const config_js_1 = require("./lib/config.js");
|
|
52
62
|
Object.defineProperty(exports, "SDK_METADATA", { enumerable: true, get: function () { return config_js_1.SDK_METADATA; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;GAGG;AACH,2CAaqB;AAZnB,uGAAA,UAAU,OAAA;AACV,wGAAA,WAAW,OAAA;AACX,iGAAA,IAAI,OAAA;AACJ,6GAAA,gBAAgB,OAAA;AAChB,+GAAA,kBAAkB,OAAA;AASpB,8CAA4B;AAC5B,+CAgBuB;AAfrB,6GAAA,cAAc,OAAA;AACd,mHAAA,oBAAoB,OAAA;AACpB,6GAAA,cAAc,OAAA;AACd,uHAAA,wBAAwB,OAAA;AACxB,wHAAA,yBAAyB,OAAA;AAY3B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;GAGG;AACH,2CAaqB;AAZnB,uGAAA,UAAU,OAAA;AACV,wGAAA,WAAW,OAAA;AACX,iGAAA,IAAI,OAAA;AACJ,6GAAA,gBAAgB,OAAA;AAChB,+GAAA,kBAAkB,OAAA;AASpB,8CAA4B;AAC5B,+CAgBuB;AAfrB,6GAAA,cAAc,OAAA;AACd,mHAAA,oBAAoB,OAAA;AACpB,6GAAA,cAAc,OAAA;AACd,uHAAA,wBAAwB,OAAA;AACxB,wHAAA,yBAAyB,OAAA;AAY3B,uDAgB2B;AAfzB,mHAAA,gBAAgB,OAAA;AAChB,mHAAA,gBAAgB,OAAA;AAChB,+GAAA,YAAY,OAAA;AACZ,gHAAA,aAAa,OAAA;AACb,+GAAA,YAAY,OAAA;AACZ,sHAAA,mBAAmB,OAAA;AACnB,6HAAA,0BAA0B,OAAA;AAU5B,uCAcmB;AAbjB,oGAAA,SAAS,OAAA;AACT,oGAAA,SAAS,OAAA;AACT,sGAAA,WAAW,OAAA;AACX,oGAAA,SAAS,OAAA;AACT,uGAAA,YAAY,OAAA;AACZ,uGAAA,YAAY,OAAA;AACZ,mGAAA,QAAQ,OAAA;AACR,kGAAA,OAAO,OAAA;AACP,wGAAA,aAAa,OAAA;AACb,uGAAA,YAAY,OAAA;AACZ,qGAAA,UAAU,OAAA;AAIZ,uCAA0E;AAAjE,kHAAA,uBAAuB,OAAA;AAAE,+GAAA,oBAAoB,OAAA;AACtD,iEAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAC7B,oDAAkC;AAElC,+CAA4E;AAAnE,yGAAA,YAAY,OAAA;AAAE,uGAAA,UAAU,OAAA;AACjC,2CAAiF;AAAxE,qGAAA,UAAU,OAAA;AAInB,uCAA2C;AAAlC,yGAAA,cAAc,OAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SHA-256 of an API key your signup gate issued to the new account, as 64
|
|
3
|
+
* lower-case hex characters. The key never leaves your backend: send only this
|
|
4
|
+
* hash, as `issuedCredential.sha256` on the assessment request. The key is
|
|
5
|
+
* hashed as its UTF-8 bytes exactly as given, with no trimming or
|
|
6
|
+
* normalisation. An empty key throws a TypeError.
|
|
7
|
+
*/
|
|
8
|
+
export declare function hashIssuedCredential(key: string): string;
|
|
9
|
+
//# sourceMappingURL=issued-credential.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issued-credential.d.ts","sourceRoot":"","sources":["../../src/issued-credential.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKxD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hashIssuedCredential = hashIssuedCredential;
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
/**
|
|
6
|
+
* SHA-256 of an API key your signup gate issued to the new account, as 64
|
|
7
|
+
* lower-case hex characters. The key never leaves your backend: send only this
|
|
8
|
+
* hash, as `issuedCredential.sha256` on the assessment request. The key is
|
|
9
|
+
* hashed as its UTF-8 bytes exactly as given, with no trimming or
|
|
10
|
+
* normalisation. An empty key throws a TypeError.
|
|
11
|
+
*/
|
|
12
|
+
function hashIssuedCredential(key) {
|
|
13
|
+
if (typeof key !== "string" || key.length === 0) {
|
|
14
|
+
throw new TypeError("issued key must be a non-empty string");
|
|
15
|
+
}
|
|
16
|
+
return (0, node_crypto_1.createHash)("sha256").update(key, "utf8").digest("hex");
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=issued-credential.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issued-credential.js","sourceRoot":"","sources":["../../src/issued-credential.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAEzC;;;;;;GAMG;AACH,8BAAqC,GAAW,EAAU;IACxD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,SAAS,CAAC,uCAAuC,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAAA,CAC/D"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Late-result handlers. Hand-written; not generated.
|
|
3
|
+
*
|
|
4
|
+
* An assessment can be revised after the signup was allowed: a slow source
|
|
5
|
+
* settles and the recommendation rises. NoResponse sends the new version as a
|
|
6
|
+
* signed assessment.updated webhook. handleLateResult verifies that delivery
|
|
7
|
+
* with constructEvent, picks an action from your policy, and acts through the
|
|
8
|
+
* auth provider's admin API: revoke the user's sessions or ban the user.
|
|
9
|
+
*
|
|
10
|
+
* The handler verifies the delivery itself, so it never acts on an unverified
|
|
11
|
+
* event. The provider calls are thin: you pass the credentials, and each
|
|
12
|
+
* action is the provider's documented admin endpoint.
|
|
13
|
+
*/
|
|
14
|
+
import { type ConstructEventOptions, type HeaderInput, type WebhookEvent, type WebhookSecrets } from "./webhooks.js";
|
|
15
|
+
/** What to do to the user. "ban" also ends every session. */
|
|
16
|
+
export type LateResultAction = "none" | "revoke_sessions" | "ban";
|
|
17
|
+
/** The action for each recommendation. A recommendation you leave out does nothing. */
|
|
18
|
+
export type LateResultPolicy = Readonly<Partial<Record<"allow" | "step_up" | "review", LateResultAction>>>;
|
|
19
|
+
/** Revoke sessions on review; do nothing on allow or step_up. Banning is opt-in. */
|
|
20
|
+
export declare const DEFAULT_LATE_RESULT_POLICY: LateResultPolicy;
|
|
21
|
+
/** The two admin actions, for one auth provider. Build one with clerkActions, workosActions or auth0Actions. */
|
|
22
|
+
export interface LateResultProvider {
|
|
23
|
+
readonly name: string;
|
|
24
|
+
/** End every active session of the user. */
|
|
25
|
+
revokeSessions(userId: string): Promise<void>;
|
|
26
|
+
/** Stop the user signing in again and end their sessions. */
|
|
27
|
+
ban(userId: string): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
export type LateResultOptions = ConstructEventOptions & {
|
|
30
|
+
/** Recommendation to action. Defaults to DEFAULT_LATE_RESULT_POLICY. */
|
|
31
|
+
policy?: LateResultPolicy;
|
|
32
|
+
/**
|
|
33
|
+
* The provider user id for the assessment's account_id. Defaults to the
|
|
34
|
+
* account_id itself, as when you assess with the provider's user id.
|
|
35
|
+
* Return null or undefined to take no action.
|
|
36
|
+
*/
|
|
37
|
+
userId?: (accountId: string, event: WebhookEvent) => string | null | undefined | Promise<string | null | undefined>;
|
|
38
|
+
};
|
|
39
|
+
export type LateResult = {
|
|
40
|
+
/** The verified event. Answer an endpoint.verification with verificationResponse(event). */
|
|
41
|
+
event: WebhookEvent;
|
|
42
|
+
/** The action taken. "none" when the policy, the event or the user id called for nothing. */
|
|
43
|
+
action: LateResultAction;
|
|
44
|
+
/** The provider user id acted on, when an action was taken. */
|
|
45
|
+
userId?: string;
|
|
46
|
+
};
|
|
47
|
+
/** Thrown when the provider's admin API refuses a call. Answer the webhook with a 5xx so NoResponse retries it. */
|
|
48
|
+
export declare class ProviderActionError extends Error {
|
|
49
|
+
readonly provider: string;
|
|
50
|
+
readonly status: number;
|
|
51
|
+
constructor(provider: string, status: number, message: string);
|
|
52
|
+
}
|
|
53
|
+
/** The action your policy names for a verified event. Only a served assessment with a recommendation can act. */
|
|
54
|
+
export declare function lateResultAction(event: WebhookEvent, policy?: LateResultPolicy): LateResultAction;
|
|
55
|
+
/**
|
|
56
|
+
* Verify a webhook delivery and apply your policy to it.
|
|
57
|
+
*
|
|
58
|
+
* `payload`, `headers`, `secrets` and the tolerance options are exactly what
|
|
59
|
+
* constructEvent takes; a delivery that fails verification throws
|
|
60
|
+
* WebhookVerificationError before any provider call. Deduplicate on
|
|
61
|
+
* `result.event.id` and ignore versions older than one you have acted on.
|
|
62
|
+
*/
|
|
63
|
+
export declare function handleLateResult(payload: Uint8Array | string, headers: HeaderInput, secrets: WebhookSecrets, provider: LateResultProvider, options?: LateResultOptions): Promise<LateResult>;
|
|
64
|
+
type Fetch = typeof fetch;
|
|
65
|
+
export type ClerkActionsOptions = {
|
|
66
|
+
/** Clerk secret key (sk_...). */
|
|
67
|
+
secretKey: string;
|
|
68
|
+
/** Default https://api.clerk.com/v1. */
|
|
69
|
+
baseUrl?: string;
|
|
70
|
+
fetch?: Fetch;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Clerk Backend API. revokeSessions lists the user's active sessions
|
|
74
|
+
* (GET /sessions?user_id&status=active) and revokes each
|
|
75
|
+
* (POST /sessions/{id}/revoke). ban is POST /users/{id}/ban, which revokes
|
|
76
|
+
* every session and blocks sign-in.
|
|
77
|
+
*/
|
|
78
|
+
export declare function clerkActions(options: ClerkActionsOptions): LateResultProvider;
|
|
79
|
+
export type WorkOSActionsOptions = {
|
|
80
|
+
/** WorkOS API key (sk_...). */
|
|
81
|
+
apiKey: string;
|
|
82
|
+
/** Default https://api.workos.com. */
|
|
83
|
+
baseUrl?: string;
|
|
84
|
+
fetch?: Fetch;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* WorkOS User Management. revokeSessions pages through
|
|
88
|
+
* GET /user_management/users/{id}/sessions and revokes each active one with
|
|
89
|
+
* POST /user_management/sessions/revoke. WorkOS has no block or ban, so ban
|
|
90
|
+
* revokes the sessions and then deletes the user
|
|
91
|
+
* (DELETE /user_management/users/{id}); deletion is permanent.
|
|
92
|
+
*/
|
|
93
|
+
export declare function workosActions(options: WorkOSActionsOptions): LateResultProvider;
|
|
94
|
+
export type Auth0ActionsOptions = {
|
|
95
|
+
/** Your Auth0 tenant domain, such as example.eu.auth0.com. The Management API is https://{domain}/api/v2. */
|
|
96
|
+
domain?: string;
|
|
97
|
+
/** The Management API base URL in place of domain. */
|
|
98
|
+
baseUrl?: string;
|
|
99
|
+
/** A Management API access token with update:users, delete:sessions and delete:refresh_tokens. */
|
|
100
|
+
token: string;
|
|
101
|
+
fetch?: Fetch;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Auth0 Management API. revokeSessions deletes every session
|
|
105
|
+
* (DELETE /users/{id}/sessions) and refresh token
|
|
106
|
+
* (DELETE /users/{id}/refresh-tokens). ban first sets blocked: true
|
|
107
|
+
* (PATCH /users/{id}), then does the same.
|
|
108
|
+
*/
|
|
109
|
+
export declare function auth0Actions(options: Auth0ActionsOptions): LateResultProvider;
|
|
110
|
+
export {};
|
|
111
|
+
//# sourceMappingURL=late-results.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"late-results.d.ts","sourceRoot":"","sources":["../../src/late-results.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAkB,KAAK,qBAAqB,EAAE,K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CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,kBAAkB,CAkB7E"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProviderActionError = exports.DEFAULT_LATE_RESULT_POLICY = void 0;
|
|
4
|
+
exports.lateResultAction = lateResultAction;
|
|
5
|
+
exports.handleLateResult = handleLateResult;
|
|
6
|
+
exports.clerkActions = clerkActions;
|
|
7
|
+
exports.workosActions = workosActions;
|
|
8
|
+
exports.auth0Actions = auth0Actions;
|
|
9
|
+
/**
|
|
10
|
+
* Late-result handlers. Hand-written; not generated.
|
|
11
|
+
*
|
|
12
|
+
* An assessment can be revised after the signup was allowed: a slow source
|
|
13
|
+
* settles and the recommendation rises. NoResponse sends the new version as a
|
|
14
|
+
* signed assessment.updated webhook. handleLateResult verifies that delivery
|
|
15
|
+
* with constructEvent, picks an action from your policy, and acts through the
|
|
16
|
+
* auth provider's admin API: revoke the user's sessions or ban the user.
|
|
17
|
+
*
|
|
18
|
+
* The handler verifies the delivery itself, so it never acts on an unverified
|
|
19
|
+
* event. The provider calls are thin: you pass the credentials, and each
|
|
20
|
+
* action is the provider's documented admin endpoint.
|
|
21
|
+
*/
|
|
22
|
+
const webhooks_js_1 = require("./webhooks.js");
|
|
23
|
+
/** Revoke sessions on review; do nothing on allow or step_up. Banning is opt-in. */
|
|
24
|
+
exports.DEFAULT_LATE_RESULT_POLICY = Object.freeze({ allow: "none", step_up: "none", review: "revoke_sessions" });
|
|
25
|
+
/** Thrown when the provider's admin API refuses a call. Answer the webhook with a 5xx so NoResponse retries it. */
|
|
26
|
+
class ProviderActionError extends Error {
|
|
27
|
+
provider;
|
|
28
|
+
status;
|
|
29
|
+
constructor(provider, status, message) {
|
|
30
|
+
super(message);
|
|
31
|
+
this.name = "ProviderActionError";
|
|
32
|
+
this.provider = provider;
|
|
33
|
+
this.status = status;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.ProviderActionError = ProviderActionError;
|
|
37
|
+
const ACTIONS = ["none", "revoke_sessions", "ban"];
|
|
38
|
+
/** The action your policy names for a verified event. Only a served assessment with a recommendation can act. */
|
|
39
|
+
function lateResultAction(event, policy = exports.DEFAULT_LATE_RESULT_POLICY) {
|
|
40
|
+
if (event.type !== "assessment.updated" || event.data.status === "expired")
|
|
41
|
+
return "none";
|
|
42
|
+
const data = event.data;
|
|
43
|
+
const recommendation = data.recommendation ?? data.risk?.recommendation;
|
|
44
|
+
if (recommendation !== "allow" && recommendation !== "step_up" && recommendation !== "review")
|
|
45
|
+
return "none";
|
|
46
|
+
const action = Object.prototype.hasOwnProperty.call(policy, recommendation) ? policy[recommendation] : undefined;
|
|
47
|
+
if (action === undefined)
|
|
48
|
+
return "none";
|
|
49
|
+
if (!ACTIONS.includes(action))
|
|
50
|
+
throw new TypeError(`unknown late result action ${String(action)}`);
|
|
51
|
+
return action;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Verify a webhook delivery and apply your policy to it.
|
|
55
|
+
*
|
|
56
|
+
* `payload`, `headers`, `secrets` and the tolerance options are exactly what
|
|
57
|
+
* constructEvent takes; a delivery that fails verification throws
|
|
58
|
+
* WebhookVerificationError before any provider call. Deduplicate on
|
|
59
|
+
* `result.event.id` and ignore versions older than one you have acted on.
|
|
60
|
+
*/
|
|
61
|
+
async function handleLateResult(payload, headers, secrets, provider, options = {}) {
|
|
62
|
+
const { policy, userId: resolve, ...verify } = options;
|
|
63
|
+
const event = (0, webhooks_js_1.constructEvent)(payload, headers, secrets, verify);
|
|
64
|
+
const action = lateResultAction(event, policy);
|
|
65
|
+
if (action === "none" || event.type !== "assessment.updated")
|
|
66
|
+
return { event, action: "none" };
|
|
67
|
+
const accountId = event.data.accountId;
|
|
68
|
+
const userId = resolve ? await resolve(accountId, event) : accountId;
|
|
69
|
+
if (userId === null || userId === undefined || userId === "")
|
|
70
|
+
return { event, action: "none" };
|
|
71
|
+
if (action === "ban")
|
|
72
|
+
await provider.ban(userId);
|
|
73
|
+
else
|
|
74
|
+
await provider.revokeSessions(userId);
|
|
75
|
+
return { event, action, userId };
|
|
76
|
+
}
|
|
77
|
+
function caller(name, baseUrl, authorization, fetcher) {
|
|
78
|
+
const base = baseUrl.replace(/\/+$/, "");
|
|
79
|
+
const run = fetcher ?? globalThis.fetch;
|
|
80
|
+
return async ({ method, path, query, body, allow404 }) => {
|
|
81
|
+
const url = new URL(base + path);
|
|
82
|
+
for (const [key, value] of Object.entries(query ?? {}))
|
|
83
|
+
url.searchParams.set(key, value);
|
|
84
|
+
const headers = { authorization, accept: "application/json" };
|
|
85
|
+
if (body !== undefined)
|
|
86
|
+
headers["content-type"] = "application/json";
|
|
87
|
+
const response = await run(url, { method, headers, ...(body !== undefined ? { body: JSON.stringify(body) } : {}) });
|
|
88
|
+
const text = await response.text();
|
|
89
|
+
if (allow404 && response.status === 404)
|
|
90
|
+
return undefined;
|
|
91
|
+
if (!response.ok)
|
|
92
|
+
throw new ProviderActionError(name, response.status, `${name} ${method} ${path} answered ${response.status}`);
|
|
93
|
+
if (!text)
|
|
94
|
+
return undefined;
|
|
95
|
+
try {
|
|
96
|
+
return JSON.parse(text);
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
const segment = (id) => {
|
|
104
|
+
if (typeof id !== "string" || id === "")
|
|
105
|
+
throw new TypeError("user id must be a non-empty string");
|
|
106
|
+
return encodeURIComponent(id);
|
|
107
|
+
};
|
|
108
|
+
function sessions(body) {
|
|
109
|
+
if (Array.isArray(body))
|
|
110
|
+
return body;
|
|
111
|
+
const data = body?.data;
|
|
112
|
+
return Array.isArray(data) ? data : [];
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Clerk Backend API. revokeSessions lists the user's active sessions
|
|
116
|
+
* (GET /sessions?user_id&status=active) and revokes each
|
|
117
|
+
* (POST /sessions/{id}/revoke). ban is POST /users/{id}/ban, which revokes
|
|
118
|
+
* every session and blocks sign-in.
|
|
119
|
+
*/
|
|
120
|
+
function clerkActions(options) {
|
|
121
|
+
if (!options?.secretKey)
|
|
122
|
+
throw new TypeError("clerkActions needs secretKey");
|
|
123
|
+
const call = caller("clerk", options.baseUrl ?? "https://api.clerk.com/v1", `Bearer ${options.secretKey}`, options.fetch);
|
|
124
|
+
const PAGE = 100;
|
|
125
|
+
return {
|
|
126
|
+
name: "clerk",
|
|
127
|
+
async revokeSessions(userId) {
|
|
128
|
+
segment(userId);
|
|
129
|
+
const active = [];
|
|
130
|
+
for (let offset = 0; offset < PAGE * 1000; offset += PAGE) {
|
|
131
|
+
const page = sessions(await call({ method: "GET", path: "/sessions", query: { user_id: userId, status: "active", limit: String(PAGE), offset: String(offset) } }));
|
|
132
|
+
for (const s of page)
|
|
133
|
+
if (s.status === "active" && typeof s.id === "string" && s.id)
|
|
134
|
+
active.push(s.id);
|
|
135
|
+
if (page.length < PAGE)
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
for (const id of active)
|
|
139
|
+
await call({ method: "POST", path: `/sessions/${encodeURIComponent(id)}/revoke` });
|
|
140
|
+
},
|
|
141
|
+
async ban(userId) {
|
|
142
|
+
await call({ method: "POST", path: `/users/${segment(userId)}/ban` });
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* WorkOS User Management. revokeSessions pages through
|
|
148
|
+
* GET /user_management/users/{id}/sessions and revokes each active one with
|
|
149
|
+
* POST /user_management/sessions/revoke. WorkOS has no block or ban, so ban
|
|
150
|
+
* revokes the sessions and then deletes the user
|
|
151
|
+
* (DELETE /user_management/users/{id}); deletion is permanent.
|
|
152
|
+
*/
|
|
153
|
+
function workosActions(options) {
|
|
154
|
+
if (!options?.apiKey)
|
|
155
|
+
throw new TypeError("workosActions needs apiKey");
|
|
156
|
+
const call = caller("workos", options.baseUrl ?? "https://api.workos.com", `Bearer ${options.apiKey}`, options.fetch);
|
|
157
|
+
const revokeSessions = async (userId) => {
|
|
158
|
+
const user = segment(userId);
|
|
159
|
+
const active = [];
|
|
160
|
+
let after;
|
|
161
|
+
for (let round = 0; round < 1000; round++) {
|
|
162
|
+
const query = { limit: "100" };
|
|
163
|
+
if (after)
|
|
164
|
+
query["after"] = after;
|
|
165
|
+
const body = (await call({ method: "GET", path: `/user_management/users/${user}/sessions`, query }));
|
|
166
|
+
for (const s of sessions(body))
|
|
167
|
+
if (s.status === "active" && typeof s.id === "string" && s.id)
|
|
168
|
+
active.push(s.id);
|
|
169
|
+
const next = body?.list_metadata?.after;
|
|
170
|
+
if (typeof next !== "string" || next === "")
|
|
171
|
+
break;
|
|
172
|
+
after = next;
|
|
173
|
+
}
|
|
174
|
+
for (const id of active)
|
|
175
|
+
await call({ method: "POST", path: "/user_management/sessions/revoke", body: { session_id: id } });
|
|
176
|
+
};
|
|
177
|
+
return {
|
|
178
|
+
name: "workos",
|
|
179
|
+
revokeSessions,
|
|
180
|
+
async ban(userId) {
|
|
181
|
+
await revokeSessions(userId);
|
|
182
|
+
await call({ method: "DELETE", path: `/user_management/users/${segment(userId)}`, allow404: true });
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Auth0 Management API. revokeSessions deletes every session
|
|
188
|
+
* (DELETE /users/{id}/sessions) and refresh token
|
|
189
|
+
* (DELETE /users/{id}/refresh-tokens). ban first sets blocked: true
|
|
190
|
+
* (PATCH /users/{id}), then does the same.
|
|
191
|
+
*/
|
|
192
|
+
function auth0Actions(options) {
|
|
193
|
+
if (!options?.token)
|
|
194
|
+
throw new TypeError("auth0Actions needs token");
|
|
195
|
+
const base = options.baseUrl ?? (options.domain ? `https://${options.domain}/api/v2` : undefined);
|
|
196
|
+
if (!base)
|
|
197
|
+
throw new TypeError("auth0Actions needs domain or baseUrl");
|
|
198
|
+
const call = caller("auth0", base, `Bearer ${options.token}`, options.fetch);
|
|
199
|
+
const revokeSessions = async (userId) => {
|
|
200
|
+
const user = segment(userId);
|
|
201
|
+
await call({ method: "DELETE", path: `/users/${user}/sessions` });
|
|
202
|
+
await call({ method: "DELETE", path: `/users/${user}/refresh-tokens` });
|
|
203
|
+
};
|
|
204
|
+
return {
|
|
205
|
+
name: "auth0",
|
|
206
|
+
revokeSessions,
|
|
207
|
+
async ban(userId) {
|
|
208
|
+
await call({ method: "PATCH", path: `/users/${segment(userId)}`, body: { blocked: true } });
|
|
209
|
+
await revokeSessions(userId);
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=late-results.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"late-results.js","sourceRoot":"","sources":["../../src/late-results.ts"],"names":[],"mappings":";;;;;;;;AAAA;;;;;;;;;;;;GAYG;AACH,+CAAqI;AAQrI,oFAAoF;AACvE,QAAA,0BAA0B,GAAqB,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;AA+BzI,mHAAmH;AACnH,yBAAiC,SAAQ,KAAK;IACnC,QAAQ,CAAS;IACjB,MAAM,CAAS;IACxB,YAAY,QAAgB,EAAE,MAAc,EAAE,OAAe,EAAE;QAC7D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IAAA,CACtB;CACF;;AAED,MAAM,OAAO,GAAsB,CAAC,MAAM,EAAE,iBAAiB,EAAE,KAAK,CAAC,CAAC;AAEtE,iHAAiH;AACjH,0BAAiC,KAAmB,EAAE,MAAM,GAAqB,QAAA,0BAA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,IAAI;QAAE,MAAM,IAAI,SAAS,CAAC,sCAAsC,CAAC,CAAC;IACvE,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,UAAU,OAAO,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAC7E,MAAM,cAAc,GAAG,KAAK,EAAE,MAAc,EAAiB,EAAE,CAAC;QAC9D,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAC7B,MAAM,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,IAAI,WAAW,EAAE,CAAC,CAAC;QAClE,MAAM,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,IAAI,iBAAiB,EAAE,CAAC,CAAC;IAAA,CACzE,CAAC;IACF,OAAO;QACL,IAAI,EAAE,OAAO;QACb,cAAc;QACd,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE;YAChB,MAAM,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;YAC5F,MAAM,cAAc,CAAC,MAAM,CAAC,CAAC;QAAA,CAC9B;KACF,CAAC;AAAA,CACH"}
|
|
@@ -31,8 +31,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
31
31
|
export declare const SDK_METADATA: {
|
|
32
32
|
readonly language: "typescript";
|
|
33
33
|
readonly openapiDocVersion: "1";
|
|
34
|
-
readonly sdkVersion: "2.0.
|
|
34
|
+
readonly sdkVersion: "2.0.12";
|
|
35
35
|
readonly genVersion: "internal";
|
|
36
|
-
readonly userAgent: "noresponse-sdk/typescript 2.0.
|
|
36
|
+
readonly userAgent: "noresponse-sdk/typescript 2.0.12 internal 1 @noresponse/node";
|
|
37
37
|
};
|
|
38
38
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -28,8 +28,8 @@ function serverURLFromOptions(options) {
|
|
|
28
28
|
exports.SDK_METADATA = {
|
|
29
29
|
language: "typescript",
|
|
30
30
|
openapiDocVersion: "1",
|
|
31
|
-
sdkVersion: "2.0.
|
|
31
|
+
sdkVersion: "2.0.12",
|
|
32
32
|
genVersion: "internal",
|
|
33
|
-
userAgent: "noresponse-sdk/typescript 2.0.
|
|
33
|
+
userAgent: "noresponse-sdk/typescript 2.0.12 internal 1 @noresponse/node",
|
|
34
34
|
};
|
|
35
35
|
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as z from "zod/v4-mini";
|
|
2
|
+
/**
|
|
3
|
+
* Optional. When the signup gate issues an API key to the new account, send SHA-256 of that key, so later usage of the key, or a leaked copy, ties back to this assessment. Each SDK has a helper that computes it. Send only the hash: customer keys are high-entropy, so the hash reveals nothing about them. The assessment stores it, and no response, webhook or log carries it.
|
|
4
|
+
*/
|
|
5
|
+
export type AssessmentRequestIssuedCredential = {
|
|
6
|
+
/**
|
|
7
|
+
* SHA-256 of the issued key's UTF-8 bytes, as 64 lower-case hex characters.
|
|
8
|
+
*/
|
|
9
|
+
sha256: string;
|
|
10
|
+
};
|
|
11
|
+
/** @internal */
|
|
12
|
+
export type AssessmentRequestIssuedCredential$Outbound = {
|
|
13
|
+
sha256: string;
|
|
14
|
+
};
|
|
15
|
+
/** @internal */
|
|
16
|
+
export declare const AssessmentRequestIssuedCredential$outboundSchema: z.ZodMiniType<AssessmentRequestIssuedCredential$Outbound, AssessmentRequestIssuedCredential>;
|
|
17
|
+
export declare function assessmentRequestIssuedCredentialToJSON(assessmentRequestIssuedCredential: AssessmentRequestIssuedCredential): string;
|
|
18
|
+
//# sourceMappingURL=assessment-request-issued-credential.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assessment-request-issued-credential.d.ts","sourceRoot":"","sources":["../../../src/models/assessment-request-issued-credential.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AAEjC;;GAEG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,gBAAgB;AAChB,MAAM,MAAM,0CAA0C,GAAG;IACvD,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,gDAAgD,EAAE,CAAC,CAAC,WAAW,CAC1E,0CAA0C,EAC1C,iCAAiC,CAGjC,CAAC;AAEH,wBAAgB,uCAAuC,CACrD,iCAAiC,EAAE,iCAAiC,GACnE,MAAM,CAMR"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.AssessmentRequestIssuedCredential$outboundSchema = void 0;
|
|
37
|
+
exports.assessmentRequestIssuedCredentialToJSON = assessmentRequestIssuedCredentialToJSON;
|
|
38
|
+
const z = __importStar(require("zod/v4-mini"));
|
|
39
|
+
/** @internal */
|
|
40
|
+
exports.AssessmentRequestIssuedCredential$outboundSchema = z.object({
|
|
41
|
+
sha256: z.string(),
|
|
42
|
+
});
|
|
43
|
+
function assessmentRequestIssuedCredentialToJSON(assessmentRequestIssuedCredential) {
|
|
44
|
+
return JSON.stringify(exports.AssessmentRequestIssuedCredential$outboundSchema.parse(assessmentRequestIssuedCredential));
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=assessment-request-issued-credential.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assessment-request-issued-credential.js","sourceRoot":"","sources":["../../../src/models/assessment-request-issued-credential.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,CAAC,wCAAoB;AAiBjC,gBAAgB;AACH,QAAA,gDAAgD,GAGzD,CAAC,CAAC,MAAM,CAAC;IACX,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;CACnB,CAAC,CAAC;AAEH,iDACE,iCAAoE,EAC5D;IACR,OAAO,IAAI,CAAC,SAAS,CACnB,QAAA,gDAAgD,CAAC,KAAK,CACpD,iCAAiC,CAClC,CACF,CAAC;AAAA,CACH"}
|