aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-keymgr/src/err.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: Remove RawKeystoreEntry (fmt)Gabriela Moldovan2026-05-181-1/+1
|
* keymgr: Remove RawKeystoreEntryGabriela Moldovan2026-05-181-10/+17
| | | | | | | | | | | | I think this adds unnecessary indirection, and it's a bit confusing to have two separate keystore entry types (we have `KeystoreEntry` too). This type exists just to server as a wrapper over the `RawEntryId` of an unrecognized keystore entry, and the `KeystoreId` of the keystore it was found in. This commit folds `RawKeystoreEntry` into `UnrecognizedEntry`, which was previously a thin wrapper over `RawKeystoreEntry`.
* keymgr: Fix some recently broken doc linksGabriela Moldovan2026-01-061-2/+2
|
* keymgr: Move Unrecognized errors out of KeyPathErrorGabriela Moldovan2026-01-061-1/+5
| | | | | | | | | | | | | | | | | | | | | Out of all the variants in `KeyPathError`, `Unrecognized` is the odd one out, because unlike the others, which are mainly just lower level parsing errors, `Unrecognized` is a higher level error constructed in `KeyMgr::describe()`. `KeyMgr::describe()` now returns an `Option`, because * the failure to describe a user provided `KeyPath` may or may not be an error * previously, `describe()` would only ever return `Ok` or `Err(KeyPathError::Unrecognized)`, which essentially a binary result. Also, `describe()` would never return any of the other `KeyPathError` kinds, which further suggests `Unrecognized` doesn't belong there The `Unrecognized` variant still exists, but is now part of `KeystoreCorruptionError`, (returned from `KeyMgr::validate_entry_integrity()`).
* 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-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-keymgr: Add err::Error::KeystoreNotFoundhjrgrn2025-07-231-1/+8
|
* arti: keys: Add arti keys-rawhjrgrn2025-07-141-20/+16
| | | | | | | | | | | | | | | | | | | * CLI: Add `keys-raw` and subcommand `remove-by-path` * arti: Add `arti::subcommand::raw` for the CLI `keys-raw` * tor-keymgr: Add `ArtiNativeKeystoreError::UnexpectedRawEntry`, `ArtiEphemeralKeystoreError::NotSupported` * tor-keymgr: Add `tor-keymgr::raw` module * tor-keymgr: Add `Keystore::remove_unchecked` * tor-keymgr: Change `Keystore::list` to return `KeystoreEntry` * tor-keymgr: Add field `KeystoreEntry::raw_id` * doc: Update keys.md * doc: Add raw.md * tor-keymgr: BREAKING: `UnrecognizedEntryError::new` associated function is now only accessible within the crate `tor-keymgr` * tor-keymgr: BREAKING: `UnrecognizedEntryId` is renamed to `UnrecognizedEntry` * tor-keymgr: BREAKING: `KeyMgr::list()` and `Keystore::list()` now return `Result<Vec<KeystoreEntryResult<KeystoreEntry>>>`
* Typo fixes (automatic and hand-verified)Nick Mathewson2025-07-091-1/+1
| | | | Made with https://crates.io/crates/typos-cli
* tor-keymgr: BREAKING: Refactor API: Keystore::listhjrgrn2025-05-301-0/+48
| | | | | * Change return type `Result<Vec<(KeyPath, KeystoreItemType)>>` if favor of `Result<Vec<StdResult<(KeyPath, KeystoreItemType), UnrecognizedEntryError>>>`
* tor-keymgr: Replace internal error with keystore corruption error.Gabriela Moldovan2024-12-041-0/+4
| | | | | This replaces a placeholder error with a concrete `KeystoreCorruptionError` variant.
* tor-keymgr: Add KeyMgr::get_key_and_cert().Gabriela Moldovan2024-12-041-0/+5
|
* tor-keymgr: Add helper for building certificate ArtiPaths.Gabriela Moldovan2024-12-041-1/+5
| | | | This will be used for looking up certificates in the keystore.
* tor-keymgr: Add variants for missing cert/signing key errors.Gabriela Moldovan2024-12-041-0/+8
| | | | | These will be soon be returned by `KeyMgr::{get_key_and_cert,get_or_generate_key_and_cert}`.
* Rename tor-keys crate to tor-key-forgeDavid Goulet2024-09-041-3/+3
| | | | Signed-off-by: David Goulet <[email protected]>
* tor-keymgr: Use tor-keys crate and remove dead codeDavid Goulet2024-09-041-5/+12
| | | | | | | | | | | Everything copied in the previous commits to tor-keys is now removed and tor-keys crate is used accross the code. Minor changes to tor-keys to accomodate this change. Part of #1137 Signed-off-by: David Goulet <[email protected]>
* tor-keymgr: Move arti-specific ssh code to arti module.Gabriela Moldovan2024-05-071-1/+1
| | | | | | | | | Some of the types and impls from `key_type/ssh.rs` (such as `UnparsedOpenSshKey`) have nothing to do with `KeyType`, and are only used by the `ArtiNativeKeystore`, so I'm moving them to the `arti` keystore module. The shared ssh-related stuff now lives in the top-level `ssh.rs`.
* tor-keymgr: Add an error type for unsupported keys.Gabriela Moldovan2024-05-071-0/+6
|
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* tor-keymgr: Fix two docs linksIan Jackson2024-02-051-1/+1
| | | | (These were broken by recent MRs so don't need a CHANGELOG update in !1950.)
* tor-keymgr: Expand the KeyAlreadyExists docs.Ian Jackson2024-02-011-0/+7
|
* tor-keymgr: Add error variant for when a key shouldn't exist.Gabriela Moldovan2024-02-011-0/+5
| | | | | | | This will be returned by `KeyMgr::generate` if the key to be generated already exists and `overwrite` is `false`. Part of #1074
* tor-keymgr: Make ArtiPathComponent a Slug internally.Gabriela Moldovan2024-01-311-15/+4
| | | | | | | | | | | | | 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: ArtiPathSyntaxError: impl EqIan Jackson2023-12-071-1/+1
|
* tor-keymgr: ArtiPathSyntaxError: rename from ArtiPathErrorIan Jackson2023-12-071-1/+1
| | | | | The previous name was ambiguous, and confusable with KeyPathError (of which it is, basically, a variant).
* tor-keymgr: Introduce InvalidKeyPathComponentValue errorsIan Jackson2023-12-071-6/+7
| | | | | | | | This is a variant in KeyPathError, which contains the actual wrong value, and the key name. But it is also a unit struct to return from the trait impl. This replaces ArtiPathError::InvalidDenotator.
* tor-keymgr: Make two errors not be CopyIan Jackson2023-12-071-1/+1
| | | | | | This is a hostage to fortune. (In a previous version of !1796 I wanted to make it untrue.)
* tor-keymgr: Change KeyDenotator error type to KeyPathError.Gabriela Moldovan2023-12-051-3/+5
| | | | | This is a separate class of errors that deserves its own error type. We will soon use `KeyPathError` in other contexts as well.
* tor-keymgr: Remove unnecessary impls for KeystoreCorruptionError.Gabriela Moldovan2023-11-291-9/+1
| | | | | | | These impl only exist because they were needed back when we didn't have the `tor_keymgr::Error` enum and all errors _had_ to implement `KeystoreError`. They are not used or required anymore, so let's remove them.
* tor-keymgr: Fix some broken docs linksIan Jackson2023-11-281-3/+3
|
* tor-keymgr: Remove a TODO that is no longer relevant.Gabriela Moldovan2023-11-211-3/+0
| | | | | | `KeystoreCorruptionError` is now part of `tor_keymgr::Error` and no longer implements `KeystoreError` (the `KeystoreError` trait is now only for keystore-specific errors).
* tor-keymgr: Remove unnecessary trait function.Gabriela Moldovan2023-11-211-7/+0
| | | | We don't use this anymore.
* tor-keymgr: Add a top-level error type (fmt).Gabriela Moldovan2023-11-211-1/+4
|
* tor-keymgr: Add a top-level error type.Gabriela Moldovan2023-11-211-21/+27
| | | | | | | | | | | | | Previously, the `tor_keymgr::Error` type was `Box<dyn KeystoreError>`. This forced us to impl `KeystoreError` for any error returned by the keymgr (including those that were not coming from a `Keystore` impl). Now, `tor_keymgr::Error` is an non-exhaustive enum and the `Box<dyn KeystoreError>` opaque error type is only returned from `Keystore` impls The reason we're keeping the `dyn KeystoreError` error type is because it enables `Keystore` implementors to use their own error types. Without it, they would have to choose from our (closed) set of error variants, which may not be suitable for their keystore. See #901.
* tor-keymgr: Move ArtiPathError, KeystoreCorruptionError to err.rs.Gabriela Moldovan2023-11-211-1/+49
| | | | | | KeystoreCorruptionError is about to become a variant of the top-level keymgr Error enum (which doesn't exist yet but will be introduced in a future commit).
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* keymgr: Add a convenience function for boxing keystore errors.Gabriela Moldovan2023-07-201-0/+7
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* keymgr: Rename KeyStore to Keystore globally.Gabriela Moldovan2023-06-291-2/+2
| | | | | We've been capitalizing the "s" in "KeyStore" inconsistently. This `s/KeyStore/Keystore/g` across the codebase.
* keymgr: Remove outdated TODOs regarding error handling.Gabriela Moldovan2023-06-281-2/+0
| | | | These were tackled in #901.
* keymgr: Add regression test for tor_keymgr::Error recursion bug.Gabriela Moldovan2023-06-271-0/+39
|
* keymgr: Fix infinite recursion in Error impl.Gabriela Moldovan2023-06-271-2/+1
| | | | | The `source` impl `tor_keymgr::Error` was just calling itself recursively.
* keymgr: Document why we need the StdError impl for tor_keymgr::Error.Gabriela Moldovan2023-06-261-0/+5
|
* keymgr: Remove AsRef<dyn StdError> trait bound and unneeded impls.Gabriela Moldovan2023-06-261-1/+1
| | | | | | We don't really need the `AsRef<dyn StdError>` impls if we make `StdError` a supertrait of `KeystoreError` (and remove the `AsRef<dyn StdError>` trait bound).
* keymgr: Replace Error with Box<dyn KeystoreError>.Gabriela Moldovan2023-06-261-142/+4
| | | | Part of #901
* keymgr: Implement KeystoreError for Bug.Gabriela Moldovan2023-06-261-0/+2
| | | | | | | This also implements `AsRef<StdError>` for `Bug` to satisfy the `KeystoreError: AsRef<dyn StdError>` trait bound. Part of #901
* keymgr: Create a KeyStoreError trait for keystore errors.Gabriela Moldovan2023-06-261-0/+33
| | | | | | The new `BoxedError` type will replace `tor_keymgr::Error`. Part of #901
* keymgr: Move dummy implementation to tor-keymgr.Gabriela Moldovan2023-06-221-5/+25
|
* keymgr: Remove Error::NotFound, update KeyMgr, KeyStore APIs.Gabriela Moldovan2023-06-211-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | This removes the `NotFound` `tor_keymgr::Error` variant. Since `KeyMgr` and `KeyStore` users will need to be able to distinguish between "not found" errors and other I/O errors, this also changes the return types of the `get()` and `remove()` functions of `KeyStore` and `KeyMgr`, which now return `Ok(None)` instead of `Error::NotFound`. This makes the `KeyStore` API consistent with `KeyMgr::get`, which already has a return type of `Result<Option<K>>` (rather than `Result<K>`). This also prepares us for #901, which will make key store errors opaque. Without this change: * we'd have to create a `struct NotFoundError;` error type. Its `HasKind` impl would need to return a new `ErrorKind::KeyStoreErrorNotFound` `ErrorKind` variant * callers would have to match the `error_kind()` of the error to figure out whether the key simply can't be found (`ErrorKind::KeyStoreErrorNotFound`), or if something went wrong (any other `ErrorKind`). Given the above, I think `Result<Option<()>>` makes for a more ergonomic API. Part of #901