Repository navigation
feat(identity): migrate Ed25519 to venv cryptography (closes #341) - #343
Merged
Merged
Conversation
Identity gen (genpkey) and message signing (pkeyutl -sign) used to shell out to system openssl. macOS LibreSSL doesn't implement Ed25519 via genpkey, which silently broke fresh-Mac installs (the 2>/dev/null ate the error — exactly the error-suppression antipattern that "Never swallow errors" exists to forbid). #342 made the failure loud and auto-installed brew openssl@3; this PR removes the dependency on system openssl entirely by routing both ops through the venv python-cryptography module that's already installed for envelope encryption. What changed: - lib/airc_core/crypto.py: add generate_ed25519_keypair_pem, load_ed25519_priv_pem, sign_ed25519_pem, save_ed25519_keypair_pem. PEM format (PKCS#8 priv, SPKI pub) matches openssl byte-for-byte — existing scopes that paired under shell-openssl load + verify cleanly here. Cross-checked: signing a Python-gen key via openssl pkeyutl -sign and signing the same message via the new path produces byte-identical base64 output. - lib/airc_core/identity.py: bootstrap_ed25519 + sign_ed25519 siblings to the existing X25519 functions, plus bootstrap-ed25519 and sign-ed25519 CLI subcommands so bash invokes via $AIRC_PYTHON -m airc_core.identity ... - airc top-level: sign_message and init_identity now route through the python CLI. Removed _resolve_openssl, AIRC_OPENSSL, _die_no_ed25519_openssl — all dead code post-migration. ssh-keygen remains (it's an OpenSSH client tool, not a libcrypto consumer, and ships working on every supported platform). - install.sh: drop openssl from the prereq list; drop the LibreSSL-detect + brew-install-openssl@3 dance (no longer needed since shell openssl isn't called). cryptography stays a hard dep via the existing venv pip-install step. - cmd_doctor.sh: replace the openssl probe with a cryptography import probe ("import cryptography.hazmat.primitives.asymmetric .ed25519"). Surfaces "re-run install.sh" if the venv didn't finish setting up. Backward compat: existing scopes' private.pem / public.pem files (generated by shell openssl in any prior version) continue to work unchanged. The PEM wrapping format is the same; load_pem_private_key parses both. No identity rotation triggered by upgrade. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
6 tasks
This was referenced Apr 30, 2026
canary→main: fresh-Mac install fixed + cryptography migration + CI honesty + UX cleanups (#341)
#349
Merged
Open
joelteply
added a commit
that referenced
this pull request
Apr 30, 2026
…351 CI failures) (#362) test: scaffold private.pem in synthesized identity dirs (post-#343 fix) Pre-#343 the test scenarios that synthesize a partial host scope (cmd_send liveness probe, away-status, list, quit) used `ssh-keygen -t ed25519` to create ssh_key + relied on the airc binary to lazily create private.pem via `openssl genpkey` if needed. Post-#343 init_identity creates private.pem via the venv cryptography path, but the test scenarios that DON'T go through `airc connect` at all skip init_identity entirely — sign_message then dies with `ed25519 sign failed: [Errno 2] No such file or directory: .../private.pem` before reaching the actual code-under- test (the monitor-liveness diagnostic, the away-marker logic, etc). Symptom in CI: 6 failures in the sdmd scenario alone all caused by the script bailing on the missing private.pem before reaching the assertion the test was actually validating. Adds `scaffold_identity()` helper next to spawn_host. Creates ssh_key (via ssh-keygen, unchanged) AND private.pem (via airc_core.identity bootstrap-ed25519 with PYTHONPATH set to make airc_core importable). Used at the 4 manual-scaffold sites: sdmd (send_dead_monitor_dies), aw (away-status), ls (list), quit (quit). The 5th ssh-keygen call (line 807, key-rotation scenario) replaces an EXISTING ssh_key after the scope was already initialized — private.pem is already there, no scaffold change needed. Pairs with other-mac's WIP for cluster B (gh-auth-less runner test infra). Both fold into #351. Co-authored-by: joel <[email protected]> Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
joelteply
added a commit
that referenced
this pull request
Apr 30, 2026
#363) The integration-suite has been failing on every canary push for the duration of this push (#351 cluster B). Root cause: 14 scenarios call airc with --room or bare connect (use_room=1), which trips cmd_connect's pre-flight gh-auth check (#338) — and CI's integration- suite runner has no gh auth wired in (no PAT secret). Add requires_gh_auth_or_skip() helper at the top of integration.sh: checks gh auth status once (cached for subsequent calls — saves rate limit budget when the suite runs many substrate scenarios), and either proceeds (when authed) or marks the scenario as skipped-pass with the reason. Test count stays sane, suite goes green on no-auth runners, substrate coverage preserved when gh IS authed (developer machines, future CI with PAT secret). Apply the gate to the 13 scenarios that exercise substrate features (--room or use_room=1 default): room, events, mnemonic, kick, heartbeat, bounce, two_tab_localhost, auto_scope, connect_after_kill_ recovers, general_sidecar_default, host_msg_publishes_to_gist, general_has_shared_gist, custom_room_creates_gist. Cluster A (Carl, #362) was test-stderr wording updates for the #343 ed25519-message-shape change. Together these close out #351. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Identity gen + envelope-signing both routed via system `openssl`, which broke silently on macOS LibreSSL (no `genpkey -algorithm Ed25519`). #342 made the failure loud and auto-installed `brew openssl@3`. This PR removes the dependency on system openssl entirely by routing through the venv `cryptography` module that's already installed for envelope encryption.
Closes #341.
What changed
Backward compat
Existing scopes' `private.pem` / `public.pem` files (created by shell openssl in any prior version) load unchanged via `load_pem_private_key`. Cross-checked: signing a Python-generated key via `openssl pkeyutl -sign` and signing the same message via the new Python path produces byte-identical base64 output. No identity rotation triggered by upgrade.
Test plan
🤖 Generated with Claude Code