create_biscuit

Function create_biscuit 

Source
pub fn create_biscuit(
    subject: String,
    resource: String,
    operation: String,
    key: KeyPair,
    time_config: TokenTimeConfig,
) -> Result<Vec<u8>, Box<dyn Error>>
Expand description

Creates a new biscuit token with the specified subject and resource.

This function creates a token that grants read and write access to the specified resource for the given subject. The token will be valid for 5 minutes by default.

§Arguments

  • subject - The subject (user) identifier
  • resource - The resource identifier to grant access to
  • operation - The operation to grant access to
  • key - The key pair used to sign the token
  • time_config - Optional time configuration for token validity

§Returns

  • Ok(Vec<u8>) - The binary token data if successful
  • Err(Box<dyn Error>) - If token creation fails