aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-keymgr/src/key_specifier.rs
Commit message (Collapse)AuthorAgeFilesLines
...
* tor-keymgr: Make InvalidKeyPathComponentValue an enum.Gabriela Moldovan2024-02-191-11/+20
| | | | | | | | | Previously, `InvalidKeyPathComponentValue` was a single error type, with the error message hard-coded to "invalid key denotator". This was wrong, because this error is used for other types of invalid components too (not just for invalid denotators). Part of #1115
* tor-keymgr: Add a note about KeyPathError.Gabriela Moldovan2024-02-191-0/+10
|
* tor-keymgr: Include the ArtiPath in PatternNotMatched.Gabriela Moldovan2024-02-191-4/+1
| | | | | | | All `KeyPathError` variants now include the `ArtiPath` that caused the error. Part of #1115
* tor-keymgr: Include ArtiPath in InvalidArtiPath.Gabriela Moldovan2024-02-191-2/+8
| | | | Part of #1115
* tor-keymgr: Include the ArtiPath in InvalidKeyPathComponentValue.Gabriela Moldovan2024-02-191-0/+2
| | | | | | The offending `ArtiPath` should be included in the error. Part of #1115
* tor-keymgr: Rename {to,from}_component to {to,from}_slug.Gabriela Moldovan2024-02-191-17/+17
| | | | | | | | | Originally, these functions converted to and from `ArtiPathComponent`. In !1931, we replaced `ArtiPathComponent` with `Slug` without renaming the conversion functions. Since we're converting to and from `Slug` now, I think it makes sense to rename them too. Part of #1115
* tor-keymgr: Downgrade a TODO from a test.Gabriela Moldovan2024-02-051-1/+1
|
* tor-keymgr: Rename KeyInfoExtractor to KeyPathInfoExtractor.Gabriela Moldovan2024-02-051-7/+7
| | | | | | This trait extracts a `KeyPathInfo`, not a `KeyInfo`. Part of #1115
* tor-keymgr: Derive getters for KeyPathInfo.Gabriela Moldovan2024-02-051-3/+1
| | | | Part of #1115
* tor-persist: Make all Slugs non-empty.Gabriela Moldovan2024-01-311-4/+12
| | | | | | | | This also removes a TODO regarding adding a `Nickname` type for representing `HsClientSpecifier` and `HsNickname` (we don't need it if `Slug`s are non-empty). Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1931#note_2990227
* tor-keymgr: Add roundrip test for HsId -> Slug -> HsId conversion.Gabriela Moldovan2024-01-311-1/+22
| | | | This also fixes a bug in `HsId::from_component`.
* tor-keymgr: Allow empty denotators in ArtiPath (fmt).Gabriela Moldovan2024-01-311-8/+2
|
* tor-keymgr: Allow empty denotators in ArtiPath.Gabriela Moldovan2024-01-311-8/+6
|
* tor-persist: Forbid slugs from starting with a hyphen.Gabriela Moldovan2024-01-311-3/+22
|
* tor-keymgr: Remove the Slug tests (fmt).Gabriela Moldovan2024-01-311-4/+1
|
* tor-keymgr: Remove the Slug tests.Gabriela Moldovan2024-01-311-34/+0
| | | | These tests belong in tor_persist now.
* tor-keymgr: Abolish ArtiPathComponent.Gabriela Moldovan2024-01-311-37/+38
| | | | | | `ArtiPathComponent`s are really just `Slugs`. Part of #1193, #1092
* tor-keymgr: Make ArtiPathComponent a Slug internally (fmt).Gabriela Moldovan2024-01-311-21/+47
|
* tor-keymgr: Make ArtiPathComponent a Slug internally.Gabriela Moldovan2024-01-311-60/+26
| | | | | | | | | | | | | This will make it easier to replace `ArtiPathComponent` with `Slug` later down the line. Note this changes the syntax rules of `ArtiPathComponent`: * previously `ArtiPathComponent`s could be unicode strings, (now they are lowercase ASCII alphanumerics, plus `-`, `_`) * previously `ArtiPathComponent`s couldn't start with `-` or `_`, but now they can Part of #1193, #1092
* tor-keymgr: Strip .onion suffix from HsId before building Slug.Gabriela Moldovan2024-01-311-3/+28
| | | | | | We are about to replace `ArtiPathComponent` with `Slug`, but `Slug`s don't support `.`, so let's strip the `.onion` suffix before encoding it in the `ArtiPath`.
* tor-keymgr: Turn some TODOs into #1195.Gabriela Moldovan2024-01-101-1/+1
|
* tor-keymgr: Turn some TODOs into #1115.Gabriela Moldovan2024-01-101-4/+5
|
* tor-keymgr: Downgrade some TODO HSS.Gabriela Moldovan2024-01-101-2/+2
|
* tor-keymgr: Implement KeySpecifierComponentViaDisplayFromStr for HsId.Gabriela Moldovan2024-01-101-0/+3
| | | | We are about to need this implementation.
* Merge branch 'keyspec' into 'main'Ian Jackson2024-01-081-345/+128
|\ | | | | | | | | | | | | KeySpecifier improvements Closes #1126, #1147, and #1151 See merge request tpo/core/arti!1851
| * tor-keymgr: KeySpecifierPattern: fix grammarIan Jackson2024-01-081-1/+1
| | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1851#note_2981473
| * tor-keymgr: KeySpecifierPattern: fix docsIan Jackson2024-01-081-3/+3
| | | | | | | | | | | | | | Swap the docs for new_any and arti_pattern to the right methods! As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1851#note_2981475
| * tor-keymgr: Fix typosgabi-2502024-01-081-1/+1
| |
| * KeyPathInfo: Add role fieldIan Jackson2024-01-041-0/+11
| | | | | | | | This *is* the spec name.
| * KeySpecifier d-a macro: Populate extra_infoIan Jackson2024-01-041-2/+7
| | | | | | | | Finishes arti#1151 item 10.
| * KeySpecifier d-a macro: Use dyn for describingIan Jackson2024-01-041-1/+0
| | | | | | | | This also passes the information we'll need to populate extra_info.
| * KeySpecifier d-a macro: Add a test for describingIan Jackson2024-01-041-0/+16
| |
| * KeyPathError::PatternNotMatched: Remove pattern from errorIan Jackson2024-01-041-2/+2
| | | | | | | | | | | | | | | | | | This can only happen if we tried to parse an ArtiPath as the wrong kind of KeySpecifier, which shouldn't happen very often. If it does, the pattern isn't that interesting. Which is just as well, since we're about to make it a bit harder to obtain it in the place where this error is going to be constructed.
| * KeySpecifier: Make KeySpecifierPattern a traitIan Jackson2024-01-041-0/+17
| | | | | | | | | | | | So now .arti_pattern() is a trait method. arti#1151 item 3.
| * KeySpecifier d-a macro: Abolish prefix fnsIan Jackson2024-01-041-14/+0
| | | | | | | | | | | | | | | | arti_prefix is no longer used. Abolish prefix too. arti#1151 item 7. Closes #1147.
| * KeySpecifier d-a macro: Introduce SomeSpecifierPattern and use dynIan Jackson2024-01-041-6/+15
| | | | | | | | | | | | | | | | This is a better API. The implementation has less monomorphisation. arti#1151 item 2 and the patterns part of 4. Closes #1126.
| * KeySpecifier tests: add a TimePeriod testIan Jackson2024-01-041-2/+36
| |
| * KeySpecifierComponent: Add .fmt_pretty() methodIan Jackson2024-01-041-1/+21
| | | | | | | | | | | | | | Part of arti#1151 item 10. Discussion in https://gitlab.torproject.org/tpo/core/arti/-/issues/1151#note_2977278
| * KeySpecifier d-a macro: Move to its own moduleIan Jackson2024-01-041-318/+4
| | | | | | | | This is going to expand and gain private helper methods.
| * KeySpecifier d-a macro: insist on structsIan Jackson2024-01-031-1/+1
| | | | | | | | | | We don't handle enums and we don't want to try. Put this here as documentation of this intent.
| * KeySpecifier d-a macro: rename from KeySpecifierDefaultIan Jackson2024-01-031-10/+10
| | | | | | | | arti#1151 item 1.
* | Remove an unneeded allowIan Jackson2024-01-021-2/+0
|/ | | | Now d-a #27 is fixed, we don't need this.
* tor-keymgr: ArtiPath[Component]: Add some more test aspectsIan Jackson2023-12-071-1/+10
| | | | | | | | | Test that the FromStr and TryFrom impls give the same answers as new(). These tests dodn't even compile before Properly validate in FromStr because the derive-more generated version has a wrong error type.
* tor-keymgr: ArtiPath tests: Add a test for a multi-component pathIan Jackson2023-12-071-2/+6
|
* tor-keymgr: ArtiPath tests: separate path from component testsIan Jackson2023-12-071-2/+4
| | | | | | Rename VALID_ARTI_PATH_COMPONENTS from _PATHS. These are tested for validity as components. I want to add a test for a multi-component path, so make a place to put it.
* tor-keymgr: arti_path tests: Add two TODOsIan Jackson2023-12-071-0/+3
| | | | These don't seem critical to me.
* tor-keymgr: path errors: Add some xrefsIan Jackson2023-12-071-0/+3
|
* tor-keymgr: ArtiPathSyntaxError: rename from ArtiPathError (fmt)Ian Jackson2023-12-071-8/+40
|
* tor-keymgr: ArtiPathSyntaxError: rename from ArtiPathErrorIan Jackson2023-12-071-22/+21
| | | | | The previous name was ambiguous, and confusable with KeyPathError (of which it is, basically, a variant).
* tor-keymgr: Move ArtiPath etc. into new moduleIan Jackson2023-12-071-189/+4
| | | | Minimal changes to still compile and pass tests.