Git Product home page Git Product logo

minibone's Issues

Decryption Errors

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 screenshot of my playground page for this,
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.