ecies/js

getrRandomValues error

vincenzoiovino opened this issue · 3 comments

Hello,
I get the following error when trying to run the example you show:

decrypt(k1.toHex(), encrypt(k1.publicKey.toHex(), data)).toString()
/home/node_modules/@noble/ciphers/webcrypto/utils.js:18
throw new Error('crypto.getRandomValues must be defined');
^

Uncaught Error: crypto.getRandomValues must be defined

Any clue on how to bypass it?

If you are on React Native, you may need to polyfill crypto.getRandomValues.
Check https://github.com/paulmillr/noble-ciphers#usage for details

No, I am not on react...

In either case you need to polyfill