aboutsummaryrefslogtreecommitdiff
path: root/crates/arti-relay/src/tasks/crypto
Commit message (Collapse)AuthorAgeFilesLines
* relay: Pass the desc task TX to the crypto taskDavid Goulet2026-07-281-0/+9
| | | | | | | | The crypto task can now signal the descriptor task that the keys have changed related to the relay descriptor (signing key and ntor keys) so a new descriptor can be built and uploaded. Signed-off-by: David Goulet <[email protected]>
* arti-relay: simplify tests by removing some `Arc`sSteven Engler2026-07-202-7/+5
|
* arti-relay: make `FullKeyView` generic over a `Borrow<KeyMgr>`Steven Engler2026-07-202-7/+18
| | | | Now it can be used with `KeyMgr` and `&KeyMgr`, not only `Arc<KeyMgr>`.
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-092-0/+2
| | | | | | | | | | | | 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.
* relay: Recompute valid_until cache in view constructorDavid Goulet2026-05-281-7/+11
| | | | | | | | | | | | | The recompute of the valid_until cache is done now in the constructor of FullKeyView so the view is directly usable once built. Else, the caller always need to call the recompute function which is error prone especially when used as a throwaway view. Also, without this change, building the view and then attempting to log the public keys would fail. Signed-off-by: David Goulet <[email protected]>
* relay: Introduce src/task/crypto/keys.rsDavid Goulet2026-05-282-1/+731
| | | | | | | | | | | Move all key related action function to keys.rs in order to alleviate crypto.rs. The Reactor will get more functionnalities soon so cleanup. No behavior change, just code movement. Related to #2548
* relay: Make FullKeyView pub(super)David Goulet2026-05-281-8/+8
| | | | | | Now, the FullKeyView is officially only seen by the crypto task. Signed-off-by: David Goulet <[email protected]>
* relay: Remove locking of FullKeyViewDavid Goulet2026-05-281-89/+49
| | | | | | | | | | | | | | | | No need for the valid_until cache locking that used to ensure coherent view accross tasks. As we move towards having the FullKeyView be solely owned by the crypto task, no need for locking. Future commit will introduce a control command channel which will be used to get keys for other tasks. The valid_until cache is kept though because it helps with key lookups to avoid walking all keys each time. Signed-off-by: David Goulet <[email protected]>
* relay: Avoid using super::super:: and instead importDavid Goulet2026-05-261-14/+14
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Use a struct for key valid_until cacheDavid Goulet2026-05-261-79/+79
| | | | | | | | | Instead of a HashMap, use a struct that contains explicit valid_until value per key type as those won't change anytime soon. This is to have a smaller memory footprint and simpler design. Signed-off-by: David Goulet <[email protected]>
* relay: Rename crypto task reconcile() to recompute_valid_until()David Goulet2026-05-261-7/+7
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: .expect() on mutex lock failureDavid Goulet2026-05-261-24/+18
| | | | | | | This change made it that we don't need Result<> to be returned for two functions therefore affecting the callsites. Signed-off-by: David Goulet <[email protected]>
* relay: Add unit test for key view reconcile()David Goulet2026-05-261-0/+151
| | | | Signed-off-by: David Goulet <[email protected]>
* relay: Crypto task removal of get_ntor_keys()David Goulet2026-05-261-7/+0
| | | | | | | | | | This is the last piece that needed to be removed since we can use the view to get those keys. This also allows us to remove the temporary FullKeyView::keymgr() function and instead keep the keymgr access strictly to the view guard. Signed-off-by: David Goulet <[email protected]>
* relay: Set the FullKeyView in InerTorRelayDavid Goulet2026-05-261-1/+0
| | | | | | | | | | | | | This is so we early set the FullKeyView and we use it accross the code from initialization. The try_generate_keys() now takes a view and locks it to make its changes. And we also make build_proto_relay_auth_material() use a view to simplify its code and also stop relying on the KeyMgr for key accessors. Signed-off-by: David Goulet <[email protected]>
* relay: Add key view reconcile() for the valid_until cacheDavid Goulet2026-05-261-4/+72
| | | | | | | | | Rebuild the valid_until cache from the key manager and return which key has changed. Function is not used in this commit. Signed-off-by: David Goulet <[email protected]>
* relay: Implement new crypto reactor run_once()David Goulet2026-05-261-0/+7
| | | | | | | | | This basically copies the code from rotate_keys_task() and puts it in the run_once(). Cleanup will follow in the next commits to lock step changes. Signed-off-by: David Goulet <[email protected]>
* relay: Add FullKeyView in the crypto task moduleDavid Goulet2026-05-261-0/+189
This object wraps the `KeyMgr` and provide getters for all specific relay key types. That view is meant to access all keys a relay has. Upcoming restricted views will wrap that object to offer a limited view that is more domain specific. A valid_until cache is kept for all expirable keys so all get() of those keys always return the same one. Signed-off-by: David Goulet <[email protected]>