summaryrefslogtreecommitdiff
path: root/crates/tor-netdoc
Commit message (Collapse)AuthorAgeFilesLines
...
* tor-netdoc: Add some TODOsIan Jackson2026-05-271-0/+2
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3985#note_3413183
* tor-netdoc: Rename FixedString to ConstantStringIan Jackson2026-05-275-34/+34
| | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3985#note_3413182 I left the word "fixed" in some of the docs and error messages, where it seemed to make sense.
* tor-netdoc: Apply deferred rustfmt import churnIan Jackson2026-05-272-3/+5
|
* tor-netdoc: introduce VoteStatusConsensus and VoteStatusVoteIan Jackson2026-05-273-36/+16
| | | | | Replacing poc's. The new define_fixed_string macro is really helping here.
* tor-netdoc: NetworkStatusVersionItem, replacing poc's tupleIan Jackson2026-05-273-7/+34
| | | | | Defining a struct gives us a place to hang the documentation, and avoids an accidentally-exhaustive tuple.
* tor-netdoc: VarietyKeyword, replacing poc's flavour typeIan Jackson2026-05-274-27/+76
| | | | | | | This is more code than the poc version but much of the extra is documentation, and it seems much less magical this way. We still need a handwritten parser for plain consensuses, sadly.
* tor-netdoc: Promote/adjust poc's NetworkStatusSignaturesIan Jackson2026-05-272-10/+17
| | | | | | | | The order of arguments of poc's ns_type macro is different to that of the real code. This is very confusing! However, the type is correct, once we've added the singleton signature for votes.
* tor-netdoc: Provide NoMoreArguments markerIan Jackson2026-05-273-2/+32
| | | | | | We're going to need this for type-driven parsing of the necessarily-absent flavour argument in a vote's `network-status-version`.
* tor-netdoc: use DirectorySignaturesHashesAccu in SignatureGroupIan Jackson2026-05-273-7/+16
| | | | | | This will let us (re)use the existing signature checking code with the parse2 type, since we'll be able to make a SignatureGroup out of a parse2'd UnverifiedNetworkStatus.
* tor-netdoc: Make fields of DirectorySignaturesHashesAccu publicIan Jackson2026-05-272-2/+5
| | | | | This will allow it to be a replacement inside `SignatureHashes`. Keeping the fields private seems to have been an oversight.
* tor-netdoc: SignatureGroup: add some notes to the docsIan Jackson2026-05-271-0/+4
|
* tor-netdoc: Replace poc's NddDirectoryFooter with new FooterIan Jackson2026-05-274-10/+30
| | | | | This is the whole of the footer section, with docs, appropriate derives, and so on.
* tor-netdoc: ConsensusFooterFields: Constructor, parse, encodeIan Jackson2026-05-273-3/+14
|
* tor-netdoc: ConsensusFooterFields: Tidy docsIan Jackson2026-05-271-4/+4
| | | | | Add links to the spec, and delete explanatory text (that ought to be in the spec, not here).
* tor-netdoc: ConsensusFooterFields: Rename weights field to bandwidth_weightsIan Jackson2026-05-274-6/+7
| | | | This matches the spec.
* tor-netdoc: Rename Footer to ConsensusFooterFieldsIan Jackson2026-05-275-11/+14
| | | | | | | | | | | This will allow us to include this, conditionally, in the new per-variety footer types for consensuses, without too much disruption to the existing code. We don't leave a compatibility alias because we're going to want a Footer in each_variety.rs which is the actual sub-document. This old struct isn't suitable because it doesn't have the intro item and is just for consensuses.
* tor-netdoc: NetworkStatusVersion, replacing poc's with FixedStringIan Jackson2026-05-273-11/+15
|
* tor-netdoc: Provide FixedString and defined_fixed_stringIan Jackson2026-05-273-1/+146
| | | | We're going to want quite a lot of this for eg network-status-version.
* Merge branch 'rd-bandwidth' into 'main'Ian Jackson2026-05-273-0/+29
|\ | | | | | | | | Add Bandwidth support to Router Descriptors See merge request tpo/core/arti!4005
| * tor-netdoc: Add bandwidth field to RouterDescClara Engler2026-05-262-0/+9
| | | | | | | | | | | | This commit adds the bandwidth field to the RouterDesc struct as it is found within the spec. The legacy parser will not support it, hence why we do default values there.
| * tor-netdoc: Add Bandwidth structClara Engler2026-05-262-0/+20
| | | | | | | | | | This commit adds the bandwidth struct for router descriptors which is present in the `bandwidth` item.
* | Merge branch 'doc-digest-reorg' into 'main'Clara Engler2026-05-2711-66/+177
|\ \ | |/ |/| | | | | tor-netdoc: Implement encoding for referenced doc digest in rs entries See merge request tpo/core/arti!3989
| * tor-netdoc: Implement encoding for md rs digestIan Jackson2026-05-182-1/+14
| | | | | | | | | | This is not tested yet. It will be tested when we add round-trip tests for votes.
| * tor-netdoc: Fix comment about from_unparsedIan Jackson2026-05-181-1/+1
| | | | | | | | This doesn't parse the keyword, only the value.
| * tor-netdoc: Tidy doc_digest_parse2_m into doc_digest_item_mIan Jackson2026-05-182-5/+5
| | | | | | | | | | | | | | | | | | * Rename it so that it doesn't mention parse2, because we're going to want to encode too. * Remove the indirection: rename the one in md.rs to be the name that's used in `with = `. (Previously, things were more complicated so the extra layer of indirection was helpful.)
| * tor-netdoc: rs referenced doc digests: Use FixedB64 (fmt)Ian Jackson2026-05-181-2/+1
| |
| * tor-netdoc: rs referenced doc digests: Use FixedB64Ian Jackson2026-05-186-42/+22
| | | | | | | | | | | | | | FixedB64 is the right type for these, when they are present. This abolishes some ad-hoc boilerplate. Sadly we still need a bit of that for Reasons.
| * tor-netdoc: relay flags with: Use ns_type! rather than conditional importIan Jackson2026-05-181-4/+7
| | | | | | | | | | | | | | | | Previously, this was't possible because derive-deftly wanted a string. But now it can take a type, and types can contain macro calls inside their generics etc. This makes the code much more local and direct.
| * tor-netdoc: Fix comments in rs variety filesIan Jackson2026-05-183-3/+3
| | | | | | | | This is router *status* not router *descriptor*.
| * tor-netdoc: Fix NotPresent to use same Each valueIan Jackson2026-05-183-13/+93
| |
| * tor-netdoc: Document that parse2 vs encode multiplicity match req'tIan Jackson2026-05-183-4/+40
| |
* | Merge branch 'routerdescs-certs' into 'main'Clara Engler2026-05-193-4/+508
|\ \ | | | | | | | | | | | | Implement Elliptic Curve Certificates for Router Descriptors See merge request tpo/core/arti!3939
| * | tor-netdoc: Remove round-trip Ed25519 cert verificationClara Engler2026-05-191-20/+0
| | | | | | | | | | | | | | | | | | This commit removes the Ed25519 round-trip verifciation in certificate creation because it reduces the code complexity and is pretty uncommon in cryptographic code.
| * | tor-netdoc: Add TODO for family name getterClara Engler2026-05-191-0/+3
| | |
| * | tor-netdoc: Test invalid certified key typeClara Engler2026-05-191-0/+9
| | | | | | | | | | | | | | | This commit tests an invalid certified key type by adding a test that does not use CertifiedKey::Ed25519.
| * | tor-netdoc: Prepare tests for invalid certified key type (fmt)Clara Engler2026-05-191-1/+7
| | | | | | | | | | | | No functional change.
| * | tor-netdoc: Prepare tests for invalid certified key typeClara Engler2026-05-191-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adjusts the tests to make it possible to add a test for a non-matching certified key type. For this, we simply store the certified key as a CertifiedKey and not as an Ed25519Identity. Inevitably, this requires us to "force" create such an identity on the fly in order to test the mismatch, which is fine because it is an edge-case anyways.
| * | tor-netdoc: Fix embedded cert numberingClara Engler2026-05-191-14/+14
| | | | | | | | | | | | | | | Fixes the numbering due to a recently added additional check. Review using --word-diff=color.
| * | tor-netdoc: Properly verify certified key typeClara Engler2026-05-191-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | This commit properly verifies the certified key type by not returning a bug but rather invalid data in the case of the certified key not being an Ed25519 key. Tests and number adjustments will follow.
| * | tor-netdoc: Add Ed25519FamilyCertClara Engler2026-05-193-1/+159
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a new type, Ed25519FamilyCert, which works very similar to Ed25519IdentityCert, except that it supports family certificates. A notable difference is, that the identity key must be provided during verification because it does not make sense to verify these certificates without it.
| * | tor-netdoc: Add Ed25519IdentityCertClara Engler2026-05-193-3/+173
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit implements the Ed25519IdentityCert type using EmbeddableCert logic that was introduced recently. These certificates contain the identity key and the signing key of a relay and the type provides two methods: .verify() for verification and .new_signed() for construction. Besides, edcert::* is now made public as this is required now given that it contains public types.
| * | tor-netdoc: Add test framework for edcertsClara Engler2026-05-191-1/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds the test utilities required for testing the yet-to-be-implemented Ed25519IdentityCert and Ed25519FamilyCert types, whose interface largely overlaps, making a test "framework" useful to avoid code duplication. Their interfaces consist of two functions: * `.verify(Ed25519Identity, KeyUnknownCert, Duration, SystemTime)` * Verifies a KeyUnknownCert whether it is valid, given a SystemTime plus post valid tolerance alongside a well-known identity key in the case of family certificates. * `.new_signed(&ed25519::Keypair, Ed25519Identity, SystemTime)` * Creates a new certificate from a signing keypair plus a certified key alongside a SystemTime at when this certificate will expire. The commit introduces a testing trait that will be implemented for both types once added. Then, there are two generic tests that test the generation and verification of a valid random one as well as a test that tests violation of various constraints common to these certificates. The generic trait is most notable for the .new_signed() and .verify() method which we are roughly documented. Please see the next commit for a concrete example if understanding is hard.
* | | tor-netdoc: Move FromIterator doc to type docClara Engler2026-05-191-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | This commit moves the documentation for FromIterator<RelayFamilyId> for RelayFamilyIds to the type level documentation of RelayFamilyIds. It also rephrases the comment to fit in there more nicely grammatically and contextually, as a pure motion of the comment would not have been helpful to have there in any circumstance.
* | | tor-netdoc: Add TODO for sort/dedup in FromIteratorClara Engler2026-05-191-0/+3
| | | | | | | | | | | | | | | | | | | | | Adds a TODO with regard to .sort() and .dedup() in FromIterator in RelayFamilyIds and the fact that it is slightly weird. This is not a new problem with the type but stems from the fact that it tries to emulate a BTreeSet inside a Vec which is not nice.
* | | tor-netdoc: Derive PartialOrd, Ord on NumericBooleanClara Engler2026-05-191-1/+1
| | | | | | | | | | | | While already here, do this change, in case it becomes useful later on.
* | | tor-netdoc: Sort and dedup in RelayFamilyIds::from_iterClara Engler2026-05-191-1/+7
| | | | | | | | | | | | | | | This makes working with this more comfortable as those calls are generally required anyways.
* | | tor-netdoc: Derive Copy on RsaIdentity wrappersClara Engler2026-05-191-4/+4
| | | | | | | | | | | | | | | RsaIdentity implements Copy itself so it makes sense to derive it on those wrappers too.
* | | tor-netdoc: Derive Eq for NumericBooleanClara Engler2026-05-191-1/+1
| | | | | | | | | | | | Helpful in tests instead of Deref.
* | | tor-netdoc: Derive Transparent on NumericBooleanClara Engler2026-05-191-5/+8
| | | | | | | | | | | | Fixes an outstanding TODO.
* | | tor-netdoc: Derive Transparent on Ed25519PublicClara Engler2026-05-191-7/+2
|/ / | | | | | | | | We will need an inverse of the existing From implementation so that derivation makes sense because we will obtain it for free then.