logical.RECOVERY_DAYSconstno test imports itconst RECOVERY_DAYS: 183The days after which the recovery key is to be proved again.
Custody of the keys that sign a fleet's changes: what is known of this machine's keys and Git (facts), the checks made from them with a stable code and the one fix each, whether the recovery key was proved lately, and the text of the file that lists the signers. Nothing here reads a key or runs a program: the facts are given, and a passphrase is never seen (it is typed into OpenSSH and Git only).
import { recoveryOverdue } from "./keys.ts";
recoveryOverdue("2026-01-01", "2026-12-01"); // truelogical.RECOVERY_DAYSconstno test imports itconst RECOVERY_DAYS: 183The days after which the recovery key is to be proved again.
logical.checkKeysfunctionno test imports itfunction checkKeys(f: Facts, now: string): readonly Finding[]Every check, in order, each with its code and its one fix. Signing works where the first six hold (OpenSSH, the daily key and its passphrase, Git signing with it, the identity, the daily key listed).
logical.opensshSignsconstno test imports itconst opensshSigns: (version: string | undefined) => booleanWhether a version of OpenSSH can sign for Git (8.2 and after).
logical.opensshVersionfunctionno test imports itfunction opensshVersion(text: string): string | undefinedThe version of OpenSSH from the first line ssh -V prints (OpenSSH_9.6p1 ...), or nothing.
logical.recoveryOverduefunctionno test imports itfunction recoveryOverdue(checkedAt: string | undefined, now: string, days?: number): booleanWhether the recovery key was never proved or was proved more than days days before now (both days, YYYY-MM-DD, or instants).
logical.renderSignersfunctionno test imports itfunction renderSigners(signers: readonly Signer[], header?: string): stringThe text of the file that lists a fleet's signers, as a tenant keeps it (signers.ts): a header, and the signers by name, role and public key.
logical.replaceKeyfunctionno test imports itfunction replaceKey(signers: readonly Signer[], name: string, key: string, day: string): readonly Signer[] | undefinedThe signers with the key of one replaced: the old key stays in the list, named <name>-retired-<day> and retired on the day (its signatures count for changes dated up to then, so that what it signed still verifies), and the new key has the name and the role; nothing where there is no such signer.
logical.sameKeyconstno test imports itconst sameKey: (a: string, b: string) => booleanThe two key lines are the same key (the type and the key, not the comment).
logical.signingWorksfunctionno test imports itfunction signingWorks(findings: readonly Finding[]): booleanWhether signing works: the checks that stop a commit being made and accepted all hold.
logical.withSignerfunctionno test imports itfunction withSigner(signers: readonly Signer[], signer: Signer): string | readonly Signer[]The signers with one added, or the same where the key is already listed; a name is used once.
logical.Factstypeno test imports ittype Facts = {
/** The version of OpenSSH, like `9.6`, or nothing where it is not there. */
readonly openssh: string… (740 characters)type Facts = {
/** The version of OpenSSH, like `9.6`, or nothing where it is not there. */
readonly openssh: string | undefined;
readonly daily: { readonly exists: boolean; readonly hasPassphrase: boolean; readonly inAgent: boolean };
readonly git: { readonly signs: boolean; readonly formatSsh: boolean; readonly signingKeyIsDaily: boolean; readonly identity: boolean };
readonly signers: { readonly dailyListed: boolean; readonly recoveryListed: boolean };
/** The recovery key: its private file is on this machine (it should not be), and the day it was last proved (a day, `YYYY-MM-DD`). */
readonly recovery: { readonly privateHere: boolean; readonly checkedAt: string | undefined };
readonly hookInstalled: boolean;
};What is known of the machine: OpenSSH, the daily key, Git's settings for the repository, the signers and the recovery key.
logical.Findingtypeno test imports ittype Finding = { readonly code: string; readonly ok: boolean; readonly says: string; readonly fix: string };One check: whether it holds, its code, what is wrong, and the one thing to do.
RECOVERY_DAYSconstno test imports itconst RECOVERY_DAYS: 183The days after which the recovery key is to be proved again.
checkKeysfunctionfunction checkKeys(f: Facts, now: string): readonly Finding[]Every check, in order, each with its code and its one fix. Signing works where the first six hold (OpenSSH, the daily key and its passphrase, Git signing with it, the identity, the daily key listed).
opensshSignsconstconst opensshSigns: (version: string | undefined) => booleanWhether a version of OpenSSH can sign for Git (8.2 and after).
opensshVersionfunctionfunction opensshVersion(text: string): string | undefinedThe version of OpenSSH from the first line ssh -V prints (OpenSSH_9.6p1 ...), or nothing.
recoveryOverduefunctionfunction recoveryOverdue(checkedAt: string | undefined, now: string, days?: number): booleanWhether the recovery key was never proved or was proved more than days days before now (both days, YYYY-MM-DD, or instants).
renderSignersfunctionfunction renderSigners(signers: readonly Signer[], header?: string): stringThe text of the file that lists a fleet's signers, as a tenant keeps it (signers.ts): a header, and the signers by name, role and public key.
replaceKeyfunctionfunction replaceKey(signers: readonly Signer[], name: string, key: string, day: string): readonly Signer[] | undefinedThe signers with the key of one replaced: the old key stays in the list, named <name>-retired-<day> and retired on the day (its signatures count for changes dated up to then, so that what it signed still verifies), and the new key has the name and the role; nothing where there is no such signer.
sameKeyconstno test imports itconst sameKey: (a: string, b: string) => booleanThe two key lines are the same key (the type and the key, not the comment).
signingWorksfunctionfunction signingWorks(findings: readonly Finding[]): booleanWhether signing works: the checks that stop a commit being made and accepted all hold.
withSignerfunctionfunction withSigner(signers: readonly Signer[], signer: Signer): string | readonly Signer[]The signers with one added, or the same where the key is already listed; a name is used once.
Factstypetype Facts = {
/** The version of OpenSSH, like `9.6`, or nothing where it is not there. */
readonly openssh: string… (740 characters)type Facts = {
/** The version of OpenSSH, like `9.6`, or nothing where it is not there. */
readonly openssh: string | undefined;
readonly daily: { readonly exists: boolean; readonly hasPassphrase: boolean; readonly inAgent: boolean };
readonly git: { readonly signs: boolean; readonly formatSsh: boolean; readonly signingKeyIsDaily: boolean; readonly identity: boolean };
readonly signers: { readonly dailyListed: boolean; readonly recoveryListed: boolean };
/** The recovery key: its private file is on this machine (it should not be), and the day it was last proved (a day, `YYYY-MM-DD`). */
readonly recovery: { readonly privateHere: boolean; readonly checkedAt: string | undefined };
readonly hookInstalled: boolean;
};What is known of the machine: OpenSSH, the daily key, Git's settings for the repository, the signers and the recovery key.
Findingtypeno test imports ittype Finding = { readonly code: string; readonly ok: boolean; readonly says: string; readonly fix: string };One check: whether it holds, its code, what is wrong, and the one thing to do.