|
| 1 | +//! Errors returned by this type |
| 2 | +
|
| 3 | +use thiserror::Error; |
| 4 | + |
| 5 | +use super::{key_rotation::KeyRotationError, role_index::RoleIndexError}; |
| 6 | + |
| 7 | +/// Errors that can occur when parsing a `KidURI` |
| 8 | +#[derive(Error, Debug)] |
| 9 | +pub enum KidURIError { |
| 10 | + /// Invalid KID URI |
| 11 | + #[error("Invalid URI")] |
| 12 | + InvalidURI(#[from] fluent_uri::error::ParseError), |
| 13 | + /// Invalid Scheme, not a KID URI |
| 14 | + #[error("Invalid Scheme, not a KID URI")] |
| 15 | + InvalidScheme, |
| 16 | + /// Network not defined in URI |
| 17 | + #[error("No defined Network")] |
| 18 | + NoDefinedNetwork, |
| 19 | + /// Path of URI is invalid |
| 20 | + #[error("Invalid Path")] |
| 21 | + InvalidPath, |
| 22 | + /// Role 0 Key in path is invalid |
| 23 | + #[error("Invalid Role 0 Key")] |
| 24 | + InvalidRole0Key, |
| 25 | + /// Role 0 Key in path is not encoded correctly |
| 26 | + #[error("Invalid Role 0 Key Encoding")] |
| 27 | + InvalidRole0KeyEncoding(#[from] base64_url::base64::DecodeError), |
| 28 | + /// Role Index is invalid |
| 29 | + #[error("Invalid Role")] |
| 30 | + InvalidRole, |
| 31 | + /// Role Index is not encoded correctly |
| 32 | + #[error("Invalid Role Index")] |
| 33 | + InvalidRoleIndex(#[from] RoleIndexError), |
| 34 | + /// Role Key Rotation is invalid |
| 35 | + #[error("Invalid Rotation")] |
| 36 | + InvalidRotation, |
| 37 | + /// Role Key Rotation is not encoded correctly |
| 38 | + #[error("Invalid Rotation Value")] |
| 39 | + InvalidRotationValue(#[from] KeyRotationError), |
| 40 | + /// Encryption key Identifier Fragment is not valid |
| 41 | + #[error("Invalid Encryption Key Fragment")] |
| 42 | + InvalidEncryptionKeyFragment, |
| 43 | +} |
0 commit comments