eth-ecies
eth-ecies copied to clipboard
Error while running code example
Hi,
I just ran your code example and get the following error:
TypeError [ERR_INVALID_ARG_TYPE]: The "list[1]" argument must be one of type Array, Buffer, or Uint8Array. Received type string
This is the code that I'm running:
const ecies = require("eth-ecies");
const ethPubKey = "1e7bcc70c72770dbb72fea022e8a6d07f814d2ebe4de9ae3f7af75bf706902a7b73ff919898c836396a6b0c96812c3213b99372050853bd1678da0ead14487d7"
let plaintext = new Buffer(`{foo:"bar",baz:42}`);
let encryptedMsg = ecies.encrypt(ethPubKey, plaintext);
console.log(encryptedMsg)
The pub key must be a byte buffer. Try using something like Buffer.from("DEADBEEF", "hex")