unity.libsodium
unity.libsodium copied to clipboard
Add WebGL target
I've been struggling to get WebGL crypto functions to work in my Algorand SDK library. I have been using .jslib native plugins to handle them, but the APIs are not the same as libsodium.
Well I'm pleased to show off that I got source libsodium working in WebGL! Check this out: https://github.com/CareBoo/unity-algorand-sdk/tree/8c1b360d745cfcb1d621d355f56fa959c33a8957/Runtime/Algorand.Unity.Crypto/Plugins/WebGL
I have only tested ChaCha20Poly1305, Ed25519, and Sha512, however, I'm really surprised it worked!
So the steps to copy from the libsodium project were the following:
- Give each file a unique name.
- Replace all
#includes with the new names. - Flatten the folders.
- Remove all directories from
#includes. - Set explicit version and minimal in the
version.h.in->version.hfile.
I recommend doing something similar to add this to WebGL. It should also just work for any platform using IL2CPP, so it opens this project up to loads of other platforms!
Thank you for reporting that. I'm not sure when I got a time, But I will looking what did you reported.