@quantumauth/node
v0.4.0
Published
QuantumAuth backend/middleware SDK
Downloads
239
Readme
@quantumauth/node
QuantumAuth Node SDK — server-side authentication middleware.
🚀 Install
pnpm add @quantumauth/nodeDevelopment
is QA_ENV is not set in your environment it will default to prod.
options are:
QA_ENV=local // for local development
QA_ENV=develop // for develop environment (Official QA develop)🧩 Usage (Express)
imports
import {
createExpressQuantumAuthMiddleware,
QUANTUMAUTH_ALLOWED_HEADERS,
QuantumAuthRequest
} from "@quantumauth/node";Use middleware
app.post("/qa/demo", qaMiddleware, (req: QuantumAuthRequest, res : Response) => {
res.json({
userId: req.userId, // middleware inject the authenticated user id in the request
body: req.body,
});
});
🔐 CORS Allowed Headers
The headers required to authenticate user with QA proof (TPM signatures)
app.use(cors({
origin: ["http://localhost:3000"], // address of the front end
methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"],
allowedHeaders: [
...QUANTUMAUTH_ALLOWED_HEADERS
],
credentials: true,
}));📘 Docs
📝 License
Apache 2.0.
