Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@aws-crypto/kms-keyring
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 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.
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();
The aws-sdk package is the official AWS SDK for JavaScript, which includes support for AWS KMS among many other AWS services. It provides more comprehensive functionality for interacting with AWS services, but requires more manual setup for cryptographic operations compared to @aws-crypto/kms-keyring.
node-forge is a JavaScript library for implementing various cryptographic operations, including encryption, decryption, and key management. Unlike @aws-crypto/kms-keyring, it does not integrate directly with AWS KMS, so it requires more effort to manage keys and secure data in AWS environments.
crypto-js is a popular JavaScript library for cryptographic operations such as encryption, decryption, and hashing. It does not provide direct integration with AWS KMS, making it less suitable for applications that require seamless integration with AWS key management services.
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 packages is not intended for direct use by clients. To get started with the AWS Encryption SDK for JavaScript, follow the instructions in the README.
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
We found that @aws-crypto/kms-keyring 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.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.