{"_id":"@cognitiveproof/cawg-trqp-plugin-mongodb","_rev":"2-f9c1d6091050ff2418af23a307c3aa52","name":"@cognitiveproof/cawg-trqp-plugin-mongodb","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@cognitiveproof/cawg-trqp-plugin-mongodb","version":"0.1.0","license":"MIT","_id":"@cognitiveproof/cawg-trqp-plugin-mongodb@0.1.0","maintainers":[{"name":"mrappard","email":"mrappard@gmail.com"}],"dist":{"shasum":"e9262f070ef2c064fe807e1f638fed620210599b","tarball":"https://registry.npmjs.org/@cognitiveproof/cawg-trqp-plugin-mongodb/-/cawg-trqp-plugin-mongodb-0.1.0.tgz","fileCount":6,"integrity":"sha512-vfMsxnZubSGM2HsZwav5aRmJprKJ8C2uogU7aabdFZW1JOyrtUe6vqIY+5lir8SHhuicjcr+aECyAwXgbsP9fg==","signatures":[{"sig":"MEQCIF69X22cSiL2lTkg2pZlFRpfWQgYqjYvpuB2FdDwOuCDAiBiYC8IwkZy8xhOU6GIYVkedwoHNePPhCCMq5wQNaS28g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":11132},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"8826f04d0b5ed79855bbc2b34f138cbaf3a6d2ae","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.typecheck.json"},"_npmUser":{"name":"mrappard","email":"mrappard@gmail.com"},"_npmVersion":"11.12.1","description":"MongoDB-backed PolicyService for cawg-trqp-refimpl","directories":{},"_nodeVersion":"25.9.0","dependencies":{"mongodb":"^6.10.0","@cognitiveproof/cawg-trqp-plugin-types":"^0.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.10","typescript":"^5.7.2"},"_npmOperationalInternal":{"tmp":"tmp/cawg-trqp-plugin-mongodb_0.1.0_1787689371009_0.9443558052320526","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"_id":"@cognitiveproof/cawg-trqp-plugin-mongodb@0.1.1","bugs":{"url":"https://github.com/Cognitive-Proof/cawg-trqp-verifer/issues"},"dist":{"shasum":"a5d3fb315c11bb671d2bbe46c07cbcdd8627ce84","tarball":"https://registry.npmjs.org/@cognitiveproof/cawg-trqp-plugin-mongodb/-/cawg-trqp-plugin-mongodb-0.1.1.tgz","fileCount":6,"integrity":"sha512-zOslBpdFMYENzjexhUXBmJmKZFgRRn+Wk2rBlQC+M6wJzN2SKlvxWCeV8E7BkMXQyolia6uD9Npb0d071HJltA==","signatures":[{"sig":"MEUCIQDNkJ48WV803OVuCvV2OVAfB1Xyxwq67UpI2tUplDVrSQIgZi2uAPUl/P3MI897k38b+ZFSWcLFismtNOield1Nmi0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCIoGR+qTSyi8ZMaArIRsM3WN4TPHuYZhjroYGfkMi4pgIgacJ7evk/ILetUCxE8jiZgbBsVzSUtvxBvVpumUMIJDg="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@cognitiveproof%2fcawg-trqp-plugin-mongodb@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":11371},"main":"dist/index.js","name":"@cognitiveproof/cawg-trqp-plugin-mongodb","type":"module","types":"dist/index.d.ts","gitHead":"81d124cf20ef41ece5113506669f6a36acf8dc75","license":"MIT","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.typecheck.json"},"version":"0.1.1","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:acbc6a44-bed3-4c39-82ba-3c854f205ca7"}},"homepage":"https://github.com/Cognitive-Proof/cawg-trqp-verifer#readme","repository":{"url":"git+https://github.com/Cognitive-Proof/cawg-trqp-verifer.git","type":"git","directory":"plugins/mongodb"},"_npmVersion":"11.19.1","description":"MongoDB-backed PolicyService for cawg-trqp-refimpl","directories":{},"maintainers":[{"name":"mrappard","email":"mrappard@gmail.com"}],"_nodeVersion":"20.20.2","dependencies":{"mongodb":"^6.10.0","@cognitiveproof/cawg-trqp-plugin-types":"^0.1.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.10","typescript":"^5.7.2"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/cawg-trqp-plugin-mongodb_0.1.1_1787876134196_0.40784114968399465"}}},"time":{"created":"2026-08-25T20:22:50.761Z","modified":"2026-08-28T00:15:34.747Z","0.1.0":"2026-08-25T20:22:51.180Z","0.1.1":"2026-08-28T00:15:34.292Z"},"license":"MIT","description":"MongoDB-backed PolicyService for cawg-trqp-refimpl","maintainers":[{"name":"mrappard","email":"mrappard@gmail.com"}],"readme":"# @cognitiveproof/cawg-trqp-plugin-mongodb\n\nMongoDB-backed `PolicyService` for [`cawg-trqp-refimpl`](../../README.md), using the official [`mongodb`](https://www.npmjs.com/package/mongodb) driver.\n\n## Install\n\n```bash\nnpm install @cognitiveproof/cawg-trqp-plugin-mongodb\n```\n\n## Usage\n\n```ts\nimport { Verifier } from \"cawg-trqp-refimpl\";\nimport { MongoPolicyService } from \"@cognitiveproof/cawg-trqp-plugin-mongodb\";\n\nconst verifier = new Verifier({\n  service: new MongoPolicyService({ uri: process.env.MONGO_URI, dbName: \"trqp\" }),\n});\n```\n\n## Schema\n\nThree collections, matching the JSON shape `MockTRQPService` reads from `data/policies.json` / `data/revocations.json` in the core package - migrating from the mock is a straightforward document copy:\n\n- **`authorizations`**: `{ entity_id, authority_id, action, resource, context, authorized, expires, policy_epoch, evidence, reason, policy_requirements }`\n- **`recognitions`**: `{ entity_id, authority_id, action, resource, context, recognized, expires, policy_epoch, evidence, reason }`\n- **`revocations`**: a single document `{ revoked_entities, policy_epoch, issued_at, channel }`\n\nCollection names are configurable via `authorizationsCollection` / `recognitionsCollection` / `revocationsCollection` options.\n\n**Context matching**: candidate documents are fetched by an exact match on `entity_id`/`authority_id`/`action`/`resource` (both collections use this shape — TRQP v2's Recognition Query is scoped the same way Authorization Query is), then filtered in application code so every key in the stored `context` must match the request's context - the request may carry additional context keys. This intentionally mirrors `MockTRQPService`'s matching semantics rather than relying on MongoDB's exact-subdocument-equality query, which would reject a match whenever key order differs or the request supplies extra context.\n\n## Not implemented in this reference scaffold\n\n- Signed feed-descriptor evidence for the policy/revocation feeds (`feedDescriptorEvidence()` returns `{}`). Extend this class if your deployment needs it.\n- Connection pooling/retry tuning beyond what the `mongodb` driver does by default.\n\n## Configuration\n\n```ts\nnew MongoPolicyService({\n  uri: \"mongodb://user:pass@host:27017\",   // default: MONGO_URI env var, else mongodb://localhost:27017\n  dbName: \"trqp\",                          // default: MONGO_DB_NAME env var, else the client's default database\n});\n```\n","readmeFilename":"README.md","homepage":"https://github.com/Cognitive-Proof/cawg-trqp-verifer#readme","repository":{"url":"git+https://github.com/Cognitive-Proof/cawg-trqp-verifer.git","type":"git","directory":"plugins/mongodb"},"bugs":{"url":"https://github.com/Cognitive-Proof/cawg-trqp-verifer/issues"}}