noble-ed25519 is nice -- small and pure JS -- but has an async API and we need a sync one. It's only async because it depends on a browser API to do sha512 async'ly. We could fork noble-25519 and make a sync version that depends on some other sha512 library.
(Related: #3 Benchmark the crypto libraries)
The crypto needs of Earthstar can be filled by 2 swappable implementations so far:
Chloride takes up 1.5mb when browserified.
We can
chloride/small
which is probably slower, see thechloride
readme for infonoble-ed25519
is nice -- small and pure JS -- but has an async API and we need a sync one. It's only async because it depends on a browser API to do sha512 async'ly. We could forknoble-25519
and make a sync version that depends on some other sha512 library.We could also try some other crypto library such as
sodium-universal
. See https://github.com/cinnamon-bun/browser-crypto-diagramThe crypto backend is swappable here, but it's hardcoded: https://github.com/earthstar-project/earthstar/blob/master/src/crypto/crypto.ts#L1-L2
It would be better to let apps decide which one they wanted, and hopefully a tree-shaking bundler would know to omit the ones not being used.