pub struct Capabilities { /* private fields */ }Expand description
Capabilities of LeafNodes.
struct {
ProtocolVersion versions<V>;
CipherSuite ciphersuites<V>;
ExtensionType extensions<V>;
ProposalType proposals<V>;
CredentialType credentials<V>;
} Capabilities;Implementations§
Source§impl Capabilities
impl Capabilities
Sourcepub fn new(
versions: Option<&[ProtocolVersion]>,
ciphersuites: Option<&[Ciphersuite]>,
extensions: Option<&[ExtensionType]>,
proposals: Option<&[ProposalType]>,
credentials: Option<&[CredentialType]>,
) -> Self
pub fn new( versions: Option<&[ProtocolVersion]>, ciphersuites: Option<&[Ciphersuite]>, extensions: Option<&[ExtensionType]>, proposals: Option<&[ProposalType]>, credentials: Option<&[CredentialType]>, ) -> Self
Create a new Capabilities struct with the given configuration.
Any argument that is None is filled with the default values from the
global configuration.
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Create new empty Capabilities.
Sourcepub fn builder() -> CapabilitiesBuilder
pub fn builder() -> CapabilitiesBuilder
Creates a new CapabilitiesBuilder for constructing Capabilities
Sourcepub fn versions(&self) -> &[ProtocolVersion]
pub fn versions(&self) -> &[ProtocolVersion]
Get a reference to the list of versions in this extension.
Sourcepub fn ciphersuites(&self) -> &[VerifiableCiphersuite]
pub fn ciphersuites(&self) -> &[VerifiableCiphersuite]
Get a reference to the list of ciphersuites in this extension.
Sourcepub fn extensions(&self) -> &[ExtensionType]
pub fn extensions(&self) -> &[ExtensionType]
Get a reference to the list of supported extensions.
Sourcepub fn proposals(&self) -> &[ProposalType]
pub fn proposals(&self) -> &[ProposalType]
Get a reference to the list of supported proposals.
Sourcepub fn credentials(&self) -> &[CredentialType]
pub fn credentials(&self) -> &[CredentialType]
Get a reference to the list of supported credential types.
Sourcepub fn with_grease(self, rand: &impl OpenMlsRand) -> Self
pub fn with_grease(self, rand: &impl OpenMlsRand) -> Self
Add random GREASE values to the capabilities to ensure extensibility.
This adds one random GREASE value to each capability list if no GREASE value is already present:
- Ciphersuites
- Extensions
- Proposals
- Credentials
GREASE values are used per RFC 9420 Section 13.5 to help prevent extensibility failures by ensuring implementations properly handle unknown values.
§Example
use openmls::prelude::*;
use openmls_rust_crypto::OpenMlsRustCrypto;
let provider = OpenMlsRustCrypto::default();
// Create capabilities with GREASE values injected
let capabilities = Capabilities::builder()
.build()
.with_grease(provider.rand());
// Verify GREASE values were added
assert!(capabilities.ciphersuites().iter().any(|cs| cs.is_grease()));
assert!(capabilities.extensions().iter().any(|ext| ext.is_grease()));
assert!(capabilities.proposals().iter().any(|prop| prop.is_grease()));
assert!(capabilities.credentials().iter().any(|cred| cred.is_grease()));Trait Implementations§
Source§impl Clone for Capabilities
impl Clone for Capabilities
Source§fn clone(&self) -> Capabilities
fn clone(&self) -> Capabilities
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Capabilities
impl Debug for Capabilities
Source§impl Default for Capabilities
impl Default for Capabilities
Source§impl<'de> Deserialize<'de> for Capabilities
impl<'de> Deserialize<'de> for Capabilities
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 Capabilities
impl Deserialize for Capabilities
Source§fn tls_deserialize<R: Read>(bytes: &mut R) -> Result<Self, Error>
fn tls_deserialize<R: Read>(bytes: &mut R) -> Result<Self, Error>
std only.bytes from the provided a std::io::Read
and returns the populated struct. Read moreSource§impl DeserializeBytes for Capabilities
impl DeserializeBytes for Capabilities
Source§impl PartialEq for Capabilities
impl PartialEq for Capabilities
Source§impl Serialize for &Capabilities
impl Serialize for &Capabilities
Source§impl Serialize for Capabilities
impl Serialize for Capabilities
Source§impl Serialize for Capabilities
impl Serialize for Capabilities
Source§impl Size for &Capabilities
impl Size for &Capabilities
fn tls_serialized_len(&self) -> usize
Source§impl Size for Capabilities
impl Size for Capabilities
fn tls_serialized_len(&self) -> usize
impl Eq for Capabilities
impl StructuralPartialEq for Capabilities
Auto Trait Implementations§
impl Freeze for Capabilities
impl RefUnwindSafe for Capabilities
impl Send for Capabilities
impl Sync for Capabilities
impl Unpin for Capabilities
impl UnsafeUnpin for Capabilities
impl UnwindSafe for Capabilities
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
§impl<T> Classify for T
impl<T> Classify for T
type Classified = T
fn classify(self) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
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