Skip to main content

Credentials

Struct Credentials 

Source
pub struct Credentials { /* private fields */ }
Expand description

The short-term credentials for a stream: ice-ufrag and ice-pwd (RFC 8839 §5.4).

The two travel together because §5.4 requires both for every data stream, whether they are written at session or media level, and because RFC 8445 §7.1.2 keys a connectivity check’s MESSAGE-INTEGRITY on the password that goes with a particular fragment. A type carrying one without the other would be a credential that cannot authenticate anything.

The fields are private so the length bounds cannot be lost after construction: the send and receive bounds differ, and which one applied is a property of how the value arrived.

Implementations§

Source§

impl Credentials

Source

pub const MAX_SENT_LEN: usize = 32

The longest ice-ufrag or ice-pwd §5.4 permits sipx to send.

Source

pub const MAX_ACCEPTED_LEN: usize = 256

The longest either that sipx must accept on receive.

Source

pub const MIN_UFRAG_LEN: usize = 4

The shortest ice-ufrag the grammar admits.

Source

pub const MIN_PWD_LEN: usize = 22

The shortest ice-pwd the grammar admits.

Source

pub fn new(ufrag: impl Into<String>, pwd: impl Into<String>) -> Option<Self>

Credentials sipx will put in an offer or answer.

None when either value is outside what §5.4 permits to be sent: “MUST NOT be longer than 32 characters when sending, but an implementation MUST accept up to 256 characters when receiving”. The asymmetry is why this is a different constructor from Credentials::received rather than a flag — sending 200 characters is a defect, and receiving them is Tuesday.

Source

pub fn received( ufrag: impl Into<String>, pwd: impl Into<String>, ) -> Option<Self>

Credentials read from a peer’s description.

Source

pub fn ufrag(&self) -> &str

The username fragment.

Source

pub fn pwd(&self) -> &str

The password.

Trait Implementations§

Source§

impl Clone for Credentials

Source§

fn clone(&self) -> Credentials

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Credentials

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Credentials

Source§

fn eq(&self, other: &Credentials) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Credentials

Source§

impl StructuralPartialEq for Credentials

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,