error.rs (1715B)
1 #[cfg(doc)] 2 use super::{ 3 AuthenticatorSelectionCriteria, CredProtect, CredentialCreationOptions, Extension, 4 PublicKeyCredentialCreationOptions, USER_HANDLE_MAX_LEN, USER_HANDLE_MIN_LEN, UserHandle, 5 UserVerificationRequirement, 6 }; 7 use core::{ 8 error::Error, 9 fmt::{self, Display, Formatter}, 10 }; 11 #[cfg(doc)] 12 use std::time::{Instant, SystemTime}; 13 /// Error returned by [`CredentialCreationOptions::start_ceremony`]. 14 #[derive(Clone, Copy, Debug, Eq, PartialEq)] 15 pub enum CreationOptionsErr { 16 /// Error when [`Extension::cred_protect`] is [`CredProtect::UserVerificationRequired`] but [`AuthenticatorSelectionCriteria::user_verification`] is not 17 /// [`UserVerificationRequirement::Required`]. 18 CredProtectRequiredWithoutUserVerification, 19 /// Error when [`PublicKeyCredentialCreationOptions::hints`] is not compatible with 20 /// [`AuthenticatorSelectionCriteria::authenticator_attachment`]. 21 HintsIncompatibleWithAuthAttachment, 22 /// [`PublicKeyCredentialCreationOptions::timeout`] could not be added to [`Instant::now`] or [`SystemTime::now`]. 23 InvalidTimeout, 24 } 25 impl Display for CreationOptionsErr { 26 #[inline] 27 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { 28 f.write_str(match *self { 29 Self::CredProtectRequiredWithoutUserVerification => "credProtect extension with a value of user verification required was requested without requiring user verification", 30 Self::HintsIncompatibleWithAuthAttachment => "hints are not compatible with the requested authenticator attachment modality", 31 Self::InvalidTimeout => "the timeout could not be added to the current Instant", 32 }) 33 } 34 } 35 impl Error for CreationOptionsErr {}