@blindpay/node 2.3.0 → 2.5.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 (71) hide show
  1. package/dist/{api-client-Cw2mNJeR.d.mts → api-client-Drd7alfK.d.mts} +2 -2
  2. package/dist/{api-client-Cw2mNJeR.d.ts → api-client-Drd7alfK.d.ts} +2 -2
  3. package/dist/{chunk-DZ4K6K32.mjs → chunk-CEJF5Y4K.mjs} +27 -24
  4. package/dist/{chunk-E7M4CJKR.mjs → chunk-VRA5HP7F.mjs} +7 -0
  5. package/dist/index.d.mts +11 -11
  6. package/dist/index.d.ts +11 -11
  7. package/dist/index.js +25 -15
  8. package/dist/index.mjs +10 -10
  9. package/dist/resources/api-keys/api-keys.test.js +25 -15
  10. package/dist/resources/api-keys/api-keys.test.mjs +4 -4
  11. package/dist/resources/api-keys/index.d.mts +1 -1
  12. package/dist/resources/api-keys/index.d.ts +1 -1
  13. package/dist/resources/available/available.test.js +25 -15
  14. package/dist/resources/available/available.test.mjs +4 -4
  15. package/dist/resources/available/index.d.mts +1 -1
  16. package/dist/resources/available/index.d.ts +1 -1
  17. package/dist/resources/bank-accounts/bank-accounts.test.js +25 -15
  18. package/dist/resources/bank-accounts/bank-accounts.test.mjs +4 -4
  19. package/dist/resources/bank-accounts/index.d.mts +1 -1
  20. package/dist/resources/bank-accounts/index.d.ts +1 -1
  21. package/dist/resources/instances/index.d.mts +1 -1
  22. package/dist/resources/instances/index.d.ts +1 -1
  23. package/dist/resources/instances/instances.test.js +25 -15
  24. package/dist/resources/instances/instances.test.mjs +4 -4
  25. package/dist/resources/partner-fees/index.d.mts +1 -1
  26. package/dist/resources/partner-fees/index.d.ts +1 -1
  27. package/dist/resources/partner-fees/partner-fees.test.js +25 -15
  28. package/dist/resources/partner-fees/partner-fees.test.mjs +4 -4
  29. package/dist/resources/payins/index.d.mts +1 -1
  30. package/dist/resources/payins/index.d.ts +1 -1
  31. package/dist/resources/payins/payins-quotes.test.js +111 -15
  32. package/dist/resources/payins/payins-quotes.test.mjs +90 -4
  33. package/dist/resources/payins/payins.test.js +27 -17
  34. package/dist/resources/payins/payins.test.mjs +6 -6
  35. package/dist/resources/payins/quotes.d.mts +68 -3
  36. package/dist/resources/payins/quotes.d.ts +68 -3
  37. package/dist/resources/payins/quotes.js +7 -0
  38. package/dist/resources/payins/quotes.mjs +1 -1
  39. package/dist/resources/payouts/index.d.mts +1 -1
  40. package/dist/resources/payouts/index.d.ts +1 -1
  41. package/dist/resources/payouts/payouts.test.js +27 -17
  42. package/dist/resources/payouts/payouts.test.mjs +6 -6
  43. package/dist/resources/quotes/index.d.mts +1 -1
  44. package/dist/resources/quotes/index.d.ts +1 -1
  45. package/dist/resources/quotes/quotes.test.js +25 -15
  46. package/dist/resources/quotes/quotes.test.mjs +4 -4
  47. package/dist/resources/receivers/index.d.mts +1 -1
  48. package/dist/resources/receivers/index.d.ts +1 -1
  49. package/dist/resources/receivers/receivers.test.js +25 -15
  50. package/dist/resources/receivers/receivers.test.mjs +4 -4
  51. package/dist/resources/terms-of-service/index.d.mts +1 -1
  52. package/dist/resources/terms-of-service/index.d.ts +1 -1
  53. package/dist/resources/terms-of-service/terms-of-service.test.js +25 -15
  54. package/dist/resources/terms-of-service/terms-of-service.test.mjs +4 -4
  55. package/dist/resources/virtual-accounts/index.d.mts +1 -1
  56. package/dist/resources/virtual-accounts/index.d.ts +1 -1
  57. package/dist/resources/virtual-accounts/virtual-accounts.test.js +25 -15
  58. package/dist/resources/virtual-accounts/virtual-accounts.test.mjs +4 -4
  59. package/dist/resources/wallets/blockchain.d.mts +1 -1
  60. package/dist/resources/wallets/blockchain.d.ts +1 -1
  61. package/dist/resources/wallets/blockchain.test.js +25 -15
  62. package/dist/resources/wallets/blockchain.test.mjs +4 -4
  63. package/dist/resources/wallets/offramp.d.mts +1 -1
  64. package/dist/resources/wallets/offramp.d.ts +1 -1
  65. package/dist/resources/wallets/offramp.test.js +25 -15
  66. package/dist/resources/wallets/offramp.test.mjs +4 -4
  67. package/dist/resources/webhooks/index.d.mts +1 -1
  68. package/dist/resources/webhooks/index.d.ts +1 -1
  69. package/dist/resources/webhooks/webhooks.test.js +25 -15
  70. package/dist/resources/webhooks/webhooks.test.mjs +4 -4
  71. package/package.json +5 -2
@@ -292,8 +292,8 @@ type PaginationParams = {
292
292
 
293
293
  type PaginationMetadata = {
294
294
  has_more: boolean;
295
- next_page: number;
296
- prev_page: number;
295
+ next_page: string;
296
+ prev_page: string;
297
297
  }
298
298
 
299
299
  type TrackingTransaction = {
@@ -292,8 +292,8 @@ type PaginationParams = {
292
292
 
293
293
  type PaginationMetadata = {
294
294
  has_more: boolean;
295
- next_page: number;
296
- prev_page: number;
295
+ next_page: string;
296
+ prev_page: string;
297
297
  }
298
298
 
299
299
  type TrackingTransaction = {
@@ -1,3 +1,7 @@
1
+ import {
2
+ createWebhookEndpointsResource,
3
+ init_webhooks
4
+ } from "./chunk-UC57SCKQ.mjs";
1
5
  import {
2
6
  createBlockchainWalletsResource,
3
7
  init_blockchain
@@ -6,10 +10,6 @@ import {
6
10
  createOfframpWalletsResource,
7
11
  init_offramp
8
12
  } from "./chunk-QGNLMN6Z.mjs";
9
- import {
10
- createWebhookEndpointsResource,
11
- init_webhooks
12
- } from "./chunk-UC57SCKQ.mjs";
13
13
  import {
14
14
  createQuotesResource,
15
15
  init_quotes as init_quotes2
@@ -26,6 +26,10 @@ import {
26
26
  createVirtualAccountsResource,
27
27
  init_virtual_accounts
28
28
  } from "./chunk-5XJJKYXE.mjs";
29
+ import {
30
+ createAvailableResource,
31
+ init_available
32
+ } from "./chunk-U7CKUUO7.mjs";
29
33
  import {
30
34
  createPartnerFeesResource,
31
35
  init_partner_fees
@@ -37,7 +41,7 @@ import {
37
41
  import {
38
42
  createPayinQuotesResource,
39
43
  init_quotes
40
- } from "./chunk-E7M4CJKR.mjs";
44
+ } from "./chunk-VRA5HP7F.mjs";
41
45
  import {
42
46
  createPayoutsResource,
43
47
  init_payouts
@@ -46,10 +50,6 @@ import {
46
50
  createApiKeysResource,
47
51
  init_api_keys
48
52
  } from "./chunk-LRHWT4JU.mjs";
49
- import {
50
- createAvailableResource,
51
- init_available
52
- } from "./chunk-U7CKUUO7.mjs";
53
53
  import {
54
54
  createBankAccountsResource,
55
55
  init_bank_accounts
@@ -69,7 +69,7 @@ import {
69
69
  var version;
70
70
  var init_package = __esm({
71
71
  "package.json"() {
72
- version = "2.3.0";
72
+ version = "2.5.0";
73
73
  }
74
74
  });
75
75
 
@@ -88,7 +88,7 @@ var init_blindpay_error = __esm({
88
88
  });
89
89
 
90
90
  // src/client.ts
91
- import { createHmac, timingSafeEqual } from "crypto";
91
+ import { Webhook } from "svix";
92
92
  var BlindPay;
93
93
  var init_client = __esm({
94
94
  "src/client.ts"() {
@@ -229,26 +229,29 @@ var init_client = __esm({
229
229
  });
230
230
  }
231
231
  /**
232
- * Verifies the BlindPay webhook signature
232
+ * Verifies the BlindPay webhook signature using Svix
233
233
  *
234
234
  * @param params.secret The webhook secret from BlindPay dashboard
235
- * @param params.id The value of the `svix-id` header
236
- * @param params.timestamp The value of the `svix-timestamp` header
237
- * @param params.payload The raw request body
238
- * @param params.svixSignature The value of the `svix-signature` header
235
+ * @param params.headers The webhook headers object containing svix-id, svix-timestamp, and svix-signature
236
+ * @param params.payload The raw request body as a string
239
237
  * @returns {boolean} True if the signature is valid, false otherwise
240
238
  */
241
239
  verifyWebhookSignature({
242
240
  secret,
243
- id,
244
- timestamp,
245
- payload,
246
- svixSignature
241
+ headers,
242
+ payload
247
243
  }) {
248
- const signedContent = `${id}.${timestamp}.${payload}`;
249
- const secretBytes = Buffer.from(secret.split("_")[1], "base64");
250
- const expectedSignature = createHmac("sha256", secretBytes).update(signedContent).digest("base64");
251
- return svixSignature.length === expectedSignature.length && timingSafeEqual(Buffer.from(svixSignature), Buffer.from(expectedSignature));
244
+ try {
245
+ const webhook = new Webhook(secret);
246
+ webhook.verify(payload, {
247
+ "svix-id": headers.id,
248
+ "svix-timestamp": headers.timestamp,
249
+ "svix-signature": headers.signature
250
+ });
251
+ return true;
252
+ } catch (e) {
253
+ return false;
254
+ }
252
255
  }
253
256
  };
254
257
  }
@@ -13,6 +13,13 @@ function createPayinQuotesResource(instanceId, client) {
13
13
  getFxRate(_b) {
14
14
  var data = __objRest(_b, []);
15
15
  return client.post(`/instances/${instanceId}/payin-quotes/fx`, data);
16
+ },
17
+ get(id) {
18
+ return client.get(`/instances/${instanceId}/payin-quotes/${id}`);
19
+ },
20
+ list(params) {
21
+ const queryParams = params ? `?${new URLSearchParams(params)}` : "";
22
+ return client.get(`/instances/${instanceId}/payin-quotes${queryParams}`);
16
23
  }
17
24
  };
18
25
  }
package/dist/index.d.mts CHANGED
@@ -11,7 +11,7 @@ export { CreatePartnerFeeInput, CreatePartnerFeeResponse, DeletePartnerFeeInput,
11
11
  import { createPayinsResource } from './resources/payins/index.mjs';
12
12
  export { CreateEvmPayinInput, CreateEvmPayinResponse, CreatePayinInput, ExportPayinsInput, ExportPayinsResponse, GetPayinInput, GetPayinResponse, GetPayinTrackInput, GetPayinTrackResponse, ListPayinsInput, ListPayinsResponse, Payin } from './resources/payins/index.mjs';
13
13
  import { createPayinQuotesResource } from './resources/payins/quotes.mjs';
14
- export { CreatePayinQuoteInput, CreatePayinQuoteResponse, GetPayinFxRateInput, GetPayinFxRateResponse } from './resources/payins/quotes.mjs';
14
+ export { CreatePayinQuoteInput, CreatePayinQuoteResponse, GetPayinFxRateInput, GetPayinFxRateResponse, GetPayinQuoteInput, GetPayinQuoteResponse, ListPayinQuotesInput, ListPayinQuotesResponse, PayinPaymentMethod } from './resources/payins/quotes.mjs';
15
15
  import { createPayoutsResource } from './resources/payouts/index.mjs';
16
16
  export { AuthorizeStellarTokenInput, AuthorizeStellarTokenResponse, CreateEvmPayoutInput, CreateEvmPayoutResponse, CreatePayoutInput, CreateStellarPayoutInput, CreateStellarPayoutResponse, ExportPayoutsInput, ExportPayoutsResponse, GetPayoutInput, GetPayoutResponse, GetPayoutTrackInput, GetPayoutTrackResponse, ListPayoutsInput, ListPayoutsResponse, Payout, SpeiProtocol } from './resources/payouts/index.mjs';
17
17
  import { createQuotesResource } from './resources/quotes/index.mjs';
@@ -27,7 +27,7 @@ import { createOfframpWalletsResource } from './resources/wallets/offramp.mjs';
27
27
  export { CreateOfframpWalletInput, CreateOfframpWalletResponse, GetOfframpWalletInput, GetOfframpWalletResponse, ListOfframpWalletsInput, ListOfframpWalletsResponse, OfframpWallet } from './resources/wallets/offramp.mjs';
28
28
  import { createWebhookEndpointsResource } from './resources/webhooks/index.mjs';
29
29
  export { CreateWebhookEndpointInput, CreateWebhookEndpointResponse, DeleteWebhookEndpointInput, GetPortalAccessUrlResponse, GetWebhookEndpointSecretInput, GetWebhookEndpointSecretResponse, ListWebhookEndpointsResponse, WebhookEvents } from './resources/webhooks/index.mjs';
30
- import './api-client-Cw2mNJeR.mjs';
30
+ import './api-client-Drd7alfK.mjs';
31
31
 
32
32
  declare class BlindPay {
33
33
  private readonly baseUrl;
@@ -66,21 +66,21 @@ declare class BlindPay {
66
66
  private patch;
67
67
  private delete;
68
68
  /**
69
- * Verifies the BlindPay webhook signature
69
+ * Verifies the BlindPay webhook signature using Svix
70
70
  *
71
71
  * @param params.secret The webhook secret from BlindPay dashboard
72
- * @param params.id The value of the `svix-id` header
73
- * @param params.timestamp The value of the `svix-timestamp` header
74
- * @param params.payload The raw request body
75
- * @param params.svixSignature The value of the `svix-signature` header
72
+ * @param params.headers The webhook headers object containing svix-id, svix-timestamp, and svix-signature
73
+ * @param params.payload The raw request body as a string
76
74
  * @returns {boolean} True if the signature is valid, false otherwise
77
75
  */
78
- verifyWebhookSignature({ secret, id, timestamp, payload, svixSignature, }: {
76
+ verifyWebhookSignature({ secret, headers, payload, }: {
79
77
  secret: string;
80
- id: string;
81
- timestamp: string;
78
+ headers: {
79
+ id: string;
80
+ timestamp: string;
81
+ signature: string;
82
+ };
82
83
  payload: string;
83
- svixSignature: string;
84
84
  }): boolean;
85
85
  }
86
86
 
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ export { CreatePartnerFeeInput, CreatePartnerFeeResponse, DeletePartnerFeeInput,
11
11
  import { createPayinsResource } from './resources/payins/index.js';
12
12
  export { CreateEvmPayinInput, CreateEvmPayinResponse, CreatePayinInput, ExportPayinsInput, ExportPayinsResponse, GetPayinInput, GetPayinResponse, GetPayinTrackInput, GetPayinTrackResponse, ListPayinsInput, ListPayinsResponse, Payin } from './resources/payins/index.js';
13
13
  import { createPayinQuotesResource } from './resources/payins/quotes.js';
14
- export { CreatePayinQuoteInput, CreatePayinQuoteResponse, GetPayinFxRateInput, GetPayinFxRateResponse } from './resources/payins/quotes.js';
14
+ export { CreatePayinQuoteInput, CreatePayinQuoteResponse, GetPayinFxRateInput, GetPayinFxRateResponse, GetPayinQuoteInput, GetPayinQuoteResponse, ListPayinQuotesInput, ListPayinQuotesResponse, PayinPaymentMethod } from './resources/payins/quotes.js';
15
15
  import { createPayoutsResource } from './resources/payouts/index.js';
16
16
  export { AuthorizeStellarTokenInput, AuthorizeStellarTokenResponse, CreateEvmPayoutInput, CreateEvmPayoutResponse, CreatePayoutInput, CreateStellarPayoutInput, CreateStellarPayoutResponse, ExportPayoutsInput, ExportPayoutsResponse, GetPayoutInput, GetPayoutResponse, GetPayoutTrackInput, GetPayoutTrackResponse, ListPayoutsInput, ListPayoutsResponse, Payout, SpeiProtocol } from './resources/payouts/index.js';
17
17
  import { createQuotesResource } from './resources/quotes/index.js';
@@ -27,7 +27,7 @@ import { createOfframpWalletsResource } from './resources/wallets/offramp.js';
27
27
  export { CreateOfframpWalletInput, CreateOfframpWalletResponse, GetOfframpWalletInput, GetOfframpWalletResponse, ListOfframpWalletsInput, ListOfframpWalletsResponse, OfframpWallet } from './resources/wallets/offramp.js';
28
28
  import { createWebhookEndpointsResource } from './resources/webhooks/index.js';
29
29
  export { CreateWebhookEndpointInput, CreateWebhookEndpointResponse, DeleteWebhookEndpointInput, GetPortalAccessUrlResponse, GetWebhookEndpointSecretInput, GetWebhookEndpointSecretResponse, ListWebhookEndpointsResponse, WebhookEvents } from './resources/webhooks/index.js';
30
- import './api-client-Cw2mNJeR.js';
30
+ import './api-client-Drd7alfK.js';
31
31
 
32
32
  declare class BlindPay {
33
33
  private readonly baseUrl;
@@ -66,21 +66,21 @@ declare class BlindPay {
66
66
  private patch;
67
67
  private delete;
68
68
  /**
69
- * Verifies the BlindPay webhook signature
69
+ * Verifies the BlindPay webhook signature using Svix
70
70
  *
71
71
  * @param params.secret The webhook secret from BlindPay dashboard
72
- * @param params.id The value of the `svix-id` header
73
- * @param params.timestamp The value of the `svix-timestamp` header
74
- * @param params.payload The raw request body
75
- * @param params.svixSignature The value of the `svix-signature` header
72
+ * @param params.headers The webhook headers object containing svix-id, svix-timestamp, and svix-signature
73
+ * @param params.payload The raw request body as a string
76
74
  * @returns {boolean} True if the signature is valid, false otherwise
77
75
  */
78
- verifyWebhookSignature({ secret, id, timestamp, payload, svixSignature, }: {
76
+ verifyWebhookSignature({ secret, headers, payload, }: {
79
77
  secret: string;
80
- id: string;
81
- timestamp: string;
78
+ headers: {
79
+ id: string;
80
+ timestamp: string;
81
+ signature: string;
82
+ };
82
83
  payload: string;
83
- svixSignature: string;
84
84
  }): boolean;
85
85
  }
86
86
 
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.3.0";
94
+ var version = "2.5.0";
95
95
 
96
96
  // src/internal/blindpay-error.ts
97
97
  var BlindPayError = class extends Error {
@@ -317,6 +317,13 @@ function createPayinQuotesResource(instanceId, client) {
317
317
  getFxRate(_b) {
318
318
  var data = __objRest(_b, []);
319
319
  return client.post(`/instances/${instanceId}/payin-quotes/fx`, data);
320
+ },
321
+ get(id) {
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}`);
320
327
  }
321
328
  };
322
329
  }
@@ -722,26 +729,29 @@ var BlindPay = class {
722
729
  });
723
730
  }
724
731
  /**
725
- * Verifies the BlindPay webhook signature
732
+ * Verifies the BlindPay webhook signature using Svix
726
733
  *
727
734
  * @param params.secret The webhook secret from BlindPay dashboard
728
- * @param params.id The value of the `svix-id` header
729
- * @param params.timestamp The value of the `svix-timestamp` header
730
- * @param params.payload The raw request body
731
- * @param params.svixSignature The value of the `svix-signature` header
735
+ * @param params.headers The webhook headers object containing svix-id, svix-timestamp, and svix-signature
736
+ * @param params.payload The raw request body as a string
732
737
  * @returns {boolean} True if the signature is valid, false otherwise
733
738
  */
734
739
  verifyWebhookSignature({
735
740
  secret,
736
- id,
737
- timestamp,
738
- payload,
739
- svixSignature
741
+ headers,
742
+ payload
740
743
  }) {
741
- const signedContent = `${id}.${timestamp}.${payload}`;
742
- const secretBytes = Buffer.from(secret.split("_")[1], "base64");
743
- const expectedSignature = (0, import_node_crypto.createHmac)("sha256", secretBytes).update(signedContent).digest("base64");
744
- return svixSignature.length === expectedSignature.length && (0, import_node_crypto.timingSafeEqual)(Buffer.from(svixSignature), Buffer.from(expectedSignature));
744
+ try {
745
+ const webhook = new import_svix.Webhook(secret);
746
+ webhook.verify(payload, {
747
+ "svix-id": headers.id,
748
+ "svix-timestamp": headers.timestamp,
749
+ "svix-signature": headers.signature
750
+ });
751
+ return true;
752
+ } catch (e) {
753
+ return false;
754
+ }
745
755
  }
746
756
  };
747
757
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -1,7 +1,11 @@
1
1
  import {
2
2
  BlindPay,
3
3
  init_client
4
- } from "./chunk-DZ4K6K32.mjs";
4
+ } from "./chunk-CEJF5Y4K.mjs";
5
+ import {
6
+ createWebhookEndpointsResource,
7
+ init_webhooks
8
+ } from "./chunk-UC57SCKQ.mjs";
5
9
  import {
6
10
  createBlockchainWalletsResource,
7
11
  init_blockchain
@@ -10,10 +14,6 @@ import {
10
14
  createOfframpWalletsResource,
11
15
  init_offramp
12
16
  } from "./chunk-QGNLMN6Z.mjs";
13
- import {
14
- createWebhookEndpointsResource,
15
- init_webhooks
16
- } from "./chunk-UC57SCKQ.mjs";
17
17
  import {
18
18
  createQuotesResource,
19
19
  init_quotes as init_quotes2
@@ -27,6 +27,10 @@ import {
27
27
  createVirtualAccountsResource,
28
28
  init_virtual_accounts
29
29
  } from "./chunk-5XJJKYXE.mjs";
30
+ import {
31
+ createAvailableResource,
32
+ init_available
33
+ } from "./chunk-U7CKUUO7.mjs";
30
34
  import {
31
35
  createPartnerFeesResource,
32
36
  init_partner_fees
@@ -38,7 +42,7 @@ import {
38
42
  import {
39
43
  createPayinQuotesResource,
40
44
  init_quotes
41
- } from "./chunk-E7M4CJKR.mjs";
45
+ } from "./chunk-VRA5HP7F.mjs";
42
46
  import {
43
47
  createPayoutsResource,
44
48
  init_payouts
@@ -47,10 +51,6 @@ import {
47
51
  createApiKeysResource,
48
52
  init_api_keys
49
53
  } from "./chunk-LRHWT4JU.mjs";
50
- import {
51
- createAvailableResource,
52
- init_available
53
- } from "./chunk-U7CKUUO7.mjs";
54
54
  import {
55
55
  createBankAccountsResource,
56
56
  init_bank_accounts
@@ -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.3.0";
18700
+ var version = "2.5.0";
18701
18701
 
18702
18702
  // src/internal/blindpay-error.ts
18703
18703
  var BlindPayError = class extends Error {
@@ -18923,6 +18923,13 @@ function createPayinQuotesResource(instanceId, client) {
18923
18923
  getFxRate(_b) {
18924
18924
  var data = __objRest(_b, []);
18925
18925
  return client.post(`/instances/${instanceId}/payin-quotes/fx`, data);
18926
+ },
18927
+ get(id) {
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}`);
18926
18933
  }
18927
18934
  };
18928
18935
  }
@@ -19328,26 +19335,29 @@ var BlindPay = class {
19328
19335
  });
19329
19336
  }
19330
19337
  /**
19331
- * Verifies the BlindPay webhook signature
19338
+ * Verifies the BlindPay webhook signature using Svix
19332
19339
  *
19333
19340
  * @param params.secret The webhook secret from BlindPay dashboard
19334
- * @param params.id The value of the `svix-id` header
19335
- * @param params.timestamp The value of the `svix-timestamp` header
19336
- * @param params.payload The raw request body
19337
- * @param params.svixSignature The value of the `svix-signature` header
19341
+ * @param params.headers The webhook headers object containing svix-id, svix-timestamp, and svix-signature
19342
+ * @param params.payload The raw request body as a string
19338
19343
  * @returns {boolean} True if the signature is valid, false otherwise
19339
19344
  */
19340
19345
  verifyWebhookSignature({
19341
19346
  secret,
19342
- id,
19343
- timestamp,
19344
- payload,
19345
- svixSignature
19347
+ headers,
19348
+ payload
19346
19349
  }) {
19347
- const signedContent = `${id}.${timestamp}.${payload}`;
19348
- const secretBytes = Buffer.from(secret.split("_")[1], "base64");
19349
- const expectedSignature = (0, import_node_crypto.createHmac)("sha256", secretBytes).update(signedContent).digest("base64");
19350
- return svixSignature.length === expectedSignature.length && (0, import_node_crypto.timingSafeEqual)(Buffer.from(svixSignature), Buffer.from(expectedSignature));
19350
+ try {
19351
+ const webhook = new import_svix.Webhook(secret);
19352
+ webhook.verify(payload, {
19353
+ "svix-id": headers.id,
19354
+ "svix-timestamp": headers.timestamp,
19355
+ "svix-signature": headers.signature
19356
+ });
19357
+ return true;
19358
+ } catch (e) {
19359
+ return false;
19360
+ }
19351
19361
  }
19352
19362
  };
19353
19363
 
@@ -7,20 +7,20 @@ import {
7
7
  import {
8
8
  BlindPay,
9
9
  init_client
10
- } from "../../chunk-DZ4K6K32.mjs";
10
+ } from "../../chunk-CEJF5Y4K.mjs";
11
+ import "../../chunk-UC57SCKQ.mjs";
11
12
  import "../../chunk-FG25JHDX.mjs";
12
13
  import "../../chunk-QGNLMN6Z.mjs";
13
- import "../../chunk-UC57SCKQ.mjs";
14
14
  import "../../chunk-TBTA7A2P.mjs";
15
15
  import "../../chunk-67XECGMJ.mjs";
16
16
  import "../../chunk-Z6EYX4D3.mjs";
17
17
  import "../../chunk-5XJJKYXE.mjs";
18
+ import "../../chunk-U7CKUUO7.mjs";
18
19
  import "../../chunk-RC5NN5UF.mjs";
19
20
  import "../../chunk-W7NJUABI.mjs";
20
- import "../../chunk-E7M4CJKR.mjs";
21
+ import "../../chunk-VRA5HP7F.mjs";
21
22
  import "../../chunk-3QQCDR3E.mjs";
22
23
  import "../../chunk-LRHWT4JU.mjs";
23
- import "../../chunk-U7CKUUO7.mjs";
24
24
  import "../../chunk-CPOSU35L.mjs";
25
25
  import "../../chunk-B5T7AQLH.mjs";
26
26
  import {
@@ -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-Drd7alfK.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-Drd7alfK.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.3.0";
18705
+ var version = "2.5.0";
18706
18706
 
18707
18707
  // src/internal/blindpay-error.ts
18708
18708
  var BlindPayError = class extends Error {
@@ -18928,6 +18928,13 @@ function createPayinQuotesResource(instanceId, client) {
18928
18928
  getFxRate(_b) {
18929
18929
  var data = __objRest(_b, []);
18930
18930
  return client.post(`/instances/${instanceId}/payin-quotes/fx`, data);
18931
+ },
18932
+ get(id) {
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}`);
18931
18938
  }
18932
18939
  };
18933
18940
  }
@@ -19333,26 +19340,29 @@ var BlindPay = class {
19333
19340
  });
19334
19341
  }
19335
19342
  /**
19336
- * Verifies the BlindPay webhook signature
19343
+ * Verifies the BlindPay webhook signature using Svix
19337
19344
  *
19338
19345
  * @param params.secret The webhook secret from BlindPay dashboard
19339
- * @param params.id The value of the `svix-id` header
19340
- * @param params.timestamp The value of the `svix-timestamp` header
19341
- * @param params.payload The raw request body
19342
- * @param params.svixSignature The value of the `svix-signature` header
19346
+ * @param params.headers The webhook headers object containing svix-id, svix-timestamp, and svix-signature
19347
+ * @param params.payload The raw request body as a string
19343
19348
  * @returns {boolean} True if the signature is valid, false otherwise
19344
19349
  */
19345
19350
  verifyWebhookSignature({
19346
19351
  secret,
19347
- id,
19348
- timestamp,
19349
- payload,
19350
- svixSignature
19352
+ headers,
19353
+ payload
19351
19354
  }) {
19352
- const signedContent = `${id}.${timestamp}.${payload}`;
19353
- const secretBytes = Buffer.from(secret.split("_")[1], "base64");
19354
- const expectedSignature = (0, import_node_crypto.createHmac)("sha256", secretBytes).update(signedContent).digest("base64");
19355
- return svixSignature.length === expectedSignature.length && (0, import_node_crypto.timingSafeEqual)(Buffer.from(svixSignature), Buffer.from(expectedSignature));
19355
+ try {
19356
+ const webhook = new import_svix.Webhook(secret);
19357
+ webhook.verify(payload, {
19358
+ "svix-id": headers.id,
19359
+ "svix-timestamp": headers.timestamp,
19360
+ "svix-signature": headers.signature
19361
+ });
19362
+ return true;
19363
+ } catch (e) {
19364
+ return false;
19365
+ }
19356
19366
  }
19357
19367
  };
19358
19368
 
@@ -8,20 +8,20 @@ import {
8
8
  import {
9
9
  BlindPay,
10
10
  init_client
11
- } from "../../chunk-DZ4K6K32.mjs";
11
+ } from "../../chunk-CEJF5Y4K.mjs";
12
+ import "../../chunk-UC57SCKQ.mjs";
12
13
  import "../../chunk-FG25JHDX.mjs";
13
14
  import "../../chunk-QGNLMN6Z.mjs";
14
- import "../../chunk-UC57SCKQ.mjs";
15
15
  import "../../chunk-TBTA7A2P.mjs";
16
16
  import "../../chunk-67XECGMJ.mjs";
17
17
  import "../../chunk-Z6EYX4D3.mjs";
18
18
  import "../../chunk-5XJJKYXE.mjs";
19
+ import "../../chunk-U7CKUUO7.mjs";
19
20
  import "../../chunk-RC5NN5UF.mjs";
20
21
  import "../../chunk-W7NJUABI.mjs";
21
- import "../../chunk-E7M4CJKR.mjs";
22
+ import "../../chunk-VRA5HP7F.mjs";
22
23
  import "../../chunk-3QQCDR3E.mjs";
23
24
  import "../../chunk-LRHWT4JU.mjs";
24
- import "../../chunk-U7CKUUO7.mjs";
25
25
  import "../../chunk-CPOSU35L.mjs";
26
26
  import "../../chunk-B5T7AQLH.mjs";
27
27
  import {
@@ -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-Drd7alfK.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-Drd7alfK.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<{