Struct core_crypto::prelude::Credential
pub struct Credential { /* private fields */ }
Expand description
Credential.
This struct contains MLS credential data, where the data depends on the
type. The [CredentialType
] always matches the [MlsCredentialType
].
struct {
CredentialType credential_type;
select (Credential.credential_type) {
case basic:
opaque identity<V>;
case x509:
Certificate chain<V>;
};
} Credential;
Implementations§
§impl Credential
impl Credential
pub fn credential_type(&self) -> CredentialType
pub fn credential_type(&self) -> CredentialType
Returns the credential type.
pub fn mls_credential(&self) -> &MlsCredentialType
pub fn new_basic(identity: Vec<u8>) -> Credential
pub fn new_basic(identity: Vec<u8>) -> Credential
Creates and returns a new basic Credential
for the given identity.
If the credential holds key material, this is generated and stored in
the key store.
pub fn new_x509(
certificates: Vec<Vec<u8>>,
) -> Result<Credential, CredentialError>
pub fn new_x509( certificates: Vec<Vec<u8>>, ) -> Result<Credential, CredentialError>
Creates and returns a new X509 Credential
for the given identity.
If the credential holds key material, this is generated and stored in
the key store.
pub async fn validate( &self, backend: &impl OpenMlsCryptoProvider, ) -> Result<(), CredentialError>
Trait Implementations§
§impl Clone for Credential
impl Clone for Credential
§fn clone(&self) -> Credential
fn clone(&self) -> Credential
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl Debug for Credential
impl Debug for Credential
§impl<'de> Deserialize<'de> for Credential
impl<'de> Deserialize<'de> for Credential
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Credential, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Credential, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl Deserialize for Credential
impl Deserialize for Credential
§fn tls_deserialize<R>(bytes: &mut R) -> Result<Credential, Error>where
R: Read,
fn tls_deserialize<R>(bytes: &mut R) -> Result<Credential, Error>where
R: Read,
This function deserializes the
bytes
from the provided a std::io::Read
and returns the populated struct. Read more§impl From<MlsCredentialType> for Credential
impl From<MlsCredentialType> for Credential
§fn from(mls_credential_type: MlsCredentialType) -> Credential
fn from(mls_credential_type: MlsCredentialType) -> Credential
Converts to this type from the input type.
§impl PartialEq for Credential
impl PartialEq for Credential
§impl Serialize for Credential
impl Serialize for Credential
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
§impl Serialize for Credential
impl Serialize for Credential
§impl Size for Credential
impl Size for Credential
fn tls_serialized_len(&self) -> usize
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<>
Read moresource§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>
Converts
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>
Converts
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