create_token_with_time

Function create_token_with_time 

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

Creates a biscuit token with custom time configuration.

This function creates a base64-encoded token string that grants the specified operation on the resource for the given subject with custom time settings.

§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 - Time configuration for token validity

§Returns

  • Ok(String) - The base64-encoded token if successful
  • Err(Box<dyn Error>) - If token creation fails