sodium-friends / sodium-universal Goto Github PK
View Code? Open in Web Editor NEWUniversal wrapper for sodium-javascript and sodium-native working in Node.js and the Browser
License: MIT License
Universal wrapper for sodium-javascript and sodium-native working in Node.js and the Browser
License: MIT License
Hello, I am running into this issue while trying to bundle hypercore for a web app. I have put together a minimal example project that fails to bundle with browserify. I have been trying to fix this myself but am not well experienced with browserify. Any help would be greatly appreciated, thank you.
https://github.com/rhodey/sodium-debug
> Error: Can't walk dependency graph: Cannot find module './crypto_auth' from '/home/rhodey/dev/dsp/js/sodium-debug/node_modules/sodium-universal/index.js'
required by /home/rhodey/dev/dsp/js/sodium-debug/node_modules/sodium-universal/index.js
at /home/rhodey/.nvm/versions/node/v14.13.1/lib/node_modules/browserify/node_modules/resolve/lib/async.js:137:35
at load (/home/rhodey/.nvm/versions/node/v14.13.1/lib/node_modules/browserify/node_modules/resolve/lib/async.js:156:43)
at onex (/home/rhodey/.nvm/versions/node/v14.13.1/lib/node_modules/browserify/node_modules/resolve/lib/async.js:181:17)
at /home/rhodey/.nvm/versions/node/v14.13.1/lib/node_modules/browserify/node_modules/resolve/lib/async.js:15:69
at FSReqCallback.oncomplete (fs.js:181:21)
Using sodium-universal is for people that don't want to concern themselves with platform incompatibilities (one system to work with all). As such I think it would be good for developers to have a means of using sodium-universal that also highlights if they are using something that doesn't work for some platforms. Something like:
const sodium = require('sodium-universal')
sodium.crypto_stream_xchacha20(/*...*/)
will run following in console:
[WARNING] crypto_stream_xchacha20 is not supported in browser versions.
→ you can disable this message by using: require('sodium-universal/unsafe')({ crypto_stream_xchacha20: true })
→ issue 1a: https://github.com/sodium-friends/sodium-javascript/issues/#1a
This way a person could easily see what the progress is and that the application they are building is currently not as compatible as they may think it is.
In a future step I could imagine that in a future release that supports crypto_stream_xchacha20
it could warn the other way around:
[INFO] crypto_stream_xchacha20 is now supported on all platforms since version x.9.9
→ you can disable this message by removing the `crypto_stream_xchacha20` property
when in your require statement: require('sodium-universal/unsafe')({ ... })
I think it would be reasonable to add this to the library (including all the issues on github). Would you be okay with PR's that add this?
The latest update of sodium-universal is causing my Vue.js project to fail building with the following error.
ERROR Failed to compile with 1 error
This dependency was not found:
* sodium-native in ./node_modules/sodium-universal/index.js
To install it, you can run: npm install --save sodium-native
ERROR Build failed with errors.
Tried adding sodium-native to my project but that didn't help
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.