Struct biscuit_auth::UnverifiedBiscuit
source · [−]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
sourceimpl UnverifiedBiscuit
impl UnverifiedBiscuit
sourcepub fn from<T>(slice: T) -> Result<Self, Token> where
T: AsRef<[u8]>,
pub fn from<T>(slice: T) -> Result<Self, Token> where
T: AsRef<[u8]>,
deserializes a token from raw bytes
sourcepub fn from_base64<T>(slice: T) -> Result<Self, Token> where
T: AsRef<[u8]>,
pub fn from_base64<T>(slice: T) -> Result<Self, Token> where
T: AsRef<[u8]>,
deserializes a token from base64
sourcepub fn check_signature<F>(self, f: F) -> Result<Biscuit, Format> where
F: Fn(Option<u32>) -> PublicKey,
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
sourcepub fn append(&self, block_builder: BlockBuilder) -> Result<Self, Token>
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
sourcepub fn to_base64(&self) -> Result<String, Token>
pub fn to_base64(&self) -> Result<String, Token>
serializes the token and encode it to a (URL safe) base64 string
sourcepub fn create_block(&self) -> BlockBuilder
pub fn create_block(&self) -> BlockBuilder
creates a new block builder
sourcepub fn from_with_symbols(
slice: &[u8],
symbols: SymbolTable
) -> Result<Self, Token>
pub fn from_with_symbols(
slice: &[u8],
symbols: SymbolTable
) -> Result<Self, Token>
deserializes from raw bytes with a custom symbol table
sourcepub fn from_base64_with_symbols<T>(
slice: T,
symbols: SymbolTable
) -> Result<Self, Token> where
T: AsRef<[u8]>,
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
sourcepub fn append_with_keypair(
&self,
keypair: &KeyPair,
block_builder: BlockBuilder
) -> Result<Self, Token>
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
sourcepub fn revocation_identifiers(&self) -> Vec<Vec<u8>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn revocation_identifiers(&self) -> Vec<Vec<u8>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
returns a list of revocation identifiers for each block, in order
if a token is generated with the same keys and the same content, those identifiers will stay the same
sourcepub fn block_count(&self) -> usize
pub fn block_count(&self) -> usize
returns the number of blocks (at least 1)
sourcepub fn print_block_source(&self, index: usize) -> Option<String>
pub fn print_block_source(&self, index: usize) -> Option<String>
prints the content of a block as Datalog source code
Trait Implementations
sourceimpl Clone for UnverifiedBiscuit
impl Clone for UnverifiedBiscuit
sourcefn clone(&self) -> UnverifiedBiscuit
fn clone(&self) -> UnverifiedBiscuit
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
Auto Trait Implementations
impl RefUnwindSafe for UnverifiedBiscuit
impl Send for UnverifiedBiscuit
impl Sync for UnverifiedBiscuit
impl Unpin for UnverifiedBiscuit
impl UnwindSafe for UnverifiedBiscuit
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more