[][src]Trait biscuit::CompactPart

pub trait CompactPart {
    fn to_bytes(&self) -> Result<Vec<u8>, Error>;
fn from_bytes(bytes: &[u8]) -> Result<Self, Error>
    where
        Self: Sized
; fn from_base64<B: AsRef<[u8]>>(encoded: &B) -> Result<Self, Error>
    where
        Self: Sized
, { ... }
fn to_base64(&self) -> Result<Base64Url, Error> { ... } }

A "part" of the compact representation of JWT/JWS/JWE. Parts are first serialized to some form and then base64 encoded and separated by periods.

An automatic implementation for any T that implements the marker trait CompactJson is provided. This implementation will serialize/deserialize T to JSON via serde.

Required methods

fn to_bytes(&self) -> Result<Vec<u8>, Error>

Convert this part into bytes

fn from_bytes(bytes: &[u8]) -> Result<Self, Error> where
    Self: Sized

Convert a sequence of bytes into Self

Loading content...

Provided methods

fn from_base64<B: AsRef<[u8]>>(encoded: &B) -> Result<Self, Error> where
    Self: Sized

Base64 decode into Self

fn to_base64(&self) -> Result<Base64Url, Error>

Serialize Self to some form and then base64URL Encode

Loading content...

Implementations on Foreign Types

impl CompactPart for Vec<u8>[src]

fn from_bytes(bytes: &[u8]) -> Result<Self, Error>[src]

Convert a sequence of bytes into Self

Loading content...

Implementors

impl CompactPart for Base64Url[src]

fn from_bytes(bytes: &[u8]) -> Result<Self, Error>[src]

Convert a sequence of bytes into Self

impl<T> CompactPart for T where
    T: CompactJson
[src]

fn to_bytes(&self) -> Result<Vec<u8>, Error>[src]

JSON serialize the part and return the JSON string bytes

impl<T: CompactPart, H: Serialize + DeserializeOwned> CompactPart for Compact<T, H>[src]

Implementation for embedded inside a JWE.

Loading content...