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

1.0.0 • Public • Published

BasisTheory JS Azure Encryption Provider

Azure (Key Vault) Encryption Provider for the Basis Theory JS Encryption SDK.

Installation

Using Node Package Manager

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

Using Yarn

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

Documentation

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

Usage

Initialization and Usage with BasisTheoryEncryption

It's required that user provides the vaulUrl to be used for fetching keys/secrets during initialization.

import { BasisTheoryEncryption } from '@basis-theory/basis-theory-js-encryption';
import { BasisTheoryAzureEncryptionProvider } from '@basis-theory/basis-theory-js-encryption-azure';

const azureProvider = new BasisTheoryAzureEncryptionProvider().init({
  vaulUrl: 'https://custom-kms.vault.azure.net'
});
const btEncryption = await new BasisTheoryEncryption().init([azureProvider]);

Caching, VaultUrl and Additional Options

The default cache implementation uses node-cache, but users can implement their own from the interface. Users can also provide their own methods for fetching/saving keys using the keyVaultOptions object.

import { BasisTheoryEncryption } from '@basis-theory/basis-theory-js-encryption';
import { BasisTheoryAzureEncryptionProvider } from '@basis-theory/basis-theory-js-encryption-azure';

const azureProvider = new BasisTheoryAzureEncryptionProvider().init({
  cache: new CacheService(),
  tokenCredential: new DefaultAzureCredential()
  vaulUrl: 'https://custom-kms.vault.azure.net',
  keyVaultOptions: {
    rsaKeySize: 2048,
    keyExpirationInDays: 90,
    getKeyByKeyId: (keyId: string) => { return key; },
    getKeyByName: (name: string, prov: string, alg: string) => { return key; },
    saveKey: (key: ProviderEncryptionKey ) => { return key; },
  },
});


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

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-azure

Weekly Downloads

0

Version

1.0.0

License

Apache-2.0

Unpacked Size

44.1 kB

Total Files

23

Last publish

Collaborators

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