Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/edda

crates/nornir-git/.nornir/sshkey-design.md

nornir-git · sshkey — design

The ONE canonical ed25519 OpenSSH deploy-key mint (LAW #5, DRY). nornir's generate_keypair and dwarves' service::generate_deploy_keypair were byte-for-byte twins of the same ssh-key + rand_core recipe; this lifts that single implementation into the shared nornir-git leaf — next to [nornir_git::ssh], the transport that authenticates git-over-SSH with exactly this id_ed25519. Pure-Rust, zero-shell (LAW #9): no ssh-keygen subprocess, ever.


f0 — the whole

  service install ──► ensure_deploy_key(home, uid, gid) ──► <home>/.ssh/id_ed25519 (0600)
  (nornir/dwarves)         │  comment = <home-basename>@<host>   id_ed25519.pub  (0644)
                           ▼                                      dir             (0700)
                 generate_ed25519_openssh(dir, comment)   ──► chown → uid:gid
                 OsRng → ssh_key::PrivateKey::random           returns DeployKey { pubkey }
                 → .to_openssh(LF)  (in-process)          ──► pubkey pasted as repo deploy key
                                                              nornir_git::ssh auths with the key

Two functions, one recipe. The primitive mints a keypair into any directory; the service helper wraps it with home-dir convention + chown and hands back the public half to register.

f1 — the API (the whole surface)

f2 — the chosen design (only the chosen one; alternatives → reasoning)

f3 — acceptance (tests, all RED-when-broken)

f4 — reuse map

Concern Reuse New
ed25519 keypair + OpenSSH (de)serialise ssh-key 0.6 (PrivateKey::random, to_openssh) —
CSPRNG rand_core::OsRng —
functional-status emit nornir_testmatrix::functional_status + this crate's selftest::emit bridge gated sshkey::wiring test
git SSH identity path / auth nornir_git::{gitio,ssh} (the consumer) —
the key-gen itself — generate_ed25519_openssh + ensure_deploy_key

f5 — deferred (follow-up, other agents)