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

@lifeomic/kms-crypt

Package Overview
Dependencies
Maintainers
58
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lifeomic/kms-crypt - npm Package Compare versions

Comparing version 0.1.1-beta.1 to 0.1.1-beta.2

10

dist/index.d.ts
/// <reference types="node" />
import { KMS } from "aws-sdk";
import { EncryptRequest, Encrypted, EncryptObjectRequest } from "./types";
import { Encrypted, EncryptObjectRequest, EncryptRequest } from "./types";
/**

@@ -9,3 +9,3 @@ * Encrypts data using a KMS data encryption key

*/
export declare function encrypt(kms: KMS, encryptRequest: EncryptRequest): Promise<Encrypted>;
export declare function encrypt(encryptRequest: EncryptRequest, config?: KMS.Types.ClientConfiguration): Promise<Encrypted>;
/**

@@ -16,3 +16,3 @@ * Encrypts an object using a KMS data encryption key

*/
export declare function encryptObject(kms: KMS, encryptRequest: EncryptObjectRequest): Promise<Encrypted>;
export declare function encryptObject(encryptRequest: EncryptObjectRequest): Promise<Encrypted>;
/**

@@ -23,3 +23,3 @@ * Decrypts data using KMS key

*/
export declare function decrypt(kms: KMS, encrypted: Encrypted): Promise<Buffer>;
export declare function decrypt(encrypted: Encrypted, config?: KMS.Types.ClientConfiguration): Promise<Buffer>;
/**

@@ -30,2 +30,2 @@ * Decrypts an object using KMS

*/
export declare function decryptObject<T = any>(kms: KMS, encrypted: Encrypted): Promise<T>;
export declare function decryptObject<T = any>(encrypted: Encrypted): Promise<T>;

@@ -11,2 +11,4 @@ "use strict";

var _awsSdk = require("aws-sdk");
var crypto = _interopRequireWildcard(require("crypto"));

@@ -21,3 +23,4 @@

*/
async function encrypt(kms, encryptRequest) {
async function encrypt(encryptRequest, config) {
const kms = new _awsSdk.KMS(config);
const {

@@ -50,4 +53,4 @@ kmsKeyId,

async function encryptObject(kms, encryptRequest) {
return encrypt(kms, {
async function encryptObject(encryptRequest) {
return encrypt({
data: Buffer.from(JSON.stringify(encryptRequest.data), "utf8"),

@@ -65,3 +68,4 @@ kmsKeyId: encryptRequest.kmsKeyId,

async function decrypt(kms, encrypted) {
async function decrypt(encrypted, config) {
const kms = new _awsSdk.KMS(config);
const decryptResponse = await kms.decrypt({

@@ -84,5 +88,5 @@ CiphertextBlob: encrypted.keyCiphertext

async function decryptObject(kms, encrypted) {
const decrypted = await decrypt(kms, encrypted);
async function decryptObject(encrypted) {
const decrypted = await decrypt(encrypted);
return JSON.parse(decrypted.toString("utf8"));
}
{
"name": "@lifeomic/kms-crypt",
"version": "0.1.1-beta.1",
"version": "0.1.1-beta.2",
"description": "Encrypt and decrypt objects with keys from KMS.",

@@ -19,5 +19,7 @@ "main": "dist/index.js",

"lint": "tslint --project .",
"test": "jest"
"test": "jest",
"publish": "yarn build && yarn publish",
"publish-beta": "yarn build && yarn publish --tag beta"
},
"peerDependencies": {
"dependencies": {
"aws-sdk": "^2"

@@ -32,3 +34,2 @@ },

"@types/node": "^12.0.4",
"aws-sdk": "^2.466.0",
"jest": "^24.8.0",

@@ -35,0 +36,0 @@ "prettier": "^1.17.1",

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