@dcentralab/d402-client 0.1.0 → 0.1.1
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/README.md +29 -60
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -13
- package/LICENSE +0 -22
package/dist/index.mjs
CHANGED
|
@@ -325,7 +325,9 @@ function normalizeAddress(address) {
|
|
|
325
325
|
}
|
|
326
326
|
function decodePaymentResponse(header) {
|
|
327
327
|
try {
|
|
328
|
-
const
|
|
328
|
+
const binString = atob(header);
|
|
329
|
+
const bytes = Uint8Array.from(binString, (m) => m.codePointAt(0));
|
|
330
|
+
const decoded = new TextDecoder().decode(bytes);
|
|
329
331
|
return JSON.parse(decoded);
|
|
330
332
|
} catch (error) {
|
|
331
333
|
throw new Error(`Failed to decode payment response: ${error}`);
|
|
@@ -425,11 +427,14 @@ __export(encoder_exports, {
|
|
|
425
427
|
safeBase64Encode: () => safeBase64Encode
|
|
426
428
|
});
|
|
427
429
|
function safeBase64Encode(data) {
|
|
428
|
-
const
|
|
429
|
-
|
|
430
|
+
const bytes = new TextEncoder().encode(data);
|
|
431
|
+
const binString = Array.from(bytes, (byte) => String.fromCodePoint(byte)).join("");
|
|
432
|
+
return btoa(binString);
|
|
430
433
|
}
|
|
431
434
|
function safeBase64Decode(data) {
|
|
432
|
-
|
|
435
|
+
const binString = atob(data);
|
|
436
|
+
const bytes = Uint8Array.from(binString, (m) => m.codePointAt(0));
|
|
437
|
+
return new TextDecoder().decode(bytes);
|
|
433
438
|
}
|
|
434
439
|
function encodePayment(payment) {
|
|
435
440
|
const jsonString = JSON.stringify(payment);
|