Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aws-crypto/kms-keyring-node

Package Overview
Dependencies
Maintainers
8
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-crypto/kms-keyring-node

The AWS Encryption SDK for JavaScript is a client-side encryption library designed to make it easy for everyone to encrypt and decrypt data using industry standards and best practices. It uses a data format compatible with the AWS Encryption SDKs in other

  • 3.2.0
  • npm
  • Socket score

Version published
Weekly downloads
152K
decreased by-9.31%
Maintainers
8
Weekly downloads
 
Created

What is @aws-crypto/kms-keyring-node?

@aws-crypto/kms-keyring-node is an AWS SDK package that provides keyring implementations for AWS Key Management Service (KMS). It allows you to encrypt and decrypt data using AWS KMS keys in a Node.js environment.

What are @aws-crypto/kms-keyring-node's main functionalities?

Encrypting Data

This feature allows you to encrypt data using a KMS key. The code sample demonstrates how to create a KMS keyring and use it to encrypt a plaintext message.

const { KmsKeyringNode, buildClient, CommitmentPolicy } = require('@aws-crypto/kms-keyring-node');
const { encrypt } = require('@aws-crypto/client-node');

const keyring = new KmsKeyringNode({ generatorKeyId: 'arn:aws:kms:us-west-2:123456789012:key/abcd-1234-efgh-5678' });
const plaintext = Buffer.from('Hello, world!');

(async () => {
  const { result } = await encrypt(keyring, plaintext);
  console.log(result); // Encrypted data
})();

Decrypting Data

This feature allows you to decrypt data that was encrypted using a KMS key. The code sample demonstrates how to create a KMS keyring and use it to decrypt an encrypted message.

const { KmsKeyringNode, buildClient, CommitmentPolicy } = require('@aws-crypto/kms-keyring-node');
const { decrypt } = require('@aws-crypto/client-node');

const keyring = new KmsKeyringNode({ generatorKeyId: 'arn:aws:kms:us-west-2:123456789012:key/abcd-1234-efgh-5678' });
const encryptedData = Buffer.from('...'); // Encrypted data from previous step

(async () => {
  const { plaintext } = await decrypt(keyring, encryptedData);
  console.log(plaintext.toString()); // Decrypted data
})();

Multi-Region Keyring

This feature allows you to create a multi-region keyring that can use multiple KMS keys from different regions. The code sample demonstrates how to configure a keyring with multiple KMS key ARNs.

const { KmsKeyringNode } = require('@aws-crypto/kms-keyring-node');

const keyring = new KmsKeyringNode({
  generatorKeyId: 'arn:aws:kms:us-west-2:123456789012:key/abcd-1234-efgh-5678',
  keyIds: [
    'arn:aws:kms:us-east-1:123456789012:key/abcd-1234-efgh-5678',
    'arn:aws:kms:eu-west-1:123456789012:key/abcd-1234-efgh-5678'
  ]
});

console.log(keyring);

Other packages similar to @aws-crypto/kms-keyring-node

FAQs

Package last updated on 23 Feb 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc