Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@aws-crypto/kms-keyring-node
Advanced tools
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
@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.
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);
The aws-sdk package is the official AWS SDK for JavaScript, which includes support for AWS KMS among many other AWS services. It provides a more general-purpose interface for interacting with AWS services, including KMS, but does not offer the same high-level abstractions for encryption and decryption as @aws-crypto/kms-keyring-node.
node-forge is a JavaScript library for implementing various cryptographic functions, including encryption and decryption. While it does not integrate directly with AWS KMS, it provides a wide range of cryptographic utilities that can be used for similar purposes. It requires more manual setup and does not offer the same seamless integration with AWS services.
crypto-js is a popular library for cryptographic operations in JavaScript. It provides a variety of cryptographic algorithms and utilities but does not integrate with AWS KMS. It is useful for general-purpose cryptographic needs but lacks the specific key management features provided by @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 languages. For more information on the AWS Encryption SDKs in all languages, see the Developer Guide.
This package should only be used as part of the AWS Encryption SDK for Javascript. For more information about the packages in this project and how they can be used together, see the main node package readme
npm install @aws-crypto/kms-keyring-node
npm test
This SDK is distributed under the Apache License, Version 2.0, see LICENSE.txt and NOTICE.txt for more information.
FAQs
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
The npm package @aws-crypto/kms-keyring-node receives a total of 155,443 weekly downloads. As such, @aws-crypto/kms-keyring-node popularity was classified as popular.
We found that @aws-crypto/kms-keyring-node demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.