import { type RosterView, type ServiceKeyEntry, type ServiceKeyKind } from "./roster-entries.ts";
import { type VerifierRevocation } from "./verifier-revocations.ts";
export interface LocalKeyVerification {
    readonly kind: ServiceKeyKind;
    readonly accountId: string;
    readonly generation: number;
    readonly sigKeyId: string;
    readonly sigPkSha256: string;
    readonly kemKeyId?: string;
    readonly kemPkSha256?: string;
    readonly kmsKeyArns: readonly string[];
    readonly templateVersion: number;
    /** The key-facts verifier key that vouched for the checked facts, and the signed `readAt` of those facts (15.10). */
    readonly verifierKeyId: string;
    readonly vouchedAt: number;
    /** The `sigKeyId` this checked entry revokes; persisted so a roster rollback cannot un-revoke it. */
    readonly supersedes?: string;
    readonly checkedAt: number;
}
/** Who vouched for the facts a key check used. */
export interface KeyFactsVouch {
    readonly verifierKeyId: string;
    readonly vouchedAt: number;
}
export type VerifiedKeysRead = {
    readonly state: "ok";
    readonly records: readonly LocalKeyVerification[];
} | {
    readonly state: "unknown";
};
export type ServiceEntryValidity = "valid" | "pending" | "invalid" | "unknown" | "superseded";
/** The clocks and the accepted verifier revocations a validity answer is computed under. */
export interface ValidityContext {
    readonly revocations: readonly VerifierRevocation[];
    readonly now: number;
    readonly nowMono: number;
}
export declare function verifiedKeysPath(agentDir?: string): string;
export declare function readVerifiedKeys(path: string): Promise<VerifiedKeysRead>;
/**
 * The record this device stores after `checkServiceKey` returned `ok` for `entry`. `undefined` when the
 * entry belongs to another account or its self-signature does not verify: such an entry can never be recorded.
 */
export declare function verificationFor(entry: ServiceKeyEntry, accountId: string, checkedAt: number, vouch: KeyFactsVouch): Promise<LocalKeyVerification | undefined>;
export declare function findVerification(records: readonly LocalKeyVerification[], entry: ServiceKeyEntry): Promise<LocalKeyVerification | undefined>;
/**
 * Validity of a service entry FOR THIS DEVICE in `accountId`. Only this device's own records count; other
 * devices' attestations and revocations never do. Two validly signed entries for one (kind, account,
 * generation) that differ in key, or share the key but disagree on `supersedes`, make the entry `unknown`. Supersession comes from this device's records only
 * (a checked entry of the same kind and account, strictly higher generation, naming this `sigKeyId`), so it
 * cannot be undone by an entry disappearing from a later roster. The roster view must be fresh (15.15 H-1), and a
 * record vouched by a revoked verifier key (15.10) never makes an entry `valid`; it still supersedes, because a
 * revocation only ever removes trust.
 */
export declare function serviceEntryValidity(entry: ServiceKeyEntry, accountId: string, records: readonly LocalKeyVerification[], roster: RosterView, context: ValidityContext): Promise<ServiceEntryValidity>;
export declare function recordVerification(path: string, record: LocalKeyVerification): Promise<void>;
//# sourceMappingURL=verified-keys.d.ts.map