ResolverConfig.auth
property · packages/auth/src/server.ts:94
readonly auth: Context.Key<I, SessionVerifier<S>>The Auth.make(…) service, which the host's layer provides.
Auth / foldkit-auth/server
interface · packages/auth/src/server.ts:92
interface ResolverConfig<I, S extends VerifiedSession, User, R> {
readonly auth: Context.Key<I, SessionVerifier<S>>
readonly http: HttpOptions
readonly principal: (
session: S,
) => Effect.Effect<User, RemoteUnauthenticated, R>
readonly requests?: 'scripted' | 'browser' | 'navigation' | undefined
readonly key?: ((user: User) => string) | undefined
}What AuthServer.resolver takes.
ResolverConfig.authproperty · packages/auth/src/server.ts:94
readonly auth: Context.Key<I, SessionVerifier<S>>The Auth.make(…) service, which the host's layer provides.
ResolverConfig.httpproperty · packages/auth/src/server.ts:96
readonly http: HttpOptionsThe options given Http.make: the cookie's name, trusted origins and CSRF header.
ResolverConfig.principalproperty · packages/auth/src/server.ts:98
readonly principal: (
session: S,
) => Effect.Effect<User, RemoteUnauthenticated, R>The application's principal for a verified session; it may refuse it.
ResolverConfig.requestsproperty · packages/auth/src/server.ts:113
readonly requests?: 'scripted' | 'browser' | 'navigation' | undefinedWho makes the requests this resolves. 'scripted' (the default): the
page's own fetch, which sends Yielded's CSRF header beside a trusted
Origin. 'browser': what a browser sends on the page's behalf, a
WebSocket upgrade or a posted form, which carries no header of the
page's; its Origin, which every browser sends on one, vouches alone.
'navigation': a page the browser navigates to, for a render's reader
that cannot write (pageReader): the cookie of a GET or HEAD is used
with no Origin or header asked, as any server-rendered page reads its
reader's session, since a link from anywhere opens one. It is refused on
any other method, on a protocol upgrade (a WebSocket's), and on a request
the browser marks as no navigation (a script's fetch), so a resolver
made for page reads cannot vouch for a socket or a request that writes.
ResolverConfig.keyproperty · packages/auth/src/server.ts:119
readonly key?: ((user: User) => string) | undefinedWho the principal is, for the x-foldkit-subject check: the client
says who it believes it is by this, as foldkit-guard's Me shows it
(key: Policy.key). Without it, the session's subjectId.