ssbc / ssb-private-group-keys

GNU Lesser General Public License v3.0
2 stars 0 forks source link

Make sure secret key is a proper buffer in the browser #16

Closed arj03 closed 1 year ago

arj03 commented 1 year ago

With this tribes2 is working in a browser :)

arj03 commented 1 year ago

To add a bit more context, sodium-universal is a leaky abstraction :( On native it returns a buffer and in javascript it returns an Uint8Array. Sigh. Sodium-universal actually has exactly this example and uses:

var rnd = Buffer.allocUnsafe(12) // Cryptographically random data

instead of sodium malloc. That would also work. The Buffer.from does a copy so it's a tiny more inefficient.

arj03 commented 1 year ago

Ok, updated to better solution.

arj03 commented 1 year ago

Thanks for taking a look. I shall bug the mix master with no notifications once he is back.

arj03 commented 1 year ago

@mixmix can you have a look?

mixmix commented 1 year ago

thanks @arj03 good to go