import * as Action from "@gjermundgaraba/effect-actions/Action"; import { Context, Schema } from "effect"; import type { Principal as Verified } from "./verify.ts"; /** * Who calls, as `CurrentPrincipal` carries it: a verified credential's principal, the * `Verifier`'s, or on a trusted local surface the process itself, `actor: { kind: "local" }`, * which no verifier produces, with no `expiresAt`. Declared here, so a package declaring a * descriptor of `CurrentPrincipal` from this entry alone names it in its emitted declarations. */ export interface Caller extends Omit { readonly actor: Verified["actor"] /** The process itself, on a trusted local surface: no credential was verified. */ | { readonly kind: "local"; }; } declare const CurrentPrincipal_base: Context.ServiceClass; /** * The caller: what a protected contract states, `caller: CurrentPrincipal`, and what an * authentication descriptor proves, * `Authentication.make("notes.Login", CurrentPrincipal, { error: ProviderUnavailable })`. * Remotely, the resource's provider gives it per request, from the verified credential; on * a trusted local surface, the host gives it the process, `Notes.local(subject)`. */ export declare class CurrentPrincipal extends CurrentPrincipal_base { } /** The verified credential behind a request, as the resource server read it. */ export declare const Principal: Schema.Struct<{ readonly subject: Schema.NonEmptyString; readonly issuer: Schema.NonEmptyString; readonly scopes: Schema.$Array; }>; export type Principal = typeof Principal.Type; /** * The credential is a transport concern: a process surface has none, so bind `Whoami` to * HTTP alone, `ActionHttp.layer(Http, [app, Notes.session])`, and leave `Notes.session` out * of MCP. */ export declare const Whoami: Action.Action<"whoami", Schema.$Record, Schema.Struct<{ readonly subject: Schema.NonEmptyString; readonly issuer: Schema.NonEmptyString; readonly scopes: Schema.$Array; }>, readonly never[], true, typeof CurrentPrincipal, undefined, undefined>; /** The query parameter naming where the issuer sends the owner after signing in or out. */ export declare const returnToParameter = "rd"; /** Where the issuer signs the owner out and clears the forward cookie. */ export declare const signOutPath = "/forward-auth/logout"; /** * Sign out at the issuer, which ends its session and every app's forward cookie, then * return to `returnTo`. It is a plain link: any page under the cookie domain may use it. */ export declare const signOutUrl: (issuer: string, returnTo: string) => string; export {};