Created
July 16, 2020 19:03
-
-
Save EnetoJara/0479254bde2b3433436ec514d0e7a9b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function encryptText (toEncript) { | |
let i, k; | |
return getIv() | |
.then(iv => { | |
i = iv; | |
return getKey() | |
}).then(key => { | |
k = key; | |
const cipher = crypto.createCipheriv(algorithm, k, i); | |
const encrypted = cipher.update(toEncript, "utf8", "hex") + cipher.final("hex"); | |
return encrypted; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment