Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const EthCrypto = require('eth-crypto');
- const privKey = "0xd9c3501c110a83bb22c319e4c50b9169f2fee017d98dc22c9af624adb6f10130";
- //const pubKey = "4f3fc0bebdeeeffd0d94afa321d8d3f8b3373a6910438842bde9808cffef0ccc261b5b5171c730a164e4d4108927e6e18fb757f81d2d4234e7cc14e2507c49ba";
- const message = "testMessage"
- const derivedPublicKey = EthCrypto.publicKeyByPrivateKey(testPriv
- );
- async function main() {
- const encrypted = await EthCrypto.encryptWithPublicKey(
- pubKey, // publicKey
- message // message
- );
- console.log({encrypted});
- const decryptedMessage = await EthCrypto.decryptWithPrivateKey(
- privKey, // privateKey
- encrypted
- // encrypted-data
- );
Add Comment
Please, Sign In to add comment