This repository has been archived by the owner on Dec 6, 2022. It is now read-only.
Use TweetNaCL to lower bundle size to drastically #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As we are developing tools that we want to reach a very wide audience it is important to think of bundle size.
I have changed the use of libsodium to tweetnacl. Todo this I had to change the symmetric encryption algorithm from
chacha20poly1305_ietf
toxsalsa20-poly1305
aka secretbox. This is equally well supported by libsodium, but allows DIDComm to be a realistic dependency in client libraries.The other option that we could entertain is that someone implements a lightweight library of only the required libsodium functions or that a subset of libsodium is implemented in wasm and distributed in a cached CDN'd version.
Using libsodium.js
The bundle sizes are:
Using tweetnacl.js
The bundle size goes down to: