feat: WEB-210 Testing logs for node_options

This commit is contained in:
Hrishikesh Vaipurkar
2024-06-23 19:32:10 +02:00
parent 714d0d91f0
commit fd64ffadb9
2 changed files with 20 additions and 14 deletions

View File

@@ -4,6 +4,8 @@ publish = ".next"
[context.branch-deploy] [context.branch-deploy]
command = "npm run lint && npm run build" command = "npm run lint && npm run build"
[context.branch-deploy.environment]
NODE_OPTIONS = "--openssl-legacy-provider"
[context.deploy-preview] [context.deploy-preview]
command = "npm run lint && npm run build" command = "npm run lint && npm run build"

View File

@@ -3,18 +3,22 @@ import crypto from "crypto"
import { env } from "@/env/server" import { env } from "@/env/server"
export default function encryptValue(originalString: string) { export default function encryptValue(originalString: string) {
const encryptionKey = env.BOOKING_ENCRYPTION_KEY let result = ""
const bufferKey = Buffer.from(encryptionKey, "utf8") console.log(process.env.NODE_OPTIONS)
let cipher = crypto.createCipheriv("DES-ECB", bufferKey, null) try {
cipher.setAutoPadding(false) const encryptionKey = env.BOOKING_ENCRYPTION_KEY
let bufferString = Buffer.from(originalString, "utf8") const bufferKey = Buffer.from(encryptionKey, "utf8")
let paddingSize = bufferKey.length - (bufferString.length % bufferKey.length) let cipher = crypto.createCipheriv("DES-ECB", bufferKey, null)
let paddedStr = Buffer.concat([bufferString, Buffer.alloc(paddingSize, 0)]) cipher.setAutoPadding(false)
let encryptedValue = cipher let bufferString = Buffer.from(originalString, "utf8")
.update(paddedStr) let paddingSize =
.toString("base64") bufferKey.length - (bufferString.length % bufferKey.length)
.replace(/\+/g, "-") let paddedStr = Buffer.concat([bufferString, Buffer.alloc(paddingSize, 0)])
cipher.final() result = cipher.update(paddedStr).toString("base64").replace(/\+/g, "-")
cipher.final()
return encryptedValue } catch (e) {
console.log(e)
result = "error"
}
return result
} }