@blindpay/node 2.4.0 → 3.0.0

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.
Files changed (77) hide show
  1. package/dist/{api-client-Cw2mNJeR.d.mts → api-client-B7VQkM_4.d.mts} +96 -35
  2. package/dist/{api-client-Cw2mNJeR.d.ts → api-client-B7VQkM_4.d.ts} +96 -35
  3. package/dist/{chunk-5XJJKYXE.mjs → chunk-LEPGLH7Q.mjs} +20 -10
  4. package/dist/{chunk-3QQCDR3E.mjs → chunk-VBZHAPK7.mjs} +8 -0
  5. package/dist/{chunk-OTRFWEEC.mjs → chunk-VRA5HP7F.mjs} +4 -0
  6. package/dist/{chunk-4DVSRRBP.mjs → chunk-WH2VNZE7.mjs} +25 -22
  7. package/dist/index.d.mts +14 -14
  8. package/dist/index.d.ts +14 -14
  9. package/dist/index.js +50 -25
  10. package/dist/index.mjs +8 -8
  11. package/dist/resources/api-keys/api-keys.test.js +50 -25
  12. package/dist/resources/api-keys/api-keys.test.mjs +5 -5
  13. package/dist/resources/api-keys/index.d.mts +1 -1
  14. package/dist/resources/api-keys/index.d.ts +1 -1
  15. package/dist/resources/available/available.test.js +50 -25
  16. package/dist/resources/available/available.test.mjs +5 -5
  17. package/dist/resources/available/index.d.mts +1 -1
  18. package/dist/resources/available/index.d.ts +1 -1
  19. package/dist/resources/bank-accounts/bank-accounts.test.js +50 -25
  20. package/dist/resources/bank-accounts/bank-accounts.test.mjs +5 -5
  21. package/dist/resources/bank-accounts/index.d.mts +2 -4
  22. package/dist/resources/bank-accounts/index.d.ts +2 -4
  23. package/dist/resources/instances/index.d.mts +1 -1
  24. package/dist/resources/instances/index.d.ts +1 -1
  25. package/dist/resources/instances/instances.test.js +50 -25
  26. package/dist/resources/instances/instances.test.mjs +5 -5
  27. package/dist/resources/partner-fees/index.d.mts +1 -1
  28. package/dist/resources/partner-fees/index.d.ts +1 -1
  29. package/dist/resources/partner-fees/partner-fees.test.js +50 -25
  30. package/dist/resources/partner-fees/partner-fees.test.mjs +5 -5
  31. package/dist/resources/payins/index.d.mts +9 -33
  32. package/dist/resources/payins/index.d.ts +9 -33
  33. package/dist/resources/payins/payins-quotes.test.js +100 -25
  34. package/dist/resources/payins/payins-quotes.test.mjs +55 -5
  35. package/dist/resources/payins/payins.test.js +164 -52
  36. package/dist/resources/payins/payins.test.mjs +119 -32
  37. package/dist/resources/payins/quotes.d.mts +38 -2
  38. package/dist/resources/payins/quotes.d.ts +38 -2
  39. package/dist/resources/payins/quotes.js +4 -0
  40. package/dist/resources/payins/quotes.mjs +1 -1
  41. package/dist/resources/payouts/index.d.mts +42 -17
  42. package/dist/resources/payouts/index.d.ts +42 -17
  43. package/dist/resources/payouts/index.js +8 -0
  44. package/dist/resources/payouts/index.mjs +1 -1
  45. package/dist/resources/payouts/payouts.test.js +162 -27
  46. package/dist/resources/payouts/payouts.test.mjs +117 -7
  47. package/dist/resources/quotes/index.d.mts +1 -1
  48. package/dist/resources/quotes/index.d.ts +1 -1
  49. package/dist/resources/quotes/quotes.test.js +50 -25
  50. package/dist/resources/quotes/quotes.test.mjs +5 -5
  51. package/dist/resources/receivers/index.d.mts +9 -7
  52. package/dist/resources/receivers/index.d.ts +9 -7
  53. package/dist/resources/receivers/receivers.test.js +57 -33
  54. package/dist/resources/receivers/receivers.test.mjs +12 -13
  55. package/dist/resources/terms-of-service/index.d.mts +1 -1
  56. package/dist/resources/terms-of-service/index.d.ts +1 -1
  57. package/dist/resources/terms-of-service/terms-of-service.test.js +50 -25
  58. package/dist/resources/terms-of-service/terms-of-service.test.mjs +5 -5
  59. package/dist/resources/virtual-accounts/index.d.mts +22 -7
  60. package/dist/resources/virtual-accounts/index.d.ts +22 -7
  61. package/dist/resources/virtual-accounts/index.js +20 -10
  62. package/dist/resources/virtual-accounts/index.mjs +1 -1
  63. package/dist/resources/virtual-accounts/virtual-accounts.test.js +169 -44
  64. package/dist/resources/virtual-accounts/virtual-accounts.test.mjs +124 -24
  65. package/dist/resources/wallets/blockchain.d.mts +1 -1
  66. package/dist/resources/wallets/blockchain.d.ts +1 -1
  67. package/dist/resources/wallets/blockchain.test.js +50 -25
  68. package/dist/resources/wallets/blockchain.test.mjs +5 -5
  69. package/dist/resources/wallets/offramp.d.mts +1 -1
  70. package/dist/resources/wallets/offramp.d.ts +1 -1
  71. package/dist/resources/wallets/offramp.test.js +50 -25
  72. package/dist/resources/wallets/offramp.test.mjs +5 -5
  73. package/dist/resources/webhooks/index.d.mts +1 -1
  74. package/dist/resources/webhooks/index.d.ts +1 -1
  75. package/dist/resources/webhooks/webhooks.test.js +50 -25
  76. package/dist/resources/webhooks/webhooks.test.mjs +5 -5
  77. package/package.json +6 -2
package/dist/index.js CHANGED
@@ -88,10 +88,10 @@ __export(index_exports, {
88
88
  module.exports = __toCommonJS(index_exports);
89
89
 
90
90
  // src/client.ts
91
- var import_node_crypto = require("crypto");
91
+ var import_svix = require("svix");
92
92
 
93
93
  // package.json
94
- var version = "2.4.0";
94
+ var version = "3.0.0";
95
95
 
96
96
  // src/internal/blindpay-error.ts
97
97
  var BlindPayError = class extends Error {
@@ -320,6 +320,10 @@ function createPayinQuotesResource(instanceId, client) {
320
320
  },
321
321
  get(id) {
322
322
  return client.get(`/instances/${instanceId}/payin-quotes/${id}`);
323
+ },
324
+ list(params) {
325
+ const queryParams = params ? `?${new URLSearchParams(params)}` : "";
326
+ return client.get(`/instances/${instanceId}/payin-quotes${queryParams}`);
323
327
  }
324
328
  };
325
329
  }
@@ -352,6 +356,14 @@ function createPayoutsResource(instanceId, client) {
352
356
  createEvm(_c) {
353
357
  var data = __objRest(_c, []);
354
358
  return client.post(`/instances/${instanceId}/payouts/evm`, data);
359
+ },
360
+ authorizeSolana(_d) {
361
+ var data = __objRest(_d, []);
362
+ return client.post(`/instances/${instanceId}/payouts/solana/authorize`, data);
363
+ },
364
+ createSolana(_e) {
365
+ var data = __objRest(_e, []);
366
+ return client.post(`/instances/${instanceId}/payouts/solana`, data);
355
367
  }
356
368
  };
357
369
  }
@@ -444,30 +456,40 @@ function createTermsOfServiceResource(instanceId, client) {
444
456
  // src/resources/virtual-accounts/index.ts
445
457
  function createVirtualAccountsResource(instanceId, client) {
446
458
  return {
447
- update(_a) {
459
+ list(receiver_id) {
460
+ return client.get(`/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts`);
461
+ },
462
+ get({
463
+ receiver_id,
464
+ id
465
+ }) {
466
+ return client.get(
467
+ `/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts/${id}`
468
+ );
469
+ },
470
+ create(_a) {
448
471
  var _b = _a, {
449
472
  receiver_id
450
473
  } = _b, data = __objRest(_b, [
451
474
  "receiver_id"
452
475
  ]);
453
- return client.put(
476
+ return client.post(
454
477
  `/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts`,
455
478
  data
456
479
  );
457
480
  },
458
- create(_c) {
481
+ update(_c) {
459
482
  var _d = _c, {
460
- receiver_id
483
+ receiver_id,
484
+ id
461
485
  } = _d, data = __objRest(_d, [
462
- "receiver_id"
486
+ "receiver_id",
487
+ "id"
463
488
  ]);
464
- return client.post(
465
- `/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts`,
489
+ return client.put(
490
+ `/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts/${id}`,
466
491
  data
467
492
  );
468
- },
469
- get(receiver_id) {
470
- return client.get(`/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts`);
471
493
  }
472
494
  };
473
495
  }
@@ -725,26 +747,29 @@ var BlindPay = class {
725
747
  });
726
748
  }
727
749
  /**
728
- * Verifies the BlindPay webhook signature
750
+ * Verifies the BlindPay webhook signature using Svix
729
751
  *
730
752
  * @param params.secret The webhook secret from BlindPay dashboard
731
- * @param params.id The value of the `svix-id` header
732
- * @param params.timestamp The value of the `svix-timestamp` header
733
- * @param params.payload The raw request body
734
- * @param params.svixSignature The value of the `svix-signature` header
753
+ * @param params.headers The webhook headers object containing svix-id, svix-timestamp, and svix-signature
754
+ * @param params.payload The raw request body as a string
735
755
  * @returns {boolean} True if the signature is valid, false otherwise
736
756
  */
737
757
  verifyWebhookSignature({
738
758
  secret,
739
- id,
740
- timestamp,
741
- payload,
742
- svixSignature
759
+ headers,
760
+ payload
743
761
  }) {
744
- const signedContent = `${id}.${timestamp}.${payload}`;
745
- const secretBytes = Buffer.from(secret.split("_")[1], "base64");
746
- const expectedSignature = (0, import_node_crypto.createHmac)("sha256", secretBytes).update(signedContent).digest("base64");
747
- return svixSignature.length === expectedSignature.length && (0, import_node_crypto.timingSafeEqual)(Buffer.from(svixSignature), Buffer.from(expectedSignature));
762
+ try {
763
+ const webhook = new import_svix.Webhook(secret);
764
+ webhook.verify(payload, {
765
+ "svix-id": headers.id,
766
+ "svix-timestamp": headers.timestamp,
767
+ "svix-signature": headers.signature
768
+ });
769
+ return true;
770
+ } catch (e) {
771
+ return false;
772
+ }
748
773
  }
749
774
  };
750
775
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  BlindPay,
3
3
  init_client
4
- } from "./chunk-4DVSRRBP.mjs";
4
+ } from "./chunk-WH2VNZE7.mjs";
5
5
  import {
6
6
  createBlockchainWalletsResource,
7
7
  init_blockchain
@@ -26,7 +26,7 @@ import "./chunk-Z6EYX4D3.mjs";
26
26
  import {
27
27
  createVirtualAccountsResource,
28
28
  init_virtual_accounts
29
- } from "./chunk-5XJJKYXE.mjs";
29
+ } from "./chunk-LEPGLH7Q.mjs";
30
30
  import {
31
31
  createPartnerFeesResource,
32
32
  init_partner_fees
@@ -38,23 +38,23 @@ import {
38
38
  import {
39
39
  createPayinQuotesResource,
40
40
  init_quotes
41
- } from "./chunk-OTRFWEEC.mjs";
41
+ } from "./chunk-VRA5HP7F.mjs";
42
42
  import {
43
43
  createPayoutsResource,
44
44
  init_payouts
45
- } from "./chunk-3QQCDR3E.mjs";
45
+ } from "./chunk-VBZHAPK7.mjs";
46
46
  import {
47
47
  createApiKeysResource,
48
48
  init_api_keys
49
49
  } from "./chunk-LRHWT4JU.mjs";
50
- import {
51
- createAvailableResource,
52
- init_available
53
- } from "./chunk-U7CKUUO7.mjs";
54
50
  import {
55
51
  createBankAccountsResource,
56
52
  init_bank_accounts
57
53
  } from "./chunk-CPOSU35L.mjs";
54
+ import {
55
+ createAvailableResource,
56
+ init_available
57
+ } from "./chunk-U7CKUUO7.mjs";
58
58
  import {
59
59
  createInstancesResource,
60
60
  init_instances
@@ -18694,10 +18694,10 @@ function getImporter(name) {
18694
18694
  var import_expect_type = __toESM(require_dist(), 1);
18695
18695
 
18696
18696
  // src/client.ts
18697
- var import_node_crypto = require("crypto");
18697
+ var import_svix = require("svix");
18698
18698
 
18699
18699
  // package.json
18700
- var version = "2.4.0";
18700
+ var version = "3.0.0";
18701
18701
 
18702
18702
  // src/internal/blindpay-error.ts
18703
18703
  var BlindPayError = class extends Error {
@@ -18926,6 +18926,10 @@ function createPayinQuotesResource(instanceId, client) {
18926
18926
  },
18927
18927
  get(id) {
18928
18928
  return client.get(`/instances/${instanceId}/payin-quotes/${id}`);
18929
+ },
18930
+ list(params) {
18931
+ const queryParams = params ? `?${new URLSearchParams(params)}` : "";
18932
+ return client.get(`/instances/${instanceId}/payin-quotes${queryParams}`);
18929
18933
  }
18930
18934
  };
18931
18935
  }
@@ -18958,6 +18962,14 @@ function createPayoutsResource(instanceId, client) {
18958
18962
  createEvm(_c) {
18959
18963
  var data = __objRest(_c, []);
18960
18964
  return client.post(`/instances/${instanceId}/payouts/evm`, data);
18965
+ },
18966
+ authorizeSolana(_d) {
18967
+ var data = __objRest(_d, []);
18968
+ return client.post(`/instances/${instanceId}/payouts/solana/authorize`, data);
18969
+ },
18970
+ createSolana(_e) {
18971
+ var data = __objRest(_e, []);
18972
+ return client.post(`/instances/${instanceId}/payouts/solana`, data);
18961
18973
  }
18962
18974
  };
18963
18975
  }
@@ -19050,30 +19062,40 @@ function createTermsOfServiceResource(instanceId, client) {
19050
19062
  // src/resources/virtual-accounts/index.ts
19051
19063
  function createVirtualAccountsResource(instanceId, client) {
19052
19064
  return {
19053
- update(_a3) {
19065
+ list(receiver_id) {
19066
+ return client.get(`/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts`);
19067
+ },
19068
+ get({
19069
+ receiver_id,
19070
+ id
19071
+ }) {
19072
+ return client.get(
19073
+ `/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts/${id}`
19074
+ );
19075
+ },
19076
+ create(_a3) {
19054
19077
  var _b = _a3, {
19055
19078
  receiver_id
19056
19079
  } = _b, data = __objRest(_b, [
19057
19080
  "receiver_id"
19058
19081
  ]);
19059
- return client.put(
19082
+ return client.post(
19060
19083
  `/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts`,
19061
19084
  data
19062
19085
  );
19063
19086
  },
19064
- create(_c) {
19087
+ update(_c) {
19065
19088
  var _d = _c, {
19066
- receiver_id
19089
+ receiver_id,
19090
+ id
19067
19091
  } = _d, data = __objRest(_d, [
19068
- "receiver_id"
19092
+ "receiver_id",
19093
+ "id"
19069
19094
  ]);
19070
- return client.post(
19071
- `/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts`,
19095
+ return client.put(
19096
+ `/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts/${id}`,
19072
19097
  data
19073
19098
  );
19074
- },
19075
- get(receiver_id) {
19076
- return client.get(`/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts`);
19077
19099
  }
19078
19100
  };
19079
19101
  }
@@ -19331,26 +19353,29 @@ var BlindPay = class {
19331
19353
  });
19332
19354
  }
19333
19355
  /**
19334
- * Verifies the BlindPay webhook signature
19356
+ * Verifies the BlindPay webhook signature using Svix
19335
19357
  *
19336
19358
  * @param params.secret The webhook secret from BlindPay dashboard
19337
- * @param params.id The value of the `svix-id` header
19338
- * @param params.timestamp The value of the `svix-timestamp` header
19339
- * @param params.payload The raw request body
19340
- * @param params.svixSignature The value of the `svix-signature` header
19359
+ * @param params.headers The webhook headers object containing svix-id, svix-timestamp, and svix-signature
19360
+ * @param params.payload The raw request body as a string
19341
19361
  * @returns {boolean} True if the signature is valid, false otherwise
19342
19362
  */
19343
19363
  verifyWebhookSignature({
19344
19364
  secret,
19345
- id,
19346
- timestamp,
19347
- payload,
19348
- svixSignature
19365
+ headers,
19366
+ payload
19349
19367
  }) {
19350
- const signedContent = `${id}.${timestamp}.${payload}`;
19351
- const secretBytes = Buffer.from(secret.split("_")[1], "base64");
19352
- const expectedSignature = (0, import_node_crypto.createHmac)("sha256", secretBytes).update(signedContent).digest("base64");
19353
- return svixSignature.length === expectedSignature.length && (0, import_node_crypto.timingSafeEqual)(Buffer.from(svixSignature), Buffer.from(expectedSignature));
19368
+ try {
19369
+ const webhook = new import_svix.Webhook(secret);
19370
+ webhook.verify(payload, {
19371
+ "svix-id": headers.id,
19372
+ "svix-timestamp": headers.timestamp,
19373
+ "svix-signature": headers.signature
19374
+ });
19375
+ return true;
19376
+ } catch (e) {
19377
+ return false;
19378
+ }
19354
19379
  }
19355
19380
  };
19356
19381
 
@@ -7,21 +7,21 @@ import {
7
7
  import {
8
8
  BlindPay,
9
9
  init_client
10
- } from "../../chunk-4DVSRRBP.mjs";
10
+ } from "../../chunk-WH2VNZE7.mjs";
11
11
  import "../../chunk-FG25JHDX.mjs";
12
12
  import "../../chunk-QGNLMN6Z.mjs";
13
13
  import "../../chunk-UC57SCKQ.mjs";
14
14
  import "../../chunk-TBTA7A2P.mjs";
15
15
  import "../../chunk-67XECGMJ.mjs";
16
16
  import "../../chunk-Z6EYX4D3.mjs";
17
- import "../../chunk-5XJJKYXE.mjs";
17
+ import "../../chunk-LEPGLH7Q.mjs";
18
18
  import "../../chunk-RC5NN5UF.mjs";
19
19
  import "../../chunk-W7NJUABI.mjs";
20
- import "../../chunk-OTRFWEEC.mjs";
21
- import "../../chunk-3QQCDR3E.mjs";
20
+ import "../../chunk-VRA5HP7F.mjs";
21
+ import "../../chunk-VBZHAPK7.mjs";
22
22
  import "../../chunk-LRHWT4JU.mjs";
23
- import "../../chunk-U7CKUUO7.mjs";
24
23
  import "../../chunk-CPOSU35L.mjs";
24
+ import "../../chunk-U7CKUUO7.mjs";
25
25
  import "../../chunk-B5T7AQLH.mjs";
26
26
  import {
27
27
  __async,
@@ -1,4 +1,4 @@
1
- import { I as InternalApiClient, B as BlindpayApiResponse } from '../../api-client-Cw2mNJeR.mjs';
1
+ import { I as InternalApiClient, B as BlindpayApiResponse } from '../../api-client-B7VQkM_4.mjs';
2
2
 
3
3
  type ListApiKeysResponse = Array<{
4
4
  id: string;
@@ -1,4 +1,4 @@
1
- import { I as InternalApiClient, B as BlindpayApiResponse } from '../../api-client-Cw2mNJeR.js';
1
+ import { I as InternalApiClient, B as BlindpayApiResponse } from '../../api-client-B7VQkM_4.js';
2
2
 
3
3
  type ListApiKeysResponse = Array<{
4
4
  id: string;
@@ -18699,10 +18699,10 @@ function getImporter(name) {
18699
18699
  var import_expect_type = __toESM(require_dist(), 1);
18700
18700
 
18701
18701
  // src/client.ts
18702
- var import_node_crypto = require("crypto");
18702
+ var import_svix = require("svix");
18703
18703
 
18704
18704
  // package.json
18705
- var version = "2.4.0";
18705
+ var version = "3.0.0";
18706
18706
 
18707
18707
  // src/internal/blindpay-error.ts
18708
18708
  var BlindPayError = class extends Error {
@@ -18931,6 +18931,10 @@ function createPayinQuotesResource(instanceId, client) {
18931
18931
  },
18932
18932
  get(id) {
18933
18933
  return client.get(`/instances/${instanceId}/payin-quotes/${id}`);
18934
+ },
18935
+ list(params) {
18936
+ const queryParams = params ? `?${new URLSearchParams(params)}` : "";
18937
+ return client.get(`/instances/${instanceId}/payin-quotes${queryParams}`);
18934
18938
  }
18935
18939
  };
18936
18940
  }
@@ -18963,6 +18967,14 @@ function createPayoutsResource(instanceId, client) {
18963
18967
  createEvm(_c) {
18964
18968
  var data = __objRest(_c, []);
18965
18969
  return client.post(`/instances/${instanceId}/payouts/evm`, data);
18970
+ },
18971
+ authorizeSolana(_d) {
18972
+ var data = __objRest(_d, []);
18973
+ return client.post(`/instances/${instanceId}/payouts/solana/authorize`, data);
18974
+ },
18975
+ createSolana(_e) {
18976
+ var data = __objRest(_e, []);
18977
+ return client.post(`/instances/${instanceId}/payouts/solana`, data);
18966
18978
  }
18967
18979
  };
18968
18980
  }
@@ -19055,30 +19067,40 @@ function createTermsOfServiceResource(instanceId, client) {
19055
19067
  // src/resources/virtual-accounts/index.ts
19056
19068
  function createVirtualAccountsResource(instanceId, client) {
19057
19069
  return {
19058
- update(_a3) {
19070
+ list(receiver_id) {
19071
+ return client.get(`/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts`);
19072
+ },
19073
+ get({
19074
+ receiver_id,
19075
+ id
19076
+ }) {
19077
+ return client.get(
19078
+ `/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts/${id}`
19079
+ );
19080
+ },
19081
+ create(_a3) {
19059
19082
  var _b = _a3, {
19060
19083
  receiver_id
19061
19084
  } = _b, data = __objRest(_b, [
19062
19085
  "receiver_id"
19063
19086
  ]);
19064
- return client.put(
19087
+ return client.post(
19065
19088
  `/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts`,
19066
19089
  data
19067
19090
  );
19068
19091
  },
19069
- create(_c) {
19092
+ update(_c) {
19070
19093
  var _d = _c, {
19071
- receiver_id
19094
+ receiver_id,
19095
+ id
19072
19096
  } = _d, data = __objRest(_d, [
19073
- "receiver_id"
19097
+ "receiver_id",
19098
+ "id"
19074
19099
  ]);
19075
- return client.post(
19076
- `/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts`,
19100
+ return client.put(
19101
+ `/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts/${id}`,
19077
19102
  data
19078
19103
  );
19079
- },
19080
- get(receiver_id) {
19081
- return client.get(`/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts`);
19082
19104
  }
19083
19105
  };
19084
19106
  }
@@ -19336,26 +19358,29 @@ var BlindPay = class {
19336
19358
  });
19337
19359
  }
19338
19360
  /**
19339
- * Verifies the BlindPay webhook signature
19361
+ * Verifies the BlindPay webhook signature using Svix
19340
19362
  *
19341
19363
  * @param params.secret The webhook secret from BlindPay dashboard
19342
- * @param params.id The value of the `svix-id` header
19343
- * @param params.timestamp The value of the `svix-timestamp` header
19344
- * @param params.payload The raw request body
19345
- * @param params.svixSignature The value of the `svix-signature` header
19364
+ * @param params.headers The webhook headers object containing svix-id, svix-timestamp, and svix-signature
19365
+ * @param params.payload The raw request body as a string
19346
19366
  * @returns {boolean} True if the signature is valid, false otherwise
19347
19367
  */
19348
19368
  verifyWebhookSignature({
19349
19369
  secret,
19350
- id,
19351
- timestamp,
19352
- payload,
19353
- svixSignature
19370
+ headers,
19371
+ payload
19354
19372
  }) {
19355
- const signedContent = `${id}.${timestamp}.${payload}`;
19356
- const secretBytes = Buffer.from(secret.split("_")[1], "base64");
19357
- const expectedSignature = (0, import_node_crypto.createHmac)("sha256", secretBytes).update(signedContent).digest("base64");
19358
- return svixSignature.length === expectedSignature.length && (0, import_node_crypto.timingSafeEqual)(Buffer.from(svixSignature), Buffer.from(expectedSignature));
19373
+ try {
19374
+ const webhook = new import_svix.Webhook(secret);
19375
+ webhook.verify(payload, {
19376
+ "svix-id": headers.id,
19377
+ "svix-timestamp": headers.timestamp,
19378
+ "svix-signature": headers.signature
19379
+ });
19380
+ return true;
19381
+ } catch (e) {
19382
+ return false;
19383
+ }
19359
19384
  }
19360
19385
  };
19361
19386
 
@@ -8,21 +8,21 @@ import {
8
8
  import {
9
9
  BlindPay,
10
10
  init_client
11
- } from "../../chunk-4DVSRRBP.mjs";
11
+ } from "../../chunk-WH2VNZE7.mjs";
12
12
  import "../../chunk-FG25JHDX.mjs";
13
13
  import "../../chunk-QGNLMN6Z.mjs";
14
14
  import "../../chunk-UC57SCKQ.mjs";
15
15
  import "../../chunk-TBTA7A2P.mjs";
16
16
  import "../../chunk-67XECGMJ.mjs";
17
17
  import "../../chunk-Z6EYX4D3.mjs";
18
- import "../../chunk-5XJJKYXE.mjs";
18
+ import "../../chunk-LEPGLH7Q.mjs";
19
19
  import "../../chunk-RC5NN5UF.mjs";
20
20
  import "../../chunk-W7NJUABI.mjs";
21
- import "../../chunk-OTRFWEEC.mjs";
22
- import "../../chunk-3QQCDR3E.mjs";
21
+ import "../../chunk-VRA5HP7F.mjs";
22
+ import "../../chunk-VBZHAPK7.mjs";
23
23
  import "../../chunk-LRHWT4JU.mjs";
24
- import "../../chunk-U7CKUUO7.mjs";
25
24
  import "../../chunk-CPOSU35L.mjs";
25
+ import "../../chunk-U7CKUUO7.mjs";
26
26
  import "../../chunk-B5T7AQLH.mjs";
27
27
  import {
28
28
  __async,
@@ -1,4 +1,4 @@
1
- import { I as InternalApiClient, R as Rail, B as BlindpayApiResponse } from '../../api-client-Cw2mNJeR.mjs';
1
+ import { I as InternalApiClient, R as Rail, B as BlindpayApiResponse } from '../../api-client-B7VQkM_4.mjs';
2
2
 
3
3
  type BankDetailKey = "type" | "name" | "pix_key" | "beneficiary_name" | "routing_number" | "account_number" | "account_type" | "account_class" | "address_line_1" | "address_line_2" | "city" | "state_province_region" | "country" | "postal_code" | "checkbook_account_id" | "checkbook_user_key" | "spei_protocol" | "spei_institution_code" | "spei_clabe" | "transfers_type" | "transfers_account" | "ach_cop_beneficiary_first_name" | "ach_cop_beneficiary_last_name" | "ach_cop_document_id" | "ach_cop_document_type" | "ach_cop_email" | "ach_cop_bank_code" | "ach_cop_bank_account" | "swift_code_bic" | "swift_account_holder_name" | "swift_account_number_iban" | "swift_beneficiary_address_line_1" | "swift_beneficiary_address_line_2" | "swift_beneficiary_country" | "swift_beneficiary_city" | "swift_beneficiary_state_province_region" | "swift_beneficiary_postal_code" | "swift_bank_name" | "swift_bank_address_line_1" | "swift_bank_address_line_2" | "swift_bank_country" | "swift_bank_city" | "swift_bank_state_province_region" | "swift_bank_postal_code" | "swift_intermediary_bank_swift_code_bic" | "swift_intermediary_bank_account_number_iban" | "swift_intermediary_bank_name" | "swift_intermediary_bank_country";
4
4
  type GetBankDetailsResponse = Array<{
@@ -1,4 +1,4 @@
1
- import { I as InternalApiClient, R as Rail, B as BlindpayApiResponse } from '../../api-client-Cw2mNJeR.js';
1
+ import { I as InternalApiClient, R as Rail, B as BlindpayApiResponse } from '../../api-client-B7VQkM_4.js';
2
2
 
3
3
  type BankDetailKey = "type" | "name" | "pix_key" | "beneficiary_name" | "routing_number" | "account_number" | "account_type" | "account_class" | "address_line_1" | "address_line_2" | "city" | "state_province_region" | "country" | "postal_code" | "checkbook_account_id" | "checkbook_user_key" | "spei_protocol" | "spei_institution_code" | "spei_clabe" | "transfers_type" | "transfers_account" | "ach_cop_beneficiary_first_name" | "ach_cop_beneficiary_last_name" | "ach_cop_document_id" | "ach_cop_document_type" | "ach_cop_email" | "ach_cop_bank_code" | "ach_cop_bank_account" | "swift_code_bic" | "swift_account_holder_name" | "swift_account_number_iban" | "swift_beneficiary_address_line_1" | "swift_beneficiary_address_line_2" | "swift_beneficiary_country" | "swift_beneficiary_city" | "swift_beneficiary_state_province_region" | "swift_beneficiary_postal_code" | "swift_bank_name" | "swift_bank_address_line_1" | "swift_bank_address_line_2" | "swift_bank_country" | "swift_bank_city" | "swift_bank_state_province_region" | "swift_bank_postal_code" | "swift_intermediary_bank_swift_code_bic" | "swift_intermediary_bank_account_number_iban" | "swift_intermediary_bank_name" | "swift_intermediary_bank_country";
4
4
  type GetBankDetailsResponse = Array<{
@@ -18699,10 +18699,10 @@ function getImporter(name) {
18699
18699
  var import_expect_type = __toESM(require_dist(), 1);
18700
18700
 
18701
18701
  // src/client.ts
18702
- var import_node_crypto = require("crypto");
18702
+ var import_svix = require("svix");
18703
18703
 
18704
18704
  // package.json
18705
- var version = "2.4.0";
18705
+ var version = "3.0.0";
18706
18706
 
18707
18707
  // src/internal/blindpay-error.ts
18708
18708
  var BlindPayError = class extends Error {
@@ -18931,6 +18931,10 @@ function createPayinQuotesResource(instanceId, client) {
18931
18931
  },
18932
18932
  get(id) {
18933
18933
  return client.get(`/instances/${instanceId}/payin-quotes/${id}`);
18934
+ },
18935
+ list(params) {
18936
+ const queryParams = params ? `?${new URLSearchParams(params)}` : "";
18937
+ return client.get(`/instances/${instanceId}/payin-quotes${queryParams}`);
18934
18938
  }
18935
18939
  };
18936
18940
  }
@@ -18963,6 +18967,14 @@ function createPayoutsResource(instanceId, client) {
18963
18967
  createEvm(_c) {
18964
18968
  var data = __objRest(_c, []);
18965
18969
  return client.post(`/instances/${instanceId}/payouts/evm`, data);
18970
+ },
18971
+ authorizeSolana(_d) {
18972
+ var data = __objRest(_d, []);
18973
+ return client.post(`/instances/${instanceId}/payouts/solana/authorize`, data);
18974
+ },
18975
+ createSolana(_e) {
18976
+ var data = __objRest(_e, []);
18977
+ return client.post(`/instances/${instanceId}/payouts/solana`, data);
18966
18978
  }
18967
18979
  };
18968
18980
  }
@@ -19055,30 +19067,40 @@ function createTermsOfServiceResource(instanceId, client) {
19055
19067
  // src/resources/virtual-accounts/index.ts
19056
19068
  function createVirtualAccountsResource(instanceId, client) {
19057
19069
  return {
19058
- update(_a3) {
19070
+ list(receiver_id) {
19071
+ return client.get(`/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts`);
19072
+ },
19073
+ get({
19074
+ receiver_id,
19075
+ id
19076
+ }) {
19077
+ return client.get(
19078
+ `/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts/${id}`
19079
+ );
19080
+ },
19081
+ create(_a3) {
19059
19082
  var _b = _a3, {
19060
19083
  receiver_id
19061
19084
  } = _b, data = __objRest(_b, [
19062
19085
  "receiver_id"
19063
19086
  ]);
19064
- return client.put(
19087
+ return client.post(
19065
19088
  `/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts`,
19066
19089
  data
19067
19090
  );
19068
19091
  },
19069
- create(_c) {
19092
+ update(_c) {
19070
19093
  var _d = _c, {
19071
- receiver_id
19094
+ receiver_id,
19095
+ id
19072
19096
  } = _d, data = __objRest(_d, [
19073
- "receiver_id"
19097
+ "receiver_id",
19098
+ "id"
19074
19099
  ]);
19075
- return client.post(
19076
- `/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts`,
19100
+ return client.put(
19101
+ `/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts/${id}`,
19077
19102
  data
19078
19103
  );
19079
- },
19080
- get(receiver_id) {
19081
- return client.get(`/instances/${instanceId}/receivers/${receiver_id}/virtual-accounts`);
19082
19104
  }
19083
19105
  };
19084
19106
  }
@@ -19336,26 +19358,29 @@ var BlindPay = class {
19336
19358
  });
19337
19359
  }
19338
19360
  /**
19339
- * Verifies the BlindPay webhook signature
19361
+ * Verifies the BlindPay webhook signature using Svix
19340
19362
  *
19341
19363
  * @param params.secret The webhook secret from BlindPay dashboard
19342
- * @param params.id The value of the `svix-id` header
19343
- * @param params.timestamp The value of the `svix-timestamp` header
19344
- * @param params.payload The raw request body
19345
- * @param params.svixSignature The value of the `svix-signature` header
19364
+ * @param params.headers The webhook headers object containing svix-id, svix-timestamp, and svix-signature
19365
+ * @param params.payload The raw request body as a string
19346
19366
  * @returns {boolean} True if the signature is valid, false otherwise
19347
19367
  */
19348
19368
  verifyWebhookSignature({
19349
19369
  secret,
19350
- id,
19351
- timestamp,
19352
- payload,
19353
- svixSignature
19370
+ headers,
19371
+ payload
19354
19372
  }) {
19355
- const signedContent = `${id}.${timestamp}.${payload}`;
19356
- const secretBytes = Buffer.from(secret.split("_")[1], "base64");
19357
- const expectedSignature = (0, import_node_crypto.createHmac)("sha256", secretBytes).update(signedContent).digest("base64");
19358
- return svixSignature.length === expectedSignature.length && (0, import_node_crypto.timingSafeEqual)(Buffer.from(svixSignature), Buffer.from(expectedSignature));
19373
+ try {
19374
+ const webhook = new import_svix.Webhook(secret);
19375
+ webhook.verify(payload, {
19376
+ "svix-id": headers.id,
19377
+ "svix-timestamp": headers.timestamp,
19378
+ "svix-signature": headers.signature
19379
+ });
19380
+ return true;
19381
+ } catch (e) {
19382
+ return false;
19383
+ }
19359
19384
  }
19360
19385
  };
19361
19386