Skip to content

Instantly share code, notes, and snippets.

@waschmittel
waschmittel / secure-enclave-ssh-setup.mjs
Last active August 3, 2026 12:53
script to setup git/ssh auth and git signing based on https://gist.github.com/arianvp/5f59f1783e3eaf1a2d4cd8e952bb4acf -- git-ssh (push/pull/...) needs fingerprint, commit-signing does not, but both keys are in the secure enclave
#!/usr/bin/env zx
//
// resolveIdentity() falls back from exact-label match to "the sole identity
// with this touch policy" so a key created by hand before this script existed
// gets adopted rather than duplicated; ambiguous cases die rather than guess.
// --cleanup deletes by resolved identity one at a time, never via
// `sc_auth delete-all-ctk-identities`, so unrelated FileVault/PIV/login
// smartcard identities are never touched.
import os from 'node:os';