Commit 0f7b63d7 authored by Kamron Aroonrua's avatar Kamron Aroonrua 💬

fn crypto

parent 49c5fdee
var crypto = require("crypto");
var publicEncrypt = function(data, publicKey) {
var buffer = Buffer.from(data);
var encrypted = crypto.publicEncrypt(publicKey, buffer);
return encrypted.toString("base64");
};
var privateDecrypt = function(crypted_data, privateKey) {
var buffer = Buffer.from(crypted_data, "base64");
var decrypted = crypto.privateDecrypt(privateKey, buffer);
return decrypted.toString("utf8");
};
module.exports = {
publicEncrypt: publicEncrypt,
privateDecrypt: privateDecrypt
}
\ No newline at end of file
var DomParser = require('dom-parser');
var parser = new DomParser();
module.exports = function (html) {
return parser.parseFromString(html);
}
\ No newline at end of file
{
"name": "dt-transform",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"dom-parser": "^0.1.6"
}
}
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