@aventara/access 0.0.0-stage → 1.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +877 -0
- package/LICENSE +91 -0
- package/LICENSE-ADDITIONAL-PERMISSION.md +9 -0
- package/README.md +2536 -2
- package/dist/access/access-options.d.ts +74 -0
- package/dist/access/access-options.js +5 -0
- package/dist/access/access.error.d.ts +35 -0
- package/dist/access/access.error.js +11 -0
- package/dist/access/access.factory.d.ts +275 -0
- package/dist/access/access.factory.js +440 -0
- package/dist/access/better-auth.hardening.d.ts +120 -0
- package/dist/access/better-auth.hardening.js +420 -0
- package/dist/access/better-auth.loader.d.ts +67 -0
- package/dist/access/better-auth.loader.js +65 -0
- package/dist/access/better-auth.range.d.ts +9 -0
- package/dist/access/better-auth.range.js +28 -0
- package/dist/access/better-auth.require.d.ts +90 -0
- package/dist/access/better-auth.require.js +6 -0
- package/dist/access/better-auth.require.node.d.ts +7 -0
- package/dist/access/better-auth.require.node.js +52 -0
- package/dist/access/claims.mapper.d.ts +79 -0
- package/dist/access/claims.mapper.js +152 -0
- package/dist/access/key-set.cache.d.ts +10 -0
- package/dist/access/key-set.cache.js +63 -0
- package/dist/access/policies-block.checker.d.ts +64 -0
- package/dist/access/policies-block.checker.js +138 -0
- package/dist/access/principal.subject.d.ts +22 -0
- package/dist/access/principal.subject.js +89 -0
- package/dist/access/profile.policy.d.ts +74 -0
- package/dist/access/profile.policy.js +110 -0
- package/dist/access/request.state.d.ts +89 -0
- package/dist/access/request.state.js +266 -0
- package/dist/access/session.hooks.d.ts +114 -0
- package/dist/access/session.hooks.js +258 -0
- package/dist/access/token.verifier.d.ts +35 -0
- package/dist/access/token.verifier.js +69 -0
- package/dist/access-schema.d.ts +48 -0
- package/dist/access-schema.js +5 -0
- package/dist/access-warning.emitter.d.ts +4 -0
- package/dist/access-warning.emitter.js +24 -0
- package/dist/access.builder.d.ts +340 -0
- package/dist/access.builder.js +75 -0
- package/dist/access.engine.d.ts +155 -0
- package/dist/access.engine.js +477 -0
- package/dist/audit/audit-event.d.ts +135 -0
- package/dist/audit/audit-event.js +8 -0
- package/dist/audit/audit.log.d.ts +122 -0
- package/dist/audit/audit.log.js +345 -0
- package/dist/audit/audit.schema.d.ts +143 -0
- package/dist/audit/audit.schema.js +50 -0
- package/dist/auth/index.d.ts +12 -0
- package/dist/auth/index.js +2 -0
- package/dist/aventara-where.translator.d.ts +19 -0
- package/dist/aventara-where.translator.js +87 -0
- package/dist/beacon/beacon.check.d.ts +59 -0
- package/dist/beacon/beacon.check.js +128 -0
- package/dist/beacon/beacon.schema.d.ts +41 -0
- package/dist/beacon/beacon.schema.js +48 -0
- package/dist/beacon/beacon.store.d.ts +29 -0
- package/dist/beacon/beacon.store.js +78 -0
- package/dist/better-auth/access.client-plugin.d.ts +75 -0
- package/dist/better-auth/access.client-plugin.js +133 -0
- package/dist/better-auth/access.plugin.d.ts +164 -0
- package/dist/better-auth/access.plugin.js +348 -0
- package/dist/better-auth/access.provider.d.ts +80 -0
- package/dist/better-auth/access.provider.js +100 -0
- package/dist/better-auth/index.d.ts +7 -0
- package/dist/better-auth/index.js +4 -0
- package/dist/better-auth/organization.bridge.d.ts +66 -0
- package/dist/better-auth/organization.bridge.js +144 -0
- package/dist/canonical-json.writer.d.ts +12 -0
- package/dist/canonical-json.writer.js +30 -0
- package/dist/cli/avaccess.bin.d.ts +2 -0
- package/dist/cli/avaccess.bin.js +26 -0
- package/dist/cli/avaccess.program.d.ts +15 -0
- package/dist/cli/avaccess.program.js +166 -0
- package/dist/cli/beacon-pins.file.d.ts +14 -0
- package/dist/cli/beacon-pins.file.js +62 -0
- package/dist/cli/beacon.loader.d.ts +20 -0
- package/dist/cli/beacon.loader.js +71 -0
- package/dist/cli/cli.context.d.ts +49 -0
- package/dist/cli/cli.context.js +66 -0
- package/dist/cli/diff.command.d.ts +2 -0
- package/dist/cli/diff.command.js +66 -0
- package/dist/cli/generate.command.d.ts +2 -0
- package/dist/cli/generate.command.js +82 -0
- package/dist/cli/keys.command.d.ts +2 -0
- package/dist/cli/keys.command.js +96 -0
- package/dist/cli/lock.file.d.ts +31 -0
- package/dist/cli/lock.file.js +181 -0
- package/dist/cli/module.loader.d.ts +13 -0
- package/dist/cli/module.loader.js +63 -0
- package/dist/cli/policies.diff.d.ts +16 -0
- package/dist/cli/policies.diff.js +101 -0
- package/dist/cli/pull.command.d.ts +2 -0
- package/dist/cli/pull.command.js +234 -0
- package/dist/cli/push.command.d.ts +2 -0
- package/dist/cli/push.command.js +59 -0
- package/dist/cli/registry.client.d.ts +63 -0
- package/dist/cli/registry.client.js +287 -0
- package/dist/cli/schema.command.d.ts +2 -0
- package/dist/cli/schema.command.js +60 -0
- package/dist/cli/serve.command.d.ts +6 -0
- package/dist/cli/serve.command.js +200 -0
- package/dist/cli/status.command.d.ts +2 -0
- package/dist/cli/status.command.js +31 -0
- package/dist/cli/translator.flag.d.ts +6 -0
- package/dist/cli/translator.flag.js +24 -0
- package/dist/cli/verify.command.d.ts +2 -0
- package/dist/cli/verify.command.js +40 -0
- package/dist/client/access-client.factory.d.ts +92 -0
- package/dist/client/access-client.factory.js +269 -0
- package/dist/client/access-verbs.schema.d.ts +66 -0
- package/dist/client/access-verbs.schema.js +159 -0
- package/dist/client/verb-rate.limiter.d.ts +116 -0
- package/dist/client/verb-rate.limiter.js +358 -0
- package/dist/foreign/foreign-facts.d.ts +30 -0
- package/dist/foreign/foreign-facts.js +75 -0
- package/dist/foreign/foreign.merger.d.ts +10 -0
- package/dist/foreign/foreign.merger.js +52 -0
- package/dist/foreign-references.check.d.ts +6 -0
- package/dist/foreign-references.check.js +131 -0
- package/dist/generator/client.emitter.d.ts +28 -0
- package/dist/generator/client.emitter.js +411 -0
- package/dist/generator/copied-modules.reader.d.ts +14 -0
- package/dist/generator/copied-modules.reader.js +80 -0
- package/dist/generator/namespace.facts.d.ts +28 -0
- package/dist/generator/namespace.facts.js +32 -0
- package/dist/generator/orm.translator.d.ts +48 -0
- package/dist/generator/orm.translator.js +29 -0
- package/dist/generator/prisma7/prisma-schema.reader.d.ts +9 -0
- package/dist/generator/prisma7/prisma-schema.reader.js +394 -0
- package/dist/generator/prisma7/prisma-where.translator.d.ts +73 -0
- package/dist/generator/prisma7/prisma-where.translator.js +138 -0
- package/dist/generator/prisma7/prisma7.translator.d.ts +2 -0
- package/dist/generator/prisma7/prisma7.translator.js +87 -0
- package/dist/generator/schema.emitter.d.ts +14 -0
- package/dist/generator/schema.emitter.js +23 -0
- package/dist/generator/tsconfig.reader.d.ts +44 -0
- package/dist/generator/tsconfig.reader.js +110 -0
- package/dist/generator/typescript-literal.writer.d.ts +5 -0
- package/dist/generator/typescript-literal.writer.js +42 -0
- package/dist/guardrails/guardrails-contract.d.ts +45 -0
- package/dist/guardrails/guardrails-contract.js +12 -0
- package/dist/guardrails/guardrails.builder.d.ts +48 -0
- package/dist/guardrails/guardrails.builder.js +32 -0
- package/dist/guardrails/guardrails.compiler.d.ts +10 -0
- package/dist/guardrails/guardrails.compiler.js +254 -0
- package/dist/guardrails/guardrails.composer.d.ts +7 -0
- package/dist/guardrails/guardrails.composer.js +95 -0
- package/dist/guardrails/guardrails.hash.d.ts +10 -0
- package/dist/guardrails/guardrails.hash.js +38 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +6 -0
- package/dist/kiosk/kiosk-verbs.schema.d.ts +19 -0
- package/dist/kiosk/kiosk-verbs.schema.js +61 -0
- package/dist/kiosk/kiosk.plugin.d.ts +217 -0
- package/dist/kiosk/kiosk.plugin.js +877 -0
- package/dist/kiosk/kiosk.schema.d.ts +176 -0
- package/dist/kiosk/kiosk.schema.js +101 -0
- package/dist/kiosk/kiosk.store.d.ts +171 -0
- package/dist/kiosk/kiosk.store.js +478 -0
- package/dist/kiosk/lan-range.policy.d.ts +31 -0
- package/dist/kiosk/lan-range.policy.js +113 -0
- package/dist/kiosk/pin.policy.d.ts +9 -0
- package/dist/kiosk/pin.policy.js +143 -0
- package/dist/kiosk/session-use.marker.d.ts +4 -0
- package/dist/kiosk/session-use.marker.js +16 -0
- package/dist/lock/lock-contract.d.ts +38 -0
- package/dist/lock/lock-contract.js +67 -0
- package/dist/lock/lock.verifier.d.ts +27 -0
- package/dist/lock/lock.verifier.js +62 -0
- package/dist/mcp/agent-scope.gate.d.ts +13 -0
- package/dist/mcp/agent-scope.gate.js +75 -0
- package/dist/mcp/agent.grant.d.ts +40 -0
- package/dist/mcp/agent.grant.js +92 -0
- package/dist/mcp/mcp-options.d.ts +60 -0
- package/dist/mcp/mcp-options.js +72 -0
- package/dist/oauth/access-token.verifier.d.ts +66 -0
- package/dist/oauth/access-token.verifier.js +201 -0
- package/dist/oauth/oauth-provider.hardening.d.ts +62 -0
- package/dist/oauth/oauth-provider.hardening.js +261 -0
- package/dist/passwords/argon2id.hasher.d.ts +97 -0
- package/dist/passwords/argon2id.hasher.js +256 -0
- package/dist/passwords/node-rs-argon2.adapter.d.ts +25 -0
- package/dist/passwords/node-rs-argon2.adapter.js +42 -0
- package/dist/passwords/passwords.options.d.ts +79 -0
- package/dist/passwords/passwords.options.js +212 -0
- package/dist/policies-contract.d.ts +219 -0
- package/dist/policies-contract.js +8 -0
- package/dist/policies.compiler.d.ts +38 -0
- package/dist/policies.compiler.js +1433 -0
- package/dist/policies.decider.d.ts +103 -0
- package/dist/policies.decider.js +390 -0
- package/dist/policies.hash.d.ts +10 -0
- package/dist/policies.hash.js +54 -0
- package/dist/predicate.evaluator.d.ts +62 -0
- package/dist/predicate.evaluator.js +378 -0
- package/dist/random-secret.generator.d.ts +2 -0
- package/dist/random-secret.generator.js +15 -0
- package/dist/read-governed-unique.check.d.ts +3 -0
- package/dist/read-governed-unique.check.js +21 -0
- package/dist/reference-reads.check.d.ts +16 -0
- package/dist/reference-reads.check.js +158 -0
- package/dist/registry/access.registry.d.ts +173 -0
- package/dist/registry/access.registry.js +865 -0
- package/dist/registry/beacon.ledger.d.ts +30 -0
- package/dist/registry/beacon.ledger.js +93 -0
- package/dist/registry/ownership.check.d.ts +54 -0
- package/dist/registry/ownership.check.js +221 -0
- package/dist/registry/registry.endpoints.d.ts +50 -0
- package/dist/registry/registry.endpoints.js +193 -0
- package/dist/registry/registry.key.d.ts +7 -0
- package/dist/registry/registry.key.js +13 -0
- package/dist/registry/registry.options.d.ts +13 -0
- package/dist/registry/registry.options.js +28 -0
- package/dist/registry/registry.refusal.d.ts +6 -0
- package/dist/registry/registry.refusal.js +11 -0
- package/dist/registry/registry.schema.d.ts +238 -0
- package/dist/registry/registry.schema.js +127 -0
- package/dist/resources/auth-tables.catalog.d.ts +96 -0
- package/dist/resources/auth-tables.catalog.js +110 -0
- package/dist/resources/auth-tables.guard.d.ts +106 -0
- package/dist/resources/auth-tables.guard.js +462 -0
- package/dist/scope.resolver.d.ts +144 -0
- package/dist/scope.resolver.js +529 -0
- package/dist/sha256.digest.d.ts +2 -0
- package/dist/sha256.digest.js +81 -0
- package/dist/standalone/access.server.d.ts +41 -0
- package/dist/standalone/access.server.js +301 -0
- package/dist/standalone/index.d.ts +1 -0
- package/dist/standalone/index.js +1 -0
- package/package.json +102 -3
- package/skill/SKILL.md +170 -0
- package/skill/reference/callers.md +99 -0
- package/skill/reference/errors.md +89 -0
- package/skill/reference/recipes.md +281 -0
- package/skill/reference/rules.md +153 -0
- package/skill/reference/setup.md +334 -0
- package/src/aventara-where.translator.ts +116 -0
- package/src/beacon/beacon.check.ts +204 -0
- package/src/canonical-json.writer.ts +51 -0
- package/src/generator/prisma7/prisma-where.translator.ts +243 -0
- package/src/policies-contract.ts +215 -0
- package/src/policies.decider.ts +662 -0
- package/src/predicate.evaluator.ts +574 -0
- package/src/scope.resolver.ts +819 -0
- package/src/sha256.digest.ts +85 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import type { KioskSettings } from "../access/profile.policy.js";
|
|
2
|
+
import type { AuditLog } from "../audit/audit.log.js";
|
|
3
|
+
import { type PasswordHook } from "../passwords/argon2id.hasher.js";
|
|
4
|
+
import { type AccessKioskDevice, type KioskAdapter } from "./kiosk.store.js";
|
|
5
|
+
import { SESSION_USE } from "./session-use.marker.js";
|
|
6
|
+
export type { AccessKioskDevice };
|
|
7
|
+
/** A session row, as Better Auth's internal adapter answers it. */
|
|
8
|
+
type SessionRow = {
|
|
9
|
+
readonly token: string;
|
|
10
|
+
readonly userId: string;
|
|
11
|
+
readonly createdAt: Date | string;
|
|
12
|
+
readonly kioskDeviceId?: string | null;
|
|
13
|
+
readonly kioskSeenAt?: Date | string | null;
|
|
14
|
+
readonly kioskPin?: boolean | null;
|
|
15
|
+
};
|
|
16
|
+
type UserRow = {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly emailVerified?: boolean;
|
|
19
|
+
readonly [field: string]: unknown;
|
|
20
|
+
};
|
|
21
|
+
type CookieAttributes = {
|
|
22
|
+
readonly [attribute: string]: unknown;
|
|
23
|
+
};
|
|
24
|
+
/** What the kiosk reads of Better Auth's context. */
|
|
25
|
+
export type KioskAuthContext = {
|
|
26
|
+
readonly adapter: KioskAdapter;
|
|
27
|
+
readonly internalAdapter: {
|
|
28
|
+
findSession(token: string): Promise<{
|
|
29
|
+
readonly session: SessionRow;
|
|
30
|
+
readonly user: UserRow;
|
|
31
|
+
} | null>;
|
|
32
|
+
createSession(userId: string, dontRememberMe: boolean, override: {
|
|
33
|
+
readonly [field: string]: unknown;
|
|
34
|
+
}, overrideAll: boolean): Promise<SessionRow | null>;
|
|
35
|
+
deleteSession(token: string): Promise<unknown>;
|
|
36
|
+
deleteSessions(tokens: string[]): Promise<unknown>;
|
|
37
|
+
updateSession(token: string, data: {
|
|
38
|
+
readonly [field: string]: unknown;
|
|
39
|
+
}): Promise<unknown>;
|
|
40
|
+
findUserById(userId: string): Promise<UserRow | null>;
|
|
41
|
+
};
|
|
42
|
+
readonly secret: string;
|
|
43
|
+
readonly authCookies: {
|
|
44
|
+
readonly sessionToken: {
|
|
45
|
+
readonly name: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
createAuthCookie(name: string, overrides?: CookieAttributes): {
|
|
49
|
+
readonly name: string;
|
|
50
|
+
readonly attributes: CookieAttributes;
|
|
51
|
+
};
|
|
52
|
+
readonly sessionConfig: {
|
|
53
|
+
readonly freshAge: number;
|
|
54
|
+
};
|
|
55
|
+
readonly options: {
|
|
56
|
+
readonly emailAndPassword?: {
|
|
57
|
+
readonly requireEmailVerification?: unknown;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
readonly logger: {
|
|
61
|
+
error(message: string): void;
|
|
62
|
+
};
|
|
63
|
+
/** What the endpoint answered, for an after hook. */
|
|
64
|
+
readonly returned?: unknown;
|
|
65
|
+
/** The headers the answer goes out with, for an after hook. */
|
|
66
|
+
readonly responseHeaders?: Headers;
|
|
67
|
+
};
|
|
68
|
+
/** A kiosk endpoint's (or a hook's) context, as Better Auth hands it over. */
|
|
69
|
+
type KioskContext = {
|
|
70
|
+
readonly [SESSION_USE]?: unknown;
|
|
71
|
+
readonly method?: unknown;
|
|
72
|
+
readonly body?: unknown;
|
|
73
|
+
readonly headers?: Headers;
|
|
74
|
+
readonly request?: unknown;
|
|
75
|
+
readonly path?: unknown;
|
|
76
|
+
readonly context: KioskAuthContext;
|
|
77
|
+
json(value: unknown): unknown;
|
|
78
|
+
setCookie(name: string, value: string, attributes?: CookieAttributes): unknown;
|
|
79
|
+
/** A request header, from `headers`, or from `request` when the call passed no `headers`. */
|
|
80
|
+
getHeader(name: string): string | null;
|
|
81
|
+
getCookie(name: string): string | null;
|
|
82
|
+
getSignedCookie(name: string, secret: string): Promise<string | false | null>;
|
|
83
|
+
};
|
|
84
|
+
type KioskHandler = (context: KioskContext) => Promise<unknown>;
|
|
85
|
+
/** Better Auth's `createAuthEndpoint`, as the kiosk calls it. */
|
|
86
|
+
export type KioskEndpointFactory = (path: string, options: {
|
|
87
|
+
readonly method: "GET" | "POST";
|
|
88
|
+
}, handler: KioskHandler) => unknown;
|
|
89
|
+
/** Better Auth's `createAuthEndpoint.serverOnly`: an endpoint its router never serves. */
|
|
90
|
+
export type KioskServerOnlyFactory = (options: {
|
|
91
|
+
readonly method: "POST";
|
|
92
|
+
}, handler: KioskHandler) => unknown;
|
|
93
|
+
/** Better Auth's `APIError`, as the kiosk throws it. */
|
|
94
|
+
type Refusal = new (status: string, body?: {
|
|
95
|
+
readonly message?: string;
|
|
96
|
+
readonly code?: string;
|
|
97
|
+
}, headers?: {
|
|
98
|
+
readonly [name: string]: string;
|
|
99
|
+
}) => Error;
|
|
100
|
+
/** What the kiosk takes from Better Auth and from the rest of Access. */
|
|
101
|
+
export type KioskInput = {
|
|
102
|
+
readonly settings: KioskSettings;
|
|
103
|
+
readonly endpoint: KioskEndpointFactory;
|
|
104
|
+
readonly serverOnly: KioskServerOnlyFactory;
|
|
105
|
+
readonly middleware: (handler: KioskHandler) => unknown;
|
|
106
|
+
readonly refusal: Refusal;
|
|
107
|
+
readonly getSessionFromCtx: (context: KioskContext, config?: {
|
|
108
|
+
readonly disableCookieCache?: boolean;
|
|
109
|
+
}) => Promise<{
|
|
110
|
+
readonly session: SessionRow;
|
|
111
|
+
readonly user: UserRow;
|
|
112
|
+
} | null>;
|
|
113
|
+
/**
|
|
114
|
+
* Better Auth's `getOAuthState`: on a social sign-in's callback, the state it
|
|
115
|
+
* parsed, whose `serverContext` the OAuth provider fills with an authorization
|
|
116
|
+
* request to resume (`query`) when the sign-in began with one.
|
|
117
|
+
*/
|
|
118
|
+
readonly oauthState: () => Promise<{
|
|
119
|
+
readonly serverContext?: {
|
|
120
|
+
readonly [key: string]: unknown;
|
|
121
|
+
};
|
|
122
|
+
} | null>;
|
|
123
|
+
readonly cookies: {
|
|
124
|
+
setSessionCookie(context: KioskContext, session: {
|
|
125
|
+
readonly session: SessionRow;
|
|
126
|
+
readonly user: UserRow;
|
|
127
|
+
}, dontRememberMe: boolean): Promise<void>;
|
|
128
|
+
deleteSessionCookie(context: KioskContext): void;
|
|
129
|
+
};
|
|
130
|
+
/** The PIN hasher: argon2id, at the `passwords` profile. */
|
|
131
|
+
readonly pins: PasswordHook;
|
|
132
|
+
/** A user's claims, as their token would carry them: what `canEnrollDevice` is asked with. */
|
|
133
|
+
readonly claimsFor: (source: {
|
|
134
|
+
readonly user: UserRow;
|
|
135
|
+
readonly session: SessionRow;
|
|
136
|
+
}) => Promise<{
|
|
137
|
+
readonly [claim: string]: unknown;
|
|
138
|
+
}>;
|
|
139
|
+
readonly auditLog: AuditLog | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* Whether the app's base URL is https: the device's credential is then a
|
|
142
|
+
* `__Host-` cookie, `Secure`, on the host alone, whatever Better Auth's cookie
|
|
143
|
+
* options say.
|
|
144
|
+
*/
|
|
145
|
+
readonly secureDevice: boolean;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* `access.kiosk`: the operator's API on the kiosk profile, for the app's own server
|
|
149
|
+
* (no route opens it). A manager's browser reaches the same through the
|
|
150
|
+
* `listDevices` and `revokeDevice` verbs.
|
|
151
|
+
*/
|
|
152
|
+
export type AccessKiosk = {
|
|
153
|
+
/** Every enrolled device, oldest first: its id, name, who enrolled it and when, and its last PIN switch. Never a credential. */
|
|
154
|
+
listDevices(): Promise<readonly AccessKioskDevice[]>;
|
|
155
|
+
/** Revokes a device, ending every session on it; `false` when there is no such device. */
|
|
156
|
+
revokeDevice(deviceId: string): Promise<boolean>;
|
|
157
|
+
};
|
|
158
|
+
/** The kiosk's members of the Access plugin: its routes, its hooks and its operator API. */
|
|
159
|
+
export declare const kioskPlugin: (input: KioskInput) => {
|
|
160
|
+
endpoints: {
|
|
161
|
+
kioskSwitchUser: unknown;
|
|
162
|
+
kioskLock: unknown;
|
|
163
|
+
kioskSetPin: unknown;
|
|
164
|
+
kioskSetUserPin: unknown;
|
|
165
|
+
kioskEnrollDevice: unknown;
|
|
166
|
+
kioskRevokeDevice: unknown;
|
|
167
|
+
kioskListDevices: unknown;
|
|
168
|
+
};
|
|
169
|
+
hooks: {
|
|
170
|
+
before: ({
|
|
171
|
+
matcher: (context: {
|
|
172
|
+
readonly headers?: unknown;
|
|
173
|
+
readonly request?: unknown;
|
|
174
|
+
} | undefined) => boolean;
|
|
175
|
+
handler: unknown;
|
|
176
|
+
} | {
|
|
177
|
+
matcher: (context: {
|
|
178
|
+
readonly body?: unknown;
|
|
179
|
+
} | undefined) => boolean;
|
|
180
|
+
handler: unknown;
|
|
181
|
+
})[];
|
|
182
|
+
after: {
|
|
183
|
+
matcher: (context: {
|
|
184
|
+
readonly path?: unknown;
|
|
185
|
+
} | undefined) => boolean;
|
|
186
|
+
handler: unknown;
|
|
187
|
+
}[];
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* Before a session is created: one opened on an enrolled device (the request
|
|
191
|
+
* brings its current credential) is bound to it, whatever signed in, unless the
|
|
192
|
+
* sign-in carries an authorization request the OAuth provider would resume for
|
|
193
|
+
* it (refused: a bound session gets no grant). The credential its last rotation
|
|
194
|
+
* retired, inside the grace, is refused as every kiosk route refuses it (`409
|
|
195
|
+
* KIOSK_DEVICE_BUSY`); any other retired credential brought back revokes the
|
|
196
|
+
* device. Either way no session is created.
|
|
197
|
+
*/
|
|
198
|
+
sessionCreating: (session: {
|
|
199
|
+
readonly kioskDeviceId?: unknown;
|
|
200
|
+
} | null | undefined, context: unknown) => Promise<false | {
|
|
201
|
+
readonly data: object;
|
|
202
|
+
} | undefined>;
|
|
203
|
+
/**
|
|
204
|
+
* A session opened with full credentials (any sign-in but a PIN, and never an
|
|
205
|
+
* admin's impersonation, which proves nothing of the user) clears its user's
|
|
206
|
+
* failed PINs on every device.
|
|
207
|
+
*/
|
|
208
|
+
sessionCreated: (session: {
|
|
209
|
+
readonly userId?: unknown;
|
|
210
|
+
readonly impersonatedBy?: unknown;
|
|
211
|
+
} | null | undefined, context: {
|
|
212
|
+
readonly path?: unknown;
|
|
213
|
+
readonly context?: unknown;
|
|
214
|
+
} | null | undefined) => Promise<void>;
|
|
215
|
+
/** `access.kiosk`, over Better Auth's context once it is built. */
|
|
216
|
+
operator: (context: () => Promise<KioskAuthContext>) => AccessKiosk;
|
|
217
|
+
};
|