{"_id":"@alphamatica/hub-sdk-express","_rev":"2-08a3b6ce2c92b2218652e1024ffe10ce","name":"@alphamatica/hub-sdk-express","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@alphamatica/hub-sdk-express","version":"0.1.0","_id":"@alphamatica/hub-sdk-express@0.1.0","maintainers":[{"name":"simbik","email":"simbik@live.ru"}],"dist":{"shasum":"6a8adbaeec1f26174cb65b941d4f1c48a66d7da4","tarball":"https://registry.npmjs.org/@alphamatica/hub-sdk-express/-/hub-sdk-express-0.1.0.tgz","fileCount":17,"integrity":"sha512-jm0I2/yPZMXzEx/tN3PTKB50ZLjhVSzUmK12jkCOvYvTeT2MX6SWovfXt584ZDoJAiop5yHgp4cJ1O6y37t0Uw==","signatures":[{"sig":"MEYCIQDcAmzNfR+K7hDCVXOirqrGaPqBMLY8l2OUqgx7v0b7aAIhANMMEK9rzk11zdjlB9zbcR5IREoORequVL0EQKmkMeuc","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26242},"main":"dist/index.js","_from":"file:alphamatica-hub-sdk-express-0.1.0.tgz","types":"dist/index.d.ts","private":false,"scripts":{"lint":"eslint \"src/**/*.ts\"","build":"tsc -p tsconfig.json"},"_npmUser":{"name":"simbik","email":"simbik@live.ru"},"_resolved":"C:\\Users\\simbi\\AppData\\Local\\Temp\\d3f3b8781a78dc14a11eaf64349923b6\\alphamatica-hub-sdk-express-0.1.0.tgz","_integrity":"sha512-jm0I2/yPZMXzEx/tN3PTKB50ZLjhVSzUmK12jkCOvYvTeT2MX6SWovfXt584ZDoJAiop5yHgp4cJ1O6y37t0Uw==","_npmVersion":"8.19.3","description":"Express middleware and helpers for alpha-hub SDK","directories":{},"_nodeVersion":"24.15.0","dependencies":{"@alphamatica/hub-sdk-core":"0.1.0"},"_hasShrinkwrap":false,"devDependencies":{"express":"^4.21.2","typescript":"^5.6.3","@types/express":"^4.17.21","@alpha/eslint-config":"0.0.0","@alpha/typescript-config":"0.0.0"},"peerDependencies":{"express":"^4 || ^5"},"_npmOperationalInternal":{"tmp":"tmp/hub-sdk-express_0.1.0_1779711518956_0.8215557016835493","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@alphamatica/hub-sdk-express","version":"0.2.0","private":false,"description":"Express middleware for alpha-hub SDK trust-headers integration","main":"dist/index.js","types":"dist/index.d.ts","dependencies":{"@alphamatica/hub-sdk-core":"0.2.0"},"peerDependencies":{"express":"^4 || ^5"},"devDependencies":{"@types/express":"^4.17.21","express":"^4.21.2","typescript":"^5.6.3","@alpha/eslint-config":"0.0.0","@alpha/typescript-config":"0.0.0"},"scripts":{"build":"tsc -p tsconfig.json","lint":"eslint \"src/**/*.ts\""},"_id":"@alphamatica/hub-sdk-express@0.2.0","_integrity":"sha512-9HbLnsoiSlXxrbtYEO/RWshgnLwE2ga3LZ0YqmRF0fD2lAHFUBez1orMdCKEj16wAkgRf3pl2Y4Bq49eFPeykQ==","_resolved":"C:\\Users\\simbi\\AppData\\Local\\Temp\\190d3cd46f7166dac40827717780dd1f\\alphamatica-hub-sdk-express-0.2.0.tgz","_from":"file:alphamatica-hub-sdk-express-0.2.0.tgz","_nodeVersion":"24.15.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-9HbLnsoiSlXxrbtYEO/RWshgnLwE2ga3LZ0YqmRF0fD2lAHFUBez1orMdCKEj16wAkgRf3pl2Y4Bq49eFPeykQ==","shasum":"44a44fb4107113478d4b2477263b6db7412732f9","tarball":"https://registry.npmjs.org/@alphamatica/hub-sdk-express/-/hub-sdk-express-0.2.0.tgz","fileCount":20,"unpackedSize":31093,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQC0QY7sW2BN6RCymjIPoxnTlqzYKHL2p0P95RSX2iwvmQIgMMtIijWSkZUPjfJcPKm/HKBkZK2nscUSXDQaluHi2Q0="}]},"_npmUser":{"name":"simbik","email":"simbik@live.ru"},"directories":{},"maintainers":[{"name":"simbik","email":"simbik@live.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/hub-sdk-express_0.2.0_1779714418915_0.08803925639259313"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-25T12:18:38.833Z","modified":"2026-05-25T13:06:59.216Z","0.1.0":"2026-05-25T12:18:39.098Z","0.2.0":"2026-05-25T13:06:59.086Z"},"description":"Express middleware for alpha-hub SDK trust-headers integration","maintainers":[{"name":"simbik","email":"simbik@live.ru"}],"readme":"# @alphamatica/hub-sdk-express\n\nExpress middleware for alpha-hub trust-headers SDK.\n\nIn the alpha-hub architecture all browser→service traffic is proxied through\nalpha-hub core. The hub validates JWT, resolves permissions, audit-logs at\nedge, then forwards to your service with `X-Alpha-User-*` headers and a\nshared `X-Alpha-Proxy-Secret`. This middleware verifies the secret and parses\nthe headers into `req.alphaUser`.\n\nYour service needs only the shared proxy secret — no hub URL, no public key.\n\n## Install\n\n```bash\npnpm add @alphamatica/hub-sdk-express\n```\n\n## Quick wire-up\n\n```js\nconst express = require('express');\nconst { alphaTrust, requirePermission } = require('@alphamatica/hub-sdk-express');\n\nconst app = express();\napp.use(express.json());\n\n// Apply trust check on every route\napp.use(alphaTrust({ proxySecret: process.env.ALPHA_PROXY_SECRET }));\n\n// Protected route\napp.get('/reports',\n  requirePermission('agms.reports.read'),\n  (req, res) => {\n    const locationIds = req.alphaUser.scopes.location_id ?? null;\n    // null = unrestricted, else narrow by ids\n    res.json({ data: '...' });\n  },\n);\n```\n\n## Environment\n\n| Variable | Description |\n|---|---|\n| `ALPHA_PROXY_SECRET` | Shared secret with alpha-hub. |\n\n## Migrating from v0.1.x\n\nv0.1.x had `createAlphaAuthState` + `alphaAuth` middleware that validated JWTs\nlocally. v0.2.0 replaces both with `alphaTrust({ proxySecret })`. Sync helpers\n(`mountAlphaSync`, `mountAlphaSso`) are gone — hub proxy handles those flows.\n\n`requirePermission` keeps the same name and semantics.\n","readmeFilename":"README.md"}