Welcome to Crypto-Middleware

This documentation provides all the information needed to start using the crypto-middleware API tgo start securing your web applications.

Good to know: Crypto-middleware works with the Web Cryptography API & Streams API. Your browser must be able to support this, Check : https://caniuse.com/?search=web%20crypto (97% browser support)

Check : https://caniuse.com/streams (78% browser support)

About

Crypto-middleware is a middleware library that can be installed in your client side javascript web application. It proxies your File object, converts it to a stream, encrypts it using a passphrase and returns back a transform stream which can be consumed however you like. You can Read the stream to perform other actions, or you can write the stream directly to your cloud storage

Install the library

The best way to interact with our API is to use one of our official libraries:

In your node terminal:
# Install via NPM
npm install --save crypto-middlware

Good to know: Import as a ES Module


Quick Start

Add the import to your React/Vue/Svelte component or import it directly in your main.js or index.js file

In your component :
import * as secure from "crypto-middleware";

Crypto-middleware exposes many methods, but you may only need two that does most of the heavy lifting for you.

startStreaming is a Asynchronous, you will need to await the return TransformStream

Arguments
Type
Description
Required

file

File Object

HTML file input object

Yes

passphrase

String

Enforce a strong passphrase

Yes

Good to know: startStreaming will convert the File Object in to a stream, you only need to send the File reference, not the file buffer object!

Example Encryption.

This example, takes in a File object, and a passphrase.

The example uses AWS to upload the file. The whole process will be streamed with low latency and memory consumption.

Last updated