forked from openmls/openmls
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added support for Credential validation
- Loading branch information
Showing
6 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#[derive(Debug, Clone, Copy, Eq, PartialEq)] | ||
pub enum CredentialRef<'a> { | ||
Basic { identity: &'a [u8] }, | ||
X509 { certificates: &'a [&'a [u8]] }, | ||
} | ||
|
||
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)] | ||
pub enum CredentialAuthenticationStatus { | ||
#[default] | ||
Valid, | ||
Invalid, | ||
Expired, | ||
Revoked, | ||
} | ||
|
||
impl std::fmt::Display for CredentialAuthenticationStatus { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
write!( | ||
f, | ||
"{}", | ||
match self { | ||
Self::Valid => "valid", | ||
Self::Invalid => "invalid", | ||
Self::Expired => "expired", | ||
Self::Revoked => "revoked", | ||
} | ||
) | ||
} | ||
} | ||
|
||
#[cfg_attr(target_family = "wasm", async_trait::async_trait(?Send))] | ||
#[cfg_attr(not(target_family = "wasm"), async_trait::async_trait)] | ||
pub trait AuthenticationServiceDelegate: std::fmt::Debug + Send + Sync { | ||
async fn validate_credential<'a>( | ||
&'a self, | ||
credential: CredentialRef<'a>, | ||
) -> CredentialAuthenticationStatus; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters