@dodopayments/convex 0.2.7 → 0.2.9

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
@@ -417,8 +417,8 @@ function convexOrUndefinedToJson(value) {
417
417
  return convexOrUndefinedToJsonInternal(value, value, "");
418
418
  }
419
419
 
420
- var __defProp$3 = Object.defineProperty;
421
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
420
+ var __defProp$4 = Object.defineProperty;
421
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
422
422
  var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
423
423
  var _a, _b;
424
424
  const IDENTIFYING_FIELD = Symbol.for("ConvexError");
@@ -533,8 +533,8 @@ function setupActionCalls(requestId) {
533
533
  };
534
534
  }
535
535
 
536
- var __defProp$2 = Object.defineProperty;
537
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
536
+ var __defProp$3 = Object.defineProperty;
537
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
538
538
  var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
539
539
  class FilterExpression {
540
540
  /**
@@ -556,8 +556,8 @@ function validateArg(arg, idx, method, argName) {
556
556
  }
557
557
  }
558
558
 
559
- var __defProp$1 = Object.defineProperty;
560
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
559
+ var __defProp$2 = Object.defineProperty;
560
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
561
561
  var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
562
562
  function setupActionVectorSearch(requestId) {
563
563
  return async (tableName, indexName, query) => {
@@ -834,8 +834,8 @@ const httpActionGeneric = (func) => {
834
834
  return q;
835
835
  };
836
836
 
837
- var __defProp = Object.defineProperty;
838
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
837
+ var __defProp$1 = Object.defineProperty;
838
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
839
839
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
840
840
  class InstalledComponent {
841
841
  constructor(definition, name) {
@@ -4964,23 +4964,33 @@ var PaymentSchema = objectType({
4964
4964
  payload_type: literalType("Payment"),
4965
4965
  billing: objectType({
4966
4966
  city: stringType().nullable(),
4967
- country: stringType().nullable(),
4967
+ country: stringType(),
4968
4968
  state: stringType().nullable(),
4969
4969
  street: stringType().nullable(),
4970
4970
  zipcode: stringType().nullable()
4971
4971
  }),
4972
4972
  brand_id: stringType(),
4973
4973
  business_id: stringType(),
4974
+ card_holder_name: stringType().nullable(),
4974
4975
  card_issuing_country: stringType().nullable(),
4975
4976
  card_last_four: stringType().nullable(),
4976
4977
  card_network: stringType().nullable(),
4977
4978
  card_type: stringType().nullable(),
4979
+ checkout_session_id: stringType().nullable(),
4978
4980
  created_at: stringType().transform((d) => new Date(d)),
4979
4981
  currency: stringType(),
4982
+ custom_field_responses: arrayType(
4983
+ objectType({
4984
+ key: stringType(),
4985
+ value: stringType()
4986
+ })
4987
+ ).nullable(),
4980
4988
  customer: objectType({
4981
4989
  customer_id: stringType(),
4982
4990
  email: stringType(),
4983
- name: stringType().nullable()
4991
+ metadata: recordType(anyType()),
4992
+ name: stringType(),
4993
+ phone_number: stringType().nullable()
4984
4994
  }),
4985
4995
  digital_products_delivered: booleanType(),
4986
4996
  discount_id: stringType().nullable(),
@@ -4991,27 +5001,25 @@ var PaymentSchema = objectType({
4991
5001
  created_at: stringType().transform((d) => new Date(d)),
4992
5002
  currency: stringType(),
4993
5003
  dispute_id: stringType(),
4994
- dispute_stage: enumType([
4995
- "pre_dispute",
4996
- "dispute_opened",
4997
- "dispute_won",
4998
- "dispute_lost"
4999
- ]),
5004
+ dispute_stage: enumType(["pre_dispute", "dispute", "pre_arbitration"]),
5000
5005
  dispute_status: enumType([
5001
5006
  "dispute_opened",
5002
- "dispute_won",
5003
- "dispute_lost",
5007
+ "dispute_expired",
5004
5008
  "dispute_accepted",
5005
5009
  "dispute_cancelled",
5006
- "dispute_challenged"
5010
+ "dispute_challenged",
5011
+ "dispute_won",
5012
+ "dispute_lost"
5007
5013
  ]),
5008
5014
  payment_id: stringType(),
5009
5015
  remarks: stringType().nullable()
5010
5016
  })
5011
- ).nullable(),
5017
+ ).default([]),
5012
5018
  error_code: stringType().nullable(),
5013
5019
  error_message: stringType().nullable(),
5014
- metadata: recordType(anyType()).nullable(),
5020
+ invoice_id: stringType().nullable(),
5021
+ invoice_url: stringType().nullable(),
5022
+ metadata: recordType(anyType()),
5015
5023
  payment_id: stringType(),
5016
5024
  payment_link: stringType().nullable(),
5017
5025
  payment_method: stringType().nullable(),
@@ -5024,21 +5032,34 @@ var PaymentSchema = objectType({
5024
5032
  ).nullable(),
5025
5033
  refunds: arrayType(
5026
5034
  objectType({
5027
- amount: numberType(),
5035
+ amount: numberType().nullable(),
5028
5036
  business_id: stringType(),
5029
5037
  created_at: stringType().transform((d) => new Date(d)),
5030
- currency: stringType(),
5038
+ currency: stringType().nullable(),
5031
5039
  is_partial: booleanType(),
5032
5040
  payment_id: stringType(),
5033
5041
  reason: stringType().nullable(),
5034
5042
  refund_id: stringType(),
5035
- status: enumType(["succeeded", "failed", "pending"])
5043
+ status: enumType(["succeeded", "failed", "pending", "review"])
5036
5044
  })
5037
- ).nullable(),
5045
+ ),
5046
+ refund_status: enumType(["partial", "full"]).nullable(),
5038
5047
  settlement_amount: numberType(),
5039
5048
  settlement_currency: stringType(),
5040
5049
  settlement_tax: numberType().nullable(),
5041
- status: enumType(["succeeded", "failed", "pending", "processing", "cancelled"]),
5050
+ status: enumType([
5051
+ "succeeded",
5052
+ "failed",
5053
+ "cancelled",
5054
+ "processing",
5055
+ "requires_customer_action",
5056
+ "requires_merchant_action",
5057
+ "requires_payment_method",
5058
+ "requires_confirmation",
5059
+ "requires_capture",
5060
+ "partially_captured",
5061
+ "partially_captured_and_capturable"
5062
+ ]).nullable(),
5042
5063
  subscription_id: stringType().nullable(),
5043
5064
  tax: numberType().nullable(),
5044
5065
  total_amount: numberType(),
@@ -5051,10 +5072,10 @@ var SubscriptionSchema = objectType({
5051
5072
  addon_id: stringType(),
5052
5073
  quantity: numberType()
5053
5074
  })
5054
- ).nullable(),
5075
+ ),
5055
5076
  billing: objectType({
5056
5077
  city: stringType().nullable(),
5057
- country: stringType().nullable(),
5078
+ country: stringType(),
5058
5079
  state: stringType().nullable(),
5059
5080
  street: stringType().nullable(),
5060
5081
  zipcode: stringType().nullable()
@@ -5066,15 +5087,72 @@ var SubscriptionSchema = objectType({
5066
5087
  customer: objectType({
5067
5088
  customer_id: stringType(),
5068
5089
  email: stringType(),
5069
- name: stringType().nullable()
5090
+ metadata: recordType(anyType()),
5091
+ name: stringType(),
5092
+ phone_number: stringType().nullable()
5070
5093
  }),
5094
+ custom_field_responses: arrayType(
5095
+ objectType({
5096
+ key: stringType(),
5097
+ value: stringType()
5098
+ })
5099
+ ).nullable(),
5100
+ discount_cycles_remaining: numberType().nullable(),
5071
5101
  discount_id: stringType().nullable(),
5072
- metadata: recordType(anyType()).nullable(),
5073
- next_billing_date: stringType().transform((d) => new Date(d)).nullable(),
5102
+ expires_at: stringType().transform((d) => new Date(d)).nullable(),
5103
+ credit_entitlement_cart: arrayType(
5104
+ objectType({
5105
+ credit_entitlement_id: stringType(),
5106
+ credit_entitlement_name: stringType(),
5107
+ credits_amount: stringType(),
5108
+ overage_balance: stringType(),
5109
+ overage_behavior: enumType([
5110
+ "forgive_at_reset",
5111
+ "invoice_at_billing",
5112
+ "carry_deficit",
5113
+ "carry_deficit_auto_repay"
5114
+ ]),
5115
+ overage_enabled: booleanType(),
5116
+ product_id: stringType(),
5117
+ remaining_balance: stringType(),
5118
+ rollover_enabled: booleanType(),
5119
+ unit: stringType(),
5120
+ expires_after_days: numberType().nullable(),
5121
+ low_balance_threshold_percent: numberType().nullable(),
5122
+ max_rollover_count: numberType().nullable(),
5123
+ overage_limit: stringType().nullable(),
5124
+ rollover_percentage: numberType().nullable(),
5125
+ rollover_timeframe_count: numberType().nullable(),
5126
+ rollover_timeframe_interval: enumType(["Day", "Week", "Month", "Year"]).nullable()
5127
+ })
5128
+ ),
5129
+ meter_credit_entitlement_cart: arrayType(
5130
+ objectType({
5131
+ credit_entitlement_id: stringType(),
5132
+ meter_id: stringType(),
5133
+ meter_name: stringType(),
5134
+ meter_units_per_credit: stringType(),
5135
+ product_id: stringType()
5136
+ })
5137
+ ),
5138
+ meters: arrayType(
5139
+ objectType({
5140
+ currency: stringType(),
5141
+ description: stringType().nullable(),
5142
+ free_threshold: numberType(),
5143
+ measurement_unit: stringType(),
5144
+ meter_id: stringType(),
5145
+ name: stringType(),
5146
+ price_per_unit: stringType().nullable()
5147
+ })
5148
+ ),
5149
+ metadata: recordType(anyType()),
5150
+ next_billing_date: stringType().transform((d) => new Date(d)),
5074
5151
  on_demand: booleanType(),
5075
5152
  payment_frequency_count: numberType(),
5076
5153
  payment_frequency_interval: enumType(["Day", "Week", "Month", "Year"]),
5077
- previous_billing_date: stringType().transform((d) => new Date(d)).nullable(),
5154
+ payment_method_id: stringType().nullable(),
5155
+ previous_billing_date: stringType().transform((d) => new Date(d)),
5078
5156
  product_id: stringType(),
5079
5157
  quantity: numberType(),
5080
5158
  recurring_pre_tax_amount: numberType(),
@@ -5082,7 +5160,6 @@ var SubscriptionSchema = objectType({
5082
5160
  "pending",
5083
5161
  "active",
5084
5162
  "on_hold",
5085
- "paused",
5086
5163
  "cancelled",
5087
5164
  "expired",
5088
5165
  "failed"
@@ -5090,20 +5167,29 @@ var SubscriptionSchema = objectType({
5090
5167
  subscription_id: stringType(),
5091
5168
  subscription_period_count: numberType(),
5092
5169
  subscription_period_interval: enumType(["Day", "Week", "Month", "Year"]),
5170
+ tax_id: stringType().nullable(),
5093
5171
  tax_inclusive: booleanType(),
5094
5172
  trial_period_days: numberType()
5095
5173
  });
5096
5174
  var RefundSchema = objectType({
5097
5175
  payload_type: literalType("Refund"),
5098
- amount: numberType(),
5176
+ amount: numberType().nullable(),
5099
5177
  business_id: stringType(),
5100
5178
  created_at: stringType().transform((d) => new Date(d)),
5101
- currency: stringType(),
5179
+ customer: objectType({
5180
+ customer_id: stringType(),
5181
+ email: stringType(),
5182
+ metadata: recordType(anyType()),
5183
+ name: stringType(),
5184
+ phone_number: stringType().nullable()
5185
+ }),
5186
+ currency: stringType().nullable(),
5102
5187
  is_partial: booleanType(),
5188
+ metadata: recordType(anyType()),
5103
5189
  payment_id: stringType(),
5104
5190
  reason: stringType().nullable(),
5105
5191
  refund_id: stringType(),
5106
- status: enumType(["succeeded", "failed", "pending"])
5192
+ status: enumType(["succeeded", "failed", "pending", "review"])
5107
5193
  });
5108
5194
  var DisputeSchema = objectType({
5109
5195
  payload_type: literalType("Dispute"),
@@ -5111,27 +5197,31 @@ var DisputeSchema = objectType({
5111
5197
  business_id: stringType(),
5112
5198
  created_at: stringType().transform((d) => new Date(d)),
5113
5199
  currency: stringType(),
5200
+ customer: objectType({
5201
+ customer_id: stringType(),
5202
+ email: stringType(),
5203
+ metadata: recordType(anyType()),
5204
+ name: stringType(),
5205
+ phone_number: stringType().nullable()
5206
+ }),
5114
5207
  dispute_id: stringType(),
5115
- dispute_stage: enumType([
5116
- "pre_dispute",
5117
- "dispute_opened",
5118
- "dispute_won",
5119
- "dispute_lost"
5120
- ]),
5208
+ dispute_stage: enumType(["pre_dispute", "dispute", "pre_arbitration"]),
5121
5209
  dispute_status: enumType([
5122
5210
  "dispute_opened",
5123
- "dispute_won",
5124
- "dispute_lost",
5211
+ "dispute_expired",
5125
5212
  "dispute_accepted",
5126
5213
  "dispute_cancelled",
5127
- "dispute_challenged"
5214
+ "dispute_challenged",
5215
+ "dispute_won",
5216
+ "dispute_lost"
5128
5217
  ]),
5129
5218
  payment_id: stringType(),
5219
+ reason: stringType().nullable(),
5130
5220
  remarks: stringType().nullable()
5131
5221
  });
5132
5222
  var LicenseKeySchema = objectType({
5133
5223
  payload_type: literalType("LicenseKey"),
5134
- activations_limit: numberType(),
5224
+ activations_limit: numberType().nullable(),
5135
5225
  business_id: stringType(),
5136
5226
  created_at: stringType().transform((d) => new Date(d)),
5137
5227
  customer_id: stringType(),
@@ -5141,7 +5231,7 @@ var LicenseKeySchema = objectType({
5141
5231
  key: stringType(),
5142
5232
  payment_id: stringType(),
5143
5233
  product_id: stringType(),
5144
- status: enumType(["active", "inactive", "expired"]),
5234
+ status: enumType(["active", "expired", "disabled"]),
5145
5235
  subscription_id: stringType().nullable()
5146
5236
  });
5147
5237
  var PaymentSucceededPayloadSchema = objectType({
@@ -5240,12 +5330,6 @@ var SubscriptionRenewedPayloadSchema = objectType({
5240
5330
  timestamp: stringType().transform((d) => new Date(d)),
5241
5331
  data: SubscriptionSchema
5242
5332
  });
5243
- var SubscriptionPausedPayloadSchema = objectType({
5244
- business_id: stringType(),
5245
- type: literalType("subscription.paused"),
5246
- timestamp: stringType().transform((d) => new Date(d)),
5247
- data: SubscriptionSchema
5248
- });
5249
5333
  var SubscriptionPlanChangedPayloadSchema = objectType({
5250
5334
  business_id: stringType(),
5251
5335
  type: literalType("subscription.plan_changed"),
@@ -5282,6 +5366,94 @@ var LicenseKeyCreatedPayloadSchema = objectType({
5282
5366
  timestamp: stringType().transform((d) => new Date(d)),
5283
5367
  data: LicenseKeySchema
5284
5368
  });
5369
+ var CreditLedgerEntrySchema = objectType({
5370
+ payload_type: literalType("CreditLedgerEntry"),
5371
+ id: stringType(),
5372
+ amount: stringType(),
5373
+ balance_after: stringType(),
5374
+ balance_before: stringType(),
5375
+ business_id: stringType(),
5376
+ created_at: stringType().transform((d) => new Date(d)),
5377
+ credit_entitlement_id: stringType(),
5378
+ customer_id: stringType(),
5379
+ is_credit: booleanType(),
5380
+ overage_after: stringType(),
5381
+ overage_before: stringType(),
5382
+ transaction_type: enumType([
5383
+ "credit_added",
5384
+ "credit_deducted",
5385
+ "credit_expired",
5386
+ "credit_rolled_over",
5387
+ "rollover_forfeited",
5388
+ "overage_charged",
5389
+ "auto_top_up",
5390
+ "manual_adjustment",
5391
+ "refund"
5392
+ ]),
5393
+ description: stringType().nullable(),
5394
+ grant_id: stringType().nullable(),
5395
+ reference_id: stringType().nullable(),
5396
+ reference_type: stringType().nullable()
5397
+ });
5398
+ var CreditBalanceLowSchema = objectType({
5399
+ payload_type: literalType("CreditBalanceLow"),
5400
+ customer_id: stringType(),
5401
+ subscription_id: stringType(),
5402
+ credit_entitlement_id: stringType(),
5403
+ credit_entitlement_name: stringType(),
5404
+ available_balance: stringType(),
5405
+ subscription_credits_amount: stringType(),
5406
+ threshold_percent: numberType(),
5407
+ threshold_amount: stringType()
5408
+ });
5409
+ var CreditAddedPayloadSchema = objectType({
5410
+ business_id: stringType(),
5411
+ type: literalType("credit.added"),
5412
+ timestamp: stringType().transform((d) => new Date(d)),
5413
+ data: CreditLedgerEntrySchema
5414
+ });
5415
+ var CreditDeductedPayloadSchema = objectType({
5416
+ business_id: stringType(),
5417
+ type: literalType("credit.deducted"),
5418
+ timestamp: stringType().transform((d) => new Date(d)),
5419
+ data: CreditLedgerEntrySchema
5420
+ });
5421
+ var CreditExpiredPayloadSchema = objectType({
5422
+ business_id: stringType(),
5423
+ type: literalType("credit.expired"),
5424
+ timestamp: stringType().transform((d) => new Date(d)),
5425
+ data: CreditLedgerEntrySchema
5426
+ });
5427
+ var CreditRolledOverPayloadSchema = objectType({
5428
+ business_id: stringType(),
5429
+ type: literalType("credit.rolled_over"),
5430
+ timestamp: stringType().transform((d) => new Date(d)),
5431
+ data: CreditLedgerEntrySchema
5432
+ });
5433
+ var CreditRolloverForfeitedPayloadSchema = objectType({
5434
+ business_id: stringType(),
5435
+ type: literalType("credit.rollover_forfeited"),
5436
+ timestamp: stringType().transform((d) => new Date(d)),
5437
+ data: CreditLedgerEntrySchema
5438
+ });
5439
+ var CreditOverageChargedPayloadSchema = objectType({
5440
+ business_id: stringType(),
5441
+ type: literalType("credit.overage_charged"),
5442
+ timestamp: stringType().transform((d) => new Date(d)),
5443
+ data: CreditLedgerEntrySchema
5444
+ });
5445
+ var CreditManualAdjustmentPayloadSchema = objectType({
5446
+ business_id: stringType(),
5447
+ type: literalType("credit.manual_adjustment"),
5448
+ timestamp: stringType().transform((d) => new Date(d)),
5449
+ data: CreditLedgerEntrySchema
5450
+ });
5451
+ var CreditBalanceLowPayloadSchema = objectType({
5452
+ business_id: stringType(),
5453
+ type: literalType("credit.balance_low"),
5454
+ timestamp: stringType().transform((d) => new Date(d)),
5455
+ data: CreditBalanceLowSchema
5456
+ });
5285
5457
  var WebhookPayloadSchema = discriminatedUnionType("type", [
5286
5458
  PaymentSucceededPayloadSchema,
5287
5459
  PaymentFailedPayloadSchema,
@@ -5299,866 +5471,840 @@ var WebhookPayloadSchema = discriminatedUnionType("type", [
5299
5471
  SubscriptionActivePayloadSchema,
5300
5472
  SubscriptionOnHoldPayloadSchema,
5301
5473
  SubscriptionRenewedPayloadSchema,
5302
- SubscriptionPausedPayloadSchema,
5303
5474
  SubscriptionPlanChangedPayloadSchema,
5304
5475
  SubscriptionCancelledPayloadSchema,
5305
5476
  SubscriptionFailedPayloadSchema,
5306
5477
  SubscriptionExpiredPayloadSchema,
5307
5478
  SubscriptionUpdatedPayloadSchema,
5308
- LicenseKeyCreatedPayloadSchema
5479
+ LicenseKeyCreatedPayloadSchema,
5480
+ CreditAddedPayloadSchema,
5481
+ CreditDeductedPayloadSchema,
5482
+ CreditExpiredPayloadSchema,
5483
+ CreditRolledOverPayloadSchema,
5484
+ CreditRolloverForfeitedPayloadSchema,
5485
+ CreditOverageChargedPayloadSchema,
5486
+ CreditManualAdjustmentPayloadSchema,
5487
+ CreditBalanceLowPayloadSchema
5309
5488
  ]);
5310
5489
 
5311
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
5312
-
5313
- var dist = {};
5314
-
5315
- var timing_safe_equal = {};
5316
-
5317
- Object.defineProperty(timing_safe_equal, "__esModule", { value: true });
5318
- timing_safe_equal.timingSafeEqual = void 0;
5490
+ // src/webhook/vendor/timing_safe_equal.ts
5319
5491
  function assert(expr, msg = "") {
5320
- if (!expr) {
5321
- throw new Error(msg);
5322
- }
5492
+ if (!expr) {
5493
+ throw new Error(msg);
5494
+ }
5323
5495
  }
5324
5496
  function timingSafeEqual(a, b) {
5325
- if (a.byteLength !== b.byteLength) {
5326
- return false;
5327
- }
5328
- if (!(a instanceof DataView)) {
5329
- a = new DataView(ArrayBuffer.isView(a) ? a.buffer : a);
5330
- }
5331
- if (!(b instanceof DataView)) {
5332
- b = new DataView(ArrayBuffer.isView(b) ? b.buffer : b);
5333
- }
5334
- assert(a instanceof DataView);
5335
- assert(b instanceof DataView);
5336
- const length = a.byteLength;
5337
- let out = 0;
5338
- let i = -1;
5339
- while (++i < length) {
5340
- out |= a.getUint8(i) ^ b.getUint8(i);
5341
- }
5342
- return out === 0;
5497
+ if (a.byteLength !== b.byteLength) {
5498
+ return false;
5499
+ }
5500
+ if (!(a instanceof DataView)) {
5501
+ a = new DataView(ArrayBuffer.isView(a) ? a.buffer : a);
5502
+ }
5503
+ if (!(b instanceof DataView)) {
5504
+ b = new DataView(ArrayBuffer.isView(b) ? b.buffer : b);
5505
+ }
5506
+ assert(a instanceof DataView);
5507
+ assert(b instanceof DataView);
5508
+ const length = a.byteLength;
5509
+ let out = 0;
5510
+ let i = -1;
5511
+ while (++i < length) {
5512
+ out |= a.getUint8(i) ^ b.getUint8(i);
5513
+ }
5514
+ return out === 0;
5343
5515
  }
5344
- timing_safe_equal.timingSafeEqual = timingSafeEqual;
5345
5516
 
5346
- var base64$1 = {};
5517
+ var __create = Object.create;
5518
+ var __defProp = Object.defineProperty;
5519
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5520
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5521
+ var __getProtoOf = Object.getPrototypeOf;
5522
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5523
+ var __commonJS = (cb, mod) => function __require2() {
5524
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
5525
+ };
5526
+ var __copyProps = (to, from, except, desc) => {
5527
+ if (from && typeof from === "object" || typeof from === "function") {
5528
+ for (let key of __getOwnPropNames(from))
5529
+ if (!__hasOwnProp.call(to, key) && key !== except)
5530
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
5531
+ }
5532
+ return to;
5533
+ };
5534
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
5535
+ // If the importer is in node compatibility mode or this is not an ESM
5536
+ // file that has been converted to a CommonJS file using a Babel-
5537
+ // compatible transform (i.e. "__esModule" has not been set), then set
5538
+ // "default" to the CommonJS "module.exports" for node compatibility.
5539
+ __defProp(target, "default", { value: mod, enumerable: true }) ,
5540
+ mod
5541
+ ));
5347
5542
 
5348
- // Copyright (C) 2016 Dmitry Chestnykh
5349
- // MIT License. See LICENSE file for details.
5350
- var __extends = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
5351
- var extendStatics = function (d, b) {
5352
- extendStatics = Object.setPrototypeOf ||
5353
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5354
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
5543
+ // ../../node_modules/@stablelib/base64/lib/base64.js
5544
+ var require_base64 = __commonJS({
5545
+ "../../node_modules/@stablelib/base64/lib/base64.js"(exports) {
5546
+ var __extends = exports && exports.__extends || /* @__PURE__ */ function() {
5547
+ var extendStatics = function(d, b) {
5548
+ extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
5549
+ d2.__proto__ = b2;
5550
+ } || function(d2, b2) {
5551
+ for (var p in b2) if (b2.hasOwnProperty(p)) d2[p] = b2[p];
5552
+ };
5355
5553
  return extendStatics(d, b);
5356
- };
5357
- return function (d, b) {
5554
+ };
5555
+ return function(d, b) {
5358
5556
  extendStatics(d, b);
5359
- function __() { this.constructor = d; }
5557
+ function __() {
5558
+ this.constructor = d;
5559
+ }
5360
5560
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
5361
- };
5362
- })();
5363
- Object.defineProperty(base64$1, "__esModule", { value: true });
5364
- /**
5365
- * Package base64 implements Base64 encoding and decoding.
5366
- */
5367
- // Invalid character used in decoding to indicate
5368
- // that the character to decode is out of range of
5369
- // alphabet and cannot be decoded.
5370
- var INVALID_BYTE = 256;
5371
- /**
5372
- * Implements standard Base64 encoding.
5373
- *
5374
- * Operates in constant time.
5375
- */
5376
- var Coder = /** @class */ (function () {
5377
- // TODO(dchest): methods to encode chunk-by-chunk.
5378
- function Coder(_paddingCharacter) {
5379
- if (_paddingCharacter === void 0) { _paddingCharacter = "="; }
5380
- this._paddingCharacter = _paddingCharacter;
5381
- }
5382
- Coder.prototype.encodedLength = function (length) {
5383
- if (!this._paddingCharacter) {
5561
+ };
5562
+ }();
5563
+ Object.defineProperty(exports, "__esModule", { value: true });
5564
+ var INVALID_BYTE = 256;
5565
+ var Coder = (
5566
+ /** @class */
5567
+ function() {
5568
+ function Coder2(_paddingCharacter) {
5569
+ if (_paddingCharacter === void 0) {
5570
+ _paddingCharacter = "=";
5571
+ }
5572
+ this._paddingCharacter = _paddingCharacter;
5573
+ }
5574
+ Coder2.prototype.encodedLength = function(length) {
5575
+ if (!this._paddingCharacter) {
5384
5576
  return (length * 8 + 5) / 6 | 0;
5385
- }
5386
- return (length + 2) / 3 * 4 | 0;
5387
- };
5388
- Coder.prototype.encode = function (data) {
5389
- var out = "";
5390
- var i = 0;
5391
- for (; i < data.length - 2; i += 3) {
5392
- var c = (data[i] << 16) | (data[i + 1] << 8) | (data[i + 2]);
5393
- out += this._encodeByte((c >>> 3 * 6) & 63);
5394
- out += this._encodeByte((c >>> 2 * 6) & 63);
5395
- out += this._encodeByte((c >>> 1 * 6) & 63);
5396
- out += this._encodeByte((c >>> 0 * 6) & 63);
5397
- }
5398
- var left = data.length - i;
5399
- if (left > 0) {
5400
- var c = (data[i] << 16) | (left === 2 ? data[i + 1] << 8 : 0);
5401
- out += this._encodeByte((c >>> 3 * 6) & 63);
5402
- out += this._encodeByte((c >>> 2 * 6) & 63);
5577
+ }
5578
+ return (length + 2) / 3 * 4 | 0;
5579
+ };
5580
+ Coder2.prototype.encode = function(data) {
5581
+ var out = "";
5582
+ var i = 0;
5583
+ for (; i < data.length - 2; i += 3) {
5584
+ var c = data[i] << 16 | data[i + 1] << 8 | data[i + 2];
5585
+ out += this._encodeByte(c >>> 3 * 6 & 63);
5586
+ out += this._encodeByte(c >>> 2 * 6 & 63);
5587
+ out += this._encodeByte(c >>> 1 * 6 & 63);
5588
+ out += this._encodeByte(c >>> 0 * 6 & 63);
5589
+ }
5590
+ var left = data.length - i;
5591
+ if (left > 0) {
5592
+ var c = data[i] << 16 | (left === 2 ? data[i + 1] << 8 : 0);
5593
+ out += this._encodeByte(c >>> 3 * 6 & 63);
5594
+ out += this._encodeByte(c >>> 2 * 6 & 63);
5403
5595
  if (left === 2) {
5404
- out += this._encodeByte((c >>> 1 * 6) & 63);
5405
- }
5406
- else {
5407
- out += this._paddingCharacter || "";
5596
+ out += this._encodeByte(c >>> 1 * 6 & 63);
5597
+ } else {
5598
+ out += this._paddingCharacter || "";
5408
5599
  }
5409
5600
  out += this._paddingCharacter || "";
5410
- }
5411
- return out;
5412
- };
5413
- Coder.prototype.maxDecodedLength = function (length) {
5414
- if (!this._paddingCharacter) {
5601
+ }
5602
+ return out;
5603
+ };
5604
+ Coder2.prototype.maxDecodedLength = function(length) {
5605
+ if (!this._paddingCharacter) {
5415
5606
  return (length * 6 + 7) / 8 | 0;
5416
- }
5417
- return length / 4 * 3 | 0;
5418
- };
5419
- Coder.prototype.decodedLength = function (s) {
5420
- return this.maxDecodedLength(s.length - this._getPaddingLength(s));
5421
- };
5422
- Coder.prototype.decode = function (s) {
5423
- if (s.length === 0) {
5607
+ }
5608
+ return length / 4 * 3 | 0;
5609
+ };
5610
+ Coder2.prototype.decodedLength = function(s) {
5611
+ return this.maxDecodedLength(s.length - this._getPaddingLength(s));
5612
+ };
5613
+ Coder2.prototype.decode = function(s) {
5614
+ if (s.length === 0) {
5424
5615
  return new Uint8Array(0);
5425
- }
5426
- var paddingLength = this._getPaddingLength(s);
5427
- var length = s.length - paddingLength;
5428
- var out = new Uint8Array(this.maxDecodedLength(length));
5429
- var op = 0;
5430
- var i = 0;
5431
- var haveBad = 0;
5432
- var v0 = 0, v1 = 0, v2 = 0, v3 = 0;
5433
- for (; i < length - 4; i += 4) {
5616
+ }
5617
+ var paddingLength = this._getPaddingLength(s);
5618
+ var length = s.length - paddingLength;
5619
+ var out = new Uint8Array(this.maxDecodedLength(length));
5620
+ var op = 0;
5621
+ var i = 0;
5622
+ var haveBad = 0;
5623
+ var v0 = 0, v1 = 0, v2 = 0, v3 = 0;
5624
+ for (; i < length - 4; i += 4) {
5434
5625
  v0 = this._decodeChar(s.charCodeAt(i + 0));
5435
5626
  v1 = this._decodeChar(s.charCodeAt(i + 1));
5436
5627
  v2 = this._decodeChar(s.charCodeAt(i + 2));
5437
5628
  v3 = this._decodeChar(s.charCodeAt(i + 3));
5438
- out[op++] = (v0 << 2) | (v1 >>> 4);
5439
- out[op++] = (v1 << 4) | (v2 >>> 2);
5440
- out[op++] = (v2 << 6) | v3;
5629
+ out[op++] = v0 << 2 | v1 >>> 4;
5630
+ out[op++] = v1 << 4 | v2 >>> 2;
5631
+ out[op++] = v2 << 6 | v3;
5441
5632
  haveBad |= v0 & INVALID_BYTE;
5442
5633
  haveBad |= v1 & INVALID_BYTE;
5443
5634
  haveBad |= v2 & INVALID_BYTE;
5444
5635
  haveBad |= v3 & INVALID_BYTE;
5445
- }
5446
- if (i < length - 1) {
5636
+ }
5637
+ if (i < length - 1) {
5447
5638
  v0 = this._decodeChar(s.charCodeAt(i));
5448
5639
  v1 = this._decodeChar(s.charCodeAt(i + 1));
5449
- out[op++] = (v0 << 2) | (v1 >>> 4);
5640
+ out[op++] = v0 << 2 | v1 >>> 4;
5450
5641
  haveBad |= v0 & INVALID_BYTE;
5451
5642
  haveBad |= v1 & INVALID_BYTE;
5452
- }
5453
- if (i < length - 2) {
5643
+ }
5644
+ if (i < length - 2) {
5454
5645
  v2 = this._decodeChar(s.charCodeAt(i + 2));
5455
- out[op++] = (v1 << 4) | (v2 >>> 2);
5646
+ out[op++] = v1 << 4 | v2 >>> 2;
5456
5647
  haveBad |= v2 & INVALID_BYTE;
5457
- }
5458
- if (i < length - 3) {
5648
+ }
5649
+ if (i < length - 3) {
5459
5650
  v3 = this._decodeChar(s.charCodeAt(i + 3));
5460
- out[op++] = (v2 << 6) | v3;
5651
+ out[op++] = v2 << 6 | v3;
5461
5652
  haveBad |= v3 & INVALID_BYTE;
5462
- }
5463
- if (haveBad !== 0) {
5653
+ }
5654
+ if (haveBad !== 0) {
5464
5655
  throw new Error("Base64Coder: incorrect characters for decoding");
5465
- }
5466
- return out;
5467
- };
5468
- // Standard encoding have the following encoded/decoded ranges,
5469
- // which we need to convert between.
5470
- //
5471
- // ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789 + /
5472
- // Index: 0 - 25 26 - 51 52 - 61 62 63
5473
- // ASCII: 65 - 90 97 - 122 48 - 57 43 47
5474
- //
5475
- // Encode 6 bits in b into a new character.
5476
- Coder.prototype._encodeByte = function (b) {
5477
- // Encoding uses constant time operations as follows:
5478
- //
5479
- // 1. Define comparison of A with B using (A - B) >>> 8:
5480
- // if A > B, then result is positive integer
5481
- // if A <= B, then result is 0
5482
- //
5483
- // 2. Define selection of C or 0 using bitwise AND: X & C:
5484
- // if X == 0, then result is 0
5485
- // if X != 0, then result is C
5486
- //
5487
- // 3. Start with the smallest comparison (b >= 0), which is always
5488
- // true, so set the result to the starting ASCII value (65).
5489
- //
5490
- // 4. Continue comparing b to higher ASCII values, and selecting
5491
- // zero if comparison isn't true, otherwise selecting a value
5492
- // to add to result, which:
5493
- //
5494
- // a) undoes the previous addition
5495
- // b) provides new value to add
5496
- //
5497
- var result = b;
5498
- // b >= 0
5499
- result += 65;
5500
- // b > 25
5501
- result += ((25 - b) >>> 8) & ((0 - 65) - 26 + 97);
5502
- // b > 51
5503
- result += ((51 - b) >>> 8) & ((26 - 97) - 52 + 48);
5504
- // b > 61
5505
- result += ((61 - b) >>> 8) & ((52 - 48) - 62 + 43);
5506
- // b > 62
5507
- result += ((62 - b) >>> 8) & ((62 - 43) - 63 + 47);
5508
- return String.fromCharCode(result);
5509
- };
5510
- // Decode a character code into a byte.
5511
- // Must return 256 if character is out of alphabet range.
5512
- Coder.prototype._decodeChar = function (c) {
5513
- // Decoding works similar to encoding: using the same comparison
5514
- // function, but now it works on ranges: result is always incremented
5515
- // by value, but this value becomes zero if the range is not
5516
- // satisfied.
5517
- //
5518
- // Decoding starts with invalid value, 256, which is then
5519
- // subtracted when the range is satisfied. If none of the ranges
5520
- // apply, the function returns 256, which is then checked by
5521
- // the caller to throw error.
5522
- var result = INVALID_BYTE; // start with invalid character
5523
- // c == 43 (c > 42 and c < 44)
5524
- result += (((42 - c) & (c - 44)) >>> 8) & (-INVALID_BYTE + c - 43 + 62);
5525
- // c == 47 (c > 46 and c < 48)
5526
- result += (((46 - c) & (c - 48)) >>> 8) & (-INVALID_BYTE + c - 47 + 63);
5527
- // c > 47 and c < 58
5528
- result += (((47 - c) & (c - 58)) >>> 8) & (-INVALID_BYTE + c - 48 + 52);
5529
- // c > 64 and c < 91
5530
- result += (((64 - c) & (c - 91)) >>> 8) & (-INVALID_BYTE + c - 65 + 0);
5531
- // c > 96 and c < 123
5532
- result += (((96 - c) & (c - 123)) >>> 8) & (-INVALID_BYTE + c - 97 + 26);
5533
- return result;
5534
- };
5535
- Coder.prototype._getPaddingLength = function (s) {
5536
- var paddingLength = 0;
5537
- if (this._paddingCharacter) {
5656
+ }
5657
+ return out;
5658
+ };
5659
+ Coder2.prototype._encodeByte = function(b) {
5660
+ var result = b;
5661
+ result += 65;
5662
+ result += 25 - b >>> 8 & 0 - 65 - 26 + 97;
5663
+ result += 51 - b >>> 8 & 26 - 97 - 52 + 48;
5664
+ result += 61 - b >>> 8 & 52 - 48 - 62 + 43;
5665
+ result += 62 - b >>> 8 & 62 - 43 - 63 + 47;
5666
+ return String.fromCharCode(result);
5667
+ };
5668
+ Coder2.prototype._decodeChar = function(c) {
5669
+ var result = INVALID_BYTE;
5670
+ result += (42 - c & c - 44) >>> 8 & -INVALID_BYTE + c - 43 + 62;
5671
+ result += (46 - c & c - 48) >>> 8 & -INVALID_BYTE + c - 47 + 63;
5672
+ result += (47 - c & c - 58) >>> 8 & -INVALID_BYTE + c - 48 + 52;
5673
+ result += (64 - c & c - 91) >>> 8 & -INVALID_BYTE + c - 65 + 0;
5674
+ result += (96 - c & c - 123) >>> 8 & -INVALID_BYTE + c - 97 + 26;
5675
+ return result;
5676
+ };
5677
+ Coder2.prototype._getPaddingLength = function(s) {
5678
+ var paddingLength = 0;
5679
+ if (this._paddingCharacter) {
5538
5680
  for (var i = s.length - 1; i >= 0; i--) {
5539
- if (s[i] !== this._paddingCharacter) {
5540
- break;
5541
- }
5542
- paddingLength++;
5681
+ if (s[i] !== this._paddingCharacter) {
5682
+ break;
5683
+ }
5684
+ paddingLength++;
5543
5685
  }
5544
5686
  if (s.length < 4 || paddingLength > 2) {
5545
- throw new Error("Base64Coder: incorrect padding");
5687
+ throw new Error("Base64Coder: incorrect padding");
5546
5688
  }
5547
- }
5548
- return paddingLength;
5689
+ }
5690
+ return paddingLength;
5691
+ };
5692
+ return Coder2;
5693
+ }()
5694
+ );
5695
+ exports.Coder = Coder;
5696
+ var stdCoder = new Coder();
5697
+ function encode2(data) {
5698
+ return stdCoder.encode(data);
5699
+ }
5700
+ exports.encode = encode2;
5701
+ function decode2(s) {
5702
+ return stdCoder.decode(s);
5703
+ }
5704
+ exports.decode = decode2;
5705
+ var URLSafeCoder = (
5706
+ /** @class */
5707
+ function(_super) {
5708
+ __extends(URLSafeCoder2, _super);
5709
+ function URLSafeCoder2() {
5710
+ return _super !== null && _super.apply(this, arguments) || this;
5711
+ }
5712
+ URLSafeCoder2.prototype._encodeByte = function(b) {
5713
+ var result = b;
5714
+ result += 65;
5715
+ result += 25 - b >>> 8 & 0 - 65 - 26 + 97;
5716
+ result += 51 - b >>> 8 & 26 - 97 - 52 + 48;
5717
+ result += 61 - b >>> 8 & 52 - 48 - 62 + 45;
5718
+ result += 62 - b >>> 8 & 62 - 45 - 63 + 95;
5719
+ return String.fromCharCode(result);
5720
+ };
5721
+ URLSafeCoder2.prototype._decodeChar = function(c) {
5722
+ var result = INVALID_BYTE;
5723
+ result += (44 - c & c - 46) >>> 8 & -INVALID_BYTE + c - 45 + 62;
5724
+ result += (94 - c & c - 96) >>> 8 & -INVALID_BYTE + c - 95 + 63;
5725
+ result += (47 - c & c - 58) >>> 8 & -INVALID_BYTE + c - 48 + 52;
5726
+ result += (64 - c & c - 91) >>> 8 & -INVALID_BYTE + c - 65 + 0;
5727
+ result += (96 - c & c - 123) >>> 8 & -INVALID_BYTE + c - 97 + 26;
5728
+ return result;
5729
+ };
5730
+ return URLSafeCoder2;
5731
+ }(Coder)
5732
+ );
5733
+ exports.URLSafeCoder = URLSafeCoder;
5734
+ var urlSafeCoder = new URLSafeCoder();
5735
+ function encodeURLSafe(data) {
5736
+ return urlSafeCoder.encode(data);
5737
+ }
5738
+ exports.encodeURLSafe = encodeURLSafe;
5739
+ function decodeURLSafe(s) {
5740
+ return urlSafeCoder.decode(s);
5741
+ }
5742
+ exports.decodeURLSafe = decodeURLSafe;
5743
+ exports.encodedLength = function(length) {
5744
+ return stdCoder.encodedLength(length);
5549
5745
  };
5550
- return Coder;
5551
- }());
5552
- base64$1.Coder = Coder;
5553
- var stdCoder = new Coder();
5554
- function encode(data) {
5555
- return stdCoder.encode(data);
5556
- }
5557
- base64$1.encode = encode;
5558
- function decode(s) {
5559
- return stdCoder.decode(s);
5560
- }
5561
- base64$1.decode = decode;
5562
- /**
5563
- * Implements URL-safe Base64 encoding.
5564
- * (Same as Base64, but '+' is replaced with '-', and '/' with '_').
5565
- *
5566
- * Operates in constant time.
5567
- */
5568
- var URLSafeCoder = /** @class */ (function (_super) {
5569
- __extends(URLSafeCoder, _super);
5570
- function URLSafeCoder() {
5571
- return _super !== null && _super.apply(this, arguments) || this;
5572
- }
5573
- // URL-safe encoding have the following encoded/decoded ranges:
5574
- //
5575
- // ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789 - _
5576
- // Index: 0 - 25 26 - 51 52 - 61 62 63
5577
- // ASCII: 65 - 90 97 - 122 48 - 57 45 95
5578
- //
5579
- URLSafeCoder.prototype._encodeByte = function (b) {
5580
- var result = b;
5581
- // b >= 0
5582
- result += 65;
5583
- // b > 25
5584
- result += ((25 - b) >>> 8) & ((0 - 65) - 26 + 97);
5585
- // b > 51
5586
- result += ((51 - b) >>> 8) & ((26 - 97) - 52 + 48);
5587
- // b > 61
5588
- result += ((61 - b) >>> 8) & ((52 - 48) - 62 + 45);
5589
- // b > 62
5590
- result += ((62 - b) >>> 8) & ((62 - 45) - 63 + 95);
5591
- return String.fromCharCode(result);
5746
+ exports.maxDecodedLength = function(length) {
5747
+ return stdCoder.maxDecodedLength(length);
5592
5748
  };
5593
- URLSafeCoder.prototype._decodeChar = function (c) {
5594
- var result = INVALID_BYTE;
5595
- // c == 45 (c > 44 and c < 46)
5596
- result += (((44 - c) & (c - 46)) >>> 8) & (-INVALID_BYTE + c - 45 + 62);
5597
- // c == 95 (c > 94 and c < 96)
5598
- result += (((94 - c) & (c - 96)) >>> 8) & (-INVALID_BYTE + c - 95 + 63);
5599
- // c > 47 and c < 58
5600
- result += (((47 - c) & (c - 58)) >>> 8) & (-INVALID_BYTE + c - 48 + 52);
5601
- // c > 64 and c < 91
5602
- result += (((64 - c) & (c - 91)) >>> 8) & (-INVALID_BYTE + c - 65 + 0);
5603
- // c > 96 and c < 123
5604
- result += (((96 - c) & (c - 123)) >>> 8) & (-INVALID_BYTE + c - 97 + 26);
5605
- return result;
5749
+ exports.decodedLength = function(s) {
5750
+ return stdCoder.decodedLength(s);
5606
5751
  };
5607
- return URLSafeCoder;
5608
- }(Coder));
5609
- base64$1.URLSafeCoder = URLSafeCoder;
5610
- var urlSafeCoder = new URLSafeCoder();
5611
- function encodeURLSafe(data) {
5612
- return urlSafeCoder.encode(data);
5613
- }
5614
- base64$1.encodeURLSafe = encodeURLSafe;
5615
- function decodeURLSafe(s) {
5616
- return urlSafeCoder.decode(s);
5617
- }
5618
- base64$1.decodeURLSafe = decodeURLSafe;
5619
- base64$1.encodedLength = function (length) {
5620
- return stdCoder.encodedLength(length);
5621
- };
5622
- base64$1.maxDecodedLength = function (length) {
5623
- return stdCoder.maxDecodedLength(length);
5624
- };
5625
- base64$1.decodedLength = function (s) {
5626
- return stdCoder.decodedLength(s);
5627
- };
5628
-
5629
- var sha256$1 = {exports: {}};
5630
-
5631
- (function (module) {
5632
- (function (root, factory) {
5633
- // Hack to make all exports of this module sha256 function object properties.
5634
- var exports = {};
5635
- factory(exports);
5636
- var sha256 = exports["default"];
5637
- for (var k in exports) {
5638
- sha256[k] = exports[k];
5639
- }
5640
-
5641
- {
5642
- module.exports = sha256;
5643
- }
5644
- })(commonjsGlobal, function(exports) {
5645
- exports.__esModule = true;
5646
- // SHA-256 (+ HMAC and PBKDF2) for JavaScript.
5647
- //
5648
- // Written in 2014-2016 by Dmitry Chestnykh.
5649
- // Public domain, no warranty.
5650
- //
5651
- // Functions (accept and return Uint8Arrays):
5652
- //
5653
- // sha256(message) -> hash
5654
- // sha256.hmac(key, message) -> mac
5655
- // sha256.pbkdf2(password, salt, rounds, dkLen) -> dk
5656
- //
5657
- // Classes:
5658
- //
5659
- // new sha256.Hash()
5660
- // new sha256.HMAC(key)
5661
- //
5662
- exports.digestLength = 32;
5663
- exports.blockSize = 64;
5664
- // SHA-256 constants
5665
- var K = new Uint32Array([
5666
- 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b,
5667
- 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01,
5668
- 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7,
5669
- 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
5670
- 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152,
5671
- 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
5672
- 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc,
5673
- 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
5674
- 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819,
5675
- 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08,
5676
- 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f,
5677
- 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
5678
- 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
5679
- ]);
5680
- function hashBlocks(w, v, p, pos, len) {
5681
- var a, b, c, d, e, f, g, h, u, i, j, t1, t2;
5682
- while (len >= 64) {
5683
- a = v[0];
5684
- b = v[1];
5685
- c = v[2];
5686
- d = v[3];
5687
- e = v[4];
5688
- f = v[5];
5689
- g = v[6];
5690
- h = v[7];
5691
- for (i = 0; i < 16; i++) {
5692
- j = pos + i * 4;
5693
- w[i] = (((p[j] & 0xff) << 24) | ((p[j + 1] & 0xff) << 16) |
5694
- ((p[j + 2] & 0xff) << 8) | (p[j + 3] & 0xff));
5695
- }
5696
- for (i = 16; i < 64; i++) {
5697
- u = w[i - 2];
5698
- t1 = (u >>> 17 | u << (32 - 17)) ^ (u >>> 19 | u << (32 - 19)) ^ (u >>> 10);
5699
- u = w[i - 15];
5700
- t2 = (u >>> 7 | u << (32 - 7)) ^ (u >>> 18 | u << (32 - 18)) ^ (u >>> 3);
5701
- w[i] = (t1 + w[i - 7] | 0) + (t2 + w[i - 16] | 0);
5702
- }
5703
- for (i = 0; i < 64; i++) {
5704
- t1 = (((((e >>> 6 | e << (32 - 6)) ^ (e >>> 11 | e << (32 - 11)) ^
5705
- (e >>> 25 | e << (32 - 25))) + ((e & f) ^ (~e & g))) | 0) +
5706
- ((h + ((K[i] + w[i]) | 0)) | 0)) | 0;
5707
- t2 = (((a >>> 2 | a << (32 - 2)) ^ (a >>> 13 | a << (32 - 13)) ^
5708
- (a >>> 22 | a << (32 - 22))) + ((a & b) ^ (a & c) ^ (b & c))) | 0;
5709
- h = g;
5710
- g = f;
5711
- f = e;
5712
- e = (d + t1) | 0;
5713
- d = c;
5714
- c = b;
5715
- b = a;
5716
- a = (t1 + t2) | 0;
5717
- }
5718
- v[0] += a;
5719
- v[1] += b;
5720
- v[2] += c;
5721
- v[3] += d;
5722
- v[4] += e;
5723
- v[5] += f;
5724
- v[6] += g;
5725
- v[7] += h;
5726
- pos += 64;
5727
- len -= 64;
5728
- }
5729
- return pos;
5730
- }
5731
- // Hash implements SHA256 hash algorithm.
5732
- var Hash = /** @class */ (function () {
5733
- function Hash() {
5734
- this.digestLength = exports.digestLength;
5735
- this.blockSize = exports.blockSize;
5736
- // Note: Int32Array is used instead of Uint32Array for performance reasons.
5737
- this.state = new Int32Array(8); // hash state
5738
- this.temp = new Int32Array(64); // temporary state
5739
- this.buffer = new Uint8Array(128); // buffer for data to hash
5740
- this.bufferLength = 0; // number of bytes in buffer
5741
- this.bytesHashed = 0; // number of total bytes hashed
5742
- this.finished = false; // indicates whether the hash was finalized
5743
- this.reset();
5744
- }
5745
- // Resets hash state making it possible
5746
- // to re-use this instance to hash other data.
5747
- Hash.prototype.reset = function () {
5748
- this.state[0] = 0x6a09e667;
5749
- this.state[1] = 0xbb67ae85;
5750
- this.state[2] = 0x3c6ef372;
5751
- this.state[3] = 0xa54ff53a;
5752
- this.state[4] = 0x510e527f;
5753
- this.state[5] = 0x9b05688c;
5754
- this.state[6] = 0x1f83d9ab;
5755
- this.state[7] = 0x5be0cd19;
5756
- this.bufferLength = 0;
5757
- this.bytesHashed = 0;
5758
- this.finished = false;
5759
- return this;
5760
- };
5761
- // Cleans internal buffers and re-initializes hash state.
5762
- Hash.prototype.clean = function () {
5763
- for (var i = 0; i < this.buffer.length; i++) {
5764
- this.buffer[i] = 0;
5765
- }
5766
- for (var i = 0; i < this.temp.length; i++) {
5767
- this.temp[i] = 0;
5768
- }
5769
- this.reset();
5770
- };
5771
- // Updates hash state with the given data.
5772
- //
5773
- // Optionally, length of the data can be specified to hash
5774
- // fewer bytes than data.length.
5775
- //
5776
- // Throws error when trying to update already finalized hash:
5777
- // instance must be reset to use it again.
5778
- Hash.prototype.update = function (data, dataLength) {
5779
- if (dataLength === void 0) { dataLength = data.length; }
5780
- if (this.finished) {
5781
- throw new Error("SHA256: can't update because hash was finished.");
5782
- }
5783
- var dataPos = 0;
5784
- this.bytesHashed += dataLength;
5785
- if (this.bufferLength > 0) {
5786
- while (this.bufferLength < 64 && dataLength > 0) {
5787
- this.buffer[this.bufferLength++] = data[dataPos++];
5788
- dataLength--;
5789
- }
5790
- if (this.bufferLength === 64) {
5791
- hashBlocks(this.temp, this.state, this.buffer, 0, 64);
5792
- this.bufferLength = 0;
5793
- }
5794
- }
5795
- if (dataLength >= 64) {
5796
- dataPos = hashBlocks(this.temp, this.state, data, dataPos, dataLength);
5797
- dataLength %= 64;
5798
- }
5799
- while (dataLength > 0) {
5800
- this.buffer[this.bufferLength++] = data[dataPos++];
5801
- dataLength--;
5802
- }
5803
- return this;
5804
- };
5805
- // Finalizes hash state and puts hash into out.
5806
- //
5807
- // If hash was already finalized, puts the same value.
5808
- Hash.prototype.finish = function (out) {
5809
- if (!this.finished) {
5810
- var bytesHashed = this.bytesHashed;
5811
- var left = this.bufferLength;
5812
- var bitLenHi = (bytesHashed / 0x20000000) | 0;
5813
- var bitLenLo = bytesHashed << 3;
5814
- var padLength = (bytesHashed % 64 < 56) ? 64 : 128;
5815
- this.buffer[left] = 0x80;
5816
- for (var i = left + 1; i < padLength - 8; i++) {
5817
- this.buffer[i] = 0;
5818
- }
5819
- this.buffer[padLength - 8] = (bitLenHi >>> 24) & 0xff;
5820
- this.buffer[padLength - 7] = (bitLenHi >>> 16) & 0xff;
5821
- this.buffer[padLength - 6] = (bitLenHi >>> 8) & 0xff;
5822
- this.buffer[padLength - 5] = (bitLenHi >>> 0) & 0xff;
5823
- this.buffer[padLength - 4] = (bitLenLo >>> 24) & 0xff;
5824
- this.buffer[padLength - 3] = (bitLenLo >>> 16) & 0xff;
5825
- this.buffer[padLength - 2] = (bitLenLo >>> 8) & 0xff;
5826
- this.buffer[padLength - 1] = (bitLenLo >>> 0) & 0xff;
5827
- hashBlocks(this.temp, this.state, this.buffer, 0, padLength);
5828
- this.finished = true;
5829
- }
5830
- for (var i = 0; i < 8; i++) {
5831
- out[i * 4 + 0] = (this.state[i] >>> 24) & 0xff;
5832
- out[i * 4 + 1] = (this.state[i] >>> 16) & 0xff;
5833
- out[i * 4 + 2] = (this.state[i] >>> 8) & 0xff;
5834
- out[i * 4 + 3] = (this.state[i] >>> 0) & 0xff;
5835
- }
5836
- return this;
5837
- };
5838
- // Returns the final hash digest.
5839
- Hash.prototype.digest = function () {
5840
- var out = new Uint8Array(this.digestLength);
5841
- this.finish(out);
5842
- return out;
5843
- };
5844
- // Internal function for use in HMAC for optimization.
5845
- Hash.prototype._saveState = function (out) {
5846
- for (var i = 0; i < this.state.length; i++) {
5847
- out[i] = this.state[i];
5848
- }
5849
- };
5850
- // Internal function for use in HMAC for optimization.
5851
- Hash.prototype._restoreState = function (from, bytesHashed) {
5852
- for (var i = 0; i < this.state.length; i++) {
5853
- this.state[i] = from[i];
5854
- }
5855
- this.bytesHashed = bytesHashed;
5856
- this.finished = false;
5857
- this.bufferLength = 0;
5858
- };
5859
- return Hash;
5860
- }());
5861
- exports.Hash = Hash;
5862
- // HMAC implements HMAC-SHA256 message authentication algorithm.
5863
- var HMAC = /** @class */ (function () {
5864
- function HMAC(key) {
5865
- this.inner = new Hash();
5866
- this.outer = new Hash();
5867
- this.blockSize = this.inner.blockSize;
5868
- this.digestLength = this.inner.digestLength;
5869
- var pad = new Uint8Array(this.blockSize);
5870
- if (key.length > this.blockSize) {
5871
- (new Hash()).update(key).finish(pad).clean();
5872
- }
5873
- else {
5874
- for (var i = 0; i < key.length; i++) {
5875
- pad[i] = key[i];
5876
- }
5877
- }
5878
- for (var i = 0; i < pad.length; i++) {
5879
- pad[i] ^= 0x36;
5880
- }
5881
- this.inner.update(pad);
5882
- for (var i = 0; i < pad.length; i++) {
5883
- pad[i] ^= 0x36 ^ 0x5c;
5884
- }
5885
- this.outer.update(pad);
5886
- this.istate = new Uint32Array(8);
5887
- this.ostate = new Uint32Array(8);
5888
- this.inner._saveState(this.istate);
5889
- this.outer._saveState(this.ostate);
5890
- for (var i = 0; i < pad.length; i++) {
5891
- pad[i] = 0;
5892
- }
5893
- }
5894
- // Returns HMAC state to the state initialized with key
5895
- // to make it possible to run HMAC over the other data with the same
5896
- // key without creating a new instance.
5897
- HMAC.prototype.reset = function () {
5898
- this.inner._restoreState(this.istate, this.inner.blockSize);
5899
- this.outer._restoreState(this.ostate, this.outer.blockSize);
5900
- return this;
5901
- };
5902
- // Cleans HMAC state.
5903
- HMAC.prototype.clean = function () {
5904
- for (var i = 0; i < this.istate.length; i++) {
5905
- this.ostate[i] = this.istate[i] = 0;
5906
- }
5907
- this.inner.clean();
5908
- this.outer.clean();
5909
- };
5910
- // Updates state with provided data.
5911
- HMAC.prototype.update = function (data) {
5912
- this.inner.update(data);
5913
- return this;
5914
- };
5915
- // Finalizes HMAC and puts the result in out.
5916
- HMAC.prototype.finish = function (out) {
5917
- if (this.outer.finished) {
5918
- this.outer.finish(out);
5919
- }
5920
- else {
5921
- this.inner.finish(out);
5922
- this.outer.update(out, this.digestLength).finish(out);
5923
- }
5924
- return this;
5925
- };
5926
- // Returns message authentication code.
5927
- HMAC.prototype.digest = function () {
5928
- var out = new Uint8Array(this.digestLength);
5929
- this.finish(out);
5930
- return out;
5931
- };
5932
- return HMAC;
5933
- }());
5934
- exports.HMAC = HMAC;
5935
- // Returns SHA256 hash of data.
5936
- function hash(data) {
5937
- var h = (new Hash()).update(data);
5938
- var digest = h.digest();
5939
- h.clean();
5940
- return digest;
5941
- }
5942
- exports.hash = hash;
5943
- // Function hash is both available as module.hash and as default export.
5944
- exports["default"] = hash;
5945
- // Returns HMAC-SHA256 of data under the key.
5946
- function hmac(key, data) {
5947
- var h = (new HMAC(key)).update(data);
5948
- var digest = h.digest();
5949
- h.clean();
5950
- return digest;
5951
- }
5952
- exports.hmac = hmac;
5953
- // Fills hkdf buffer like this:
5954
- // T(1) = HMAC-Hash(PRK, T(0) | info | 0x01)
5955
- function fillBuffer(buffer, hmac, info, counter) {
5956
- // Counter is a byte value: check if it overflowed.
5957
- var num = counter[0];
5958
- if (num === 0) {
5959
- throw new Error("hkdf: cannot expand more");
5960
- }
5961
- // Prepare HMAC instance for new data with old key.
5962
- hmac.reset();
5963
- // Hash in previous output if it was generated
5964
- // (i.e. counter is greater than 1).
5965
- if (num > 1) {
5966
- hmac.update(buffer);
5967
- }
5968
- // Hash in info if it exists.
5969
- if (info) {
5970
- hmac.update(info);
5971
- }
5972
- // Hash in the counter.
5973
- hmac.update(counter);
5974
- // Output result to buffer and clean HMAC instance.
5975
- hmac.finish(buffer);
5976
- // Increment counter inside typed array, this works properly.
5977
- counter[0]++;
5978
- }
5979
- var hkdfSalt = new Uint8Array(exports.digestLength); // Filled with zeroes.
5980
- function hkdf(key, salt, info, length) {
5981
- if (salt === void 0) { salt = hkdfSalt; }
5982
- if (length === void 0) { length = 32; }
5983
- var counter = new Uint8Array([1]);
5984
- // HKDF-Extract uses salt as HMAC key, and key as data.
5985
- var okm = hmac(salt, key);
5986
- // Initialize HMAC for expanding with extracted key.
5987
- // Ensure no collisions with `hmac` function.
5988
- var hmac_ = new HMAC(okm);
5989
- // Allocate buffer.
5990
- var buffer = new Uint8Array(hmac_.digestLength);
5991
- var bufpos = buffer.length;
5992
- var out = new Uint8Array(length);
5993
- for (var i = 0; i < length; i++) {
5994
- if (bufpos === buffer.length) {
5995
- fillBuffer(buffer, hmac_, info, counter);
5996
- bufpos = 0;
5997
- }
5998
- out[i] = buffer[bufpos++];
5999
- }
6000
- hmac_.clean();
6001
- buffer.fill(0);
6002
- counter.fill(0);
6003
- return out;
6004
- }
6005
- exports.hkdf = hkdf;
6006
- // Derives a key from password and salt using PBKDF2-HMAC-SHA256
6007
- // with the given number of iterations.
6008
- //
6009
- // The number of bytes returned is equal to dkLen.
6010
- //
6011
- // (For better security, avoid dkLen greater than hash length - 32 bytes).
6012
- function pbkdf2(password, salt, iterations, dkLen) {
6013
- var prf = new HMAC(password);
6014
- var len = prf.digestLength;
6015
- var ctr = new Uint8Array(4);
6016
- var t = new Uint8Array(len);
6017
- var u = new Uint8Array(len);
6018
- var dk = new Uint8Array(dkLen);
6019
- for (var i = 0; i * len < dkLen; i++) {
6020
- var c = i + 1;
6021
- ctr[0] = (c >>> 24) & 0xff;
6022
- ctr[1] = (c >>> 16) & 0xff;
6023
- ctr[2] = (c >>> 8) & 0xff;
6024
- ctr[3] = (c >>> 0) & 0xff;
6025
- prf.reset();
6026
- prf.update(salt);
6027
- prf.update(ctr);
6028
- prf.finish(u);
6029
- for (var j = 0; j < len; j++) {
6030
- t[j] = u[j];
6031
- }
6032
- for (var j = 2; j <= iterations; j++) {
6033
- prf.reset();
6034
- prf.update(u).finish(u);
6035
- for (var k = 0; k < len; k++) {
6036
- t[k] ^= u[k];
6037
- }
6038
- }
6039
- for (var j = 0; j < len && i * len + j < dkLen; j++) {
6040
- dk[i * len + j] = t[j];
6041
- }
6042
- }
6043
- for (var i = 0; i < len; i++) {
6044
- t[i] = u[i] = 0;
6045
- }
6046
- for (var i = 0; i < 4; i++) {
6047
- ctr[i] = 0;
6048
- }
6049
- prf.clean();
6050
- return dk;
6051
- }
6052
- exports.pbkdf2 = pbkdf2;
6053
- });
6054
- } (sha256$1));
5752
+ }
5753
+ });
6055
5754
 
6056
- var sha256Exports = sha256$1.exports;
5755
+ // ../../node_modules/fast-sha256/sha256.js
5756
+ var require_sha256 = __commonJS({
5757
+ "../../node_modules/fast-sha256/sha256.js"(exports, module) {
5758
+ (function(root, factory) {
5759
+ var exports2 = {};
5760
+ factory(exports2);
5761
+ var sha2562 = exports2["default"];
5762
+ for (var k in exports2) {
5763
+ sha2562[k] = exports2[k];
5764
+ }
5765
+ if (typeof module === "object" && typeof module.exports === "object") {
5766
+ module.exports = sha2562;
5767
+ } else if (typeof define === "function" && define.amd) {
5768
+ define(function() {
5769
+ return sha2562;
5770
+ });
5771
+ } else {
5772
+ root.sha256 = sha2562;
5773
+ }
5774
+ })(exports, function(exports2) {
5775
+ exports2.__esModule = true;
5776
+ exports2.digestLength = 32;
5777
+ exports2.blockSize = 64;
5778
+ var K = new Uint32Array([
5779
+ 1116352408,
5780
+ 1899447441,
5781
+ 3049323471,
5782
+ 3921009573,
5783
+ 961987163,
5784
+ 1508970993,
5785
+ 2453635748,
5786
+ 2870763221,
5787
+ 3624381080,
5788
+ 310598401,
5789
+ 607225278,
5790
+ 1426881987,
5791
+ 1925078388,
5792
+ 2162078206,
5793
+ 2614888103,
5794
+ 3248222580,
5795
+ 3835390401,
5796
+ 4022224774,
5797
+ 264347078,
5798
+ 604807628,
5799
+ 770255983,
5800
+ 1249150122,
5801
+ 1555081692,
5802
+ 1996064986,
5803
+ 2554220882,
5804
+ 2821834349,
5805
+ 2952996808,
5806
+ 3210313671,
5807
+ 3336571891,
5808
+ 3584528711,
5809
+ 113926993,
5810
+ 338241895,
5811
+ 666307205,
5812
+ 773529912,
5813
+ 1294757372,
5814
+ 1396182291,
5815
+ 1695183700,
5816
+ 1986661051,
5817
+ 2177026350,
5818
+ 2456956037,
5819
+ 2730485921,
5820
+ 2820302411,
5821
+ 3259730800,
5822
+ 3345764771,
5823
+ 3516065817,
5824
+ 3600352804,
5825
+ 4094571909,
5826
+ 275423344,
5827
+ 430227734,
5828
+ 506948616,
5829
+ 659060556,
5830
+ 883997877,
5831
+ 958139571,
5832
+ 1322822218,
5833
+ 1537002063,
5834
+ 1747873779,
5835
+ 1955562222,
5836
+ 2024104815,
5837
+ 2227730452,
5838
+ 2361852424,
5839
+ 2428436474,
5840
+ 2756734187,
5841
+ 3204031479,
5842
+ 3329325298
5843
+ ]);
5844
+ function hashBlocks(w, v, p, pos, len) {
5845
+ var a, b, c, d, e, f, g, h, u, i, j, t1, t2;
5846
+ while (len >= 64) {
5847
+ a = v[0];
5848
+ b = v[1];
5849
+ c = v[2];
5850
+ d = v[3];
5851
+ e = v[4];
5852
+ f = v[5];
5853
+ g = v[6];
5854
+ h = v[7];
5855
+ for (i = 0; i < 16; i++) {
5856
+ j = pos + i * 4;
5857
+ w[i] = (p[j] & 255) << 24 | (p[j + 1] & 255) << 16 | (p[j + 2] & 255) << 8 | p[j + 3] & 255;
5858
+ }
5859
+ for (i = 16; i < 64; i++) {
5860
+ u = w[i - 2];
5861
+ t1 = (u >>> 17 | u << 32 - 17) ^ (u >>> 19 | u << 32 - 19) ^ u >>> 10;
5862
+ u = w[i - 15];
5863
+ t2 = (u >>> 7 | u << 32 - 7) ^ (u >>> 18 | u << 32 - 18) ^ u >>> 3;
5864
+ w[i] = (t1 + w[i - 7] | 0) + (t2 + w[i - 16] | 0);
5865
+ }
5866
+ for (i = 0; i < 64; i++) {
5867
+ 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;
5868
+ t2 = ((a >>> 2 | a << 32 - 2) ^ (a >>> 13 | a << 32 - 13) ^ (a >>> 22 | a << 32 - 22)) + (a & b ^ a & c ^ b & c) | 0;
5869
+ h = g;
5870
+ g = f;
5871
+ f = e;
5872
+ e = d + t1 | 0;
5873
+ d = c;
5874
+ c = b;
5875
+ b = a;
5876
+ a = t1 + t2 | 0;
5877
+ }
5878
+ v[0] += a;
5879
+ v[1] += b;
5880
+ v[2] += c;
5881
+ v[3] += d;
5882
+ v[4] += e;
5883
+ v[5] += f;
5884
+ v[6] += g;
5885
+ v[7] += h;
5886
+ pos += 64;
5887
+ len -= 64;
5888
+ }
5889
+ return pos;
5890
+ }
5891
+ var Hash = (
5892
+ /** @class */
5893
+ function() {
5894
+ function Hash2() {
5895
+ this.digestLength = exports2.digestLength;
5896
+ this.blockSize = exports2.blockSize;
5897
+ this.state = new Int32Array(8);
5898
+ this.temp = new Int32Array(64);
5899
+ this.buffer = new Uint8Array(128);
5900
+ this.bufferLength = 0;
5901
+ this.bytesHashed = 0;
5902
+ this.finished = false;
5903
+ this.reset();
5904
+ }
5905
+ Hash2.prototype.reset = function() {
5906
+ this.state[0] = 1779033703;
5907
+ this.state[1] = 3144134277;
5908
+ this.state[2] = 1013904242;
5909
+ this.state[3] = 2773480762;
5910
+ this.state[4] = 1359893119;
5911
+ this.state[5] = 2600822924;
5912
+ this.state[6] = 528734635;
5913
+ this.state[7] = 1541459225;
5914
+ this.bufferLength = 0;
5915
+ this.bytesHashed = 0;
5916
+ this.finished = false;
5917
+ return this;
5918
+ };
5919
+ Hash2.prototype.clean = function() {
5920
+ for (var i = 0; i < this.buffer.length; i++) {
5921
+ this.buffer[i] = 0;
5922
+ }
5923
+ for (var i = 0; i < this.temp.length; i++) {
5924
+ this.temp[i] = 0;
5925
+ }
5926
+ this.reset();
5927
+ };
5928
+ Hash2.prototype.update = function(data, dataLength) {
5929
+ if (dataLength === void 0) {
5930
+ dataLength = data.length;
5931
+ }
5932
+ if (this.finished) {
5933
+ throw new Error("SHA256: can't update because hash was finished.");
5934
+ }
5935
+ var dataPos = 0;
5936
+ this.bytesHashed += dataLength;
5937
+ if (this.bufferLength > 0) {
5938
+ while (this.bufferLength < 64 && dataLength > 0) {
5939
+ this.buffer[this.bufferLength++] = data[dataPos++];
5940
+ dataLength--;
5941
+ }
5942
+ if (this.bufferLength === 64) {
5943
+ hashBlocks(this.temp, this.state, this.buffer, 0, 64);
5944
+ this.bufferLength = 0;
5945
+ }
5946
+ }
5947
+ if (dataLength >= 64) {
5948
+ dataPos = hashBlocks(this.temp, this.state, data, dataPos, dataLength);
5949
+ dataLength %= 64;
5950
+ }
5951
+ while (dataLength > 0) {
5952
+ this.buffer[this.bufferLength++] = data[dataPos++];
5953
+ dataLength--;
5954
+ }
5955
+ return this;
5956
+ };
5957
+ Hash2.prototype.finish = function(out) {
5958
+ if (!this.finished) {
5959
+ var bytesHashed = this.bytesHashed;
5960
+ var left = this.bufferLength;
5961
+ var bitLenHi = bytesHashed / 536870912 | 0;
5962
+ var bitLenLo = bytesHashed << 3;
5963
+ var padLength = bytesHashed % 64 < 56 ? 64 : 128;
5964
+ this.buffer[left] = 128;
5965
+ for (var i = left + 1; i < padLength - 8; i++) {
5966
+ this.buffer[i] = 0;
5967
+ }
5968
+ this.buffer[padLength - 8] = bitLenHi >>> 24 & 255;
5969
+ this.buffer[padLength - 7] = bitLenHi >>> 16 & 255;
5970
+ this.buffer[padLength - 6] = bitLenHi >>> 8 & 255;
5971
+ this.buffer[padLength - 5] = bitLenHi >>> 0 & 255;
5972
+ this.buffer[padLength - 4] = bitLenLo >>> 24 & 255;
5973
+ this.buffer[padLength - 3] = bitLenLo >>> 16 & 255;
5974
+ this.buffer[padLength - 2] = bitLenLo >>> 8 & 255;
5975
+ this.buffer[padLength - 1] = bitLenLo >>> 0 & 255;
5976
+ hashBlocks(this.temp, this.state, this.buffer, 0, padLength);
5977
+ this.finished = true;
5978
+ }
5979
+ for (var i = 0; i < 8; i++) {
5980
+ out[i * 4 + 0] = this.state[i] >>> 24 & 255;
5981
+ out[i * 4 + 1] = this.state[i] >>> 16 & 255;
5982
+ out[i * 4 + 2] = this.state[i] >>> 8 & 255;
5983
+ out[i * 4 + 3] = this.state[i] >>> 0 & 255;
5984
+ }
5985
+ return this;
5986
+ };
5987
+ Hash2.prototype.digest = function() {
5988
+ var out = new Uint8Array(this.digestLength);
5989
+ this.finish(out);
5990
+ return out;
5991
+ };
5992
+ Hash2.prototype._saveState = function(out) {
5993
+ for (var i = 0; i < this.state.length; i++) {
5994
+ out[i] = this.state[i];
5995
+ }
5996
+ };
5997
+ Hash2.prototype._restoreState = function(from, bytesHashed) {
5998
+ for (var i = 0; i < this.state.length; i++) {
5999
+ this.state[i] = from[i];
6000
+ }
6001
+ this.bytesHashed = bytesHashed;
6002
+ this.finished = false;
6003
+ this.bufferLength = 0;
6004
+ };
6005
+ return Hash2;
6006
+ }()
6007
+ );
6008
+ exports2.Hash = Hash;
6009
+ var HMAC = (
6010
+ /** @class */
6011
+ function() {
6012
+ function HMAC2(key) {
6013
+ this.inner = new Hash();
6014
+ this.outer = new Hash();
6015
+ this.blockSize = this.inner.blockSize;
6016
+ this.digestLength = this.inner.digestLength;
6017
+ var pad = new Uint8Array(this.blockSize);
6018
+ if (key.length > this.blockSize) {
6019
+ new Hash().update(key).finish(pad).clean();
6020
+ } else {
6021
+ for (var i = 0; i < key.length; i++) {
6022
+ pad[i] = key[i];
6023
+ }
6024
+ }
6025
+ for (var i = 0; i < pad.length; i++) {
6026
+ pad[i] ^= 54;
6027
+ }
6028
+ this.inner.update(pad);
6029
+ for (var i = 0; i < pad.length; i++) {
6030
+ pad[i] ^= 54 ^ 92;
6031
+ }
6032
+ this.outer.update(pad);
6033
+ this.istate = new Uint32Array(8);
6034
+ this.ostate = new Uint32Array(8);
6035
+ this.inner._saveState(this.istate);
6036
+ this.outer._saveState(this.ostate);
6037
+ for (var i = 0; i < pad.length; i++) {
6038
+ pad[i] = 0;
6039
+ }
6040
+ }
6041
+ HMAC2.prototype.reset = function() {
6042
+ this.inner._restoreState(this.istate, this.inner.blockSize);
6043
+ this.outer._restoreState(this.ostate, this.outer.blockSize);
6044
+ return this;
6045
+ };
6046
+ HMAC2.prototype.clean = function() {
6047
+ for (var i = 0; i < this.istate.length; i++) {
6048
+ this.ostate[i] = this.istate[i] = 0;
6049
+ }
6050
+ this.inner.clean();
6051
+ this.outer.clean();
6052
+ };
6053
+ HMAC2.prototype.update = function(data) {
6054
+ this.inner.update(data);
6055
+ return this;
6056
+ };
6057
+ HMAC2.prototype.finish = function(out) {
6058
+ if (this.outer.finished) {
6059
+ this.outer.finish(out);
6060
+ } else {
6061
+ this.inner.finish(out);
6062
+ this.outer.update(out, this.digestLength).finish(out);
6063
+ }
6064
+ return this;
6065
+ };
6066
+ HMAC2.prototype.digest = function() {
6067
+ var out = new Uint8Array(this.digestLength);
6068
+ this.finish(out);
6069
+ return out;
6070
+ };
6071
+ return HMAC2;
6072
+ }()
6073
+ );
6074
+ exports2.HMAC = HMAC;
6075
+ function hash(data) {
6076
+ var h = new Hash().update(data);
6077
+ var digest = h.digest();
6078
+ h.clean();
6079
+ return digest;
6080
+ }
6081
+ exports2.hash = hash;
6082
+ exports2["default"] = hash;
6083
+ function hmac2(key, data) {
6084
+ var h = new HMAC(key).update(data);
6085
+ var digest = h.digest();
6086
+ h.clean();
6087
+ return digest;
6088
+ }
6089
+ exports2.hmac = hmac2;
6090
+ function fillBuffer(buffer, hmac3, info, counter) {
6091
+ var num = counter[0];
6092
+ if (num === 0) {
6093
+ throw new Error("hkdf: cannot expand more");
6094
+ }
6095
+ hmac3.reset();
6096
+ if (num > 1) {
6097
+ hmac3.update(buffer);
6098
+ }
6099
+ if (info) {
6100
+ hmac3.update(info);
6101
+ }
6102
+ hmac3.update(counter);
6103
+ hmac3.finish(buffer);
6104
+ counter[0]++;
6105
+ }
6106
+ var hkdfSalt = new Uint8Array(exports2.digestLength);
6107
+ function hkdf(key, salt, info, length) {
6108
+ if (salt === void 0) {
6109
+ salt = hkdfSalt;
6110
+ }
6111
+ if (length === void 0) {
6112
+ length = 32;
6113
+ }
6114
+ var counter = new Uint8Array([1]);
6115
+ var okm = hmac2(salt, key);
6116
+ var hmac_ = new HMAC(okm);
6117
+ var buffer = new Uint8Array(hmac_.digestLength);
6118
+ var bufpos = buffer.length;
6119
+ var out = new Uint8Array(length);
6120
+ for (var i = 0; i < length; i++) {
6121
+ if (bufpos === buffer.length) {
6122
+ fillBuffer(buffer, hmac_, info, counter);
6123
+ bufpos = 0;
6124
+ }
6125
+ out[i] = buffer[bufpos++];
6126
+ }
6127
+ hmac_.clean();
6128
+ buffer.fill(0);
6129
+ counter.fill(0);
6130
+ return out;
6131
+ }
6132
+ exports2.hkdf = hkdf;
6133
+ function pbkdf2(password, salt, iterations, dkLen) {
6134
+ var prf = new HMAC(password);
6135
+ var len = prf.digestLength;
6136
+ var ctr = new Uint8Array(4);
6137
+ var t = new Uint8Array(len);
6138
+ var u = new Uint8Array(len);
6139
+ var dk = new Uint8Array(dkLen);
6140
+ for (var i = 0; i * len < dkLen; i++) {
6141
+ var c = i + 1;
6142
+ ctr[0] = c >>> 24 & 255;
6143
+ ctr[1] = c >>> 16 & 255;
6144
+ ctr[2] = c >>> 8 & 255;
6145
+ ctr[3] = c >>> 0 & 255;
6146
+ prf.reset();
6147
+ prf.update(salt);
6148
+ prf.update(ctr);
6149
+ prf.finish(u);
6150
+ for (var j = 0; j < len; j++) {
6151
+ t[j] = u[j];
6152
+ }
6153
+ for (var j = 2; j <= iterations; j++) {
6154
+ prf.reset();
6155
+ prf.update(u).finish(u);
6156
+ for (var k = 0; k < len; k++) {
6157
+ t[k] ^= u[k];
6158
+ }
6159
+ }
6160
+ for (var j = 0; j < len && i * len + j < dkLen; j++) {
6161
+ dk[i * len + j] = t[j];
6162
+ }
6163
+ }
6164
+ for (var i = 0; i < len; i++) {
6165
+ t[i] = u[i] = 0;
6166
+ }
6167
+ for (var i = 0; i < 4; i++) {
6168
+ ctr[i] = 0;
6169
+ }
6170
+ prf.clean();
6171
+ return dk;
6172
+ }
6173
+ exports2.pbkdf2 = pbkdf2;
6174
+ });
6175
+ }
6176
+ });
6057
6177
 
6058
- Object.defineProperty(dist, "__esModule", { value: true });
6059
- var Webhook_1 = dist.Webhook = WebhookVerificationError_1 = dist.WebhookVerificationError = void 0;
6060
- const timing_safe_equal_1 = timing_safe_equal;
6061
- const base64 = base64$1;
6062
- const sha256 = sha256Exports;
6063
- const WEBHOOK_TOLERANCE_IN_SECONDS = 5 * 60;
6064
- class ExtendableError extends Error {
6065
- constructor(message) {
6066
- super(message);
6067
- Object.setPrototypeOf(this, ExtendableError.prototype);
6068
- this.name = "ExtendableError";
6069
- this.stack = new Error(message).stack;
6178
+ // src/webhook/vendor/standardwebhook.ts
6179
+ var base64 = __toESM(require_base64());
6180
+ var sha256 = __toESM(require_sha256());
6181
+ var WEBHOOK_TOLERANCE_IN_SECONDS = 5 * 60;
6182
+ var ExtendableError = class _ExtendableError extends Error {
6183
+ constructor(message) {
6184
+ super(message);
6185
+ Object.setPrototypeOf(this, _ExtendableError.prototype);
6186
+ this.name = "ExtendableError";
6187
+ this.stack = new Error(message).stack;
6188
+ }
6189
+ };
6190
+ var WebhookVerificationError = class _WebhookVerificationError extends ExtendableError {
6191
+ constructor(message) {
6192
+ super(message);
6193
+ Object.setPrototypeOf(this, _WebhookVerificationError.prototype);
6194
+ this.name = "WebhookVerificationError";
6195
+ }
6196
+ };
6197
+ var Webhook = class _Webhook {
6198
+ static prefix = "whsec_";
6199
+ key;
6200
+ constructor(secret, options) {
6201
+ if (!secret) {
6202
+ throw new Error("Secret can't be empty.");
6203
+ }
6204
+ if ((options == null ? void 0 : options.format) === "raw") {
6205
+ if (secret instanceof Uint8Array) {
6206
+ this.key = secret;
6207
+ } else {
6208
+ this.key = Uint8Array.from(secret, (c) => c.charCodeAt(0));
6209
+ }
6210
+ } else {
6211
+ if (typeof secret !== "string") {
6212
+ throw new Error("Expected secret to be of type string");
6213
+ }
6214
+ if (secret.startsWith(_Webhook.prefix)) {
6215
+ secret = secret.substring(_Webhook.prefix.length);
6216
+ }
6217
+ this.key = base64.decode(secret);
6070
6218
  }
6071
- }
6072
- class WebhookVerificationError extends ExtendableError {
6073
- constructor(message) {
6074
- super(message);
6075
- Object.setPrototypeOf(this, WebhookVerificationError.prototype);
6076
- this.name = "WebhookVerificationError";
6219
+ }
6220
+ verify(payload, headers_) {
6221
+ const headers = {};
6222
+ for (const key of Object.keys(headers_)) {
6223
+ headers[key.toLowerCase()] = headers_[key];
6224
+ }
6225
+ const msgId = headers["webhook-id"];
6226
+ const msgSignature = headers["webhook-signature"];
6227
+ const msgTimestamp = headers["webhook-timestamp"];
6228
+ if (!msgSignature || !msgId || !msgTimestamp) {
6229
+ throw new WebhookVerificationError("Missing required headers");
6230
+ }
6231
+ const timestamp = this.verifyTimestamp(msgTimestamp);
6232
+ const computedSignature = this.sign(msgId, timestamp, payload);
6233
+ const expectedSignature = computedSignature.split(",")[1];
6234
+ const passedSignatures = msgSignature.split(" ");
6235
+ const encoder = new globalThis.TextEncoder();
6236
+ for (const versionedSignature of passedSignatures) {
6237
+ const [version, signature] = versionedSignature.split(",");
6238
+ if (version !== "v1") {
6239
+ continue;
6240
+ }
6241
+ if (timingSafeEqual(
6242
+ encoder.encode(signature),
6243
+ encoder.encode(expectedSignature)
6244
+ )) {
6245
+ return JSON.parse(payload.toString());
6246
+ }
6077
6247
  }
6078
- }
6079
- var WebhookVerificationError_1 = dist.WebhookVerificationError = WebhookVerificationError;
6080
- class Webhook {
6081
- constructor(secret, options) {
6082
- if (!secret) {
6083
- throw new Error("Secret can't be empty.");
6084
- }
6085
- if ((options === null || options === void 0 ? void 0 : options.format) === "raw") {
6086
- if (secret instanceof Uint8Array) {
6087
- this.key = secret;
6088
- }
6089
- else {
6090
- this.key = Uint8Array.from(secret, (c) => c.charCodeAt(0));
6091
- }
6092
- }
6093
- else {
6094
- if (typeof secret !== "string") {
6095
- throw new Error("Expected secret to be of type string");
6096
- }
6097
- if (secret.startsWith(Webhook.prefix)) {
6098
- secret = secret.substring(Webhook.prefix.length);
6099
- }
6100
- this.key = base64.decode(secret);
6101
- }
6248
+ throw new WebhookVerificationError("No matching signature found");
6249
+ }
6250
+ sign(msgId, timestamp, payload) {
6251
+ if (typeof payload === "string") ; else if (payload.constructor.name === "Buffer") {
6252
+ payload = payload.toString();
6253
+ } else {
6254
+ throw new Error("Expected payload to be of type string or Buffer.");
6102
6255
  }
6103
- verify(payload, headers_) {
6104
- const headers = {};
6105
- for (const key of Object.keys(headers_)) {
6106
- headers[key.toLowerCase()] = headers_[key];
6107
- }
6108
- const msgId = headers["webhook-id"];
6109
- const msgSignature = headers["webhook-signature"];
6110
- const msgTimestamp = headers["webhook-timestamp"];
6111
- if (!msgSignature || !msgId || !msgTimestamp) {
6112
- throw new WebhookVerificationError("Missing required headers");
6113
- }
6114
- const timestamp = this.verifyTimestamp(msgTimestamp);
6115
- const computedSignature = this.sign(msgId, timestamp, payload);
6116
- const expectedSignature = computedSignature.split(",")[1];
6117
- const passedSignatures = msgSignature.split(" ");
6118
- const encoder = new globalThis.TextEncoder();
6119
- for (const versionedSignature of passedSignatures) {
6120
- const [version, signature] = versionedSignature.split(",");
6121
- if (version !== "v1") {
6122
- continue;
6123
- }
6124
- if ((0, timing_safe_equal_1.timingSafeEqual)(encoder.encode(signature), encoder.encode(expectedSignature))) {
6125
- return JSON.parse(payload.toString());
6126
- }
6127
- }
6128
- throw new WebhookVerificationError("No matching signature found");
6256
+ const encoder = new TextEncoder();
6257
+ const timestampNumber = Math.floor(timestamp.getTime() / 1e3);
6258
+ const toSign = encoder.encode(`${msgId}.${timestampNumber}.${payload}`);
6259
+ const expectedSignature = base64.encode(sha256.hmac(this.key, toSign));
6260
+ return `v1,${expectedSignature}`;
6261
+ }
6262
+ verifyTimestamp(timestampHeader) {
6263
+ const now = Math.floor(Date.now() / 1e3);
6264
+ const timestamp = parseInt(timestampHeader, 10);
6265
+ if (isNaN(timestamp)) {
6266
+ throw new WebhookVerificationError("Invalid Signature Headers");
6129
6267
  }
6130
- sign(msgId, timestamp, payload) {
6131
- if (typeof payload === "string") ;
6132
- else if (payload.constructor.name === "Buffer") {
6133
- payload = payload.toString();
6134
- }
6135
- else {
6136
- throw new Error("Expected payload to be of type string or Buffer.");
6137
- }
6138
- const encoder = new TextEncoder();
6139
- const timestampNumber = Math.floor(timestamp.getTime() / 1000);
6140
- const toSign = encoder.encode(`${msgId}.${timestampNumber}.${payload}`);
6141
- const expectedSignature = base64.encode(sha256.hmac(this.key, toSign));
6142
- return `v1,${expectedSignature}`;
6268
+ if (now - timestamp > WEBHOOK_TOLERANCE_IN_SECONDS) {
6269
+ throw new WebhookVerificationError("Message timestamp too old");
6143
6270
  }
6144
- verifyTimestamp(timestampHeader) {
6145
- const now = Math.floor(Date.now() / 1000);
6146
- const timestamp = parseInt(timestampHeader, 10);
6147
- if (isNaN(timestamp)) {
6148
- throw new WebhookVerificationError("Invalid Signature Headers");
6149
- }
6150
- if (now - timestamp > WEBHOOK_TOLERANCE_IN_SECONDS) {
6151
- throw new WebhookVerificationError("Message timestamp too old");
6152
- }
6153
- if (timestamp > now + WEBHOOK_TOLERANCE_IN_SECONDS) {
6154
- throw new WebhookVerificationError("Message timestamp too new");
6155
- }
6156
- return new Date(timestamp * 1000);
6271
+ if (timestamp > now + WEBHOOK_TOLERANCE_IN_SECONDS) {
6272
+ throw new WebhookVerificationError("Message timestamp too new");
6157
6273
  }
6158
- }
6159
- Webhook_1 = dist.Webhook = Webhook;
6160
- Webhook.prefix = "whsec_";
6274
+ return new Date(timestamp * 1e3);
6275
+ }
6276
+ };
6277
+ /**
6278
+ * The MIT License
6279
+ *
6280
+ * Copyright (c) 2023 Svix (https://www.svix.com)
6281
+ *
6282
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
6283
+ * of this software and associated documentation files (the "Software"), to deal
6284
+ * in the Software without restriction, including without limitation the rights
6285
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
6286
+ * copies of the Software, and to permit persons to whom the Software is
6287
+ * furnished to do so, subject to the following conditions:
6288
+ *
6289
+ * The above copyright notice and this permission notice shall be included in
6290
+ * all copies or substantial portions of the Software.
6291
+ *
6292
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6293
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
6294
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
6295
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
6296
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
6297
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
6298
+ * THE SOFTWARE.
6299
+ *
6300
+ * @fileoverview Server-only webhook verification implementation.
6301
+ * @description Vendored from standardwebhooks package to avoid bundling issues.
6302
+ * Uses Node.js crypto module - DO NOT import in client/browser code.
6303
+ * @license MIT
6304
+ * @internal
6305
+ */
6161
6306
 
6307
+ // src/webhook/webhook.ts
6162
6308
  async function handleWebhookPayload(payload, config, context) {
6163
6309
  const callHandler = (handler, payload2) => {
6164
6310
  if (!handler) return;
@@ -6218,9 +6364,6 @@ async function handleWebhookPayload(payload, config, context) {
6218
6364
  if (payload.type === "subscription.renewed") {
6219
6365
  await callHandler(config.onSubscriptionRenewed, payload);
6220
6366
  }
6221
- if (payload.type === "subscription.paused") {
6222
- await callHandler(config.onSubscriptionPaused, payload);
6223
- }
6224
6367
  if (payload.type === "subscription.plan_changed") {
6225
6368
  await callHandler(config.onSubscriptionPlanChanged, payload);
6226
6369
  }
@@ -6239,17 +6382,41 @@ async function handleWebhookPayload(payload, config, context) {
6239
6382
  if (payload.type === "license_key.created") {
6240
6383
  await callHandler(config.onLicenseKeyCreated, payload);
6241
6384
  }
6385
+ if (payload.type === "credit.added") {
6386
+ await callHandler(config.onCreditAdded, payload);
6387
+ }
6388
+ if (payload.type === "credit.deducted") {
6389
+ await callHandler(config.onCreditDeducted, payload);
6390
+ }
6391
+ if (payload.type === "credit.expired") {
6392
+ await callHandler(config.onCreditExpired, payload);
6393
+ }
6394
+ if (payload.type === "credit.rolled_over") {
6395
+ await callHandler(config.onCreditRolledOver, payload);
6396
+ }
6397
+ if (payload.type === "credit.rollover_forfeited") {
6398
+ await callHandler(config.onCreditRolloverForfeited, payload);
6399
+ }
6400
+ if (payload.type === "credit.overage_charged") {
6401
+ await callHandler(config.onCreditOverageCharged, payload);
6402
+ }
6403
+ if (payload.type === "credit.manual_adjustment") {
6404
+ await callHandler(config.onCreditManualAdjustment, payload);
6405
+ }
6406
+ if (payload.type === "credit.balance_low") {
6407
+ await callHandler(config.onCreditBalanceLow, payload);
6408
+ }
6242
6409
  }
6243
6410
  var verifyWebhookPayload = async ({
6244
6411
  webhookKey,
6245
6412
  headers,
6246
6413
  body
6247
6414
  }) => {
6248
- const standardWebhook = new Webhook_1(webhookKey);
6415
+ const standardWebhook = new Webhook(webhookKey);
6249
6416
  try {
6250
6417
  standardWebhook.verify(body, headers);
6251
6418
  } catch (e) {
6252
- if (e instanceof WebhookVerificationError_1) {
6419
+ if (e instanceof WebhookVerificationError) {
6253
6420
  throw new Error(e.message);
6254
6421
  }
6255
6422
  throw e;