# pouchdb-security

> PouchDB database access restrictions using a security document.

Latest version **4.2.0** (published 2019-09-25) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install pouchdb-security
pnpm add pouchdb-security
yarn add pouchdb-security
bun add pouchdb-security
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.2.0 |
| Published | 2019-09-25 |
| First published | 2014-09-01 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 109.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 979 |
| Author | Marten de Vries |
| Maintainers | commandoline, daleharvey, garrensmith, nolanlawson |
| Keywords | pouch, pouchdb, couch, couchdb, security, access, online, offline |

## Links

- npm: https://www.npmjs.com/package/pouchdb-security
- Repository: https://github.com/pouchdb/pouchdb-server
- Homepage: https://github.com/pouchdb/pouchdb-server#readme
- Issues: https://github.com/pouchdb/pouchdb-server/issues
- npm.io page: https://npm.io/package/pouchdb-security

## Dependencies (8)

- [extend](https://npm.io/package/extend.md) ^3.0.0
- [promise-nodify](https://npm.io/package/promise-nodify.md) ^1.0.2
- [pouchdb-promise](https://npm.io/package/pouchdb-promise.md) ^6.4.1
- [pouchdb-wrappers](https://npm.io/package/pouchdb-wrappers.md) 4.2.0
- [pouchdb-plugin-error](https://npm.io/package/pouchdb-plugin-error.md) 4.2.0
- [pouchdb-req-http-query](https://npm.io/package/pouchdb-req-http-query.md) 4.2.0
- [pouchdb-bulkdocs-wrapper](https://npm.io/package/pouchdb-bulkdocs-wrapper.md) 4.2.0
- [pouchdb-changeslike-wrapper](https://npm.io/package/pouchdb-changeslike-wrapper.md) 4.2.0

## Recent versions

- 4.2.0 (latest) — 2019-09-25
- 5.0.1-rc1.0 (beta) — 2025-08-27
- 4.1.0 — 2018-08-13
- 4.0.1 — 2018-06-05
- 4.0.0 — 2018-01-27
- 2.3.7 — 2017-05-15
- 2.3.6 — 2017-03-03
- 2.3.5 — 2017-03-02
- 1.2.6 — 2016-02-05
- 1.2.5 — 2015-10-24
- 1.2.4 — 2015-08-19
- 1.2.3 — 2015-04-25
- 1.2.2 — 2015-04-25
- 1.2.1 — 2015-01-15
- 1.2.0 — 2014-09-14
- … 5 more at https://npm.io/package/pouchdb-security/versions

## README

pouchdb-security
================

PouchDB database access restrictions using a security document. Like
_security in CouchDB (and when used on an http database, that url is
checked.)

API
---

**NodeJS package name:** `pouchdb-security`

**Browser object name:** `window.Security`

First, make sure you understand how security objects work in CouchDB.
A good start is [their HTTP documentation](http://docs.couchdb.org/en/latest/api/database/security.html).

### Security.putSecurity(secObj[, callback])

Equivalent to PUTting a document to /db/_security in CouchDB.
Replaces the current security object for the database with the given
one.

For example:

```javascript
{
  "admins": {
    "names": [
      "your_name"
    ],
    "roles": []
  },
  "members": {
    "names": [],
    "roles": [
      "app_users"
    ]
  }
}
```

**Returns**: `{ok: true}`.

### Security.getSecurity([callback])

Equivalent to going to /db/_security in CouchDB.

**Returns**: the security object for the current database.
(`{}` when none has been set, like in CouchDB.)

Source
------

PouchDB Server and its sub-packages are distributed as a [monorepo](https://github.com/babel/babel/blob/master/doc/design/monorepo.md).

For a full list of packages, see [the GitHub source](https://github.com/pouchdb/pouchdb-server/tree/master/packages/node_modules).

License
-------

The Apache 2 License. See [the LICENSE file](https://github.com/pouchdb/pouchdb-server/blob/master/LICENSE) for more information.

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