2.0.1 • Published 6 months ago

@am92/kms v2.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

@am92/kms

npm version  ECMAScript Module  License: MIT  Vulnerabilities: Snyk  Downloads Bundle Size

This package provides Key Management related functionalities using either Node Crypto or AWS KMS. It provides the following functionalities:

  • Generating Encryption Key for Symmetric and Asymmetric Algorithms
  • Encrypting and Decrypting data using:
    • Defined Master Key and Master IV in case of Node Crypto
    • KMS defined Master Key and IV in case of AWS KMS

Table of Content

Installation

$ npm install --save @am92/kms

Environment Variables

The following environment variables need to be set to work with this package:

##### KMS Config
export KMS_ENABLED=false
export KMS_TYPE=''
export KMS_KEY_SPEC='AES_256'
export KMS_KEY_PAIR_SPEC='RSA_2048'
export KMS_KEY_FORMAT='base64'
export KMS_PLAIN_TEXT_FORMAT='base64'
export KMS_CIPHER_TEXT_FORMAT='base64'
export KMS_MASTER_KEY_HEX='0000000000000000000000000000000000000000000000000000000000000000'
export KMS_MASTER_IV_HEX='00000000000000000000000000000000'
export KMS_AWS_REGION='ap-south-1'
export KMS_AWS_KEY_ID=''

Note:

  • If 'KMS_ENABLED' is set to 'true', 'KMS_TYPE' is required. Possible values are 'NODE' and 'AWS'
  • If 'KMS_TYPE' is set to 'AWS', 'KMS_AWS_KEY_ID'is required
  • Variables where values have been defined can be omitted from being defined as the mentioned values are internally defaulted.

Creating a KMS Instance

import { Kms } from '@am92/kms'

const kms = new Kms()
export default kms

If you wish to pass your custom 'config' to Kms Class, then you can build it as follows:

import { Kms } from '@am92/kms'

const config = {
  KMS_TYPE: 'NODE'
}

const kms = new Kms(config)
export default kms

Contributors

Resources

License

2.0.1

6 months ago

2.0.0

6 months ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.2

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago