🚀 DAY 4 OF LAUNCH WEEK: Introducing GitHub Actions Scanning Support.Learn more →
Socket
Book a DemoInstallSign in
Socket

@credenceanalytics/aws-kms-adaptor

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@credenceanalytics/aws-kms-adaptor

This package contains the code for aws kms

latest
npmnpm
Version
1.0.0
Version published
Maintainers
0
Created
Source

AWS KMS Adaptor

Installation

  • Execute below mentioned command:
    npm install @credenceanalytics/aws-kms-adaptor
    

Requirements

  • AWS SDK: Ensure AWS credentials are properly configured for KMS access.
  • Dependencies: This library internally uses @aws-crypto/client-node.

Usage

Initialization

Import and initialize the AWS KMS Adaptor with your AWS configuration:

`const AwskmsInstance = require('aws-kms-adaptor');
 const kmsAdaptor = new AwskmsInstance(<awsconfig>);` 

Encrypt Data

const plaintext = 'Sensitive information';
kmsAdaptor.encryptDataAndReturn(<plaintext>).then((encryptedData) => {
  console.log('Encrypted Data:', encryptedData);
}).catch((error) => {
  console.error('Encryption Error:', error.message);
});

Decrypt Data

const encryptedData = '<Base64-encoded encrypted data>';
kmsAdaptor.decryptData(encryptedData).then((decryptedData) => {
  console.log('Decrypted Data:', decryptedData);
}).catch((error) => {
  console.error('Decryption Error:', error.message);
});

Configuration

  • AWS Key ARN: The kms_key_Arn parameter specifies the KMS key used for encryption and decryption.
  • Encryption Context: Default context includes metadata for purpose and environment. You can customize it in the encryptionContext field inside the class.

Feel free to modify this template further to fit your project's specific needs.

FAQs

Package last updated on 27 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts