Created
August 2, 2019 04:19
-
-
Save DonerKebab/e0192d2fa5a8c222c656e844731ef186 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
encryptData: async function() { | |
const kms = new AWS.KMS(); | |
const params = { | |
KeyId: "arn:aws:kms:eu-west-1:846317326898:key/937948cd-8e08-49cb-9a59-5e2e62e7f70c", // your key alias or full ARN key | |
Plaintext: "nguyen huy phuong - 987897 - 123456", // your super secret. | |
} | |
kms.encrypt(params).promise().then(data => { | |
const base64EncryptedString = data.CiphertextBlob.toString('base64'); | |
console.log('base64 encrypted string: ' + base64EncryptedString); | |
return base64EncryptedString; | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment