Comments (9)
Both encrypt
and decrypt
in eth-ecies
are synchronous. Try removing the async/await?
Also, which line is causing the error? Can you show the stack trace?
from eth-ecies.
Removed async and await.Still getting the same error .Plus in nodejs it works with async await too.
The exact line where the error occurs is this(the one where the decrypt function of the ecies library is called):-
let decryptedData = ecies.decrypt(userPrivateKey, bufferEncryptedData);
NOTE:- I have this line at the top of my code to import the library
const ecies = require("eth-ecies");
from eth-ecies.
This is the bn.js file (as shown in the browser console)which throws the error(at line 6)
(function (module, exports) {
'use strict';
// Utils
function assert (val, msg) {
if (!val) throw new Error(msg || 'Assertion failed');
}
from eth-ecies.
Can you paste the stack trace?
from eth-ecies.
What exactly do i paste as the stack trace ?The browser console?if not then how do i get it ?
from eth-ecies.
here is the trace :-
thanks for your help! 😄
_
from eth-ecies.
The stack trace before minifying your js bundle? Do you have source maps? if you use create react app it should print stack trace in console or on screen.
Anyway, I suspect it's the BN.toBuffer
function, at assert(typeof Buffer !== 'undefined');
. It has something to do with the Buffer polyfill. A fix is on the way. Thanks for the issue.
from eth-ecies.
Version 1.0.3 uses safe-buffer
and it should have fixed this issue. Please update the package
from eth-ecies.
Thanks a lot.It works perfectly now :)
from eth-ecies.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eth-ecies.