aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-keymgr/src/test_utils.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.
* keymgr: Use unquoted keypair_specifier in testsGabriela Moldovan2026-04-161-1/+1
|
* keymgr: Update cert testsGabriela Moldovan2026-03-171-1/+16
| | | | | | | | | | | | | | This is needed now that `get_or_generate_key_and_cert()` uses the keypair specifier when generating the subject key. Without this the cert retrieval tests fail because `get_or_generate_key_and_cert()` now requires the subject key specifier to have an associated keypair specifier ("KeyCertificateSpecifier has no keypair specifier for the subject key?"). Note that even with this patch, the `get_cert_entry()` test still fails because of a bug in the `get_*()` family of functions. This will be fixed in a future commit.
* keymgr: Generate test cert specifiers using d-dGabriela Moldovan2026-03-121-22/+23
| | | | | | This will enable us to test against other keymgr APIs (e.g. `list_matching()`), which require some extra trait impls that get generated for free by our new `CertSpecifier` macro.
* keymgr: Abolish KeyCertificateSpecifier::signing_key_specifier() (fmt)Gabriela Moldovan2026-03-121-3/+1
|
* keymgr: Abolish KeyCertificateSpecifier::signing_key_specifier()Gabriela Moldovan2026-03-121-9/+3
| | | | | | | We need to be able to parse KeyPaths into KeyCertificateSpecifier, and we can't do that if the signing key is part of the cert specifier (because the signing key doesn't get encoded in the key path, unlike the subject key, which does)
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-3/+5
| | | | | | | | | | | | | | 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-keymgr: test_utils: TestSpecifier::path_prefix: Drop methodplaybahn2025-03-261-7/+6
| | | | Part of #1455
* tor-keymgr: Fix clippy errorsplaybahn2025-03-261-1/+2
|
* tor-keymgr: test_utils: Fix unresolved importplaybahn2025-03-261-4/+8
|
* tor-keymgr: keystore::arti::tests: More intuitive assert_eq!playbahn2025-03-261-1/+1
|
* tor-keymgr: Rework utils for ssh-keygen interop testsplaybahn2025-03-261-52/+50
| | | | | | | | | | | Part of #1455 [PATCH 2(v2)/4] - Rework sshkeygen::ed25519_encoded to also work as replacement for sshkeygen::exists - Drop sshkeygen::exists - Rename sshkeygen::{ed25519_encoded -> sshkeygen_ed25519_strings} - Pull out sshkeygen_ed25519_strings from mod sshkeygen - Drop mod sshkeygen
* tor-keymgr: Remove unused importsplaybahn2025-03-261-1/+0
| | | | _sigh_
* tor-keymgr: test_utils: Add ssh-keygen interop test utilsplaybahn2025-03-261-0/+53
| | | | | | | | | | Part of #1455 [PATCH 2/4] Utils include: - mod sshkeygen - sshkeygen::exists - check if ssh-keygen is available - sshkeygen::ed25519_encoded - generate encoded Ed25519 keys
* tor-keymgr: test_utils: Fix typo: TestSpecifier::new paramplaybahn2025-03-261-2/+2
| | | | | | | TestSpecifier::new(prefix: ...) -> new(suffix: ...) Prefix is given by TestSpecifier::path_prefix() which returns const TEST_SPECIFIER_PATH = "..."
* tor-keymgr: Use @ to annotate internal macro branches.Gabriela Moldovan2025-02-061-3/+3
|
* tor-keymgr: Define the test key constants using a macro.Gabriela Moldovan2025-02-061-42/+83
| | | | Closes #1396
* tor-keymgr: Rename test constants to match file names.Gabriela Moldovan2025-02-061-12/+12
| | | | Part of #1396
* tor-key-forge: Split out ItemType as a separate trait.Gabriela Moldovan2025-01-131-2/+4
| | | | | | | | This is necessary because `ParsedCert`s will not be `EncodableItem`s. This is because we cannot (and don't want to) write certificates that have not yet been validated to the keystore. They do need to be retrievable from the keystore though, so we also change `ErasedKey` to be `Box<dyn ItemType>` instead.
* tor-keymgr: Add a test certificate specifier to test_utils.Gabriela Moldovan2024-12-041-1/+34
| | | | This is about to be used in a couple of places.
* tor-keymgr: Replace as_ssh_key_data with as_keystore_item (fmt).Gabriela Moldovan2024-12-041-1/+1
|
* tor-keymgr: Replace as_ssh_key_data with as_keystore_item.Gabriela Moldovan2024-12-041-2/+2
|
* tor-key-forge: Replace EncodableItem::key_type() with item_type().Gabriela Moldovan2024-12-041-3/+3
| | | | | This function now returns a `KeystoreItemType`, enabling us to represent certs as `EncodableItem`s.
* tor-keymgr: Replace KeyType with KeystoreItemType (fmt).Gabriela Moldovan2024-12-041-2/+6
|
* tor-keymgr: Replace KeyType with KeystoreItemType.Gabriela Moldovan2024-12-041-2/+2
| | | | | This is part of the work needed to support storing certificates in the keystore (they won't have a `KeyType`, but rather `CertType`).
* tor-key-forge: Rename EncodableKey to EncodableItem.Gabriela Moldovan2024-12-041-4/+4
| | | | | | | | This is the first step in replacing `EncodableKey` with the new `EncodableItem` trait (see doc/dev/keymgr-certificates.md). (this refactoring is split over multiple commits to make reviewing easier)
* tor-keymgr: Add tests for CTorClientKeystore.Gabriela Moldovan2024-10-081-0/+48
|
* tor-keymgr: Move assert_found helper to test_utils.Gabriela Moldovan2024-10-081-0/+23
| | | | | This moves `assert_found` out of the `keystore::arti::test` so we can reuse it for testing other keystore implementations too.
* rename get_keypair_specifier() to keypair_specifier()Adam Joseph F0B74D717CDE8412A3E0D4D5F29AC8080DA8E1E02024-09-091-1/+1
| | | | https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2393#note_3073480
* tor_keymgr: add get_keypair_specifier() to KeySpecifier, and derive itAdam Joseph F0B74D717CDE8412A3E0D4D5F29AC8080DA8E1E02024-09-091-0/+4
| | | | | | | 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-keymgr: Move TestSpecifier to test_utils.Gabriela Moldovan2024-05-071-0/+40
| | | | | | | This is used by `ArtiNativeKeystore` and the `EphemeralKeystore`. Moving it to test_utils means `EphemeralKeystore` no longer needs to import test helpers from the arti module.
* tor-keymgr: Move test constants to test_utils.Gabriela Moldovan2024-05-071-0/+50
| | | | | Closes #1363 and addresses a handful of TODOs about `include_str!`ing the same key multiple times from various test modules.
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* tor-keymgr: Replace assert_key_specifier_rountrip macro with functionIan Jackson2023-12-071-11/+31
| | | | The new function checks both directions. The (misspelled) macro didn't.
* tor-hsservice: Test the TryFrom<&KeyPath> KeySpecifier impl.Gabriela Moldovan2023-12-051-1/+2
|
* tor-keymgr: Add a module for test utilities.Gabriela Moldovan2023-12-051-0/+13