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.1 to 0.0.2

src/cipher/cipher.sanity.test.ts

7

package.json

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

"license": "Apache-2.0",
"version": "0.0.1",
"version": "0.0.2",
"main": "dist/index.js",

@@ -33,4 +33,4 @@ "typings": "dist/index.d.ts",

"build": "tsc -b",
"coverage": "NODE_NO_WARNINGS=1 NODE_OPTIONS=--experimental-vm-modules jest --ci --coverage",
"test": "jest --runInBand --forceExit -- ",
"coverage": "NODE_NO_WARNINGS=1 NODE_OPTIONS=--experimental-vm-modules jest --ci --coverage && jest-coverage-badges",
"test": "NODE_NO_WARNINGS=1 NODE_OPTIONS=--experimental-vm-modules jest --runInBand --forceExit -- ",
"lint": "eslint ./src --fix"

@@ -55,2 +55,3 @@ },

"dotenv": "^16.1.3",
"jest-coverage-badges": "^1.1.2",
"jose": "^3.20.1",

@@ -57,0 +58,0 @@ "mongoose": "^5.12.12",

# Mongo Encrypted Query
[![CI](https://github.com/ipbyrne/mongo-encrypted-query/actions/workflows/ci.yml/badge.svg)](https://github.com/ipbyrne/mongo-encrypted-query/actions/workflows/ci.yml)
![Branches](./badges/coverage-branches.svg)
![Functions](./badges/coverage-functions.svg)
![Lines](./badges/coverage-lines.svg)
![Statements](./badges/coverage-statements.svg)
![Jest coverage](./badges/coverage-jest%20coverage.svg)
![Branches](./coverage/badge-branches.svg)
![Functions](./coverage/badge-functions.svg)
![Lines](./coverage/badge-lines.svg)
![Statements](./coverage/badge-statements.svg)
[![NPM](https://nodei.co/npm/@ipbyrne/mongo-encrypted-query.png?mini=true)](https://npmjs.org/package/@ipbyrne/mongo-encrypted-query)
This is a simple SDK that can be used to encrypt all of your data in MongoDB in a way that makes it searchable with any MongoDB equality operator.
## To Use
## How To Use
This package is intended to be layed over any implementation using MongoDB by utilizing 3 functions whenever you are interacting into the database.
### 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.
### 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.
### 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 will then return the decrypted data.
### Generate Encryption Key (`generateEncryptionKeyPair`)
This function is used to generate a key pair that can be used for encrypting and decrypting the data. These keys should never be saved in source or the database and should be stored in a key service where they are accessed whenever you are encrypting/decrypting data.
This will then return the decrypted data.
## Working In The Repo
To run the test to see how this works in practice you can run:

@@ -14,0 +34,0 @@ ```

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