@trigger.dev/sdk 0.0.0-prerelease-20250211141853 → 0.0.0-prerelease-20250213143202
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/dist/commonjs/imports/uncrypto-cjs.cjs.map +1 -0
- package/dist/commonjs/imports/uncrypto.d.ts +1 -0
- package/dist/commonjs/imports/uncrypto.js +7 -0
- package/dist/commonjs/v3/index.d.ts +2 -2
- package/dist/commonjs/v3/index.js +3 -2
- package/dist/commonjs/v3/index.js.map +1 -1
- package/dist/commonjs/v3/runs.d.ts +16 -16
- package/dist/commonjs/v3/webhooks.d.ts +47 -0
- package/dist/commonjs/v3/webhooks.js +110 -0
- package/dist/commonjs/v3/webhooks.js.map +1 -0
- package/dist/commonjs/version.js +1 -1
- package/dist/esm/apiClient.d.ts +146 -146
- package/dist/esm/imports/uncrypto.d.ts +2 -0
- package/dist/esm/imports/uncrypto.js +5 -0
- package/dist/esm/imports/uncrypto.js.map +1 -0
- package/dist/esm/io.d.ts +12 -12
- package/dist/esm/status.d.ts +4 -4
- package/dist/esm/triggerClient.d.ts +40 -40
- package/dist/esm/triggers/notifications.d.ts +8 -8
- package/dist/esm/triggers/scheduled.d.ts +2 -2
- package/dist/esm/types.d.ts +2 -2
- package/dist/esm/v3/index.d.ts +2 -2
- package/dist/esm/v3/index.js +2 -2
- package/dist/esm/v3/index.js.map +1 -1
- package/dist/esm/v3/runs.d.ts +19 -19
- package/dist/esm/v3/webhooks.d.ts +47 -0
- package/dist/esm/v3/webhooks.js +106 -0
- package/dist/esm/v3/webhooks.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uncrypto-cjs.cjs","sourceRoot":"","sources":["../../../src/imports/uncrypto-cjs.cts"],"names":[],"mappings":";;AAAA,aAAa;AACb,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEvC,aAAa;AACb,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -11,12 +11,12 @@ export * from "./idempotencyKeys.js";
|
|
|
11
11
|
export * from "./tags.js";
|
|
12
12
|
export * from "./metadata.js";
|
|
13
13
|
export * from "./timeout.js";
|
|
14
|
-
export * from "./
|
|
14
|
+
export * from "./webhooks.js";
|
|
15
15
|
export type { Context };
|
|
16
16
|
import type { Context } from "./shared.js";
|
|
17
17
|
import type { ApiClientConfiguration } from "@trigger.dev/core/v3";
|
|
18
18
|
export type { ApiClientConfiguration };
|
|
19
|
-
export { ApiError, AuthenticationError, BadRequestError, ConflictError, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, UnprocessableEntityError, AbortTaskRunError, logger, type LogLevel, } from "@trigger.dev/core/v3";
|
|
19
|
+
export { ApiError, AuthenticationError, BadRequestError, ConflictError, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, UnprocessableEntityError, AbortTaskRunError, OutOfMemoryError, logger, type LogLevel, } from "@trigger.dev/core/v3";
|
|
20
20
|
export { runs, type RunShape, type AnyRunShape, type TaskRunShape, type RealtimeRun, type AnyRealtimeRun, type RetrieveRunResult, type AnyRetrieveRunResult, } from "./runs.js";
|
|
21
21
|
export * as schedules from "./schedules/index.js";
|
|
22
22
|
export * as envvars from "./envvars.js";
|
|
@@ -26,7 +26,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
26
26
|
return result;
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.auth = exports.configure = exports.envvars = exports.schedules = exports.runs = exports.logger = exports.AbortTaskRunError = exports.UnprocessableEntityError = exports.RateLimitError = exports.PermissionDeniedError = exports.NotFoundError = exports.InternalServerError = exports.ConflictError = exports.BadRequestError = exports.AuthenticationError = exports.ApiError = exports.queue = exports.retry = void 0;
|
|
29
|
+
exports.auth = exports.configure = exports.envvars = exports.schedules = exports.runs = exports.logger = exports.OutOfMemoryError = exports.AbortTaskRunError = exports.UnprocessableEntityError = exports.RateLimitError = exports.PermissionDeniedError = exports.NotFoundError = exports.InternalServerError = exports.ConflictError = exports.BadRequestError = exports.AuthenticationError = exports.ApiError = exports.queue = exports.retry = void 0;
|
|
30
30
|
__exportStar(require("./cache.js"), exports);
|
|
31
31
|
__exportStar(require("./config.js"), exports);
|
|
32
32
|
var retry_js_1 = require("./retry.js");
|
|
@@ -42,7 +42,7 @@ __exportStar(require("./idempotencyKeys.js"), exports);
|
|
|
42
42
|
__exportStar(require("./tags.js"), exports);
|
|
43
43
|
__exportStar(require("./metadata.js"), exports);
|
|
44
44
|
__exportStar(require("./timeout.js"), exports);
|
|
45
|
-
__exportStar(require("./
|
|
45
|
+
__exportStar(require("./webhooks.js"), exports);
|
|
46
46
|
var v3_1 = require("@trigger.dev/core/v3");
|
|
47
47
|
Object.defineProperty(exports, "ApiError", { enumerable: true, get: function () { return v3_1.ApiError; } });
|
|
48
48
|
Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return v3_1.AuthenticationError; } });
|
|
@@ -54,6 +54,7 @@ Object.defineProperty(exports, "PermissionDeniedError", { enumerable: true, get:
|
|
|
54
54
|
Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return v3_1.RateLimitError; } });
|
|
55
55
|
Object.defineProperty(exports, "UnprocessableEntityError", { enumerable: true, get: function () { return v3_1.UnprocessableEntityError; } });
|
|
56
56
|
Object.defineProperty(exports, "AbortTaskRunError", { enumerable: true, get: function () { return v3_1.AbortTaskRunError; } });
|
|
57
|
+
Object.defineProperty(exports, "OutOfMemoryError", { enumerable: true, get: function () { return v3_1.OutOfMemoryError; } });
|
|
57
58
|
Object.defineProperty(exports, "logger", { enumerable: true, get: function () { return v3_1.logger; } });
|
|
58
59
|
var runs_js_1 = require("./runs.js");
|
|
59
60
|
Object.defineProperty(exports, "runs", { enumerable: true, get: function () { return runs_js_1.runs; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/v3/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,8CAA4B;AAC5B,uCAAsD;AAA7C,iGAAA,KAAK,OAAA;AACd,yCAAoC;AAA3B,kGAAA,KAAK,OAAA;AACd,6CAA2B;AAC3B,6CAA2B;AAC3B,4CAA0B;AAC1B,iDAA+B;AAC/B,6CAA2B;AAC3B,uDAAqC;AACrC,4CAA0B;AAC1B,gDAA8B;AAC9B,+CAA6B;AAC7B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/v3/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,8CAA4B;AAC5B,uCAAsD;AAA7C,iGAAA,KAAK,OAAA;AACd,yCAAoC;AAA3B,kGAAA,KAAK,OAAA;AACd,6CAA2B;AAC3B,6CAA2B;AAC3B,4CAA0B;AAC1B,iDAA+B;AAC/B,6CAA2B;AAC3B,uDAAqC;AACrC,4CAA0B;AAC1B,gDAA8B;AAC9B,+CAA6B;AAC7B,gDAA8B;AAS9B,2CAc8B;AAb5B,8FAAA,QAAQ,OAAA;AACR,yGAAA,mBAAmB,OAAA;AACnB,qGAAA,eAAe,OAAA;AACf,mGAAA,aAAa,OAAA;AACb,yGAAA,mBAAmB,OAAA;AACnB,mGAAA,aAAa,OAAA;AACb,2GAAA,qBAAqB,OAAA;AACrB,oGAAA,cAAc,OAAA;AACd,8GAAA,wBAAwB,OAAA;AACxB,uGAAA,iBAAiB,OAAA;AACjB,sGAAA,gBAAgB,OAAA;AAChB,4FAAA,MAAM,OAAA;AAIR,qCASmB;AARjB,+FAAA,IAAI,OAAA;AASN,kEAAkD;AAClD,wDAAwC;AAGxC,qCAA4C;AAAnC,oGAAA,SAAS,OAAA;AAAE,+FAAA,IAAI,OAAA"}
|
|
@@ -48,14 +48,13 @@ declare function poll<TRunId extends AnyRunHandle | AnyTask | string>(runId: Run
|
|
|
48
48
|
durationMs: number;
|
|
49
49
|
costInCents: number;
|
|
50
50
|
baseCostInCents: number;
|
|
51
|
-
attemptCount: number;
|
|
52
51
|
relatedRuns: {
|
|
53
52
|
root?: {
|
|
54
53
|
status: "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "COMPLETED" | "CANCELED" | "FAILED" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED" | "TIMED_OUT";
|
|
55
54
|
id: string;
|
|
56
|
-
tags: string[];
|
|
57
|
-
isTest: boolean;
|
|
58
55
|
createdAt: Date;
|
|
56
|
+
isTest: boolean;
|
|
57
|
+
tags: string[];
|
|
59
58
|
durationMs: number;
|
|
60
59
|
costInCents: number;
|
|
61
60
|
baseCostInCents: number;
|
|
@@ -69,9 +68,9 @@ declare function poll<TRunId extends AnyRunHandle | AnyTask | string>(runId: Run
|
|
|
69
68
|
isFailed: boolean;
|
|
70
69
|
isCancelled: boolean;
|
|
71
70
|
updatedAt: Date;
|
|
71
|
+
version?: string | undefined;
|
|
72
72
|
startedAt?: Date | undefined;
|
|
73
73
|
idempotencyKey?: string | undefined;
|
|
74
|
-
version?: string | undefined;
|
|
75
74
|
metadata?: Record<string, any> | undefined;
|
|
76
75
|
ttl?: string | undefined;
|
|
77
76
|
batchId?: string | undefined;
|
|
@@ -82,9 +81,9 @@ declare function poll<TRunId extends AnyRunHandle | AnyTask | string>(runId: Run
|
|
|
82
81
|
parent?: {
|
|
83
82
|
status: "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "COMPLETED" | "CANCELED" | "FAILED" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED" | "TIMED_OUT";
|
|
84
83
|
id: string;
|
|
85
|
-
tags: string[];
|
|
86
|
-
isTest: boolean;
|
|
87
84
|
createdAt: Date;
|
|
85
|
+
isTest: boolean;
|
|
86
|
+
tags: string[];
|
|
88
87
|
durationMs: number;
|
|
89
88
|
costInCents: number;
|
|
90
89
|
baseCostInCents: number;
|
|
@@ -98,9 +97,9 @@ declare function poll<TRunId extends AnyRunHandle | AnyTask | string>(runId: Run
|
|
|
98
97
|
isFailed: boolean;
|
|
99
98
|
isCancelled: boolean;
|
|
100
99
|
updatedAt: Date;
|
|
100
|
+
version?: string | undefined;
|
|
101
101
|
startedAt?: Date | undefined;
|
|
102
102
|
idempotencyKey?: string | undefined;
|
|
103
|
-
version?: string | undefined;
|
|
104
103
|
metadata?: Record<string, any> | undefined;
|
|
105
104
|
ttl?: string | undefined;
|
|
106
105
|
batchId?: string | undefined;
|
|
@@ -111,9 +110,9 @@ declare function poll<TRunId extends AnyRunHandle | AnyTask | string>(runId: Run
|
|
|
111
110
|
children?: {
|
|
112
111
|
status: "WAITING_FOR_DEPLOY" | "QUEUED" | "EXECUTING" | "REATTEMPTING" | "FROZEN" | "COMPLETED" | "CANCELED" | "FAILED" | "CRASHED" | "INTERRUPTED" | "SYSTEM_FAILURE" | "DELAYED" | "EXPIRED" | "TIMED_OUT";
|
|
113
112
|
id: string;
|
|
114
|
-
tags: string[];
|
|
115
|
-
isTest: boolean;
|
|
116
113
|
createdAt: Date;
|
|
114
|
+
isTest: boolean;
|
|
115
|
+
tags: string[];
|
|
117
116
|
durationMs: number;
|
|
118
117
|
costInCents: number;
|
|
119
118
|
baseCostInCents: number;
|
|
@@ -127,9 +126,9 @@ declare function poll<TRunId extends AnyRunHandle | AnyTask | string>(runId: Run
|
|
|
127
126
|
isFailed: boolean;
|
|
128
127
|
isCancelled: boolean;
|
|
129
128
|
updatedAt: Date;
|
|
129
|
+
version?: string | undefined;
|
|
130
130
|
startedAt?: Date | undefined;
|
|
131
131
|
idempotencyKey?: string | undefined;
|
|
132
|
-
version?: string | undefined;
|
|
133
132
|
metadata?: Record<string, any> | undefined;
|
|
134
133
|
ttl?: string | undefined;
|
|
135
134
|
batchId?: string | undefined;
|
|
@@ -152,25 +151,26 @@ declare function poll<TRunId extends AnyRunHandle | AnyTask | string>(runId: Run
|
|
|
152
151
|
id: string;
|
|
153
152
|
createdAt: Date;
|
|
154
153
|
updatedAt: Date;
|
|
155
|
-
startedAt?: Date | undefined;
|
|
156
154
|
error?: {
|
|
157
155
|
message: string;
|
|
158
156
|
name?: string | undefined;
|
|
159
157
|
stackTrace?: string | undefined;
|
|
160
158
|
} | undefined;
|
|
159
|
+
startedAt?: Date | undefined;
|
|
161
160
|
completedAt?: Date | undefined;
|
|
162
161
|
} | undefined)[];
|
|
162
|
+
attemptCount: number;
|
|
163
|
+
error?: {
|
|
164
|
+
message: string;
|
|
165
|
+
name?: string | undefined;
|
|
166
|
+
stackTrace?: string | undefined;
|
|
167
|
+
} | undefined;
|
|
163
168
|
startedAt?: Date | undefined;
|
|
164
169
|
idempotencyKey?: string | undefined;
|
|
165
170
|
metadata?: Record<string, any> | undefined;
|
|
166
171
|
ttl?: string | undefined;
|
|
167
172
|
payloadPresignedUrl?: string | undefined;
|
|
168
173
|
outputPresignedUrl?: string | undefined;
|
|
169
|
-
error?: {
|
|
170
|
-
message: string;
|
|
171
|
-
name?: string | undefined;
|
|
172
|
-
stackTrace?: string | undefined;
|
|
173
|
-
} | undefined;
|
|
174
174
|
batchId?: string | undefined;
|
|
175
175
|
finishedAt?: Date | undefined;
|
|
176
176
|
delayedUntil?: Date | undefined;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Webhook } from "@trigger.dev/core/v3";
|
|
2
|
+
/**
|
|
3
|
+
* The type of error thrown when a webhook fails to parse or verify
|
|
4
|
+
*/
|
|
5
|
+
export declare class WebhookError extends Error {
|
|
6
|
+
constructor(message: string);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Options for constructing a webhook event
|
|
10
|
+
*/
|
|
11
|
+
type ConstructEventOptions = {
|
|
12
|
+
/** Raw payload as string or Buffer */
|
|
13
|
+
payload: string | Buffer;
|
|
14
|
+
/** Signature header as string, Buffer, or string array */
|
|
15
|
+
header: string | Buffer | Array<string>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Interface describing the webhook utilities
|
|
19
|
+
*/
|
|
20
|
+
interface Webhooks {
|
|
21
|
+
/**
|
|
22
|
+
* Constructs and validates a webhook event from an incoming request
|
|
23
|
+
* @param request - Either a Request object or ConstructEventOptions containing the payload and signature
|
|
24
|
+
* @param secret - Secret key used to verify the webhook signature
|
|
25
|
+
* @returns Promise resolving to a validated AlertWebhook object
|
|
26
|
+
* @throws {WebhookError} If validation fails or payload can't be parsed
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* // Using with Request object
|
|
30
|
+
* const event = await webhooks.constructEvent(request, "webhook_secret");
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* // Using with manual options
|
|
34
|
+
* const event = await webhooks.constructEvent({
|
|
35
|
+
* payload: rawBody,
|
|
36
|
+
* header: signatureHeader
|
|
37
|
+
* }, "webhook_secret");
|
|
38
|
+
*/
|
|
39
|
+
constructEvent(request: ConstructEventOptions | Request, secret: string): Promise<Webhook>;
|
|
40
|
+
/** Header name used for webhook signatures */
|
|
41
|
+
SIGNATURE_HEADER_NAME: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Webhook utilities for handling incoming webhook requests
|
|
45
|
+
*/
|
|
46
|
+
export declare const webhooks: Webhooks;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.webhooks = exports.WebhookError = void 0;
|
|
4
|
+
const v3_1 = require("@trigger.dev/core/v3");
|
|
5
|
+
const uncrypto_js_1 = require("../imports/uncrypto.js");
|
|
6
|
+
/**
|
|
7
|
+
* The type of error thrown when a webhook fails to parse or verify
|
|
8
|
+
*/
|
|
9
|
+
class WebhookError extends Error {
|
|
10
|
+
constructor(message) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = "WebhookError";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.WebhookError = WebhookError;
|
|
16
|
+
/** Header name used for webhook signatures */
|
|
17
|
+
const SIGNATURE_HEADER_NAME = "x-trigger-signature-hmacsha256";
|
|
18
|
+
/**
|
|
19
|
+
* Webhook utilities for handling incoming webhook requests
|
|
20
|
+
*/
|
|
21
|
+
exports.webhooks = {
|
|
22
|
+
constructEvent,
|
|
23
|
+
SIGNATURE_HEADER_NAME,
|
|
24
|
+
};
|
|
25
|
+
async function constructEvent(request, secret) {
|
|
26
|
+
let payload;
|
|
27
|
+
let signature;
|
|
28
|
+
if (request instanceof Request) {
|
|
29
|
+
if (!secret) {
|
|
30
|
+
throw new WebhookError("Secret is required when passing a Request object");
|
|
31
|
+
}
|
|
32
|
+
const signatureHeader = request.headers.get(SIGNATURE_HEADER_NAME);
|
|
33
|
+
if (!signatureHeader) {
|
|
34
|
+
throw new WebhookError("No signature header found");
|
|
35
|
+
}
|
|
36
|
+
signature = signatureHeader;
|
|
37
|
+
payload = await request.text();
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
payload = request.payload.toString();
|
|
41
|
+
if (Array.isArray(request.header)) {
|
|
42
|
+
throw new WebhookError("Signature header cannot be an array");
|
|
43
|
+
}
|
|
44
|
+
signature = request.header.toString();
|
|
45
|
+
}
|
|
46
|
+
// Verify the signature
|
|
47
|
+
const isValid = await verifySignature(payload, signature, secret);
|
|
48
|
+
if (!isValid) {
|
|
49
|
+
throw new WebhookError("Invalid signature");
|
|
50
|
+
}
|
|
51
|
+
// Parse and validate the payload
|
|
52
|
+
try {
|
|
53
|
+
const jsonPayload = JSON.parse(payload);
|
|
54
|
+
const parsedPayload = v3_1.Webhook.parse(jsonPayload);
|
|
55
|
+
return parsedPayload;
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
if (error instanceof Error) {
|
|
59
|
+
throw new WebhookError(`Webhook parsing failed: ${error.message}`);
|
|
60
|
+
}
|
|
61
|
+
throw new WebhookError("Webhook parsing failed");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Verifies the signature of a webhook payload
|
|
66
|
+
* @param payload - Raw payload string to verify
|
|
67
|
+
* @param signature - Expected signature to check against
|
|
68
|
+
* @param secret - Secret key used to generate the signature
|
|
69
|
+
* @returns Promise resolving to boolean indicating if signature is valid
|
|
70
|
+
* @throws {WebhookError} If signature verification process fails
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* const isValid = await verifySignature(
|
|
74
|
+
* '{"event": "test"}',
|
|
75
|
+
* "abc123signature",
|
|
76
|
+
* "webhook_secret"
|
|
77
|
+
* );
|
|
78
|
+
*/
|
|
79
|
+
async function verifySignature(payload, signature, secret) {
|
|
80
|
+
try {
|
|
81
|
+
if (!secret) {
|
|
82
|
+
throw new WebhookError("Secret is required for signature verification");
|
|
83
|
+
}
|
|
84
|
+
// Convert the payload and secret to buffers
|
|
85
|
+
const hashPayload = Buffer.from(payload, "utf-8");
|
|
86
|
+
const hmacSecret = Buffer.from(secret, "utf-8");
|
|
87
|
+
// Import the secret key
|
|
88
|
+
const key = await uncrypto_js_1.subtle.importKey("raw", hmacSecret, { name: "HMAC", hash: "SHA-256" }, false, ["sign", "verify"]);
|
|
89
|
+
// Calculate the expected signature
|
|
90
|
+
const actualSignature = await uncrypto_js_1.subtle.sign("HMAC", key, hashPayload);
|
|
91
|
+
const actualSignatureHex = Buffer.from(actualSignature).toString("hex");
|
|
92
|
+
// Compare signatures using timing-safe comparison
|
|
93
|
+
return timingSafeEqual(signature, actualSignatureHex);
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
throw new WebhookError("Signature verification failed");
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// Timing-safe comparison to prevent timing attacks
|
|
100
|
+
function timingSafeEqual(a, b) {
|
|
101
|
+
if (a.length !== b.length) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
let result = 0;
|
|
105
|
+
for (let i = 0; i < a.length; i++) {
|
|
106
|
+
result |= a.charCodeAt(i) ^ b.charCodeAt(i);
|
|
107
|
+
}
|
|
108
|
+
return result === 0;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=webhooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../../../src/v3/webhooks.ts"],"names":[],"mappings":";;;AAAA,6CAA+C;AAC/C,wDAAgD;AAEhD;;GAEG;AACH,MAAa,YAAa,SAAQ,KAAK;IACrC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AALD,oCAKC;AAED,8CAA8C;AAC9C,MAAM,qBAAqB,GAAG,gCAAgC,CAAC;AAwC/D;;GAEG;AACU,QAAA,QAAQ,GAAa;IAChC,cAAc;IACd,qBAAqB;CACtB,CAAC;AAEF,KAAK,UAAU,cAAc,CAC3B,OAAwC,EACxC,MAAc;IAEd,IAAI,OAAe,CAAC;IACpB,IAAI,SAAiB,CAAC;IAEtB,IAAI,OAAO,YAAY,OAAO,EAAE,CAAC;QAC/B,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,YAAY,CAAC,kDAAkD,CAAC,CAAC;QAC7E,CAAC;QAED,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;QACnE,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,MAAM,IAAI,YAAY,CAAC,2BAA2B,CAAC,CAAC;QACtD,CAAC;QACD,SAAS,GAAG,eAAe,CAAC;QAE5B,OAAO,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE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