-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decryption Errors #1
Comments
Hey @tkcranny. Thanks for filing this issue and taking the time to set up a minimal reproducible example. To cut straight to the chase, the immediate fix for your code example is to replace - const enc = await inMb.encrypt({ input }, key)
+ const enc = await inMb.encrypt(input) The reason this fails is subtle, but fortunately is expected behaviour. To delve into the details:
In short, another viable fix here would be something like - const enc = await inMb.encrypt({ input }, key)
+ const enc = await inMb.encrypt(input, userId)
- const decrypted = await outMb.decrypt(enc); // Crashes here.
+ const decrypted = await outMb.decrypt(enc, userId) Hopefully this clarifies the intended usage. (P.S. Congratulations on filing minibone issue #1) |
Hey folks. I've been curious about client-side encryption and have been trying out Minibone.
I've been running into some errors when I call
.decrypt()
on Minibone instances. This call even fails with different error messages between different browsers, albeit from the same calls.I'm using a client-side SvelteKit application. Creating Minibone instances, generating the payloads, and encrypting data all work fine, it's just the
.decrypt
method that seems to be problematic, presumably because of something lower-level in the WebCrypto API.I've been able to get it down to the below example. I've also made a rudimentary StackBlitz example that replicates it.
This crashes on the last
.decrypt(call)
.If the library isn't intended for frontend applications / browsers, or I'm invoking it incorrectly, then I'm all ears.
Interestingly the error is also different between different browsers, Chrome gives:
Where Safari and Firefox give:
A screenshot of my playground page for this,
The text was updated successfully, but these errors were encountered: