Function specifications::policy::generate_policy_token

source ·
pub fn generate_policy_token(
    initiator: impl AsRef<str>,
    system: impl AsRef<str>,
    exp: Duration,
    secret_path: impl AsRef<Path>,
) -> Result<String, Error>
Expand description

Generates a new access token for the checker.

§Arguments

  • initiator: The name of the person performing the request, to embed in the token.
  • system: The name or identifier of the node or other entity through which the request is performed, to embed in the token.
  • exp: The duration the token will be valid for.
  • secret_path: The path to the policy_secret.json file to use to sign the token with.

§Returns

The generate JSON Web Token (JWT) as a String.

§Errors

This function may error if we encountered any I/O errors.