@trustforge-protocol/lucia
v0.1.5
Published
TrustForge authentication and policy enforcement adapter for Lucia. Seamlessly integrate zero-trust verifiable actions into your Lucia application.
Maintainers
Readme
@trustforge-protocol/lucia
Lucia v3 session-validation hook that projects every validated session into a TrustForge actor + capabilities.
Status
Draft. Part of TrustForge Phase D. Not production ready.
Install
bun add @trustforge-protocol/lucia @trustforge-protocol/sdk luciaUsage
import { Lucia } from "lucia";
import { trustforgeForLucia } from "@trustforge-protocol/lucia";
const lucia = new Lucia(adapter, {
/* ... */
});
export const tfLucia = trustforgeForLucia(lucia, {
daemonUrl: "http://127.0.0.1:7616",
});
// In your route handler:
const result = await tfLucia.validateSession(sessionId);
if (result.tfActor) {
// result.tfActor / result.tfCapabilities / result.tfTrustLevel are populated
}Per-route enforcement
const requireRead = tfLucia.tfRequire("fs.read", "/etc/passwd");
const verdict = await requireRead(result);
if (!verdict.allowed) throw new Error(verdict.reason);