Created
March 8, 2018 13:40
-
-
Save hm0429/891e280b95b80eff9eef42e469be758f 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
// npm install eth-crypto --save | |
const EthCrypto = require('eth-crypto'); | |
const privateKey = '0x61ce8b95ca5fd6f55cd97ac60817777bdf64f1670e903758ce53efc32c3dffeb'; | |
const encryptedMessage = { | |
iv: '3c12aa4bdbb6219479eb0ebe62ee908f', | |
ephemPublicKey: '04f70ca0c9e6741c8709de1cfec75f980823dd753b9c1a87cc4afbfdf44707b1830c0385b0fa808fa18f55a5f7551370242d95cd61546823fda2f73d26e1906a81', | |
ciphertext: 'a21abfac3a44ca4c22bdfb23a97a115f', | |
mac: 'b4d282d05422672689bd1027c948b2189dc52e7f9101e753be6fb3df844572c4' | |
}; | |
(async() => { | |
const decryptedMessage = await EthCrypto.decryptWithPrivateKey(privateKey, encryptedMessage); | |
console.log(decryptedMessage); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
piyo!
😃