Skip to content

Instantly share code, notes, and snippets.

@hm0429
Last active March 8, 2018 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hm0429/b7a51de4e24175b638ef97a632e97e4f to your computer and use it in GitHub Desktop.
Save hm0429/b7a51de4e24175b638ef97a632e97e4f to your computer and use it in GitHub Desktop.
// npm install eth-crypto --save
const EthCrypto = require('eth-crypto');
const publicKey = 'fff49b58b83104ff16875452852466a46c7169ba4e368d11830c9170624e0a9509080a05a38c18841718ea4fc13483ac467d3e2d728d41ff16b73b9c943734f8';
const message = "piyo!";
(async() => {
const encryptedMessage = await EthCrypto.encryptWithPublicKey(publicKey, message);
console.log(encryptedMessage);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment