{"library":"pouchdb-security","title":"PouchDB Security","description":"pouchdb-security (v4.2.0) is a plugin for PouchDB that enforces database access restrictions via a CouchDB-compatible security document. It validates user permissions for read, write, admin roles against the `_security` doc. Part of the PouchDB ecosystem with irregular releases; key differentiator is its server-side enforcement when used with pouchdb-server/express-pouchdb, supporting both Node.js and browser environments.","language":"javascript","status":"active","last_verified":"Sat Apr 25","install":{"commands":["npm install pouchdb-security"],"cli":null},"imports":["import Security from 'pouchdb-security'","import { Security } from 'pouchdb-security'","import PouchDB from 'pouchdb'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import PouchDB from 'pouchdb';\nimport Security from 'pouchdb-security';\n\n// Register plugin\nPouchDB.plugin(Security);\n\nconst db = new PouchDB('mydb');\n\n// Set security document\nawait db.putSecurity({\n  admins: { names: ['admin'], roles: [] },\n  members: { names: ['alice'], roles: ['reader'] }\n});\n\n// Verify access (server-side only)\ntry {\n  const doc = await db.get('some-doc', { auth: { username: 'alice', password: 'pass' } });\n  console.log('Access granted');\n} catch (err) {\n  console.error('Access denied:', err);\n}","lang":"typescript","description":"Registers the pouchdb-security plugin, creates a database, sets a security document, and attempts to fetch a document with authentication.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}