aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-hsservice/src/keys.rs
Commit message (Collapse)AuthorAgeFilesLines
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+1
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* hsclient, hsservice: Use unquoted paths in ctor_path attrGabriela Moldovan2026-04-161-2/+2
|
* hsservice: Use unquoted type in keypair_specifier attrGabriela Moldovan2026-04-161-2/+2
|
* hsclient, hsservice: Remove no longer needed conversion functionsGabriela Moldovan2026-01-061-58/+0
|
* keymgr: Use d-d to generate CTorPath<->KeySpecifier conversionsGabriela Moldovan2026-01-061-2/+2
|
* keymgr: Make CTorPath more like the client/service specifiers (fmt)Gabriela Moldovan2026-01-061-6/+2
|
* keymgr: Make CTorPath more like the client/service specifiersGabriela Moldovan2026-01-061-9/+5
| | | | | | | | | | | | | This will make it easier to see the correspondence between CTorPaths and the HS client/service key specifiers. Initially, I was hoping this would make it easier to write a d-d macro that automatically derives a `CTorPath` variant (e.g. `HsClientDescEncKeypair`) from the KeySpecifier type name (`HsClientDescEncKeypairSpecifier`), but alas, I don't think d-d can "chop off" name suffixes ("Specifier", in this case). `from_ctor_path()`/`ctor_path()` implementations for converting `CTorPath`s to and from key specifiers.
* keymgr: Push error handling into the from_ctor_path() functionsGabriela Moldovan2026-01-061-8/+16
|
* keymgr: Specify ctor conversion functions as moduleGabriela Moldovan2026-01-061-42/+46
| | | | | | | This is similar to `#[serde(with = "...")]`, and feels a bit nicer than having to specify two separate functions for the conversions (because with two separate functions, you *can* technically only specify one of them, which shouldn't be allowed).
* keymgr: Extend KeySpecifier macro to support CTorPath conversionsGabriela Moldovan2026-01-061-2/+38
| | | | | This enables us to implement `KeyMgr::describe()`, which relies on the ability to extract the key specifier of the key from its `KeyPath`.
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* arti: keys: Add `keys check-integrity` CLI toolhjrgrn2025-09-041-42/+7
|
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-1/+1
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* tor-hsservice: Implement ctor_path() for service keys.Gabriela Moldovan2024-10-081-0/+20
|
* tor_keymgr: add get_keypair_specifier() to KeySpecifier, and derive itAdam Joseph F0B74D717CDE8412A3E0D4D5F29AC8080DA8E1E02024-09-091-0/+2
| | | | | | | This commit adds a new method `get_keypair_specifier()` to `KeySpecifier`. This method is used to indicate when one KeySpecifier (e.g. `KP_hs_id`) is the public part of another keypair (e.g. `KS_hs_id`). It will return the containing keypair in this case, and `None` otherwise.
* tor_hsservice: add `impl From<&FooPublicKeySpecifier> for ↵Adam Joseph F0B74D717CDE8412A3E0D4D5F29AC8080DA8E1E02024-09-091-0/+17
| | | | | | | | | | | | | FooKeypairSpecifier` instances This adds the following trivial `From` instances: - tor_hsservice: impl From<&HsIdPublicKeySpecifier> for HsIdKeypairSpecifier - tor_hsservice: impl From<&BlindIdPublicKeySpecifier> for BlindIdKeypairSpecifier - tor_hscrypto::pk: impl From<HsBlindIdKeypair> for HsBlindIdKey - tor_llcrypto::pk::ed25519: impl From<ExpandedKeypair> for PublicKey - tor_keymgr::mgr: impl From<TestKey> for TestPublicKey - tor::hscrypto::pk: impl From<HsIdKeypair> for HsIdKey
* Change deftly syntax to post 0.12.1 versionIan Jackson2024-06-171-1/+1
| | | | | | | | | | | * Change `pub` to `export` * Change the `=` in define to `:` * Change `pub_template_semver_check` to `template_export_semver_check` Right now, 0.12.1 supports both syntaxes. I have verified this branch also compiles with https://gitlab.torproject.org/Diziet/rust-derive-deftly/-/merge_requests/402 ee171ffaf56d7dcb7d75584054921153fe19b222
* derive-deftly: Change some docs referencesIan Jackson2024-04-031-1/+1
| | | | Found by "git grep adhoc" and manual inspection.
* Switch to derive-deftlyIan Jackson2024-04-031-38/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the combination of a number of separate commits, many of which were generated by seddery, and then rebased and squashed. Cargo.toml perl -i~ -pe 's{^derive-adhoc}{derive-deftly = "0.10"}' crates/*/Cargo.toml (not regenerated during rebase) update Cargo.lock `cargo fetch` without --locked (regenerated during rebase) seddery git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{^use derive_adhoc}{use derive_deftly}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bdefine_derive_adhoc\b}{define_derive_deftly}g' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bAdhoc\b}{Deftly}g if m{derive}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\#\[derive_adhoc\b}{#[derive_deftly}g' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{use derive_adhoc}{use derive_deftly}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bderive_adhoc\b}{derive_deftly_adhoc} if m{use.*deftly}' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bderive_adhoc!}{derive_deftly_adhoc!}' (not regenerated during rebase) Manually add `#[derive_deftly_adhoc]` where needed. seddery git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\#\[adhoc\b}{#[deftly}g' git-ls-files | grep '\.rs$' | xargs perl -i~ -pe 's{\bderive_adhoc_template}{derive_deftly_template}' (not regenerated during rebase) Manually fix up an import Manually update some builder attrs Manually fix up tor_rtmock::time_core This was missed in my seddery, due to me rebasing the branch and not redoing the seddery.
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* Fix some rustdoc warnings.Nick Mathewson2024-03-121-1/+1
| | | | | These are mostly about explicitly linking to things that were already in scope.
* tor-hsservice: prelude: Move imports from keys.rsIan Jackson2024-03-051-14/+1
|
* tor-keymgr: Rename KeyMgr::remove_with_type to KeyMgr::remove_entry.Gabriela Moldovan2024-02-191-1/+1
| | | | Part of #1271
* tor-keymgr: Make KeyMgr::remove_with_type take a KeystoreEntry.Gabriela Moldovan2024-02-191-4/+1
| | | | | | | NB: `KeyMgr::remove_with_type` will need to be renamed to `KeyMgr::remove_entry`. Part of #1271
* tor-keymgr: Make KeyMgr::list_matching return `KeystoreEntry`s.Gabriela Moldovan2024-02-191-3/+4
| | | | Part of #1271
* tor-hsservice: Rename the service keystore dir to "hss".Gabriela Moldovan2024-02-011-14/+14
| | | | | | | | | | | The onion service keys now live in the `hss/<nickname>` subdirectory within the keystore. This layout change is **not** backwards-compatible, so if you want to use your existing hidden service keys, you will need to manually move them to `<keystore_root>/hss`. Closes #1260
* tor-keymgr: Lowercase the role when building the ArtiPath.Gabriela Moldovan2024-01-311-5/+5
| | | | | | | The role is a slug, and slugs are not allowed to contain uppercase characters. Closes #1195
* tor-hsservice: Fix typos etc.gabi-2502024-01-241-2/+2
|
* tor-hsservice: key expiry: Code motion and reindentingIan Jackson2024-01-241-26/+22
| | | | | Now the remove_if_expire closure, which does the actual work, is lexically outside the macro, and the macro is trivial.
* tor-hsservice: key expiry: Introduce HsTimePeriodKeySpecifier traitIan Jackson2024-01-241-10/+49
| | | | | | This allows us to have a closure containing runtime-polymorphic code, reducing monomorphisation and moving code out of a macro into a closure.
* tor-hsservice: key expiry: Rely on limiting publisher key scanIan Jackson2024-01-241-2/+6
| | | | | | | | Our pattern is now supposed to ensure that we don't see any irrelevant keys. So if we do, that's a bug. (The code layout is getting increasingly odd. We'll sort that out along with some code motion later.)
* tor-hsservice: key expiry: Limit publisher key scanIan Jackson2024-01-241-5/+5
| | | | | | | Only examine keys for this HS. This avoids thinking about every key for every HS for every netdir change. That's quadratic in the number of HS's.
* tor-hsservice: key expiry: Break out KeystoreSweeper::expire_keysIan Jackson2024-01-241-0/+48
| | | | We're going to change where this is called.
* tor-keymgr: Fully qualify KeySpecifierPattern in KeySpecifier macro.Gabriela Moldovan2024-01-101-1/+0
| | | | | | If you derive `KeySpecifier` and forget to import `KeySpecifierPattern` you get a confusing error. It's better to let the macro import (or fully qualify) the necessary types from tor-keymgr.
* KeySpecifier etc: apply deferred rustfmt import churnIan Jackson2024-01-041-1/+1
|
* KeySpecifier d-a macro: Do not produce fn new()Ian Jackson2024-01-041-5/+6
| | | | | | Where we wanted this, use derive_more::Constructor isntead. arti#1151 item 6.
* KeySpecifier: Make KeySpecifierPattern a traitIan Jackson2024-01-041-0/+1
| | | | | | So now .arti_pattern() is a trait method. arti#1151 item 3.
* KeySpecifier d-a macro: Introduce SomeSpecifierPattern and use dynIan Jackson2024-01-041-1/+1
| | | | | | | | This is a better API. The implementation has less monomorphisation. arti#1151 item 2 and the patterns part of 4. Closes #1126.
* tor-hsservice: Drop an unused importIan Jackson2024-01-041-1/+0
| | | | | I'm not sure why the compiler doesn't complain about this already, but it becomes "more" unused later.
* KeySpecifier d-a macro: rename from KeySpecifierDefaultIan Jackson2024-01-031-7/+7
| | | | arti#1151 item 1.
* tor-hsservice: Fix broken doc link.Gabriela Moldovan2023-12-141-1/+1
|
* tor-hsservice: keys: Remove unused imports (and a blocking todo)Ian Jackson2023-12-071-2/+0
|
* tor-hsservice: tests: IptKeySpecifier: Do round trip testIan Jackson2023-12-071-8/+8
|
* tor-hsservice: IptKeySpecifier: impl KeySpecifier via macroIan Jackson2023-12-071-14/+8
|
* tor-hsservice: IptKeySpecifier: make it ownedIan Jackson2023-12-071-4/+4
| | | | | The macro is going to want to be able to do a back-conversion from an ArtiPath, so there has to be an owned version.
* tor-hsservice: IptKeySpecifier: reorder fieldsIan Jackson2023-12-071-2/+2
| | | | | Now they are in the order they appear in the ArtiPath, which is a bit clearer.
* tor-hsservice: IptKeyRole: impl FromStr and KeySpecifierComponentIan Jackson2023-12-071-1/+4
|
* tor-keymgr: Replace assert_key_specifier_rountrip macro with function (fmt)Ian Jackson2023-12-071-12/+3
| | | | Formatting churn at call sites.
* tor-keymgr: Replace assert_key_specifier_rountrip macro with functionIan Jackson2023-12-071-13/+8
| | | | The new function checks both directions. The (misspelled) macro didn't.
* tor-hsservice: Add a cross-reference to KeystoreSweeper.Gabriela Moldovan2023-12-051-0/+7
|