@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
41 lines • 2.4 kB
TypeScript
import { type StatementFields, type VerifierKeyPin } from "./signed-statement.ts";
/** A whole key, or (with `from` and `to`) only the statements it signed with `readAt` in `[from, to]`. */
export interface VerifierRevocation {
readonly keyId: string;
readonly from?: number;
readonly to?: number;
}
export type VerifierRevocationsRead = {
readonly state: "ok";
readonly revocations: readonly VerifierRevocation[];
} | {
readonly state: "unknown";
};
export interface RevocationFreshness {
readonly issuedAt: number;
readonly fetchedMono: number;
}
export declare const REVOCATION_MAX_AGE_MS: number;
export declare function verifierRevocationsPath(agentDir?: string): string;
export declare function parseRevocationsStatement(fields: StatementFields, nonce: string): {
readonly issuedAt: number;
readonly revocations: readonly VerifierRevocation[];
} | undefined;
export declare function isKeyRevoked(revocations: readonly VerifierRevocation[], keyId: string): boolean;
export declare function isVouchRevoked(revocations: readonly VerifierRevocation[], verifierKeyId: string, vouchedAt: number): boolean;
/**
* The entries of a statement signed by `signer` that this device accepts. A whole-key revocation needs a signer
* of a strictly higher pinned generation, a window revocation the same or a higher one; the signer must not be
* revoked itself. A key this release does not pin is never revoked here, so a stored revocation cannot block a
* generation a later release pins.
*/
export declare function acceptedRevocations(entries: readonly VerifierRevocation[], signer: VerifierKeyPin, pins: readonly VerifierKeyPin[], held: readonly VerifierRevocation[]): VerifierRevocation[];
/**
* Whether a record vouched at `vouchedAt` may authorize a NEW wrap: this process holds a verified statement issued
* at or after `vouchedAt` (both times verifier-signed, one clock) and fetched at most 6 h ago on the monotonic
* clock. No fetch, no new wrap.
*/
export declare function newWrapAllowed(vouchedAt: number, freshness: RevocationFreshness | undefined, nowMono: number): boolean;
export declare function readVerifierRevocations(path: string): Promise<VerifierRevocationsRead>;
export declare function recordVerifierRevocations(path: string, accepted: readonly VerifierRevocation[]): Promise<boolean>;
//# sourceMappingURL=verifier-revocations.d.ts.map