Repository navigation
Conversation
This was referenced Oct 17, 2026
Open
plebhash
force-pushed
the
2026-10-16-noise-certificate-ux
branch
from
October 17, 2026 01:27
5420fba to
b03df1f
Compare
plebhash
added a commit
to plebhash/sv2-apps
that referenced
this pull request
Oct 17, 2026
…ificate-ux Temporary commit so CI builds against stratum-mining/stratum#2426. Drop it and update stratum-core to stratum main once that PR is merged.
plebhash
force-pushed
the
2026-10-16-noise-certificate-ux
branch
from
October 17, 2026 01:34
b03df1f to
88b7391
Compare
plebhash
added a commit
to plebhash/sv2-apps
that referenced
this pull request
Oct 17, 2026
…ificate-ux Temporary commit so CI builds against stratum-mining/stratum#2426. Drop it and update stratum-core to stratum main once that PR is merged.
plebhash
force-pushed
the
2026-10-16-noise-certificate-ux
branch
from
October 17, 2026 14:36
88b7391 to
ba2b862
Compare
plebhash
added a commit
to plebhash/sv2-apps
that referenced
this pull request
Oct 17, 2026
…ificate-ux Temporary commit so CI builds against stratum-mining/stratum#2426. Drop it and update stratum-core to stratum main once that PR is merged.
plebhash
force-pushed
the
2026-10-16-noise-certificate-ux
branch
from
October 17, 2026 14:43
ba2b862 to
bd155ec
Compare
plebhash
added a commit
to plebhash/sv2-apps
that referenced
this pull request
Oct 17, 2026
…ificate-ux Temporary commit so CI builds against stratum-mining/stratum#2426. Drop it and update stratum-core to stratum main once that PR is merged.
plebhash
force-pushed
the
2026-10-16-noise-certificate-ux
branch
2 times, most recently
from
October 17, 2026 14:55
7701e54 to
77ec4ba
Compare
plebhash
added a commit
to plebhash/sv2-apps
that referenced
this pull request
Oct 17, 2026
…ificate-ux Temporary commit so CI builds against stratum-mining/stratum#2426. Drop it and update stratum-core to stratum main once that PR is merged.
plebhash
force-pushed
the
2026-10-16-noise-certificate-ux
branch
from
November 12, 2026 18:19
77ec4ba to
aad73ee
Compare
plebhash
added a commit
to plebhash/sv2-apps
that referenced
this pull request
Nov 12, 2026
…ificate-ux Temporary commit so CI builds against stratum-mining/stratum#2426. Drop it and update stratum-core to stratum main once that PR is merged.
Every Responder so far signed a fresh certificate at handshake time over a static key generated for that one handshake, which puts the authority private key on the internet-facing host and leaves the certificate lifetime up to that host. Responder::from_certificate takes the server's static keypair and a SIGNATURE_NOISE_MESSAGE (spec 4.5.2) issued for it elsewhere; step_1 sends those bytes verbatim, so the authority private key never has to be on the server and the validity window is the one the issuer signed. The existing constructors keep signing at handshake time. ref stratum-mining#2437
Responder::new and Responder::from_authority_kp need the authority private key on the internet-facing host, generate a static key that cannot be certified in advance, and let that host pick the certificate lifetime. Say so on both constructors, in the crate overview and in the README, and point servers outside development and testing at Responder::from_certificate. Closes stratum-mining#2437
`Responder::from_certificate` accepts a certificate signed elsewhere, but the type that defines its byte layout, signed digest and clock leeway was private, so an issuer had to re-implement all three and keep them in step with the initiator. Re-export `SignatureNoiseMessage`, add the conversion into its 74 bytes so an issuer can encode the header it signs, and make the leeway a crate constant.
A failed handshake used to return the `SignatureNoiseMessage` alone, leaving the operator to compare raw unix timestamps against the clock to guess what went wrong, and an application nothing to act on short of parsing a log line. Verification now returns a `CertificateError` naming the failed check (unsupported version, bad signature, not yet valid, expired), with the clock reading the time checks were made against, and `Error::InvalidCertificate` carries it next to the `SignatureNoiseMessage`. The signature is checked before the validity window, so a reported `NotYetValid` or `Expired` always refers to timestamps the authority signed: a forged certificate, or one that does not verify for this server static pubkey and authority pubkey, is reported as `InvalidSignature` whatever timestamps it carries. `SignatureNoiseMessage::verify` and `verify_with_now` return the same `Result<(), CertificateError>` in place of a bool, so whoever loads a pre-issued certificate for `Responder::from_certificate` can run the initiator's checks ahead of any handshake and learn which one failed, instead of re-implementing them. The `SignatureNoiseMessage` `Display` drops the hex signature, which means nothing in a log line (`Debug` still has it), and codec_sv2 prints the reason ahead of it. `CertificateError` is re-exported next to `SignatureNoiseMessage`. The docs around them now tell the `SIGNATURE_NOISE_MESSAGE` apart from the certificate it forms with the responder's static key, as the spec does. noise_sv2 3.0.0, codec_sv2 9.0.0 and stratum-core 0.8.0, since each exposes the one below in its public API. stratum-mining#2425
A successful handshake discarded the certificate, so an initiator could not log which certificate it accepted or when it expires. `NoiseEngine::certificate` and codec_sv2's `Transport::certificate` now return it as a `Certificate`: the spec's CERTIFICATE, formed by the `SignatureNoiseMessage` and the server's static public key its signature covers, together with the authority public key that signature was verified against. A certificate needs an authority key, so an initiator built with `Initiator::without_pk` gets `None`, as does the responder. That also lets callers tell an authenticated session from an unauthenticated one without tracking which constructor they used (stratum-mining#2391). stratum-mining#2425
plebhash
force-pushed
the
2026-10-16-noise-certificate-ux
branch
from
November 13, 2026 19:34
aad73ee to
735556d
Compare
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.
noise_sv2: report why a certificate was rejected, expose the verified oneclose #2425
companion stratum-mining/sv2-apps#931
built on top of #2497, which should land first: the first three commits here are that PR's
the handshake now hands applications typed results instead of text to parse (#2425 (comment)):
Error::InvalidCertificate { signature_noise_message, reason }, wherereasonis aCertificateError(UnsupportedVersion,InvalidSignature,NotYetValid { now },Expired { now },nowbeing the local clock reading)NoiseEngine::certificate()/Transport::certificate()return the verifiedCertificate(signature_noise_message,server_static_pubkey,authority_pubkey), orNonewithout an authority key (without_pk, responder)SignatureNoiseMessage::verify/verify_with_now, public sincenoise_sv2: let aResponderpresent a pre-issued certificate #2497 for whoever loads a pre-issued certificate, return the sameResult<(), CertificateError>in place of a boolthe certificate (spec 4.5.3) and the
SIGNATURE_NOISE_MESSAGE(spec 4.5.2) are kept apart in code and docs; the signature is checked before the validity window, so a forged certificate or a wrong key is reported asInvalidSignature, never as expiredCertificatehas noDisplay: the spec (4.7) encodes the authority pubkey in base58-check, whichnoise_sv2has no encoder for, so the apps format it;SignatureNoiseMessageandCertificateErrorkeep theirs for the codec error textas logged by the apps:
breaking:
noise_sv23.0.0,codec_sv29.0.0,stratum-core0.8.0 (each exposes the one below)heads-up: sv2-ui parses the old error text (stratum-mining/sv2-ui#383)