UNPKG

@code-yeongyu/senpi

Version:

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

43 lines • 1.92 kB
import type { KeyObject } from "node:crypto"; import type { AccountPrincipal, PresenterAccountAuthority } from "./mcp-presenter-account.ts"; import type { SealedAnswer } from "./secret-input-requests.ts"; import type { SecretHostToken } from "./secret-host-token.ts"; export interface SealedAnswerFrame { readonly id: string; readonly grantId: string; readonly uiRequestId: string; readonly answerId: string; readonly sig: Buffer; readonly value?: { readonly stepup: string; readonly enc: Buffer; readonly ct: Buffer; }; } /** Step 1: the exact key set, `v === 1` and every bound; `undefined` is `invalid_secret_response`. */ export declare function parseSealedAnswer(value: unknown): SealedAnswerFrame | undefined; export interface SealedAnswerContext { readonly frame: SealedAnswerFrame; readonly principal: AccountPrincipal; readonly req: string; readonly deadlineAtMs: number; readonly hostToken: SecretHostToken | undefined; readonly account: PresenterAccountAuthority; } export type CheckedSealedAnswer = { readonly ok: true; readonly jti?: string; readonly exp?: number; } | { readonly ok: false; readonly error: "invalid_secret_response" | "secret_stepup_refused"; }; /** * Step 4: the envelope signature under the principal's installation key, verified strictly (decision 0022 SP-0 L4). * Step 5 for a value: `verifySecretAnswer` and the 6.5 host checks. The signed transcript names the token's `jti`, * which must equal the verified one. */ export declare function checkSealedAnswer(context: SealedAnswerContext): Promise<CheckedSealedAnswer>; /** Step 6's open, run at the latch with the request key: HPKE open, then the canonical unpad. */ export declare function openSealedValue(answer: SealedAnswer, key: KeyObject, hpkePk: string): string | undefined; //# sourceMappingURL=secret-sealed-answers.d.ts.map