# sequelize-vault

> A Sequelize plugin for easily integrating Hashicorp Vault

Latest version **5.1.0** (published 2021-02-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install sequelize-vault
pnpm add sequelize-vault
yarn add sequelize-vault
bun add sequelize-vault
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.1.0 |
| Published | 2021-02-03 |
| First published | 2018-04-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=11.0.0 |
| Dependencies | 3 |
| Unpacked size | 46.9 KB |
| Known vulnerabilities | 0 (+28 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 7 |
| Author | linyows |
| Maintainers | linyows, dojineko |
| Keywords | sequelize, vault |

## Links

- npm: https://www.npmjs.com/package/sequelize-vault
- Repository: https://github.com/linyows/sequelize-vault
- Issues: https://github.com/linyows/sequelize-vault/issues
- npm.io page: https://npm.io/package/sequelize-vault

## Dependencies (3)

- [axios](https://npm.io/package/axios.md) ^0.21.1
- [sequelize](https://npm.io/package/sequelize.md) ^5.21.3
- [@types/axios](https://npm.io/package/@types/axios.md) ^0.14.0

## Recent versions

- 5.1.0 (latest) — 2021-02-03
- 5.0.0 — 2019-03-26
- 4.0.0 — 2019-03-26
- 3.0.0 — 2018-11-02
- 2.3.0 — 2018-11-01
- 2.2.0 — 2018-06-28
- 2.1.1 — 2018-06-27
- 2.1.0 — 2018-06-27
- 2.0.0 — 2018-06-26
- 1.5.2 — 2018-06-25
- 1.5.1 — 2018-06-22
- 1.5.0 — 2018-05-10
- 1.4.0 — 2018-05-10
- 1.3.1 — 2018-05-09
- 1.3.0 — 2018-05-09
- … 5 more at https://npm.io/package/sequelize-vault/versions

## README

<h1 align="center"><a href="http://docs.sequelizejs.com/"><img src="https://polidog.jp/images/sequelize.png" height="80" align="middle"></a> <a href="https://www.vaultproject.io/"><img src="https://s3.amazonaws.com/hashicorp-marketing-web-assets/brand/Vault_PrimaryLogo_FullColor.HkwAATB6e.svg" height="65" align="middle"></a></h1>

<p align="center"><strong>Sequelize Vault</strong>: A Sequelize plugin for easily integrating Hashicorp Vault.</p> <br>

<p align="center">
<a href="https://www.npmjs.com/package/sequelize-vault" title="npm"><img src="https://img.shields.io/npm/v/sequelize-vault.svg?style=for-the-badge"></a><a href="https://travis-ci.org/linyows/sequelize-vault" title="travis"><img src="https://img.shields.io/travis/linyows/sequelize-vault.svg?style=for-the-badge"></a><a href="https://codecov.io/gh/linyows/sequelize-vault" title="codecov.io"><img src="https://img.shields.io/codecov/c/gh/linyows/sequelize-vault.svg?style=for-the-badge"></a><a href="https://github.com/linyows/sequelize-vault/blob/master/LICENSE" title="MIT License"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge"></a>
</p> <br><br><br>

Installation
------------

```sh
$ npm install sequelize-vault
```

Usage
-----

This package transparently encrypts and decrypts columns in `_encrypted` format using Hashicorp Vault.

### Node.js:

```js
const Sequelize = require('sequelize')
const SequelizeVault = require('sequelize-vault')

const s = new Sequelize({
  username: 'root',
  password: '',
  dialect: 'sqlite',
  database: 'test',
})
const User = s.define('user', {
  ssn_encrypted: Sequelize.STRING,
  ssn: Sequelize.VIRTUAL,
})

SequelizeVault.Vault.app = 'fooapp'
SequelizeVault.Vault.address = 'http://master-vault'
SequelizeVault.default(User)

const u = await User.create({ ssn: '123-45-6789' })
console.log(u.ssn_encrypted)
// vault:v0:EE3EV8P5hyo9h...
```

### TypeScript:

```ts
import {Sequelize, Table, Column, Model} from 'sequelize-typescript'
import SequelizeVault, {Vault} from 'sequelize-vault'

const s = new Sequelize({
  username: 'root',
  password: '',
  dialect: 'sqlite',
  database: 'test',
})

@Table
class User extends Model<User> {
  @Column
  ssn_encrypted: string

  @Column(DataType.VIRTUAL)
  ssn: string
}

s.addModels([User])

Vault.app = 'fooapp'
Vault.address = 'http://master-vault'
SequlizeVault(User)
const u = await User.create({ ssn: '123-45-6789' })
console.log(u.ssn_encrypted)
// vault:v0:EE3EV8P5hyo9h...
```

Options
-------

Key           | Value
---           | ---
enabled       | true or false(default)
app           | my-app
token         | abcd1234
address       | https://vault.example.com
suffix        | \_encrypted
convergented  | true or false(default)
context       | Vault.app(default)
path          | v1/transit
timeout       | 3 * 60 * 1000
ua            | sequelize-vault/1.0.0 (+https://github....

Contribution
------------

1. Fork (https://github.com/linyows/sequelize-vault/fork)
1. Create a feature branch
1. Commit your changes
1. Rebase your local changes against the master branch
1. Run test suite with the `npm ci` command and confirm that it passes
1. Create a new Pull Request

Author
------

[linyows](https://github.com/linyows)

---
_Source: https://npm.io/package/sequelize-vault · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
