Skip to content

Add WebGL target #7

Open
Open
@jasonboukheir

Description

@jasonboukheir

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:

  1. Give each file a unique name.
  2. Replace all #includes with the new names.
  3. Flatten the folders.
  4. Remove all directories from #includes.
  5. Set explicit version and minimal in the version.h.in -> version.h file.

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions