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

@ipbyrne/mongo-encrypted-query

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ipbyrne/mongo-encrypted-query - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

2

package.json

@@ -6,3 +6,3 @@ {

"license": "Apache-2.0",
"version": "0.0.7",
"version": "0.0.8",
"main": "dist/index.js",

@@ -9,0 +9,0 @@ "typings": "dist/index.d.ts",

@@ -16,9 +16,11 @@ # Mongo Encrypted Query

### Encrypt Data (`encryptData`)
This function is to be used whenever you are saving data into the database. You are expected to pass into this functio the data to be saved, the public key you are going to use to encrypt the data, and the salt you want to use to make the data queryable.
This function is to be used whenever you are saving data into the database. You are expected to pass into this function the data to be saved and the private key you are going to use to encrypt the data to make the data queryable.
When saving to MongoDB you are expected to pass in an object but it can encrypt any data you pass in (string, number, array, etc).
### Encrypt Query (`encryptQuery`)
This function is to be used to format any query you want to use when querying the database. This function takes in the traditional MongoDB query, along with the salt used when saving the data you are trying to query.
This function is to be used to format any query you want to use when querying the database. This function takes in the traditional MongoDB query, along with the private key used when saving the data you are trying to query.
### Decrypt Data (`decryptData`)
This function is used to decrypt the data returned from MongoDB. This function is expecting the data returned from MongoDB, the private key you will use to decrypt the data, and the salt used when saving the data.
This function is used to decrypt the data returned from MongoDB. This function is expecting the data returned from MongoDB, the private key you will use to decrypt the data.

@@ -30,4 +32,2 @@ This will then return the decrypted data.

This will then return the decrypted data.
## Working In The Repo

@@ -93,2 +93,6 @@

## Encrypting Keys
In order to encrypt your keys in your database along with the values, you must set the `ENCRYPT_KEYS` `ENV` var to be `'true'`.
If you are not worried about the keys being readable in the database you can opt out of encrypting them. One benefit of doing this would be it will allow you to build indexes on fields to speed up queries.
To opt-out of having your keys encrypted, make sure you set your `ENCRYPT_KEYS` `ENV` var to anything but `'true'` or you do no provide it at all.
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