create_token

Function create_token 

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

Creates a biscuit token with default time configuration.

This function creates a base64-encoded token string that grants the specified operation on the 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

§Returns

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