Skip to content

Instantly share code, notes, and snippets.

@edewit
Last active December 29, 2015 00:09
Show Gist options
  • Select an option

  • Save edewit/7584216 to your computer and use it in GitHub Desktop.

Select an option

Save edewit/7584216 to your computer and use it in GitHub Desktop.
agCrypto.deriveKey('my password').then(function(rawPassword) {
return agCrypto.getRandomValue();
}).then(function(generatedIV) {
return agCrypto.encrypt({
IV: generatedIV,
key: rawPassword,
data: "My Bonnie lies over the ocean, my Bonnie lies over the sea"
});
}).then(function(cipherText) {
console.log(cipherText);
}, function(error) {
// there was some error.
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment