https://github.com/adorsys/encrypt-down
An abstract-leveldown implementation that wraps another store to encrypt the stored values.
https://github.com/adorsys/encrypt-down
database encryption level level-db
Last synced: 6 months ago
JSON representation
An abstract-leveldown implementation that wraps another store to encrypt the stored values.
- Host: GitHub
- URL: https://github.com/adorsys/encrypt-down
- Owner: adorsys
- License: mit
- Created: 2018-07-27T11:40:55.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-04-28T03:56:39.000Z (over 2 years ago)
- Last Synced: 2024-09-20T06:11:57.394Z (about 1 year ago)
- Topics: database, encryption, level, level-db
- Language: JavaScript
- Homepage:
- Size: 2.43 MB
- Stars: 18
- Watchers: 7
- Forks: 3
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# :closed_lock_with_key: encrypt-down :closed_lock_with_key:
[](#contributors-)
[](https://github.com/level/awesome)
[](https://travis-ci.org/adorsys/encrypt-down)
[](https://coveralls.io/github/adorsys/encrypt-down)
[](https://www.npmjs.com/package/@adorsys/encrypt-down)
[](https://www.npmjs.com/package/@adorsys/encrypt-down)
[](https://conventionalcommits.org)
[](https://standardjs.com)
[](https://github.com/prettier/prettier#readme)
[](https://github.com/adorsys/encrypt-down/blob/master/LICENSE)encrypt-down is an encryption layer for LevelDB.
For LevelDB exist several persistence bindings.
Amongst others bindings for [IndexedDB](https://developer.mozilla.org/de/docs/IndexedDB).By using encrypt-down it is possible to store lots (several MB) of sensitive user data securely (encrypted) in the browser across user sessions.
### Installation
```bash
npm install @adorsys/encrypt-down
```### Usage
We need a JSON Web Key (JWK) or JSON Web Key Set (JWKS) as specified by [RFC 7517](https://tools.ietf.org/html/rfc7517).
```js
const memdown = require('memdown')
const encryptdown = require('@adorsys/encrypt-down')
const levelup = require('levelup')
const jwk = {
kty: 'oct',
alg: 'A256GCM',
use: 'enc',
k: '123456789abcdefghijklmnopqrstuvwxyz12345678'
}
const memdb = memdown()
const db = levelup(encryptdown(memdb, { jwk }))db.put('key', { awesome: true }, function (err) {
memdb._get('key', { asBuffer: false }, function (err, value) {
console.log(value)
// eyJlbmMiOiJBMjU2R0NNIiwiYWxnIjoiZGlyIiwia2lkIjoialpESEVqN0ZhR3N5OHNUSUZLRWlnejB4TjFEVWlBZWp0S1ZNcEl2Z3dqOCJ9..LLeRPtRCpn-Zie6-.zZc0LQ_vvHCppRAaC5fxw4yJ0041l6mGOSgLDVnaPagSv_3Khp8a8lyAo9utHQKpVX6RNVaVPBQQxJpkw_Zyljeg7L-O_Nc3N2Hi_904qE6_zwORqQRc.R0JhfgTHIcD_93kXzZ8BrA
})
db.get('key', { asBuffer: false }, function (err, value) {
console.log(value)
// { awesome: true }
})
})
```### Browser Support
[](https://saucelabs.com/u/adorsysbot)
## API
### `const db = require('@adorsys/encrypt-down')(db[, options])`
- `db` must be an [`abstract-leveldown`](https://github.com/level/abstract-leveldown) compliant store
- `options`:
- `jwk`: a JSON Web Key (JWK) or JSON Web Key Set (JWKS) as specified by [RFC 7517](https://tools.ietf.org/html/rfc7517)## Credits
Made with :heart: by [radzom](https://github.com/radzom) and all these wonderful contributors ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
Vincent Weevers
π¬
Francis Pouatcha
π€
Boris Skert
π
Jan-Otto KrΓΆpke
π§ π
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind are welcome!
## Big Thanks
Cross-browser Testing Platform and Open Source β₯ Provided by [Sauce Labs](https://saucelabs.com).
[](https://saucelabs.com)
## Contributors β¨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!