@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.cjs
CHANGED
|
@@ -443,7 +443,7 @@ async function authorizeCardPayment(environment, { merchantId, ...rest }) {
|
|
|
443
443
|
try {
|
|
444
444
|
const baseUrl = getBaseUrl(environment);
|
|
445
445
|
const res = await fetch(
|
|
446
|
-
`${baseUrl}/api/v1/checkout/authorize-card-3ds-payment`,
|
|
446
|
+
`${baseUrl}/api/v1/checkout/authorize-card-3ds-payment-sdk`,
|
|
447
447
|
{
|
|
448
448
|
method: "POST",
|
|
449
449
|
headers: {
|
|
@@ -516,10 +516,12 @@ async function generateStableCoinAddress(environment, { merchantId, ...rest }) {
|
|
|
516
516
|
|
|
517
517
|
// src/apis/encrypt.api.ts
|
|
518
518
|
var import_crypto_js = __toESM(require("crypto-js"), 1);
|
|
519
|
-
function encryptPayload(
|
|
520
|
-
const
|
|
521
|
-
const
|
|
522
|
-
const
|
|
519
|
+
function encryptPayload(merchantId, formData = {}) {
|
|
520
|
+
const merchId = merchantId.replace("-", "");
|
|
521
|
+
const first16Key = merchId.slice(0, 16);
|
|
522
|
+
const last16Iv = merchId.slice(-16);
|
|
523
|
+
const key = import_crypto_js.default.enc.Utf8.parse(first16Key);
|
|
524
|
+
const iv = import_crypto_js.default.enc.Utf8.parse(last16Iv);
|
|
523
525
|
const postDataObj = JSON.stringify(formData);
|
|
524
526
|
const encryptedData = import_crypto_js.default.AES.encrypt(
|
|
525
527
|
import_crypto_js.default.enc.Utf8.parse(postDataObj),
|
|
@@ -535,10 +537,12 @@ function encryptPayload(environment, formData = {}) {
|
|
|
535
537
|
requestParam: encryptedData.toString()
|
|
536
538
|
};
|
|
537
539
|
}
|
|
538
|
-
function decryptPayload(
|
|
539
|
-
const
|
|
540
|
-
const
|
|
541
|
-
const
|
|
540
|
+
function decryptPayload(merchantId, payload) {
|
|
541
|
+
const merchId = merchantId.replace("-", "");
|
|
542
|
+
const first16Key = merchId.slice(0, 16);
|
|
543
|
+
const last16Iv = merchId.slice(-16);
|
|
544
|
+
const key = import_crypto_js.default.enc.Utf8.parse(first16Key);
|
|
545
|
+
const iv = import_crypto_js.default.enc.Utf8.parse(last16Iv);
|
|
542
546
|
const decryptedData = import_crypto_js.default.AES.decrypt(payload, key, {
|
|
543
547
|
keySize: 128 / 8,
|
|
544
548
|
iv,
|
|
@@ -2036,7 +2040,7 @@ function PayByCard({
|
|
|
2036
2040
|
emailAddress: billingForm.emailAddress ?? "",
|
|
2037
2041
|
phoneNumber: billingForm.phoneNumber ?? ""
|
|
2038
2042
|
};
|
|
2039
|
-
const encryptedCardDetails = encryptPayload(
|
|
2043
|
+
const encryptedCardDetails = encryptPayload(secretKey, cardDetails);
|
|
2040
2044
|
const payload = {
|
|
2041
2045
|
customerId: paymentObject?.email || payForm.customerName || "",
|
|
2042
2046
|
amount: String(paymentObject?.amount ?? ""),
|