IF Commons GitHub

physical/keys

Written to: 3 requirements: 3 proved, 0 partly, 0 failing, 0 with no test recorded. 0004-change-control-keys FR-004, 0004-change-control-keys FR-005, 0004-change-control-keys FR-006

The keys on this machine and what is done with them: the facts read (OpenSSH, the daily key, Git's settings for the repository, the agent, the hook), a key made by OpenSSH itself (so that the passphrase is typed into OpenSSH and nowhere else), Git set to sign with it for the repository alone, a test signature proved against the signers, the pre-push hook. A key is never overwritten, nothing is loaded into an agent, and no passphrase is seen, stored or passed: ssh-keygen and git ask for it on the terminal (or through the program named in SSH_ASKPASS).

import { readFacts } from "./keys.ts";
// const facts = await readFacts({ repo, keyFile, signersText, recoveryCheckedAt });

Source: commons/change-control/src/physical/keys.ts

7 of 16 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

physical.HOOK_MARKERconstno test imports it
const HOOK_MARKER: "# change-control pre-push hook"

The marker of the hook this library installs.

physical.commitSignedfunctionno test imports it
function commitSigned(repo: string, keyFile: string, message: string, options?: { readonly allowEmpty?: boolean | undefined; readonly paths?: readonly string[] | undefined; }): Promise<Result<string, string>>

A commit made as the key signs it (an empty one where asked), the passphrase typed on the terminal.

physical.configureGitfunctionno test imports it
function configureGit(repo: string, keyFile: string): Promise<Result<true, string>>

Git set to sign every commit of this repository with the key, for this repository alone.

physical.installHookfunctionno test imports it
function installHook(repo: string, command: string): Promise<Result<"already" | "installed", string>>

The pre-push hook: it runs the command with what Git hands it, and is never put over a hook that is not ours.

physical.makeKeyfunctionno test imports it
function makeKey(file: string, comment: string): Promise<Result<string, string>>

A key pair made by OpenSSH (ed25519), the passphrase typed into OpenSSH on the terminal: refused where the file is there (a key is never overwritten). The public key line is given back.

physical.readFactsfunctionno test imports it
function readFacts(i: FactsInput): Promise<Facts>

The facts of this machine, read with no change and no passphrase asked.

physical.testSignfunctionno test imports it
function testSign(keyFile: string, expectedPub: string, principal: string): Promise<Result<true, string>>

A test signature with a key, checked against the public key it should be listed as (OpenSSH asks for the passphrase): proves the key and its passphrase.

physical.FactsInputtypeno test imports it
type FactsInput = { readonly repo: string; /** The daily key's private file (its public file is beside it, `.pub`). … (503 characters)
type FactsInput = {
  readonly repo: string;
  /** The daily key's private file (its public file is beside it, `.pub`). */
  readonly keyFile: string;
  /** The text of the file that lists the signers, and the public keys of the daily and the recovery signers by name where they are listed. */
  readonly dailyPub: string | undefined;
  readonly recoveryListed: boolean;
  readonly recoveryKeyFile: string | undefined;
  readonly recoveryCheckedAt: string | undefined;
  readonly signersText: string;
};

What is read to know the facts.

HOOK_MARKERconst
const HOOK_MARKER: "# change-control pre-push hook"

The marker of the hook this library installs.

Imported by 3 tests of the run (3 passed, 0 failed): the library's results

commitSignedfunction
function commitSigned(repo: string, keyFile: string, message: string, options?: { readonly allowEmpty?: boolean | undefined; readonly paths?: readonly string[] | undefined; }): Promise<Result<string, string>>

A commit made as the key signs it (an empty one where asked), the passphrase typed on the terminal.

Imported by 3 tests of the run (3 passed, 0 failed): the library's results

configureGitfunction
function configureGit(repo: string, keyFile: string): Promise<Result<true, string>>

Git set to sign every commit of this repository with the key, for this repository alone.

Imported by 3 tests of the run (3 passed, 0 failed): the library's results

installHookfunction
function installHook(repo: string, command: string): Promise<Result<"already" | "installed", string>>

The pre-push hook: it runs the command with what Git hands it, and is never put over a hook that is not ours.

Imported by 3 tests of the run (3 passed, 0 failed): the library's results

makeKeyfunction
function makeKey(file: string, comment: string): Promise<Result<string, string>>

A key pair made by OpenSSH (ed25519), the passphrase typed into OpenSSH on the terminal: refused where the file is there (a key is never overwritten). The public key line is given back.

Imported by 3 tests of the run (3 passed, 0 failed): the library's results

readFactsfunction
function readFacts(i: FactsInput): Promise<Facts>

The facts of this machine, read with no change and no passphrase asked.

Imported by 3 tests of the run (3 passed, 0 failed): the library's results

testSignfunction
function testSign(keyFile: string, expectedPub: string, principal: string): Promise<Result<true, string>>

A test signature with a key, checked against the public key it should be listed as (OpenSSH asks for the passphrase): proves the key and its passphrase.

Imported by 3 tests of the run (3 passed, 0 failed): the library's results

FactsInputtypeno test imports it
type FactsInput = { readonly repo: string; /** The daily key's private file (its public file is beside it, `.pub`). … (503 characters)
type FactsInput = {
  readonly repo: string;
  /** The daily key's private file (its public file is beside it, `.pub`). */
  readonly keyFile: string;
  /** The text of the file that lists the signers, and the public keys of the daily and the recovery signers by name where they are listed. */
  readonly dailyPub: string | undefined;
  readonly recoveryListed: boolean;
  readonly recoveryKeyFile: string | undefined;
  readonly recoveryCheckedAt: string | undefined;
  readonly signersText: string;
};

What is read to know the facts.

Titles, headings, exports, tables, columns and requirements. Esc closes.