@miden-npm/react 0.0.8 → 0.0.10
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.cjs +14 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -401,7 +401,7 @@ async function authorizeCardPayment(environment, { merchantId, ...rest }) {
|
|
|
401
401
|
try {
|
|
402
402
|
const baseUrl = getBaseUrl(environment);
|
|
403
403
|
const res = await fetch(
|
|
404
|
-
`${baseUrl}/api/v1/checkout/authorize-card-3ds-payment`,
|
|
404
|
+
`${baseUrl}/api/v1/checkout/authorize-card-3ds-payment-sdk`,
|
|
405
405
|
{
|
|
406
406
|
method: "POST",
|
|
407
407
|
headers: {
|
|
@@ -474,10 +474,12 @@ async function generateStableCoinAddress(environment, { merchantId, ...rest }) {
|
|
|
474
474
|
|
|
475
475
|
// src/apis/encrypt.api.ts
|
|
476
476
|
import CryptoJS from "crypto-js";
|
|
477
|
-
function encryptPayload(
|
|
478
|
-
const
|
|
479
|
-
const
|
|
480
|
-
const
|
|
477
|
+
function encryptPayload(merchantId, formData = {}) {
|
|
478
|
+
const merchId = merchantId.replace("-", "");
|
|
479
|
+
const first16Key = merchId.slice(0, 16);
|
|
480
|
+
const last16Iv = merchId.slice(-16);
|
|
481
|
+
const key = CryptoJS.enc.Utf8.parse(first16Key);
|
|
482
|
+
const iv = CryptoJS.enc.Utf8.parse(last16Iv);
|
|
481
483
|
const postDataObj = JSON.stringify(formData);
|
|
482
484
|
const encryptedData = CryptoJS.AES.encrypt(
|
|
483
485
|
CryptoJS.enc.Utf8.parse(postDataObj),
|
|
@@ -493,10 +495,12 @@ function encryptPayload(environment, formData = {}) {
|
|
|
493
495
|
requestParam: encryptedData.toString()
|
|
494
496
|
};
|
|
495
497
|
}
|
|
496
|
-
function decryptPayload(
|
|
497
|
-
const
|
|
498
|
-
const
|
|
499
|
-
const
|
|
498
|
+
function decryptPayload(merchantId, payload) {
|
|
499
|
+
const merchId = merchantId.replace("-", "");
|
|
500
|
+
const first16Key = merchId.slice(0, 16);
|
|
501
|
+
const last16Iv = merchId.slice(-16);
|
|
502
|
+
const key = CryptoJS.enc.Utf8.parse(first16Key);
|
|
503
|
+
const iv = CryptoJS.enc.Utf8.parse(last16Iv);
|
|
500
504
|
const decryptedData = CryptoJS.AES.decrypt(payload, key, {
|
|
501
505
|
keySize: 128 / 8,
|
|
502
506
|
iv,
|
|
@@ -1994,7 +1998,7 @@ function PayByCard({
|
|
|
1994
1998
|
emailAddress: billingForm.emailAddress ?? "",
|
|
1995
1999
|
phoneNumber: billingForm.phoneNumber ?? ""
|
|
1996
2000
|
};
|
|
1997
|
-
const encryptedCardDetails = encryptPayload(
|
|
2001
|
+
const encryptedCardDetails = encryptPayload(secretKey, cardDetails);
|
|
1998
2002
|
const payload = {
|
|
1999
2003
|
customerId: paymentObject?.email || payForm.customerName || "",
|
|
2000
2004
|
amount: String(paymentObject?.amount ?? ""),
|