@openfacilitator/sdk 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -608,7 +608,8 @@ function createPaymentMiddleware(config) {
608
608
  }
609
609
  let paymentPayload;
610
610
  try {
611
- paymentPayload = JSON.parse(paymentString);
611
+ const decoded = Buffer.from(paymentString, "base64").toString("utf-8");
612
+ paymentPayload = JSON.parse(decoded);
612
613
  if (!isPaymentPayload(paymentPayload)) {
613
614
  throw new Error("Invalid payment payload structure");
614
615
  }
@@ -712,7 +713,8 @@ function honoPaymentMiddleware(config) {
712
713
  }
713
714
  let paymentPayload;
714
715
  try {
715
- paymentPayload = JSON.parse(paymentString);
716
+ const decoded = atob(paymentString);
717
+ paymentPayload = JSON.parse(decoded);
716
718
  if (!isPaymentPayload(paymentPayload)) {
717
719
  throw new Error("Invalid payment payload structure");
718
720
  }
package/dist/index.mjs CHANGED
@@ -557,7 +557,8 @@ function createPaymentMiddleware(config) {
557
557
  }
558
558
  let paymentPayload;
559
559
  try {
560
- paymentPayload = JSON.parse(paymentString);
560
+ const decoded = Buffer.from(paymentString, "base64").toString("utf-8");
561
+ paymentPayload = JSON.parse(decoded);
561
562
  if (!isPaymentPayload(paymentPayload)) {
562
563
  throw new Error("Invalid payment payload structure");
563
564
  }
@@ -661,7 +662,8 @@ function honoPaymentMiddleware(config) {
661
662
  }
662
663
  let paymentPayload;
663
664
  try {
664
- paymentPayload = JSON.parse(paymentString);
665
+ const decoded = atob(paymentString);
666
+ paymentPayload = JSON.parse(decoded);
665
667
  if (!isPaymentPayload(paymentPayload)) {
666
668
  throw new Error("Invalid payment payload structure");
667
669
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfacilitator/sdk",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "TypeScript SDK for x402 payment facilitation",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",