Commit 8100d282 authored by Kiridena I.T.K_IT19981840's avatar Kiridena I.T.K_IT19981840

Merge branch 'NFT-endpoint-changes' into 'master'

aes encoder, rsa encoder and key-code insert done

See merge request !26
parents 852d7861 1fd31c14
const mongoose = require("mongoose");
const AssetKey = new mongoose.Schema({
assetcode: String,
key: String,
});
module.exports = mongoose.model("AssetKey", AssetKey);
const crypto = require("crypto");
function GenerateAESKey() {
return crypto.randomBytes(32).toString("hex"); // 32 bytes = 256 bits
}
module.exports = GenerateAESKey;
const crypto = require("crypto");
function RSAEncrypt(publicKey, plainString) {
const encrypted = crypto.publicEncrypt(
{ key: publicKey, padding: crypto.constants.RSA_PKCS1_PADDING },
Buffer.from(plainString)
);
return encrypted.toString("base64");
}
module.exports = RSAEncrypt;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment