pub struct UnverifiedBiscuit { /* private fields */ }
Expand description

A token that was parsed without cryptographic signature verification

Use this if you want to attenuate or print the content of a token without verifying it.

It can be converted to a Biscuit using UnverifiedBiscuit::check_signature, and then used for authorization

Implementations§

source§

impl UnverifiedBiscuit

source

pub fn from<T>(slice: T) -> Result<Self, Token>
where T: AsRef<[u8]>,

deserializes a token from raw bytes

source

pub fn from_base64<T>(slice: T) -> Result<Self, Token>
where T: AsRef<[u8]>,

deserializes a token from base64

source

pub fn check_signature<F>(self, f: F) -> Result<Biscuit, Format>
where F: Fn(Option<u32>) -> PublicKey,

checks the signature of the token and convert it to a Biscuit for authorization

source

pub fn append(&self, block_builder: BlockBuilder) -> Result<Self, Token>

adds a new block to the token

since the public key is integrated into the token, the keypair can be discarded right after calling this function

source

pub fn to_vec(&self) -> Result<Vec<u8>, Token>

serializes the token

source

pub fn to_base64(&self) -> Result<String, Token>

serializes the token and encode it to a (URL safe) base64 string

source

pub fn from_with_symbols( slice: &[u8], symbols: SymbolTable ) -> Result<Self, Token>

deserializes from raw bytes with a custom symbol table

source

pub fn from_base64_with_symbols<T>( slice: T, symbols: SymbolTable ) -> Result<Self, Token>
where T: AsRef<[u8]>,

deserializes a token from base64 with a custom symbol table

source

pub fn append_with_keypair( &self, keypair: &KeyPair, block_builder: BlockBuilder ) -> Result<Self, Token>

adds a new block to the token

since the public key is integrated into the token, the keypair can be discarded right after calling this function

source

pub fn root_key_id(&self) -> Option<u32>

returns an (optional) root key identifier. It provides a hint for public key selection during verification

source

pub fn revocation_identifiers(&self) -> Vec<Vec<u8>>

returns a list of revocation identifiers for each block, in order

revocation identifiers are unique: tokens generated separately with the same contents will have different revocation ids

source

pub fn external_public_keys(&self) -> Vec<Option<Vec<u8>>>

returns a list of external key for each block, in order

Blocks carrying an external public key are third-party blocks and their contents can be trusted as coming from the holder of the corresponding private key

source

pub fn block_count(&self) -> usize

returns the number of blocks (at least 1)

source

pub fn print_block_source(&self, index: usize) -> Result<String, Token>

prints the content of a block as Datalog source code

source

pub fn seal(&self) -> Result<UnverifiedBiscuit, Token>

creates a sealed version of the token

sealed tokens cannot be attenuated

source

pub fn third_party_request(&self) -> Result<ThirdPartyRequest, Token>

source

pub fn append_third_party(&self, slice: &[u8]) -> Result<Self, Token>

source

pub fn append_third_party_base64<T>(&self, slice: T) -> Result<Self, Token>
where T: AsRef<[u8]>,

Trait Implementations§

source§

impl Clone for UnverifiedBiscuit

source§

fn clone(&self) -> UnverifiedBiscuit

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for UnverifiedBiscuit

source§

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

Formats the value using the given formatter. Read more

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> 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

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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>,

§

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