[update] - icici
This commit is contained in:
@@ -44,9 +44,9 @@ try {
|
||||
// byPassOTP: envVars?.BY_PASS_OTP,
|
||||
mysql: {
|
||||
development: {
|
||||
username: "mymotukuser",
|
||||
password: "password_Carrot11",
|
||||
database: "optifii_sprint",
|
||||
username: "root",
|
||||
password: "root",
|
||||
database: "optifii",
|
||||
host: "127.0.0.1",
|
||||
port: 3306,
|
||||
dialect: "mysql",
|
||||
|
||||
@@ -1,40 +1,27 @@
|
||||
const crypto = require('crypto');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { iciciApi } = require('../../api');
|
||||
const { AsyncHandler } = require('../../utils/handler/Async.handler');
|
||||
|
||||
module.exports = {
|
||||
Registration: AsyncHandler(async (req, res) => {
|
||||
const publicKeyPath = path.join(__dirname, 'public_key.pem');
|
||||
const publicKeyPath = path.join(__dirname, 'certificate.pem');
|
||||
const publicKeyPem = fs.readFileSync(publicKeyPath, 'utf8');
|
||||
|
||||
const jsonData = {
|
||||
"AGGRNAME": "CIBTESTING",
|
||||
"AGGRID": "TXBCIBTEST001",
|
||||
"CORPID": "TXBCORP1",
|
||||
"USERID": "USER1",
|
||||
"URN": "TESTING123",
|
||||
"ALIASID": ""
|
||||
};
|
||||
|
||||
// Encrypt JSON data with the public key
|
||||
const encrypted = crypto.publicEncrypt(
|
||||
{
|
||||
key: publicKeyPem,
|
||||
padding: crypto.constants.RSA_PKCS1_PADDING
|
||||
padding: crypto.constants.RSA_PKCS1_PADDING,
|
||||
|
||||
},
|
||||
Buffer.from(JSON.stringify(jsonData))
|
||||
Buffer.from(JSON.stringify(req.body))
|
||||
);
|
||||
|
||||
// Encode encrypted bytes to Base64
|
||||
const base64Encrypted = encrypted.toString('base64');
|
||||
|
||||
const data = await iciciApi.Registration(base64Encrypted)
|
||||
res.status(200).json(data);
|
||||
|
||||
res.status(200).json({ base64Encrypted });
|
||||
}),
|
||||
|
||||
|
||||
RegistrationStatus: AsyncHandler(async (req, res) => {
|
||||
const publicKeyPath = path.join(__dirname, 'public_key.pem');
|
||||
const publicKeyPem = fs.readFileSync(publicKeyPath, 'utf8');
|
||||
@@ -58,9 +45,7 @@ module.exports = {
|
||||
|
||||
// Encode encrypted bytes to Base64
|
||||
const base64Encrypted = encrypted.toString('base64');
|
||||
|
||||
const data = await iciciApi.RegistrationStatus(base64Encrypted)
|
||||
res.status(200).json(data);
|
||||
res.status(200).json({ base64Encrypted });
|
||||
|
||||
}),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user