Giter VIP home page Giter VIP logo

Comments (9)

libertylocked avatar libertylocked commented on August 16, 2024

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.

piano-man avatar piano-man commented on August 16, 2024

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.

piano-man avatar piano-man commented on August 16, 2024

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.

libertylocked avatar libertylocked commented on August 16, 2024

Can you paste the stack trace?

from eth-ecies.

piano-man avatar piano-man commented on August 16, 2024

What exactly do i paste as the stack trace ?The browser console?if not then how do i get it ?

from eth-ecies.

piano-man avatar piano-man commented on August 16, 2024

here is the trace :-

thanks for your help! 😄
_

from eth-ecies.

libertylocked avatar libertylocked commented on August 16, 2024

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.

libertylocked avatar libertylocked commented on August 16, 2024

Version 1.0.3 uses safe-buffer and it should have fixed this issue. Please update the package

from eth-ecies.

piano-man avatar piano-man commented on August 16, 2024

Thanks a lot.It works perfectly now :)

from eth-ecies.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.