New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

kms-decrypt

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kms-decrypt

Decrypts a KMS encrypted file into a string

  • 1.0.0-beta.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

KMS Decryption

A simple package that takes a path to a file that's been encrypted with KMS and returns the decrypted contents.

Usage

// Install the package
npm install @pluralsight/kms-decrypt
// Then in a file where you want to use the package

import {Decrypt, KmsClientInfo} from 'kms-decrypt'

const kmsValues: KmsClientInfo = {
  projectId:`name-of-your-gcp-project`,
  keyRingId:`name-of-your-keyring`,
  cryptoKeyId : `name-of-your-key`,
  location: `location`
}

export const yourFunction = async(): Promise<void> =>{

const decryption = new Decrypt(kmsValues)
const encryptedFilePath = `/some/path/encryptedFilename.encrypted`
// another example, assuming you have a folder named secrets at the root level
// const encryptedFilePath = path.resolve(__dirname, `./secrets/Filename.encrypted`)
const testToken = await decryption.decryptToString(encryptedFilePath)
}

Decrypt.test has an integration test. You need to encrypt the testSecret.txt file with your credentials and put the testSecret.encrypted file in the src folder. Then create a file named `.clientConfig.ts like this:

import * as I from './Interfaces'

export const kmsValues: I.KmsClientInfo = {
  projectId: `your-project-name`,
  keyRingId: `your-ring`,
  cryptoKeyId: `your-key`,
  location: `global`,
}

The location can be specific to what you set when you created your key credentials.

Here's the gcloud SDK command that will encrypt the file once you substitute in your key ring and key.
gcloud kms encrypt --location global --keyring <your-key-ring> --key <your-key> --plaintext-file testSecret.txt --ciphertext-file testSecret.encrypted

Keywords

FAQs

Package last updated on 28 Nov 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