Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility warnings #4

Open
martinheidegger opened this issue Aug 12, 2020 · 2 comments
Open

Incompatibility warnings #4

martinheidegger opened this issue Aug 12, 2020 · 2 comments

Comments

@martinheidegger
Copy link

martinheidegger commented Aug 12, 2020

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?

@RangerMauve
Copy link

Maybe it should be under a DEBUG flag in case folks don't want extra console output?

@mafintosh
Copy link
Member

Easiest/best way would prob be to add a more where it force uses the JS bindings so you can see what breaks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants