{"_id":"@cognitiveproof/cawg-trqp-plugin-mysql","_rev":"2-bd09d3865412df43babe24570f932c2f","name":"@cognitiveproof/cawg-trqp-plugin-mysql","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@cognitiveproof/cawg-trqp-plugin-mysql","version":"0.1.0","license":"MIT","_id":"@cognitiveproof/cawg-trqp-plugin-mysql@0.1.0","maintainers":[{"name":"mrappard","email":"mrappard@gmail.com"}],"dist":{"shasum":"0799cc7a97ceef51b732a82674aea13278c82ff6","tarball":"https://registry.npmjs.org/@cognitiveproof/cawg-trqp-plugin-mysql/-/cawg-trqp-plugin-mysql-0.1.0.tgz","fileCount":6,"integrity":"sha512-t3J1NZLdNlwdEg29KP+IW4En6sCBT4jbwGy0BNdvdVll7oMYq7V9qqXtBDq0m2Cvc9YvxaXLOJCtBvGVOcHy0Q==","signatures":[{"sig":"MEUCIE0a+XaDUHmtxaGBi4s7EOhHoQpv2XzqibyeMdoOhPryAiEAn5Ufa5zwjdWGtWmeVMO272u+xFGqke9QsJ4SXy3JUJM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":11041},"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":"MySQL-backed PolicyService for cawg-trqp-refimpl","directories":{},"_nodeVersion":"25.9.0","dependencies":{"mysql2":"^3.11.4","@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-mysql_0.1.0_1787689380634_0.8715558479101879","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@cognitiveproof/cawg-trqp-plugin-mysql","version":"0.1.1","description":"MySQL-backed PolicyService for cawg-trqp-refimpl","license":"MIT","repository":{"type":"git","url":"git+https://github.com/Cognitive-Proof/cawg-trqp-verifer.git","directory":"plugins/mysql"},"type":"module","main":"dist/index.js","types":"dist/index.d.ts","publishConfig":{"access":"public"},"scripts":{"build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.typecheck.json","test":"vitest run"},"dependencies":{"@cognitiveproof/cawg-trqp-plugin-types":"^0.1.1","mysql2":"^3.11.4"},"devDependencies":{"typescript":"^5.7.2","vitest":"^4.1.10"},"gitHead":"81d124cf20ef41ece5113506669f6a36acf8dc75","_id":"@cognitiveproof/cawg-trqp-plugin-mysql@0.1.1","bugs":{"url":"https://github.com/Cognitive-Proof/cawg-trqp-verifer/issues"},"homepage":"https://github.com/Cognitive-Proof/cawg-trqp-verifer#readme","_nodeVersion":"20.20.2","_npmVersion":"11.19.1","dist":{"integrity":"sha512-6C/xz6rLJ9w1qE7XcBmx0SEiqiLgnE40YarBfUW1N/CeiqoWfLV0gxsVR8iL6LG4fa12tu0FgMSBimwe3DtUqQ==","shasum":"4012a2b0bcec28531e4c7da0eff4b6fc277f87c3","tarball":"https://registry.npmjs.org/@cognitiveproof/cawg-trqp-plugin-mysql/-/cawg-trqp-plugin-mysql-0.1.1.tgz","fileCount":6,"unpackedSize":11357,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@cognitiveproof%2fcawg-trqp-plugin-mysql@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDY5mRDKbmypMfxJclLBW92ZbYzrzfuCodqMxpi0w3hNQIgTBdPnx/xtKReDexGo5Tgqvc9E8vl51FuLH58j1bWzE0="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:6ba22098-c2d9-4f19-8b6f-b3831dc84510"}},"directories":{},"maintainers":[{"name":"mrappard","email":"mrappard@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/cawg-trqp-plugin-mysql_0.1.1_1787876078777_0.2276565351685793"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-25T20:23:00.416Z","modified":"2026-08-28T00:14:39.241Z","0.1.0":"2026-08-25T20:23:00.753Z","0.1.1":"2026-08-28T00:14:38.909Z"},"license":"MIT","description":"MySQL-backed PolicyService for cawg-trqp-refimpl","maintainers":[{"name":"mrappard","email":"mrappard@gmail.com"}],"readme":"# @cognitiveproof/cawg-trqp-plugin-mysql\n\nMySQL-backed `PolicyService` for [`cawg-trqp-refimpl`](../../README.md), using [`mysql2`](https://www.npmjs.com/package/mysql2).\n\n## Install\n\n```bash\nnpm install @cognitiveproof/cawg-trqp-plugin-mysql\n```\n\n## Usage\n\n```ts\nimport { Verifier } from \"cawg-trqp-refimpl\";\nimport { MySQLPolicyService } from \"@cognitiveproof/cawg-trqp-plugin-mysql\";\n\nconst verifier = new Verifier({\n  service: new MySQLPolicyService({ uri: process.env.MYSQL_URI }),\n});\n```\n\n## Schema\n\n```sql\nCREATE TABLE authorizations (\n  id INT AUTO_INCREMENT PRIMARY KEY,\n  entity_id VARCHAR(255) NOT NULL,\n  authority_id VARCHAR(255) NOT NULL,\n  action VARCHAR(255) NOT NULL,\n  resource VARCHAR(255) NOT NULL,\n  context JSON,\n  authorized BOOLEAN NOT NULL,\n  expires VARCHAR(64),\n  policy_epoch VARCHAR(64),\n  evidence JSON,\n  reason VARCHAR(255),\n  policy_requirements JSON,\n  INDEX (entity_id, authority_id, action, resource)\n);\n\nCREATE TABLE recognitions (\n  id INT AUTO_INCREMENT PRIMARY KEY,\n  entity_id VARCHAR(255) NOT NULL,\n  authority_id VARCHAR(255) NOT NULL,\n  action VARCHAR(255) NOT NULL,\n  resource VARCHAR(255) NOT NULL,\n  context JSON,\n  recognized BOOLEAN NOT NULL,\n  expires VARCHAR(64),\n  policy_epoch VARCHAR(64),\n  evidence JSON,\n  reason VARCHAR(255),\n  INDEX (entity_id, authority_id, action, resource)\n);\n\n-- Single-row table: this reference scaffold reads the first row it finds.\nCREATE TABLE revocations (\n  id INT AUTO_INCREMENT PRIMARY KEY,\n  revoked_entities JSON NOT NULL,\n  policy_epoch VARCHAR(64),\n  issued_at VARCHAR(64),\n  channel VARCHAR(64)\n);\n```\n\nTable names are configurable via `authorizationsTable` / `recognitionsTable` / `revocationsTable` options.\n\n**Context matching**: candidate rows are fetched by an exact `WHERE` match on `entity_id`/`authority_id`/`action`/`resource` (both tables 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` JSON must match the request's context - the request may carry additional context keys. This intentionally mirrors `MockTRQPService`'s matching semantics rather than a JSON-equality SQL predicate, which would be both less portable across MySQL versions and sensitive to key order.\n\n## Not implemented in this reference scaffold\n\n- Signed feed-descriptor evidence for the policy/revocation feeds (`feedDescriptorEvidence()` returns `{}`).\n- Connection pool tuning beyond `mysql2`'s defaults.\n\n## Configuration\n\n```ts\nnew MySQLPolicyService({ uri: \"mysql://user:pass@host:3306/trqp\" }); // default: MYSQL_URI env var, else mysql://root@localhost:3306/trqp\n```\n","readmeFilename":"README.md","homepage":"https://github.com/Cognitive-Proof/cawg-trqp-verifer#readme","repository":{"type":"git","url":"git+https://github.com/Cognitive-Proof/cawg-trqp-verifer.git","directory":"plugins/mysql"},"bugs":{"url":"https://github.com/Cognitive-Proof/cawg-trqp-verifer/issues"}}