Published 29 May 2023
The increase in development of information technology and the rapid growth in internet banking and shopping have seamlessly made electronic payment grown increasingly high over the last few decades and that has become a driving force to increase the use of E-commerce services which has led to high spike of internet users.
step 2
This library support SSR -Server Side Rendereing application eg Express based based arch and other frameworks built on top nodeJS
step 3
Install the library into the node based backend project and companion front-end application, by doing so your 50% ahead encrypting your data.
step 4
The code snippet below show how to use this library inside your project
First Implementation - Encryption
import { encryptData } from "@letsecure/encryptmydata";
import path from "path";
encryptData({
incomingData: <PLAIN_DATA_TO_BE_ENCRYPTED>,
//your private key to sign the message has signature
relativeOrAbsolutePathToPrivateKey:path.resolve(PATH_TO_STORED_PRIVATE_KEY_FILE),
//sender's public key to encrypt the message
relativeOrAbsolutePathToPublicKey:path.resolve(PATH_TO_STORED_PUBLIC_KEY_FILE),
passphase: "PASSPHRASE_FOR_YOUR_ENCRYPTION",
cb: ({ data, signature }) => {
return (payload = {
data,
signature,
});
},
});
Second Implementation - Decryption
import { decryptData } from "@letsecure/encryptmydata";
//descypt the key here using duo library
const { data, verified } = decryptData({
EncryptedData: encryptedData,
passphase: keys.secretAccessKey,
//your private key to reveal the data
relativeOrAbsolutePathToPrivateKey: keys.privateKey,
//sender's public key to validate the signature
relativeOrAbsolutePathToPublicKey: keys.publicKey,
signature,
});
//verify digital signature
if(!verified) throw new Error('data tampered')
End to End encryption
Tosin Owoeye
Web Engineer & Blockchain Developer