ADR-027 resolves the architectural gap surfaced when ACME integration became a concrete target: 1. TlsIdentity::Acme variant — static config data (domains, cache_dir, directory, contact) with async AcmeState constructed at endpoint setup via two-phase TlsSetup (not stuffed into the Clone-able enum). 2. TlsIdentity::RawKey decoupled from the iroh feature — uses Ed25519SecretKey (alknet-core-owned wrapper over ed25519_dalek) instead of iroh::SecretKey. Raw-key TLS identity (RFC 7250, the default for most alknet nodes) now works in quinn-only builds. iroh transport converts via SecretKey::from_bytes. 3. ACME feature-gated behind new acme feature (rustls-acme optional dep). Non-ACME builds don't compile it. 4. dispatch_quinn guard for acme-tls/1 challenge connections — TLS-ALPN-01 is handled at the rustls cert resolver layer during the handshake; the guard closes challenge connections gracefully instead of logging a misleading "no handler" warning. Research confirmed QUIC (quinn) handles ACME challenges differently than TCP (reverse-proxy): quinn gives no ClientHello peek hook, but the challenge is fully answered at the cert resolution step before the connection surfaces to the application. No handler registration needed. Spec updates: config.md, endpoint.md, open-questions.md (OQ-12), overview.md + README.md (ADR index), ADR-010 (cross-ref). Tasks: core/rawkey-decouple-from-iroh (gen 1, no deps), core/acme-integration (gen 2, depends on rawkey). Graph: 36 tasks.
5.4 KiB
id, name, status, depends_on, scope, risk, impact, level
| id | name | status | depends_on | scope | risk | impact | level |
|---|---|---|---|---|---|---|---|
| core/rawkey-decouple-from-iroh | Decouple TlsIdentity::RawKey from the iroh feature (ADR-027) | pending | narrow | medium | component | implementation |
Description
TlsIdentity::RawKey(iroh::SecretKey) is gated #[cfg(feature = "iroh")]
and the RawKeyCertResolver / Ed25519SigningKey rustls impls are gated
#[cfg(all(feature = "quinn", feature = "iroh"))]. This means quinn-only
builds (the default feature set) cannot use RFC 7250 raw-key identity —
the mode described as "default for most alknet nodes" (OQ-12, ADR-027).
The coupling is artificial: iroh::SecretKey is a thin newtype over
ed25519_dalek::SigningKey. The alknet code uses only .public().as_bytes(),
.sign(msg), and .clone(). This task replaces iroh::SecretKey with an
alknet-core-owned Ed25519SecretKey wrapper, un-gates the raw-key TLS
path from the iroh feature, and updates the iroh transport to convert.
See ADR-027 for the full design rationale.
Implementation steps
-
Add
ed25519-dalekas a direct dependency of alknet-core inCargo.toml. It's already in the lockfile (transitive via iroh). Version:2.2(match what's inCargo.lock). -
Introduce
Ed25519SecretKeyinconfig.rs(or a newtls.rsmodule if config.rs is getting large):#[derive(Clone)] pub struct Ed25519SecretKey(ed25519_dalek::SigningKey); impl Ed25519SecretKey { pub fn generate() -> Self { ... } pub fn from_bytes(bytes: &[u8; 32]) -> Self { ... } pub fn as_bytes(&self) -> &[u8; 32] { ... } pub fn public(&self) -> ed25519_dalek::VerifyingKey { ... } }Add
ZeroizeOnDrop(the key is secret material). Add a redactingDebugimpl (likeSecret<T>in types.rs). Do NOT deriveDebug— the raw key bytes must not be printed. -
Change
TlsIdentity::RawKeyfromRawKey(iroh::SecretKey)toRawKey(Ed25519SecretKey). Remove the#[cfg(feature = "iroh")]gate —RawKeyis available in all builds. -
Rewire
Ed25519SigningKeyinendpoint.rs:- Change the inner field from
iroh::SecretKeytoEd25519SecretKey(ored25519_dalek::SigningKey). spki_public_key(): useself.key.public().as_bytes()(same logic, different key type —ed25519_dalek::VerifyingKeyhasas_bytes()).sign(): useself.key.sign(message)→ ed25519-dalek'sSigningKey::signreturnsSignaturewhich hasto_bytes().- Change the cfg gate from
#[cfg(all(feature = "quinn", feature = "iroh"))]to#[cfg(feature = "quinn")]onRawKeyCertResolver,Ed25519SigningKey, and all related impls.
- Change the inner field from
-
Update
build_iroh_endpoint: whenTlsIdentity::RawKey(key)is present, convert toiroh::SecretKey::from_bytes(key.as_bytes())before passing toiroh::Endpoint::builder().secret_key(...). This conversion is#[cfg(feature = "iroh")]only. -
Update
build_rustls_server_config: theRawKeyarm changes from#[cfg(feature = "iroh")]to always-available (within the#[cfg(feature = "quinn")]function). TheRawKeyCertResolver::newtakes&Ed25519SecretKeyinstead of&iroh::SecretKey. -
Update all tests that construct
TlsIdentity::RawKey:endpoint.rstests:iroh::SecretKey::generate(&mut csprng)→Ed25519SecretKey::generate().- Any test in
config.rsthat constructsRawKey.
What NOT to change
TlsIdentity::X509andSelfSigned— untouched by this task.- The
endpoint-request-client-certtask (server config client auth) — independent, can proceed in parallel or before/after this task. - ACME — separate follow-up task (
core/acme-integration).
Acceptance Criteria
ed25519-dalekis a direct dependency of alknet-coreEd25519SecretKeytype exists withgenerate,from_bytes,as_bytes,public; redactingDebug;ZeroizeOnDropTlsIdentity::RawKeyusesEd25519SecretKey, notiroh::SecretKeyTlsIdentity::RawKeyis not gated behind#[cfg(feature = "iroh")]RawKeyCertResolverandEd25519SigningKeyare gated#[cfg(feature = "quinn")]only (notall(feature = "quinn", feature = "iroh"))build_iroh_endpointconvertsEd25519SecretKey→iroh::SecretKey::from_bytescargo build -p alknet-core --features quinn(no iroh) succeeds withTlsIdentity::RawKeyusablecargo build -p alknet-core --all-featuressucceedscargo test -p alknet-core --all-featuressucceedscargo test -p alknet-core --features quinnsucceeds (quinn-only, no iroh)cargo clippy -p alknet-core --all-features --all-targetscleancargo clippy -p alknet-core --features quinn --all-targetsclean
References
- ADR-027 — full design rationale
- crates/alknet-core/src/config.rs:33-41 —
TlsIdentityenum - crates/alknet-core/src/endpoint.rs:593-689 —
RawKeyCertResolver,Ed25519SigningKey - crates/alknet-core/src/endpoint.rs:511-538 —
build_iroh_endpoint(conversion site) - crates/alknet-core/src/endpoint.rs:484-495 —
build_rustls_server_configRawKey arm - /workspace/iroh/iroh-base/src/key.rs:261 —
iroh::SecretKey(SigningKey)newtype
Notes
This is the foundation task for ADR-027. The ACME task (
core/acme-integration) depends on this one because both modifyTlsIdentityandbuild_rustls_server_config. Doing decoupling first means the ACME task builds on the cleaned-up enum without iroh coupling.