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

@aws-crypto/kms-keyring

Package Overview
Dependencies
Maintainers
3
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-crypto/kms-keyring

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

  • 0.1.0-preview.4
  • npm
  • Socket score

Version published
Maintainers
3
Created

What is @aws-crypto/kms-keyring?

@aws-crypto/kms-keyring is an npm package that provides key management and cryptographic operations using AWS Key Management Service (KMS). It allows developers to encrypt and decrypt data using AWS KMS keys, making it easier to manage encryption keys and secure data in AWS environments.

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

Encrypt Data

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

const { KmsKeyringNode } = require('@aws-crypto/kms-keyring');
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 = 'Hello, World!';

async function encryptData() {
  const { result } = await encrypt(keyring, plaintext);
  console.log('Encrypted data:', result);
}

encryptData();

Decrypt Data

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

const { KmsKeyringNode } = require('@aws-crypto/kms-keyring');
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 = '...'; // Encrypted data from previous example

async function decryptData() {
  const { plaintext } = await decrypt(keyring, encryptedData);
  console.log('Decrypted data:', plaintext.toString());
}

decryptData();

Generate Data Key

This feature allows you to generate a data key using an AWS KMS key. The code sample demonstrates how to create a KMS keyring and use it to generate a data key, returning both the plaintext and encrypted versions of the key.

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

const keyring = new KmsKeyringNode({ generatorKeyId: 'arn:aws:kms:us-west-2:123456789012:key/abcd-1234-efgh-5678' });

async function generateKey() {
  const { plaintext, ciphertext } = await generateDataKey(keyring, { length: 32 });
  console.log('Generated data key:', plaintext);
  console.log('Encrypted data key:', ciphertext);
}

generateKey();

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

FAQs

Package last updated on 20 Sep 2019

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