{"_id":"@superfunctions/oauth-storage","_rev":"4-89594cc3f9b419dec25d249f041d2979","name":"@superfunctions/oauth-storage","dist-tags":{"latest":"0.1.2"},"versions":{"0.0.1":{"name":"@superfunctions/oauth-storage","version":"0.0.1","keywords":["oauth","storage","superfunctions"],"author":{"name":"21n"},"license":"MIT","_id":"@superfunctions/oauth-storage@0.0.1","maintainers":[{"name":"21native","email":"npm@21n.org"}],"homepage":"https://github.com/21nCo/super-functions#readme","bugs":{"url":"https://github.com/21nCo/super-functions/issues"},"dist":{"shasum":"db0252151f9ecb5c1f2c2a3540f4a7c8b57578fe","tarball":"https://registry.npmjs.org/@superfunctions/oauth-storage/-/oauth-storage-0.0.1.tgz","fileCount":26,"integrity":"sha512-FPPIjR0sPba51hCZqme+94P6r+N45sMbqjpDOQ4NiuU6wJjAwwvsbhD31zODv9y4P6Bk+z6/B0Ud+sUfjy8/yQ==","signatures":[{"sig":"MEUCIQDc2m5h7tuZn2Xm1mMkKrru6TH/O+C9AIup7gxEuTwD8QIgIF62DjjYtlULmlc9hGth3tMEawKQDnOxpUfPQ+DY/cQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":134474},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"c566cac4b41a7b4a55ff128aad6471f275f03e22","scripts":{"lint":"echo 'lint not configured'","test":"vitest --config ./vitest.config.ts --run","build":"tsc","clean":"rm -rf dist","typecheck":"tsc --noEmit","test:watch":"vitest --config ./vitest.config.ts --watch"},"_npmUser":{"name":"21native","email":"npm@21n.org"},"repository":{"url":"git+https://github.com/21nCo/super-functions.git","type":"git","directory":"packages/oauth-storage"},"_npmVersion":"10.8.2","description":"OAuth state and token storage contracts for Superfunctions","directories":{},"_nodeVersion":"20.20.2","dependencies":{"@superfunctions/db":"0.1.4"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.2.4","typescript":"^5.6.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/oauth-storage_0.0.1_1778750602930_0.6257379700348749","host":"s3://npm-registry-packages-npm-production"}},"0.1.0":{"name":"@superfunctions/oauth-storage","version":"0.1.0","keywords":["oauth","storage","superfunctions"],"author":{"name":"21n"},"license":"MIT","_id":"@superfunctions/oauth-storage@0.1.0","maintainers":[{"name":"21native","email":"npm@21n.org"}],"homepage":"https://github.com/21nCo/super-functions#readme","bugs":{"url":"https://github.com/21nCo/super-functions/issues"},"dist":{"shasum":"87be11d568d07f8cc395cfe9a74b9c4701e368fa","tarball":"https://registry.npmjs.org/@superfunctions/oauth-storage/-/oauth-storage-0.1.0.tgz","fileCount":26,"integrity":"sha512-0x7bMvGspqwD7TsBIQv6A4baxa7VJt5Wehf3Qx6sJ0ZHrWeIDp37Vj/pI7pfuMnXlDAU3/qooengFYWZChtcHA==","signatures":[{"sig":"MEYCIQD2HEHTLbgrvRc7dbcOUBy4dTNzjXx2ZOrqgn9N689ZzQIhAInXB2bkZ/6Yb+RLbMwNBKIoJwV8bg+AxLsTHpv+V0mG","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":134474},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"e11bd81db6390dbc38303a5f3da6baadbaef0c8b","scripts":{"lint":"echo 'lint not configured'","test":"vitest --config ./vitest.config.ts --run","build":"tsc","clean":"rm -rf dist","typecheck":"tsc --noEmit","test:watch":"vitest --config ./vitest.config.ts --watch"},"_npmUser":{"name":"21native","email":"npm@21n.org"},"repository":{"url":"git+https://github.com/21nCo/super-functions.git","type":"git","directory":"packages/oauth-storage"},"_npmVersion":"10.8.2","description":"OAuth state and token storage contracts for Superfunctions","directories":{},"_nodeVersion":"20.20.2","dependencies":{"@superfunctions/db":"0.2.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.2.4","typescript":"^5.6.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/oauth-storage_0.1.0_1787981270988_0.7124134179827963","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@superfunctions/oauth-storage","version":"0.1.1","keywords":["oauth","storage","superfunctions"],"author":{"name":"21n"},"license":"MIT","_id":"@superfunctions/oauth-storage@0.1.1","maintainers":[{"name":"21native","email":"npm@21n.org"}],"homepage":"https://github.com/21nCo/superfunctions#readme","bugs":{"url":"https://github.com/21nCo/superfunctions/issues"},"dist":{"shasum":"58de8b411f9a84c4f226b1dc565741a737c1a611","tarball":"https://registry.npmjs.org/@superfunctions/oauth-storage/-/oauth-storage-0.1.1.tgz","fileCount":26,"integrity":"sha512-ceip53BCNB9uH+y5GnA4y2o6mF4vYPMgV4qAuZ27AeO16o/Lb3YG0hL0ZkR2v/Ai5WpiKMRLlPaz1UeBlfyvIg==","signatures":[{"sig":"MEYCIQClv7dPZVB5hBGOlEY5YAutQWLTGjTotWyNaEagIbyTvAIhALeDbM7TmNDRK4TI0+idA+hhWZAXZ+eSeFZCARuKaY34","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCICCwGpYdBn2x95pXyq4xg390AhZNnYIlzrkzR30tnt/sAiEA4Z6KSluThXu3uh9PaXyLPlWjuNMekZp1+dSaY3EsDSY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@superfunctions%2foauth-storage@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":134530},"main":"./dist/index.js","type":"module","_from":"file:/home/runner/work/_temp/npm-package/superfunctions-oauth-storage-0.1.1.tgz","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"699d9d09932199d660333c57fe7bc646492ea3bf","scripts":{"lint":"echo 'lint not configured'","test":"vitest --config ./vitest.config.ts --run","build":"tsc","clean":"rm -rf dist","typecheck":"tsc --noEmit","test:watch":"vitest --config ./vitest.config.ts --watch"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"bf1e92f0-26dd-4481-958f-9fefcc77991d"}},"_resolved":"/home/runner/work/_temp/npm-package/superfunctions-oauth-storage-0.1.1.tgz","_integrity":"sha512-ceip53BCNB9uH+y5GnA4y2o6mF4vYPMgV4qAuZ27AeO16o/Lb3YG0hL0ZkR2v/Ai5WpiKMRLlPaz1UeBlfyvIg==","repository":{"url":"git+https://github.com/21nCo/superfunctions.git","type":"git","directory":"packages/oauth-storage"},"_npmVersion":"11.21.0","description":"OAuth state and token storage contracts for Superfunctions","directories":{},"_nodeVersion":"22.23.4","dependencies":{"@superfunctions/db":"0.2.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.2.4","typescript":"^5.6.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/oauth-storage_0.1.1_1794344068538_0.1839351088736223","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"_id":"@superfunctions/oauth-storage@0.1.2","bugs":{"url":"https://github.com/21nCo/superfunctions/issues"},"dist":{"shasum":"82ac40c536222e02899536abd064c44b88e65ab4","tarball":"https://registry.npmjs.org/@superfunctions/oauth-storage/-/oauth-storage-0.1.2.tgz","fileCount":26,"integrity":"sha512-xjapNRoyEPDWfnkoQELFli0JwWW8Ng3CvRYMN5q97b8WvCJ6liq66XrUaLsODbzCDrOqg4AIOvL9Ym1fDIwbnw==","signatures":[{"sig":"MEYCIQD7+F5f6NmV1WPooaFMS6QUor+iNWKs/RdbcMBJ76SS7AIhAJ++/3ZJXcnUMY9f7GLvgKYvtjCAHyA2FXY8M0hzDgbz","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIE/r40VLMI/O06KhRfK1Y16OLUNFo3gCAYkVuN5BIc3uAiAQ/HrFLoVmxRL3wH7AKWd12nDr94xlcGdckXKbMbUjPw=="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@superfunctions%2foauth-storage@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":135380},"main":"./dist/index.js","name":"@superfunctions/oauth-storage","type":"module","_from":"file:/home/runner/work/_temp/npm-package/superfunctions-oauth-storage-0.1.2.tgz","types":"./dist/index.d.ts","author":{"name":"21n"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"15885bfdd543ff74733b3f6bb6cc11ec0c05b194","license":"MIT","scripts":{"lint":"echo 'lint not configured'","test":"vitest --config ./vitest.config.ts --run","build":"tsc","clean":"rm -rf dist","typecheck":"tsc --noEmit","test:watch":"vitest --config ./vitest.config.ts --watch"},"version":"0.1.2","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"bf1e92f0-26dd-4481-958f-9fefcc77991d"}},"homepage":"https://github.com/21nCo/superfunctions#readme","keywords":["oauth","storage","superfunctions"],"_resolved":"/home/runner/work/_temp/npm-package/superfunctions-oauth-storage-0.1.2.tgz","_integrity":"sha512-xjapNRoyEPDWfnkoQELFli0JwWW8Ng3CvRYMN5q97b8WvCJ6liq66XrUaLsODbzCDrOqg4AIOvL9Ym1fDIwbnw==","repository":{"url":"git+https://github.com/21nCo/superfunctions.git","type":"git","directory":"packages/oauth-storage"},"_npmVersion":"11.21.0","description":"OAuth state and token storage contracts for Superfunctions","directories":{},"maintainers":[{"name":"21native","email":"npm@21n.org"}],"_nodeVersion":"22.23.5","dependencies":{"@superfunctions/db":"0.2.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.2.4","typescript":"^5.6.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/oauth-storage_0.1.2_1795593617013_0.6778994787605904"}}},"time":{"created":"2026-05-14T09:23:22.795Z","modified":"2026-11-25T08:00:17.507Z","0.0.1":"2026-05-14T09:23:23.088Z","0.1.0":"2026-08-29T05:27:51.155Z","0.1.1":"2026-11-10T20:54:28.627Z","0.1.2":"2026-11-25T08:00:17.113Z"},"bugs":{"url":"https://github.com/21nCo/superfunctions/issues"},"author":{"name":"21n"},"license":"MIT","homepage":"https://github.com/21nCo/superfunctions#readme","keywords":["oauth","storage","superfunctions"],"repository":{"url":"git+https://github.com/21nCo/superfunctions.git","type":"git","directory":"packages/oauth-storage"},"description":"OAuth state and token storage contracts for Superfunctions","maintainers":[{"name":"21native","email":"npm@21n.org"}],"readme":"# @superfunctions/oauth-storage\n\nShared OAuth state and token persistence contracts, adapters, and encryption helpers.\n\n## Install\n\n```bash\nnpm install @superfunctions/oauth-storage @superfunctions/db\n```\n\n## Quick Start\n\nProduction code should persist tokens through `EncryptedTokenVault`.\n\n```ts\nimport {\n  AesGcmTokenCipher,\n  EncryptedTokenVault,\n  MemoryOAuthStateStore,\n  MemoryTokenVault,\n} from \"@superfunctions/oauth-storage\";\n\nconst stateStore = new MemoryOAuthStateStore();\nconst cipher = new AesGcmTokenCipher((keyRef) => {\n  if (keyRef !== \"oauth-default\") {\n    throw new Error(\"unknown keyRef\");\n  }\n\n  return Buffer.alloc(32, 7);\n});\n\nconst tokenVault = new EncryptedTokenVault(new MemoryTokenVault(), cipher);\n```\n\nIf you want the shared DB abstraction, `createOAuthDbStorage(...)` builds the stores with the correct default model names:\n\n```ts\nimport { createOAuthDbStorage } from \"@superfunctions/oauth-storage\";\n\nconst { stateStore, tokenVault, models } = createOAuthDbStorage({\n  adapter,\n});\n\nconsole.log(models.oauthStates); // oauth_states\nconsole.log(models.oauthTokenVault); // oauth_tokens\n```\n\n## Package Boundary\n\n`@superfunctions/oauth-storage` owns:\n\n- `OAuthStateStore` for short-lived redirect state\n- `TokenVault` for connection-bound token records\n- consent and revocation-failure stores\n- in-memory, SQL, and `@superfunctions/db` adapters\n- `EncryptedTokenVault`, `TokenCipher`, and `AesGcmTokenCipher`\n\nIt does not decide when to start OAuth, exchange tokens, or expose HTTP endpoints.\n\n## Production Notes\n\n- The default SQL/DB token model name is `oauth_tokens`.\n- `MemoryOAuthStateStore` and `MemoryTokenVault` are fine for tests and small prototypes, but not for multi-instance production deployments.\n- Prefer `EncryptedTokenVault` for durable token storage so plaintext token JSON never becomes the long-lived record format.\n- If you already use a custom token table/model name, keep passing `models.oauthTokenVault` until your schema migration is complete.\n\n## Related Packages\n\n- OAuth core primitives: [../oauth-core/README.md](../oauth-core/README.md)\n- Flow orchestration: [../oauth-flow/README.md](../oauth-flow/README.md)\n- Test fixtures: [../oauth-testing/README.md](../oauth-testing/README.md)\n","readmeFilename":"README.md"}