backbone-hq / minibone Goto Github PK
View Code? Open in Web Editor NEWA compact, versatile, and misuse-resistant library for end-to-end-encryption
License: Apache License 2.0
A compact, versatile, and misuse-resistant library for end-to-end-encryption
License: Apache License 2.0
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.
const miniboneTest = async (userId: string, secretKey: string, input: string) => {
const inMb = await Minibone.create();
const key = await inMb.save(secretKey, ['app.my.domain', userId]);
const enc = await inMb.encrypt({ input }, key);
const outMb = await Minibone.load(key, secretKey, ['app.my.domain', userId]);
const decrypted = await outMb.decrypt(enc); // Crashes here.
};
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:
Uncaught (in promise) TypeError: Failed to execute 'decrypt' on 'SubtleCrypto': AesGcmParams: additionalData: Not a BufferSource.
Where Safari and Firefox give:
Unhandled Promise Rejection: OperationError: The operation failed for an operation-specific reason.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.