@blindpay/node 2.4.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-4DVSRRBP.mjs → chunk-CEJF5Y4K.mjs} +27 -24
  4. package/dist/{chunk-OTRFWEEC.mjs → chunk-VRA5HP7F.mjs} +4 -0
  5. package/dist/index.d.mts +11 -11
  6. package/dist/index.d.ts +11 -11
  7. package/dist/index.js +22 -15
  8. package/dist/index.mjs +10 -10
  9. package/dist/resources/api-keys/api-keys.test.js +22 -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 +22 -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 +22 -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 +22 -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 +22 -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 +72 -15
  32. package/dist/resources/payins/payins-quotes.test.mjs +54 -4
  33. package/dist/resources/payins/payins.test.js +24 -17
  34. package/dist/resources/payins/payins.test.mjs +6 -6
  35. package/dist/resources/payins/quotes.d.mts +38 -2
  36. package/dist/resources/payins/quotes.d.ts +38 -2
  37. package/dist/resources/payins/quotes.js +4 -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 +24 -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 +22 -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 +22 -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 +22 -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 +22 -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 +22 -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 +22 -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 +22 -15
  70. package/dist/resources/webhooks/webhooks.test.mjs +4 -4
  71. package/package.json +5 -2
@@ -1,4 +1,4 @@
1
- import { I as InternalApiClient, g as CurrencyType, S as StablecoinToken, B as BlindpayApiResponse, h as Currency } from '../../api-client-Cw2mNJeR.js';
1
+ import { I as InternalApiClient, g as CurrencyType, S as StablecoinToken, B as BlindpayApiResponse, h as Currency, P as PaginationParams, f as PaginationMetadata } from '../../api-client-Drd7alfK.js';
2
2
 
3
3
  type PayinPaymentMethod = "ach" | "wire" | "pix" | "spei";
4
4
  type CreatePayinQuoteInput = {
@@ -63,10 +63,46 @@ type GetPayinQuoteResponse = {
63
63
  created_at: string;
64
64
  updated_at: string;
65
65
  };
66
+ type ListPayinQuotesInput = PaginationParams & {
67
+ receiver_id?: string;
68
+ blockchain_wallet_id?: string;
69
+ payment_method?: PayinPaymentMethod;
70
+ token?: StablecoinToken;
71
+ };
72
+ type ListPayinQuotesResponse = {
73
+ data: Array<{
74
+ id: string;
75
+ payment_method: PayinPaymentMethod;
76
+ token: StablecoinToken;
77
+ request_amount: number;
78
+ cover_fees: boolean;
79
+ currency_type: CurrencyType;
80
+ expires_at: number | null;
81
+ currency: Extract<Currency, "BRL" | "USD" | "MXN" | "COP" | "ARS">;
82
+ commercial_quotation: number | null;
83
+ blindpay_quotation: number | null;
84
+ receiver_amount: number;
85
+ sender_amount: number;
86
+ partner_fee_amount: number | null;
87
+ flat_fee: number | null;
88
+ total_fee_amount: number | null;
89
+ payer_rules: {
90
+ pix_allowed_tax_ids: string[];
91
+ } | null;
92
+ blockchain_wallet_id: string;
93
+ instance_id: string;
94
+ partner_fee_id: string | null;
95
+ billing_fee: number | null;
96
+ created_at: string;
97
+ updated_at: string;
98
+ }>;
99
+ pagination: PaginationMetadata;
100
+ };
66
101
  declare function createPayinQuotesResource(instanceId: string, client: InternalApiClient): {
67
102
  create({ ...data }: CreatePayinQuoteInput): Promise<BlindpayApiResponse<CreatePayinQuoteResponse>>;
68
103
  getFxRate({ ...data }: GetPayinFxRateInput): Promise<BlindpayApiResponse<GetPayinFxRateResponse>>;
69
104
  get(id: GetPayinQuoteInput): Promise<BlindpayApiResponse<GetPayinQuoteResponse>>;
105
+ list(params?: ListPayinQuotesInput): Promise<BlindpayApiResponse<ListPayinQuotesResponse>>;
70
106
  };
71
107
 
72
- export { type CreatePayinQuoteInput, type CreatePayinQuoteResponse, type GetPayinFxRateInput, type GetPayinFxRateResponse, type GetPayinQuoteInput, type GetPayinQuoteResponse, type PayinPaymentMethod, createPayinQuotesResource };
108
+ export { type CreatePayinQuoteInput, type CreatePayinQuoteResponse, type GetPayinFxRateInput, type GetPayinFxRateResponse, type GetPayinQuoteInput, type GetPayinQuoteResponse, type ListPayinQuotesInput, type ListPayinQuotesResponse, type PayinPaymentMethod, createPayinQuotesResource };
@@ -49,6 +49,10 @@ function createPayinQuotesResource(instanceId, client) {
49
49
  },
50
50
  get(id) {
51
51
  return client.get(`/instances/${instanceId}/payin-quotes/${id}`);
52
+ },
53
+ list(params) {
54
+ const queryParams = params ? `?${new URLSearchParams(params)}` : "";
55
+ return client.get(`/instances/${instanceId}/payin-quotes${queryParams}`);
52
56
  }
53
57
  };
54
58
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createPayinQuotesResource,
3
3
  init_quotes
4
- } from "../../chunk-OTRFWEEC.mjs";
4
+ } from "../../chunk-VRA5HP7F.mjs";
5
5
  import "../../chunk-OBKEW4AQ.mjs";
6
6
  init_quotes();
7
7
  export {
@@ -1,4 +1,4 @@
1
- import { I as InternalApiClient, P as PaginationParams, B as BlindpayApiResponse, T as TransactionStatus, b as TrackingTransaction, c as TrackingPayment, i as TrackingLiquidity, d as TrackingComplete, e as TrackingPartnerFee, N as Network, S as StablecoinToken, h as Currency, j as TransactionDocumentType, R as Rail, C as Country, A as AccountClass, a as BankAccountType, f as PaginationMetadata } from '../../api-client-Cw2mNJeR.mjs';
1
+ import { I as InternalApiClient, P as PaginationParams, B as BlindpayApiResponse, T as TransactionStatus, b as TrackingTransaction, c as TrackingPayment, i as TrackingLiquidity, d as TrackingComplete, e as TrackingPartnerFee, N as Network, S as StablecoinToken, h as Currency, j as TransactionDocumentType, R as Rail, C as Country, A as AccountClass, a as BankAccountType, f as PaginationMetadata } from '../../api-client-Drd7alfK.mjs';
2
2
 
3
3
  type SpeiProtocol = "clabe" | "debitcard" | "phonenum";
4
4
  type Payout = {
@@ -1,4 +1,4 @@
1
- import { I as InternalApiClient, P as PaginationParams, B as BlindpayApiResponse, T as TransactionStatus, b as TrackingTransaction, c as TrackingPayment, i as TrackingLiquidity, d as TrackingComplete, e as TrackingPartnerFee, N as Network, S as StablecoinToken, h as Currency, j as TransactionDocumentType, R as Rail, C as Country, A as AccountClass, a as BankAccountType, f as PaginationMetadata } from '../../api-client-Cw2mNJeR.js';
1
+ import { I as InternalApiClient, P as PaginationParams, B as BlindpayApiResponse, T as TransactionStatus, b as TrackingTransaction, c as TrackingPayment, i as TrackingLiquidity, d as TrackingComplete, e as TrackingPartnerFee, N as Network, S as StablecoinToken, h as Currency, j as TransactionDocumentType, R as Rail, C as Country, A as AccountClass, a as BankAccountType, f as PaginationMetadata } from '../../api-client-Drd7alfK.js';
2
2
 
3
3
  type SpeiProtocol = "clabe" | "debitcard" | "phonenum";
4
4
  type Payout = {
@@ -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 = "2.5.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
  }
@@ -19336,26 +19340,29 @@ var BlindPay = class {
19336
19340
  });
19337
19341
  }
19338
19342
  /**
19339
- * Verifies the BlindPay webhook signature
19343
+ * Verifies the BlindPay webhook signature using Svix
19340
19344
  *
19341
19345
  * @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
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
19346
19348
  * @returns {boolean} True if the signature is valid, false otherwise
19347
19349
  */
19348
19350
  verifyWebhookSignature({
19349
19351
  secret,
19350
- id,
19351
- timestamp,
19352
- payload,
19353
- svixSignature
19352
+ headers,
19353
+ payload
19354
19354
  }) {
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));
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
+ }
19359
19366
  }
19360
19367
  };
19361
19368
 
@@ -19462,8 +19469,8 @@ describe("Payouts", () => {
19462
19469
  ],
19463
19470
  pagination: {
19464
19471
  has_more: true,
19465
- next_page: 3,
19466
- prev_page: 1
19472
+ next_page: "3",
19473
+ prev_page: "1"
19467
19474
  }
19468
19475
  };
19469
19476
  fetchMock.mockResponseOnce(JSON.stringify(mockedPayouts), {
@@ -8,20 +8,20 @@ import {
8
8
  import {
9
9
  BlindPay,
10
10
  init_client
11
- } from "../../chunk-4DVSRRBP.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-OTRFWEEC.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 {
@@ -136,8 +136,8 @@ var require_payouts_test = __commonJS({
136
136
  ],
137
137
  pagination: {
138
138
  has_more: true,
139
- next_page: 3,
140
- prev_page: 1
139
+ next_page: "3",
140
+ prev_page: "1"
141
141
  }
142
142
  };
143
143
  fetchMock.mockResponseOnce(JSON.stringify(mockedPayouts), {
@@ -1,4 +1,4 @@
1
- import { I as InternalApiClient, g as CurrencyType, N as Network, S as StablecoinToken, j as TransactionDocumentType, B as BlindpayApiResponse, h as Currency } from '../../api-client-Cw2mNJeR.mjs';
1
+ import { I as InternalApiClient, g as CurrencyType, N as Network, S as StablecoinToken, j as TransactionDocumentType, B as BlindpayApiResponse, h as Currency } from '../../api-client-Drd7alfK.mjs';
2
2
 
3
3
  type CreateQuoteInput = {
4
4
  bank_account_id: string;
@@ -1,4 +1,4 @@
1
- import { I as InternalApiClient, g as CurrencyType, N as Network, S as StablecoinToken, j as TransactionDocumentType, B as BlindpayApiResponse, h as Currency } from '../../api-client-Cw2mNJeR.js';
1
+ import { I as InternalApiClient, g as CurrencyType, N as Network, S as StablecoinToken, j as TransactionDocumentType, B as BlindpayApiResponse, h as Currency } from '../../api-client-Drd7alfK.js';
2
2
 
3
3
  type CreateQuoteInput = {
4
4
  bank_account_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 = "2.5.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
  }
@@ -19336,26 +19340,29 @@ var BlindPay = class {
19336
19340
  });
19337
19341
  }
19338
19342
  /**
19339
- * Verifies the BlindPay webhook signature
19343
+ * Verifies the BlindPay webhook signature using Svix
19340
19344
  *
19341
19345
  * @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
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
19346
19348
  * @returns {boolean} True if the signature is valid, false otherwise
19347
19349
  */
19348
19350
  verifyWebhookSignature({
19349
19351
  secret,
19350
- id,
19351
- timestamp,
19352
- payload,
19353
- svixSignature
19352
+ headers,
19353
+ payload
19354
19354
  }) {
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));
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
+ }
19359
19366
  }
19360
19367
  };
19361
19368
 
@@ -8,20 +8,20 @@ import {
8
8
  import {
9
9
  BlindPay,
10
10
  init_client
11
- } from "../../chunk-4DVSRRBP.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-OTRFWEEC.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, B as BlindpayApiResponse, A as AccountClass, C as Country } from '../../api-client-Cw2mNJeR.mjs';
1
+ import { I as InternalApiClient, B as BlindpayApiResponse, A as AccountClass, C as Country } from '../../api-client-Drd7alfK.mjs';
2
2
 
3
3
  type ProofOfAddressDocType = "UTILITY_BILL" | "BANK_STATEMENT" | "RENTAL_AGREEMENT" | "TAX_DOCUMENT" | "GOVERNMENT_CORRESPONDENCE";
4
4
  type PurposeOfTransactions = "business_transactions" | "charitable_donations" | "investment_purposes" | "payments_to_friends_or_family_abroad" | "personal_or_living_expenses" | "protect_wealth" | "purchase_good_and_services" | "receive_payment_for_freelancing" | "receive_salary" | "other";
@@ -1,4 +1,4 @@
1
- import { I as InternalApiClient, B as BlindpayApiResponse, A as AccountClass, C as Country } from '../../api-client-Cw2mNJeR.js';
1
+ import { I as InternalApiClient, B as BlindpayApiResponse, A as AccountClass, C as Country } from '../../api-client-Drd7alfK.js';
2
2
 
3
3
  type ProofOfAddressDocType = "UTILITY_BILL" | "BANK_STATEMENT" | "RENTAL_AGREEMENT" | "TAX_DOCUMENT" | "GOVERNMENT_CORRESPONDENCE";
4
4
  type PurposeOfTransactions = "business_transactions" | "charitable_donations" | "investment_purposes" | "payments_to_friends_or_family_abroad" | "personal_or_living_expenses" | "protect_wealth" | "purchase_good_and_services" | "receive_payment_for_freelancing" | "receive_salary" | "other";
@@ -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 = "2.5.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
  }
@@ -19336,26 +19340,29 @@ var BlindPay = class {
19336
19340
  });
19337
19341
  }
19338
19342
  /**
19339
- * Verifies the BlindPay webhook signature
19343
+ * Verifies the BlindPay webhook signature using Svix
19340
19344
  *
19341
19345
  * @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
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
19346
19348
  * @returns {boolean} True if the signature is valid, false otherwise
19347
19349
  */
19348
19350
  verifyWebhookSignature({
19349
19351
  secret,
19350
- id,
19351
- timestamp,
19352
- payload,
19353
- svixSignature
19352
+ headers,
19353
+ payload
19354
19354
  }) {
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));
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
+ }
19359
19366
  }
19360
19367
  };
19361
19368
 
@@ -8,20 +8,20 @@ import {
8
8
  import {
9
9
  BlindPay,
10
10
  init_client
11
- } from "../../chunk-4DVSRRBP.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-OTRFWEEC.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, 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 InitiateInput = {
4
4
  idempotency_key: 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 InitiateInput = {
4
4
  idempotency_key: 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 = "2.5.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
  }
@@ -19336,26 +19340,29 @@ var BlindPay = class {
19336
19340
  });
19337
19341
  }
19338
19342
  /**
19339
- * Verifies the BlindPay webhook signature
19343
+ * Verifies the BlindPay webhook signature using Svix
19340
19344
  *
19341
19345
  * @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
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
19346
19348
  * @returns {boolean} True if the signature is valid, false otherwise
19347
19349
  */
19348
19350
  verifyWebhookSignature({
19349
19351
  secret,
19350
- id,
19351
- timestamp,
19352
- payload,
19353
- svixSignature
19352
+ headers,
19353
+ payload
19354
19354
  }) {
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));
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
+ }
19359
19366
  }
19360
19367
  };
19361
19368
 
@@ -8,20 +8,20 @@ import {
8
8
  import {
9
9
  BlindPay,
10
10
  init_client
11
- } from "../../chunk-4DVSRRBP.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-OTRFWEEC.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, S as StablecoinToken, B as BlindpayApiResponse } from '../../api-client-Cw2mNJeR.mjs';
1
+ import { I as InternalApiClient, S as StablecoinToken, B as BlindpayApiResponse } from '../../api-client-Drd7alfK.mjs';
2
2
 
3
3
  type VirtualAccount = {
4
4
  id: string;
@@ -1,4 +1,4 @@
1
- import { I as InternalApiClient, S as StablecoinToken, B as BlindpayApiResponse } from '../../api-client-Cw2mNJeR.js';
1
+ import { I as InternalApiClient, S as StablecoinToken, B as BlindpayApiResponse } from '../../api-client-Drd7alfK.js';
2
2
 
3
3
  type VirtualAccount = {
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 = "2.5.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
  }
@@ -19336,26 +19340,29 @@ var BlindPay = class {
19336
19340
  });
19337
19341
  }
19338
19342
  /**
19339
- * Verifies the BlindPay webhook signature
19343
+ * Verifies the BlindPay webhook signature using Svix
19340
19344
  *
19341
19345
  * @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
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
19346
19348
  * @returns {boolean} True if the signature is valid, false otherwise
19347
19349
  */
19348
19350
  verifyWebhookSignature({
19349
19351
  secret,
19350
- id,
19351
- timestamp,
19352
- payload,
19353
- svixSignature
19352
+ headers,
19353
+ payload
19354
19354
  }) {
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));
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
+ }
19359
19366
  }
19360
19367
  };
19361
19368
 
@@ -8,20 +8,20 @@ import {
8
8
  import {
9
9
  BlindPay,
10
10
  init_client
11
- } from "../../chunk-4DVSRRBP.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-OTRFWEEC.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, B as BlindpayApiResponse, N as Network } from '../../api-client-Cw2mNJeR.mjs';
1
+ import { I as InternalApiClient, B as BlindpayApiResponse, N as Network } from '../../api-client-Drd7alfK.mjs';
2
2
 
3
3
  type GetBlockchainWalletMessage = string;
4
4
  type GetBlockchainWalletMessageResponse = {