@basis-theory/basis-theory-js-encryption-browser
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

BasisTheory JS Browser Encryption Provider

Browser (Subtle) Encryption Provider for the Basis Theory JS Encryption SDK.

Installation

Using Node Package Manager

npm install --save @basis-theory/basis-theory-js-encryption-browser

Using Yarn

yarn add @basis-theory/basis-theory-js-encryption-browser

Documentation

For further documentation and examples, please refer to our Docs.

Usage

Initialization and Usage with BasisTheoryEncryption

Browser Encryption depends on window, usage is restrained to client-side frameworks.

import { BasisTheoryEncryption } from '@basis-theory/basis-theory-js-encryption';
import { BasisTheoryBrowserEncryptionProvider } from '@basis-theory/basis-theory-js-encryption-browser';

const browserProvider = new BasisTheoryBrowserEncryptionProvider();
const btEncryption = await new BasisTheoryEncryption().init([browserProvider]);

Repositories

Local Key Repository and Provider Key Repository implementations are provided for testing using the browser's localStorage. It's expected that the user provides their own repository implementations through the init call.

import { BasisTheoryEncryption } from '@basis-theory/basis-theory-js-encryption';
import { BasisTheoryBrowserEncryptionProvider } from '@basis-theory/basis-theory-js-encryption-browser';

const browserProvider = new BasisTheoryBrowserEncryptionProvider().init({
  keyRepository: new MyKeyRepository(),
  providerKeyRepository: new MyProviderKeyRepository(),
  rsaKeySize: 2048,
});


const btEncryption = await new BasisTheoryEncryption().init([browserProvider]);

Development

The provided scripts with the SDK will check for all dependencies, build the solution, and run all tests.

Dependencies

Build the SDK and run Tests

Run the following command from the root of the project:

make verify

Readme

Keywords

none

Package Sidebar

Install

npm i @basis-theory/basis-theory-js-encryption-browser

Weekly Downloads

25

Version

1.0.0

License

Apache-2.0

Unpacked Size

60.2 kB

Total Files

25

Last publish

Collaborators

  • greathouse-bt
  • kevinperaza-bt
  • justjordant
  • jleon15
  • lcschy
  • briangonzalezatbt
  • dhudec
  • davi.basistheory
  • armsteadj1
  • matthew_basistheory
  • bt-platform