@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
47 lines • 2.17 kB
TypeScript
import { type VerifierKeyPin } from "./signed-statement.ts";
import { type RevocationFreshness } from "./verifier-revocations.ts";
export interface KmsKeyFacts {
readonly spki: string;
readonly origin: "AWS_KMS" | "EXTERNAL" | "AWS_CLOUDHSM" | "EXTERNAL_KEY_STORE";
readonly keySpec: string;
readonly keyUsage: "KEY_AGREEMENT" | "SIGN_VERIFY" | "ENCRYPT_DECRYPT";
readonly keyManager: "CUSTOMER" | "AWS";
readonly keyState: string;
readonly multiRegion: boolean;
readonly tags: Readonly<Record<string, string>>;
/** JSON of GetKeyPolicy; the check re-canonicalizes it before comparing. */
readonly policy: string;
readonly grantCount: number;
/** When the verifier read these facts upstream (ms since epoch); the record's `vouchedAt`. */
readonly readAt: number;
/** The pinned verifier key that signed these facts; the record's `verifierKeyId`. */
readonly verifierKeyId: string;
}
/**
* A verified statement whose `readAt` is outside the age bounds on this device's clock. Kept apart from `"unknown"`
* so the check can tell the user to look at the clock; `skewMs` is `now - readAt` (negative: facts from the future).
*/
export interface KeyFactsStale {
readonly refusal: "facts-stale";
readonly skewMs: number;
}
export type KeyFactsAnswer = KmsKeyFacts | KeyFactsStale | "unknown";
export interface KmsKeyReader {
describe(keyArn: string): Promise<KeyFactsAnswer>;
}
export interface AnchoredKeyFactsReader extends KmsKeyReader {
refreshRevocations(): Promise<boolean>;
revocationFreshness(): RevocationFreshness | undefined;
}
export interface AnchoredKeyFactsReaderOptions {
readonly endpoint: string | undefined;
readonly verifierKeys: readonly VerifierKeyPin[];
readonly revocationsPath: string;
readonly now?: () => number;
readonly monoNow?: () => number;
readonly fetch?: typeof fetch;
}
export declare const MAX_FACTS_AGE_MS = 120000;
export declare const MAX_FACTS_FUTURE_SKEW_MS = 30000;
export declare function anchoredKeyFactsReader(options: AnchoredKeyFactsReaderOptions): AnchoredKeyFactsReader;
//# sourceMappingURL=key-facts-client.d.ts.map