🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

crypto-props

Package Overview
Dependencies
Maintainers
3
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crypto-props

Encrypt/decrypt values from given properties of an object

2.0.3
latest
Source
npm
Version published
Maintainers
3
Created
Source

Build Status Coverage Status js-standard-style

crypto-props

Encrypt/decrypt values from given properties of an object

Usage

const code = require('crypto-props')
const data = {
  id: 123456,
  text: 'Så vakker var aldri natten'
}
const encryptOptions = {
  secret: 'Louie Louie oh no I got to go Louie Louie oh no I got to go',
  data: data,
  method: 'encrypt'
}

const encrypted = code(encryptOptions)
console.log(encrypted)

// => { id: 'ce13f1936bd589bbf5be9251719db344$5ab30813af82a83fe04af171c4796e97', text: 'b1098619cc68e59c9cc2d0785d1fe035f72aa2e867d967022500d6e4d6e4e1a3$716e4e71e277601efe93f47d84bf1150' }

const decryptOptions = {
  secret: 'Louie Louie oh no I got to go',
  data: encrypted,
  method: 'decrypt'
}

const decrypted = code(decryptOptions)
console.log(decrypted)

// => {id: '123456', text: 'Så vakker var aldri natten'}

API

const options = {
  secret: 'string' // Secret for encrypt/decrypt,
  data: {object} // Object for encryption/decryption,
  method: 'string' // 'encrypt' or 'decrypt',
  exclude: [array] // array of property keys to exclude from encryption/decryption,
  include: [array] // array of property keys to include from encryption/decryption
}

License

MIT

Keywords

tfk

FAQs

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