UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

51 lines • 2.72 kB
import type { McpFormBinding } from "../../core/mcp-form-types.ts"; import type { PresenterAccountAuthority } from "./mcp-presenter-account.ts"; import { type SecretBinding } from "./secret-sealed.ts"; /** A host token the engine holds for one session, with the claims it decided on. */ export interface SecretHostToken { readonly token: string; readonly acc: string; /** The minting (host) device; a step-up token's `hdev` must equal it (6.5). */ readonly dev: string; readonly iat: number; readonly exp: number; } export declare class SecretHostTokens { private readonly hostInstance; private readonly authority; private readonly privateKey; private readonly spki; /** The host key as 0022 puts it on the wire: the raw 32 bytes, unpadded base64url (`hostPk`). */ readonly hostPk: string; /** Its RFC 7638 OKP thumbprint: the host token's `cnf.jkt` and `B`'s `hostJkt`. */ readonly hostJkt: string; private readonly entries; private readonly listeners; private disposed; /** `undefined` unless the authority can both mint host tokens and verify step-up tokens: then no key exists. */ static create(hostInstance: string, authority: PresenterAccountAuthority | undefined): SecretHostTokens | undefined; private constructor(); /** * A grant with `secret_input_v1` was acquired on `binding`. Mints the session's token unless a valid one is held; * `held` reports whether a current account-principal grant on the binding still negotiates the feature. */ want(durableSessionId: string, binding: McpFormBinding, held: () => boolean): void; /** The session's token while it is valid now and still names the signed-in account; read synchronously. */ current(durableSessionId: string): SecretHostToken | undefined; private valid; /** * The host key's signature over a request binding, as 128 lowercase hex characters (0022 3.5). It signs only a `B` * naming this host instance and this key, so the key signs nothing outside the request domain for another host. */ signRequest(binding: SecretBinding): string; /** Fires after every successful mint or re-mint, so pending sealed requests can carry the new token (3.2). */ onToken(listener: (durableSessionId: string, token: SecretHostToken) => void): () => void; dispose(): void; private mint; /** The claims the engine relies on, checked against what it asked for; anything else is not this session's token. */ private accept; /** Re-mints after `delayMs`, measured on the local clock so issuer clock skew cannot shorten it. */ private arm; private drop; } //# sourceMappingURL=secret-host-token.d.ts.map