@dodopayments/express 0.2.4 → 0.2.5

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/index.cjs CHANGED
@@ -7508,6 +7508,32 @@ var buildCheckoutUrl = async ({
7508
7508
  }
7509
7509
  };
7510
7510
 
7511
+ var __create = Object.create;
7512
+ var __defProp = Object.defineProperty;
7513
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7514
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7515
+ var __getProtoOf = Object.getPrototypeOf;
7516
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7517
+ var __commonJS = (cb, mod) => function __require2() {
7518
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
7519
+ };
7520
+ var __copyProps = (to, from, except, desc) => {
7521
+ if (from && typeof from === "object" || typeof from === "function") {
7522
+ for (let key of __getOwnPropNames(from))
7523
+ if (!__hasOwnProp.call(to, key) && key !== except)
7524
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
7525
+ }
7526
+ return to;
7527
+ };
7528
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
7529
+ // If the importer is in node compatibility mode or this is not an ESM
7530
+ // file that has been converted to a CommonJS file using a Babel-
7531
+ // compatible transform (i.e. "__esModule" has not been set), then set
7532
+ // "default" to the CommonJS "module.exports" for node compatibility.
7533
+ __defProp(target, "default", { value: mod, enumerable: true }) ,
7534
+ mod
7535
+ ));
7536
+
7511
7537
  function checkoutHandler(config) {
7512
7538
  const getHandler = async (req, res) => {
7513
7539
  const queryParams = req.query;
@@ -7966,6 +7992,675 @@ var WebhookPayloadSchema = discriminatedUnionType("type", [
7966
7992
  LicenseKeyCreatedPayloadSchema
7967
7993
  ]);
7968
7994
 
7995
+ // ../../node_modules/@stablelib/base64/lib/base64.js
7996
+ var require_base64 = __commonJS({
7997
+ "../../node_modules/@stablelib/base64/lib/base64.js"(exports) {
7998
+ var __extends = exports && exports.__extends || /* @__PURE__ */ function() {
7999
+ var extendStatics = function(d, b) {
8000
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
8001
+ d2.__proto__ = b2;
8002
+ } || function(d2, b2) {
8003
+ for (var p in b2) if (b2.hasOwnProperty(p)) d2[p] = b2[p];
8004
+ };
8005
+ return extendStatics(d, b);
8006
+ };
8007
+ return function(d, b) {
8008
+ extendStatics(d, b);
8009
+ function __() {
8010
+ this.constructor = d;
8011
+ }
8012
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
8013
+ };
8014
+ }();
8015
+ Object.defineProperty(exports, "__esModule", { value: true });
8016
+ var INVALID_BYTE = 256;
8017
+ var Coder = (
8018
+ /** @class */
8019
+ function() {
8020
+ function Coder2(_paddingCharacter) {
8021
+ if (_paddingCharacter === void 0) {
8022
+ _paddingCharacter = "=";
8023
+ }
8024
+ this._paddingCharacter = _paddingCharacter;
8025
+ }
8026
+ Coder2.prototype.encodedLength = function(length) {
8027
+ if (!this._paddingCharacter) {
8028
+ return (length * 8 + 5) / 6 | 0;
8029
+ }
8030
+ return (length + 2) / 3 * 4 | 0;
8031
+ };
8032
+ Coder2.prototype.encode = function(data) {
8033
+ var out = "";
8034
+ var i = 0;
8035
+ for (; i < data.length - 2; i += 3) {
8036
+ var c = data[i] << 16 | data[i + 1] << 8 | data[i + 2];
8037
+ out += this._encodeByte(c >>> 3 * 6 & 63);
8038
+ out += this._encodeByte(c >>> 2 * 6 & 63);
8039
+ out += this._encodeByte(c >>> 1 * 6 & 63);
8040
+ out += this._encodeByte(c >>> 0 * 6 & 63);
8041
+ }
8042
+ var left = data.length - i;
8043
+ if (left > 0) {
8044
+ var c = data[i] << 16 | (left === 2 ? data[i + 1] << 8 : 0);
8045
+ out += this._encodeByte(c >>> 3 * 6 & 63);
8046
+ out += this._encodeByte(c >>> 2 * 6 & 63);
8047
+ if (left === 2) {
8048
+ out += this._encodeByte(c >>> 1 * 6 & 63);
8049
+ } else {
8050
+ out += this._paddingCharacter || "";
8051
+ }
8052
+ out += this._paddingCharacter || "";
8053
+ }
8054
+ return out;
8055
+ };
8056
+ Coder2.prototype.maxDecodedLength = function(length) {
8057
+ if (!this._paddingCharacter) {
8058
+ return (length * 6 + 7) / 8 | 0;
8059
+ }
8060
+ return length / 4 * 3 | 0;
8061
+ };
8062
+ Coder2.prototype.decodedLength = function(s) {
8063
+ return this.maxDecodedLength(s.length - this._getPaddingLength(s));
8064
+ };
8065
+ Coder2.prototype.decode = function(s) {
8066
+ if (s.length === 0) {
8067
+ return new Uint8Array(0);
8068
+ }
8069
+ var paddingLength = this._getPaddingLength(s);
8070
+ var length = s.length - paddingLength;
8071
+ var out = new Uint8Array(this.maxDecodedLength(length));
8072
+ var op = 0;
8073
+ var i = 0;
8074
+ var haveBad = 0;
8075
+ var v0 = 0, v1 = 0, v2 = 0, v3 = 0;
8076
+ for (; i < length - 4; i += 4) {
8077
+ v0 = this._decodeChar(s.charCodeAt(i + 0));
8078
+ v1 = this._decodeChar(s.charCodeAt(i + 1));
8079
+ v2 = this._decodeChar(s.charCodeAt(i + 2));
8080
+ v3 = this._decodeChar(s.charCodeAt(i + 3));
8081
+ out[op++] = v0 << 2 | v1 >>> 4;
8082
+ out[op++] = v1 << 4 | v2 >>> 2;
8083
+ out[op++] = v2 << 6 | v3;
8084
+ haveBad |= v0 & INVALID_BYTE;
8085
+ haveBad |= v1 & INVALID_BYTE;
8086
+ haveBad |= v2 & INVALID_BYTE;
8087
+ haveBad |= v3 & INVALID_BYTE;
8088
+ }
8089
+ if (i < length - 1) {
8090
+ v0 = this._decodeChar(s.charCodeAt(i));
8091
+ v1 = this._decodeChar(s.charCodeAt(i + 1));
8092
+ out[op++] = v0 << 2 | v1 >>> 4;
8093
+ haveBad |= v0 & INVALID_BYTE;
8094
+ haveBad |= v1 & INVALID_BYTE;
8095
+ }
8096
+ if (i < length - 2) {
8097
+ v2 = this._decodeChar(s.charCodeAt(i + 2));
8098
+ out[op++] = v1 << 4 | v2 >>> 2;
8099
+ haveBad |= v2 & INVALID_BYTE;
8100
+ }
8101
+ if (i < length - 3) {
8102
+ v3 = this._decodeChar(s.charCodeAt(i + 3));
8103
+ out[op++] = v2 << 6 | v3;
8104
+ haveBad |= v3 & INVALID_BYTE;
8105
+ }
8106
+ if (haveBad !== 0) {
8107
+ throw new Error("Base64Coder: incorrect characters for decoding");
8108
+ }
8109
+ return out;
8110
+ };
8111
+ Coder2.prototype._encodeByte = function(b) {
8112
+ var result = b;
8113
+ result += 65;
8114
+ result += 25 - b >>> 8 & 0 - 65 - 26 + 97;
8115
+ result += 51 - b >>> 8 & 26 - 97 - 52 + 48;
8116
+ result += 61 - b >>> 8 & 52 - 48 - 62 + 43;
8117
+ result += 62 - b >>> 8 & 62 - 43 - 63 + 47;
8118
+ return String.fromCharCode(result);
8119
+ };
8120
+ Coder2.prototype._decodeChar = function(c) {
8121
+ var result = INVALID_BYTE;
8122
+ result += (42 - c & c - 44) >>> 8 & -INVALID_BYTE + c - 43 + 62;
8123
+ result += (46 - c & c - 48) >>> 8 & -INVALID_BYTE + c - 47 + 63;
8124
+ result += (47 - c & c - 58) >>> 8 & -INVALID_BYTE + c - 48 + 52;
8125
+ result += (64 - c & c - 91) >>> 8 & -INVALID_BYTE + c - 65 + 0;
8126
+ result += (96 - c & c - 123) >>> 8 & -INVALID_BYTE + c - 97 + 26;
8127
+ return result;
8128
+ };
8129
+ Coder2.prototype._getPaddingLength = function(s) {
8130
+ var paddingLength = 0;
8131
+ if (this._paddingCharacter) {
8132
+ for (var i = s.length - 1; i >= 0; i--) {
8133
+ if (s[i] !== this._paddingCharacter) {
8134
+ break;
8135
+ }
8136
+ paddingLength++;
8137
+ }
8138
+ if (s.length < 4 || paddingLength > 2) {
8139
+ throw new Error("Base64Coder: incorrect padding");
8140
+ }
8141
+ }
8142
+ return paddingLength;
8143
+ };
8144
+ return Coder2;
8145
+ }()
8146
+ );
8147
+ exports.Coder = Coder;
8148
+ var stdCoder = new Coder();
8149
+ function encode2(data) {
8150
+ return stdCoder.encode(data);
8151
+ }
8152
+ exports.encode = encode2;
8153
+ function decode2(s) {
8154
+ return stdCoder.decode(s);
8155
+ }
8156
+ exports.decode = decode2;
8157
+ var URLSafeCoder = (
8158
+ /** @class */
8159
+ function(_super) {
8160
+ __extends(URLSafeCoder2, _super);
8161
+ function URLSafeCoder2() {
8162
+ return _super !== null && _super.apply(this, arguments) || this;
8163
+ }
8164
+ URLSafeCoder2.prototype._encodeByte = function(b) {
8165
+ var result = b;
8166
+ result += 65;
8167
+ result += 25 - b >>> 8 & 0 - 65 - 26 + 97;
8168
+ result += 51 - b >>> 8 & 26 - 97 - 52 + 48;
8169
+ result += 61 - b >>> 8 & 52 - 48 - 62 + 45;
8170
+ result += 62 - b >>> 8 & 62 - 45 - 63 + 95;
8171
+ return String.fromCharCode(result);
8172
+ };
8173
+ URLSafeCoder2.prototype._decodeChar = function(c) {
8174
+ var result = INVALID_BYTE;
8175
+ result += (44 - c & c - 46) >>> 8 & -INVALID_BYTE + c - 45 + 62;
8176
+ result += (94 - c & c - 96) >>> 8 & -INVALID_BYTE + c - 95 + 63;
8177
+ result += (47 - c & c - 58) >>> 8 & -INVALID_BYTE + c - 48 + 52;
8178
+ result += (64 - c & c - 91) >>> 8 & -INVALID_BYTE + c - 65 + 0;
8179
+ result += (96 - c & c - 123) >>> 8 & -INVALID_BYTE + c - 97 + 26;
8180
+ return result;
8181
+ };
8182
+ return URLSafeCoder2;
8183
+ }(Coder)
8184
+ );
8185
+ exports.URLSafeCoder = URLSafeCoder;
8186
+ var urlSafeCoder = new URLSafeCoder();
8187
+ function encodeURLSafe(data) {
8188
+ return urlSafeCoder.encode(data);
8189
+ }
8190
+ exports.encodeURLSafe = encodeURLSafe;
8191
+ function decodeURLSafe(s) {
8192
+ return urlSafeCoder.decode(s);
8193
+ }
8194
+ exports.decodeURLSafe = decodeURLSafe;
8195
+ exports.encodedLength = function(length) {
8196
+ return stdCoder.encodedLength(length);
8197
+ };
8198
+ exports.maxDecodedLength = function(length) {
8199
+ return stdCoder.maxDecodedLength(length);
8200
+ };
8201
+ exports.decodedLength = function(s) {
8202
+ return stdCoder.decodedLength(s);
8203
+ };
8204
+ }
8205
+ });
8206
+
8207
+ // ../../node_modules/fast-sha256/sha256.js
8208
+ var require_sha256 = __commonJS({
8209
+ "../../node_modules/fast-sha256/sha256.js"(exports, module) {
8210
+ (function(root, factory) {
8211
+ var exports2 = {};
8212
+ factory(exports2);
8213
+ var sha2562 = exports2["default"];
8214
+ for (var k in exports2) {
8215
+ sha2562[k] = exports2[k];
8216
+ }
8217
+ if (typeof module === "object" && typeof module.exports === "object") {
8218
+ module.exports = sha2562;
8219
+ } else if (typeof define === "function" && define.amd) {
8220
+ define(function() {
8221
+ return sha2562;
8222
+ });
8223
+ } else {
8224
+ root.sha256 = sha2562;
8225
+ }
8226
+ })(exports, function(exports2) {
8227
+ exports2.__esModule = true;
8228
+ exports2.digestLength = 32;
8229
+ exports2.blockSize = 64;
8230
+ var K = new Uint32Array([
8231
+ 1116352408,
8232
+ 1899447441,
8233
+ 3049323471,
8234
+ 3921009573,
8235
+ 961987163,
8236
+ 1508970993,
8237
+ 2453635748,
8238
+ 2870763221,
8239
+ 3624381080,
8240
+ 310598401,
8241
+ 607225278,
8242
+ 1426881987,
8243
+ 1925078388,
8244
+ 2162078206,
8245
+ 2614888103,
8246
+ 3248222580,
8247
+ 3835390401,
8248
+ 4022224774,
8249
+ 264347078,
8250
+ 604807628,
8251
+ 770255983,
8252
+ 1249150122,
8253
+ 1555081692,
8254
+ 1996064986,
8255
+ 2554220882,
8256
+ 2821834349,
8257
+ 2952996808,
8258
+ 3210313671,
8259
+ 3336571891,
8260
+ 3584528711,
8261
+ 113926993,
8262
+ 338241895,
8263
+ 666307205,
8264
+ 773529912,
8265
+ 1294757372,
8266
+ 1396182291,
8267
+ 1695183700,
8268
+ 1986661051,
8269
+ 2177026350,
8270
+ 2456956037,
8271
+ 2730485921,
8272
+ 2820302411,
8273
+ 3259730800,
8274
+ 3345764771,
8275
+ 3516065817,
8276
+ 3600352804,
8277
+ 4094571909,
8278
+ 275423344,
8279
+ 430227734,
8280
+ 506948616,
8281
+ 659060556,
8282
+ 883997877,
8283
+ 958139571,
8284
+ 1322822218,
8285
+ 1537002063,
8286
+ 1747873779,
8287
+ 1955562222,
8288
+ 2024104815,
8289
+ 2227730452,
8290
+ 2361852424,
8291
+ 2428436474,
8292
+ 2756734187,
8293
+ 3204031479,
8294
+ 3329325298
8295
+ ]);
8296
+ function hashBlocks(w, v, p, pos, len) {
8297
+ var a, b, c, d, e, f, g, h, u, i, j, t1, t2;
8298
+ while (len >= 64) {
8299
+ a = v[0];
8300
+ b = v[1];
8301
+ c = v[2];
8302
+ d = v[3];
8303
+ e = v[4];
8304
+ f = v[5];
8305
+ g = v[6];
8306
+ h = v[7];
8307
+ for (i = 0; i < 16; i++) {
8308
+ j = pos + i * 4;
8309
+ w[i] = (p[j] & 255) << 24 | (p[j + 1] & 255) << 16 | (p[j + 2] & 255) << 8 | p[j + 3] & 255;
8310
+ }
8311
+ for (i = 16; i < 64; i++) {
8312
+ u = w[i - 2];
8313
+ t1 = (u >>> 17 | u << 32 - 17) ^ (u >>> 19 | u << 32 - 19) ^ u >>> 10;
8314
+ u = w[i - 15];
8315
+ t2 = (u >>> 7 | u << 32 - 7) ^ (u >>> 18 | u << 32 - 18) ^ u >>> 3;
8316
+ w[i] = (t1 + w[i - 7] | 0) + (t2 + w[i - 16] | 0);
8317
+ }
8318
+ for (i = 0; i < 64; i++) {
8319
+ t1 = (((e >>> 6 | e << 32 - 6) ^ (e >>> 11 | e << 32 - 11) ^ (e >>> 25 | e << 32 - 25)) + (e & f ^ ~e & g) | 0) + (h + (K[i] + w[i] | 0) | 0) | 0;
8320
+ t2 = ((a >>> 2 | a << 32 - 2) ^ (a >>> 13 | a << 32 - 13) ^ (a >>> 22 | a << 32 - 22)) + (a & b ^ a & c ^ b & c) | 0;
8321
+ h = g;
8322
+ g = f;
8323
+ f = e;
8324
+ e = d + t1 | 0;
8325
+ d = c;
8326
+ c = b;
8327
+ b = a;
8328
+ a = t1 + t2 | 0;
8329
+ }
8330
+ v[0] += a;
8331
+ v[1] += b;
8332
+ v[2] += c;
8333
+ v[3] += d;
8334
+ v[4] += e;
8335
+ v[5] += f;
8336
+ v[6] += g;
8337
+ v[7] += h;
8338
+ pos += 64;
8339
+ len -= 64;
8340
+ }
8341
+ return pos;
8342
+ }
8343
+ var Hash = (
8344
+ /** @class */
8345
+ function() {
8346
+ function Hash2() {
8347
+ this.digestLength = exports2.digestLength;
8348
+ this.blockSize = exports2.blockSize;
8349
+ this.state = new Int32Array(8);
8350
+ this.temp = new Int32Array(64);
8351
+ this.buffer = new Uint8Array(128);
8352
+ this.bufferLength = 0;
8353
+ this.bytesHashed = 0;
8354
+ this.finished = false;
8355
+ this.reset();
8356
+ }
8357
+ Hash2.prototype.reset = function() {
8358
+ this.state[0] = 1779033703;
8359
+ this.state[1] = 3144134277;
8360
+ this.state[2] = 1013904242;
8361
+ this.state[3] = 2773480762;
8362
+ this.state[4] = 1359893119;
8363
+ this.state[5] = 2600822924;
8364
+ this.state[6] = 528734635;
8365
+ this.state[7] = 1541459225;
8366
+ this.bufferLength = 0;
8367
+ this.bytesHashed = 0;
8368
+ this.finished = false;
8369
+ return this;
8370
+ };
8371
+ Hash2.prototype.clean = function() {
8372
+ for (var i = 0; i < this.buffer.length; i++) {
8373
+ this.buffer[i] = 0;
8374
+ }
8375
+ for (var i = 0; i < this.temp.length; i++) {
8376
+ this.temp[i] = 0;
8377
+ }
8378
+ this.reset();
8379
+ };
8380
+ Hash2.prototype.update = function(data, dataLength) {
8381
+ if (dataLength === void 0) {
8382
+ dataLength = data.length;
8383
+ }
8384
+ if (this.finished) {
8385
+ throw new Error("SHA256: can't update because hash was finished.");
8386
+ }
8387
+ var dataPos = 0;
8388
+ this.bytesHashed += dataLength;
8389
+ if (this.bufferLength > 0) {
8390
+ while (this.bufferLength < 64 && dataLength > 0) {
8391
+ this.buffer[this.bufferLength++] = data[dataPos++];
8392
+ dataLength--;
8393
+ }
8394
+ if (this.bufferLength === 64) {
8395
+ hashBlocks(this.temp, this.state, this.buffer, 0, 64);
8396
+ this.bufferLength = 0;
8397
+ }
8398
+ }
8399
+ if (dataLength >= 64) {
8400
+ dataPos = hashBlocks(this.temp, this.state, data, dataPos, dataLength);
8401
+ dataLength %= 64;
8402
+ }
8403
+ while (dataLength > 0) {
8404
+ this.buffer[this.bufferLength++] = data[dataPos++];
8405
+ dataLength--;
8406
+ }
8407
+ return this;
8408
+ };
8409
+ Hash2.prototype.finish = function(out) {
8410
+ if (!this.finished) {
8411
+ var bytesHashed = this.bytesHashed;
8412
+ var left = this.bufferLength;
8413
+ var bitLenHi = bytesHashed / 536870912 | 0;
8414
+ var bitLenLo = bytesHashed << 3;
8415
+ var padLength = bytesHashed % 64 < 56 ? 64 : 128;
8416
+ this.buffer[left] = 128;
8417
+ for (var i = left + 1; i < padLength - 8; i++) {
8418
+ this.buffer[i] = 0;
8419
+ }
8420
+ this.buffer[padLength - 8] = bitLenHi >>> 24 & 255;
8421
+ this.buffer[padLength - 7] = bitLenHi >>> 16 & 255;
8422
+ this.buffer[padLength - 6] = bitLenHi >>> 8 & 255;
8423
+ this.buffer[padLength - 5] = bitLenHi >>> 0 & 255;
8424
+ this.buffer[padLength - 4] = bitLenLo >>> 24 & 255;
8425
+ this.buffer[padLength - 3] = bitLenLo >>> 16 & 255;
8426
+ this.buffer[padLength - 2] = bitLenLo >>> 8 & 255;
8427
+ this.buffer[padLength - 1] = bitLenLo >>> 0 & 255;
8428
+ hashBlocks(this.temp, this.state, this.buffer, 0, padLength);
8429
+ this.finished = true;
8430
+ }
8431
+ for (var i = 0; i < 8; i++) {
8432
+ out[i * 4 + 0] = this.state[i] >>> 24 & 255;
8433
+ out[i * 4 + 1] = this.state[i] >>> 16 & 255;
8434
+ out[i * 4 + 2] = this.state[i] >>> 8 & 255;
8435
+ out[i * 4 + 3] = this.state[i] >>> 0 & 255;
8436
+ }
8437
+ return this;
8438
+ };
8439
+ Hash2.prototype.digest = function() {
8440
+ var out = new Uint8Array(this.digestLength);
8441
+ this.finish(out);
8442
+ return out;
8443
+ };
8444
+ Hash2.prototype._saveState = function(out) {
8445
+ for (var i = 0; i < this.state.length; i++) {
8446
+ out[i] = this.state[i];
8447
+ }
8448
+ };
8449
+ Hash2.prototype._restoreState = function(from, bytesHashed) {
8450
+ for (var i = 0; i < this.state.length; i++) {
8451
+ this.state[i] = from[i];
8452
+ }
8453
+ this.bytesHashed = bytesHashed;
8454
+ this.finished = false;
8455
+ this.bufferLength = 0;
8456
+ };
8457
+ return Hash2;
8458
+ }()
8459
+ );
8460
+ exports2.Hash = Hash;
8461
+ var HMAC = (
8462
+ /** @class */
8463
+ function() {
8464
+ function HMAC2(key) {
8465
+ this.inner = new Hash();
8466
+ this.outer = new Hash();
8467
+ this.blockSize = this.inner.blockSize;
8468
+ this.digestLength = this.inner.digestLength;
8469
+ var pad = new Uint8Array(this.blockSize);
8470
+ if (key.length > this.blockSize) {
8471
+ new Hash().update(key).finish(pad).clean();
8472
+ } else {
8473
+ for (var i = 0; i < key.length; i++) {
8474
+ pad[i] = key[i];
8475
+ }
8476
+ }
8477
+ for (var i = 0; i < pad.length; i++) {
8478
+ pad[i] ^= 54;
8479
+ }
8480
+ this.inner.update(pad);
8481
+ for (var i = 0; i < pad.length; i++) {
8482
+ pad[i] ^= 54 ^ 92;
8483
+ }
8484
+ this.outer.update(pad);
8485
+ this.istate = new Uint32Array(8);
8486
+ this.ostate = new Uint32Array(8);
8487
+ this.inner._saveState(this.istate);
8488
+ this.outer._saveState(this.ostate);
8489
+ for (var i = 0; i < pad.length; i++) {
8490
+ pad[i] = 0;
8491
+ }
8492
+ }
8493
+ HMAC2.prototype.reset = function() {
8494
+ this.inner._restoreState(this.istate, this.inner.blockSize);
8495
+ this.outer._restoreState(this.ostate, this.outer.blockSize);
8496
+ return this;
8497
+ };
8498
+ HMAC2.prototype.clean = function() {
8499
+ for (var i = 0; i < this.istate.length; i++) {
8500
+ this.ostate[i] = this.istate[i] = 0;
8501
+ }
8502
+ this.inner.clean();
8503
+ this.outer.clean();
8504
+ };
8505
+ HMAC2.prototype.update = function(data) {
8506
+ this.inner.update(data);
8507
+ return this;
8508
+ };
8509
+ HMAC2.prototype.finish = function(out) {
8510
+ if (this.outer.finished) {
8511
+ this.outer.finish(out);
8512
+ } else {
8513
+ this.inner.finish(out);
8514
+ this.outer.update(out, this.digestLength).finish(out);
8515
+ }
8516
+ return this;
8517
+ };
8518
+ HMAC2.prototype.digest = function() {
8519
+ var out = new Uint8Array(this.digestLength);
8520
+ this.finish(out);
8521
+ return out;
8522
+ };
8523
+ return HMAC2;
8524
+ }()
8525
+ );
8526
+ exports2.HMAC = HMAC;
8527
+ function hash(data) {
8528
+ var h = new Hash().update(data);
8529
+ var digest = h.digest();
8530
+ h.clean();
8531
+ return digest;
8532
+ }
8533
+ exports2.hash = hash;
8534
+ exports2["default"] = hash;
8535
+ function hmac2(key, data) {
8536
+ var h = new HMAC(key).update(data);
8537
+ var digest = h.digest();
8538
+ h.clean();
8539
+ return digest;
8540
+ }
8541
+ exports2.hmac = hmac2;
8542
+ function fillBuffer(buffer, hmac3, info, counter) {
8543
+ var num = counter[0];
8544
+ if (num === 0) {
8545
+ throw new Error("hkdf: cannot expand more");
8546
+ }
8547
+ hmac3.reset();
8548
+ if (num > 1) {
8549
+ hmac3.update(buffer);
8550
+ }
8551
+ if (info) {
8552
+ hmac3.update(info);
8553
+ }
8554
+ hmac3.update(counter);
8555
+ hmac3.finish(buffer);
8556
+ counter[0]++;
8557
+ }
8558
+ var hkdfSalt = new Uint8Array(exports2.digestLength);
8559
+ function hkdf(key, salt, info, length) {
8560
+ if (salt === void 0) {
8561
+ salt = hkdfSalt;
8562
+ }
8563
+ if (length === void 0) {
8564
+ length = 32;
8565
+ }
8566
+ var counter = new Uint8Array([1]);
8567
+ var okm = hmac2(salt, key);
8568
+ var hmac_ = new HMAC(okm);
8569
+ var buffer = new Uint8Array(hmac_.digestLength);
8570
+ var bufpos = buffer.length;
8571
+ var out = new Uint8Array(length);
8572
+ for (var i = 0; i < length; i++) {
8573
+ if (bufpos === buffer.length) {
8574
+ fillBuffer(buffer, hmac_, info, counter);
8575
+ bufpos = 0;
8576
+ }
8577
+ out[i] = buffer[bufpos++];
8578
+ }
8579
+ hmac_.clean();
8580
+ buffer.fill(0);
8581
+ counter.fill(0);
8582
+ return out;
8583
+ }
8584
+ exports2.hkdf = hkdf;
8585
+ function pbkdf2(password, salt, iterations, dkLen) {
8586
+ var prf = new HMAC(password);
8587
+ var len = prf.digestLength;
8588
+ var ctr = new Uint8Array(4);
8589
+ var t = new Uint8Array(len);
8590
+ var u = new Uint8Array(len);
8591
+ var dk = new Uint8Array(dkLen);
8592
+ for (var i = 0; i * len < dkLen; i++) {
8593
+ var c = i + 1;
8594
+ ctr[0] = c >>> 24 & 255;
8595
+ ctr[1] = c >>> 16 & 255;
8596
+ ctr[2] = c >>> 8 & 255;
8597
+ ctr[3] = c >>> 0 & 255;
8598
+ prf.reset();
8599
+ prf.update(salt);
8600
+ prf.update(ctr);
8601
+ prf.finish(u);
8602
+ for (var j = 0; j < len; j++) {
8603
+ t[j] = u[j];
8604
+ }
8605
+ for (var j = 2; j <= iterations; j++) {
8606
+ prf.reset();
8607
+ prf.update(u).finish(u);
8608
+ for (var k = 0; k < len; k++) {
8609
+ t[k] ^= u[k];
8610
+ }
8611
+ }
8612
+ for (var j = 0; j < len && i * len + j < dkLen; j++) {
8613
+ dk[i * len + j] = t[j];
8614
+ }
8615
+ }
8616
+ for (var i = 0; i < len; i++) {
8617
+ t[i] = u[i] = 0;
8618
+ }
8619
+ for (var i = 0; i < 4; i++) {
8620
+ ctr[i] = 0;
8621
+ }
8622
+ prf.clean();
8623
+ return dk;
8624
+ }
8625
+ exports2.pbkdf2 = pbkdf2;
8626
+ });
8627
+ }
8628
+ });
8629
+
8630
+ // src/webhook/vendor/standardwebhook.ts
8631
+ __toESM(require_base64());
8632
+ __toESM(require_sha256());
8633
+ /**
8634
+ * The MIT License
8635
+ *
8636
+ * Copyright (c) 2023 Svix (https://www.svix.com)
8637
+ *
8638
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8639
+ * of this software and associated documentation files (the "Software"), to deal
8640
+ * in the Software without restriction, including without limitation the rights
8641
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8642
+ * copies of the Software, and to permit persons to whom the Software is
8643
+ * furnished to do so, subject to the following conditions:
8644
+ *
8645
+ * The above copyright notice and this permission notice shall be included in
8646
+ * all copies or substantial portions of the Software.
8647
+ *
8648
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
8649
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
8650
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
8651
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
8652
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
8653
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
8654
+ * THE SOFTWARE.
8655
+ *
8656
+ * @fileoverview Server-only webhook verification implementation.
8657
+ * @description Vendored from standardwebhooks package to avoid bundling issues.
8658
+ * Uses Node.js crypto module - DO NOT import in client/browser code.
8659
+ * @license MIT
8660
+ * @internal
8661
+ */
8662
+
8663
+ // src/webhook/webhook.ts
7969
8664
  async function handleWebhookPayload(payload, config, context) {
7970
8665
  const callHandler = (handler, payload2) => {
7971
8666
  if (!handler) return;