Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while running code example #4

Open
HugoSanchez opened this issue Feb 1, 2019 · 1 comment
Open

Error while running code example #4

HugoSanchez opened this issue Feb 1, 2019 · 1 comment

Comments

@HugoSanchez
Copy link

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)
@libertylocked
Copy link
Owner

The pub key must be a byte buffer. Try using something like Buffer.from("DEADBEEF", "hex")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants