pub struct Credential { /* private fields */ }
Expand description
Credential.
OpenMLS does not look into credentials and only passes them along. As such they are opaque to the code in OpenMLS and only the basic necessary checks and operations are done.
OpenMLS provides an implementation of the BasicCredential
.
This struct contains MLS credential data, where the data depends on the type.
Note: While the credential is opaque to OpenMLS, the library must know how to deserialize it. The implementation only works with credentials that are encoded as variable-sized vectors. Other credentials will cause OpenMLS either to crash or exhibit unexpected behaviour.
struct {
CredentialType credential_type;
select (Credential.credential_type) {
case basic:
opaque identity<V>;
case x509:
Certificate chain<V>;
};
} Credential;
Implementations§
Source§impl Credential
impl Credential
Sourcepub fn credential_type(&self) -> CredentialType
pub fn credential_type(&self) -> CredentialType
Returns the credential type.
Sourcepub fn new(
credential_type: CredentialType,
serialized_credential: Vec<u8>,
) -> Self
pub fn new( credential_type: CredentialType, serialized_credential: Vec<u8>, ) -> Self
Creates and returns a new Credential
of the given
CredentialType
.
Sourcepub fn serialized_content(&self) -> &[u8] ⓘ
pub fn serialized_content(&self) -> &[u8] ⓘ
Get this serialized credential content.
This is the content of the select
statement. It is a TLS serialized
vector.
Sourcepub fn deserialized<T: Size + Deserialize>(&self) -> Result<T, Error>
pub fn deserialized<T: Size + Deserialize>(&self) -> Result<T, Error>
Get the credential, deserialized.
Trait Implementations§
Source§impl Clone for Credential
impl Clone for Credential
Source§fn clone(&self) -> Credential
fn clone(&self) -> Credential
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for Credential
impl Debug for Credential
Source§impl<'de> Deserialize<'de> for Credential
impl<'de> Deserialize<'de> for Credential
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Deserialize for Credential
impl Deserialize for Credential
Source§fn tls_deserialize<R: Read>(bytes: &mut R) -> Result<Self, Error>
fn tls_deserialize<R: Read>(bytes: &mut R) -> Result<Self, Error>
bytes
from the provided a std::io::Read
and returns the populated struct. Read moreSource§impl DeserializeBytes for Credential
impl DeserializeBytes for Credential
Source§impl From<BasicCredential> for Credential
impl From<BasicCredential> for Credential
Source§fn from(credential: BasicCredential) -> Self
fn from(credential: BasicCredential) -> Self
Source§impl PartialEq for Credential
impl PartialEq for Credential
Source§impl Serialize for &Credential
impl Serialize for &Credential
Source§impl Serialize for Credential
impl Serialize for Credential
Source§impl Serialize for Credential
impl Serialize for Credential
Source§impl Size for &Credential
impl Size for &Credential
fn tls_serialized_len(&self) -> usize
Source§impl Size for Credential
impl Size for Credential
fn tls_serialized_len(&self) -> usize
Source§impl TryFrom<Credential> for BasicCredential
impl TryFrom<Credential> for BasicCredential
Source§type Error = BasicCredentialError
type Error = BasicCredentialError
impl Eq for Credential
impl StructuralPartialEq for Credential
Auto Trait Implementations§
impl Freeze for Credential
impl RefUnwindSafe for Credential
impl Send for Credential
impl Sync for Credential
impl Unpin for Credential
impl UnwindSafe for Credential
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more