0.5.0 • Published 4 years ago

@buttercup/app-env v0.5.0

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

App Env

Buttercup application environment configuration manager

Build Status

About

Buttercup is a cross-platform password manager, and in being so requires vastly different configurations for each platform it runs on. Take for instance Buttercup for Desktop and the browser extension - one is Node (native) and the other is web-based. This project provides a method to set environment-specific tools and methods (for crypto, for instance). It also provides some presets for native and web.

React Native

There is no preset configuration in this library for React Native (Buttercup for Mobile), as this environment is extremely complex and highly-reliant on React-Native internals.

Usage

Step 1: Install @buttercup/app-env as a dependency:

npm install @buttercup/app-env --save

Step 2: Load a preset environment:

// For node:
require("@buttercup/app-env/native");
// For web:
import "@buttercup/app-env/web";

Or execute a custom environment configuration (see later section).

Step 3: Load Buttercup and other dependencies

Buttercup should always be loaded after the app-env:

const { ArchiveManager } = require("buttercup");

// ...

Custom environment configuration

You can easily specify your own configuration by specifying methods for each required property, for example:

const { getSharedAppEnv } = require("@buttercup/app-env");

function decryptText(/* ... */) {
    /* ... */
}

function encryptText(/* ... */) {
    /* ... */
}

getSharedAppEnv().setProperties({
    "crypto/v1/decryptText": decryptText,
    "crypto/v1/encryptText": encryptText
});

The following properties should be specified:

PropertyDescription
compression/v1/compressTextMethod for compressing text -> text.
compression/v1/decompressTextMethod for decompressing text -> text.
crypto/v1/decryptTextDecryption method for decrypting text.
crypto/v1/encryptTextEncryption method for encrypting text.
crypto/v1/setDerivationRoundsSet the number of derivation rounds to use for key derivation.
0.5.0

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago