AKASHAorg / secure-webstore

A secure IndexedDB store with built-in encryption
MIT License
44 stars 6 forks source link

Buffer.from is not a function; Console & unit testing errors #17

Closed Arjen-1 closed 3 years ago

Arjen-1 commented 3 years ago

Hi Andrei,

We love your npm package and are using it for a while now.

Error: Buffer.from() is not a function after updating to Angular 12 & removing webpack v4.

We've encountered a bug since we've updated our application to Angular 12. This update enforces webpack v5 via a peer-dependency. And from what we found there is a problem within secure-webstore being unable to find Buffer.from() and therefore it gives this error: `Error: Buffer.from() is not a function. This error occurs in both the console as in the unit-tests.

I searched the web and found something which might be interesting. This 'Buffer' was part of webpack 4. But is removed since webpack 5. And now that we can't use webpack 4 because Angular enforces webpack v5 as a peer-dependency.

I'm not sure how webpack is related to secure-webstore and i'm not sure the issue is really in the area i've just described. I hope you know more about this issue and might know a solution.

To Reproduce Use secure-website in combination with Angular12 and make sure there is no direct dependency to webpack ( as it is a peer-dependency of @angular-devkit/build-angular )

Expected behavior A clear and concise description of what you expected to happen.

Screenshots error buffer from console2 error buffer from console error buffer from unit test karma jasmine

Desktop (please complete the following information):

Thank you again for your great package. Hope to hear from you.

Kind regards,

Arjen

Jopie64 commented 3 years ago

Note that this is a problem in dependent lib easy-web-crypto for which there is a fix in a PR here: AKASHAorg/easy-web-crypto#17.

deiu commented 3 years ago

I've merged the upstream PR and published a new version on npm. Can you update and test again please?

Jopie64 commented 3 years ago

Thanks for publishing the new version! However, to be able to test the fix, PR #18 must also be merged...