Skip to main content

/images/icons/xs_temp.svg Generate UUID

    security.create_uuid as $myVariable
ParameterPurposeExample
$myVariableThis is the variable you want to store the generated value in.$myVariable
    security.create_uuid as $myVariable

/images/icons/xs_temp.svg Create Authentication Token

    security.create_auth_token {
      table = "users"
      extras = { "role": "admin" }
      expiration = 86400
      id = 1
    } as $authToken
ParameterPurposeExample
dbtableThe ID of the database table that has authentication enabled”97”
extrasA JSON object that contains any extra information you want to include in the token
    ’{“role”:“admin”}‘|json_decode
expirationThe time in seconds that the token should remain valid86400
idThe ID of the record to use to generate the authentication token1
asThe variable to store the generated token in$authToken
    security.create_auth_token {
      table = "users"
      extras = { "role": "admin" }
      expiration = 86400
      id = 1
    } as $authToken

/images/icons/xs_temp.svg Validate Password

    security.check_password {
      text_password = "textPassword"
      hash_password = "hashedPassword"
    } as $tokenValidate
ParameterPurposeExample
text_passwordThe text version of the password to check”textPassword”
$textPassword
hash_passwordThe hashed version of the password to check, usually coming from a database table”hashedPassword”
$user1.password
    security.check_password {
      text_password = "textPassword"
      hash_password = "hashedPassword"
    } as tokenValidate

/images/icons/xs_temp.svg Generate Password

    security.create_password {
      character_count = 12
      require_lowercase = true
      require_uppercase = true
      require_digit = true
      require_symbol = true
      symbol_whitelist = "$#%&"
    } as $generatedPassword
ParameterPurposeExample
character_countThe length of the generated password12
require_lowercase
require_uppercase
require_digit
require_symbol
Various specifications for the generated password
require_lowercase = true
require_uppercase = true
require_digit = true
require_symbol = true
symbol_whitelistIf you require symbols in your generated password, whitelist the allowed symbols here.
symbol_whitelist = ”$#%&“
asThe variable that you want to store the generated password.generatedPassword
    security.create_password {
      character_count = 12
      require_lowercase = true
      require_uppercase = true
      require_digit = true
      require_symbol = true
      symbol_whitelist = "$#%&"
    } as generatedPassword

/images/icons/xs_temp.svg Generate Random Number

    security.random_number {
      min = 0
      max = 9007199254740991
    } as $randomNumber
ParameterPurposeExample
minThe beginning of the range for the randomly generated number0
maxThe end of the range for the randomly generated number10000
asThe variable that you want to store the generated numberrandomNumber
    security.random_number {
      min = 0
      max = 9007199254740991
    } as randomNumber

/images/icons/xs_temp.svg Generate Random Bytes

    security.random_bytes {
      length = 16
    } as $randomBytes
ParameterPurposeExample
lengthThe length of the string you’d like to generate16
asThe variable that you want to store the random bytes generatedrandomBytes
    security.random_bytes {
      length = 16
    } as randomBytes

/images/icons/xs_temp.svg Create Secret Key

    security.create_secret_key {
      bits = 1024
      format = "object"
    } as $crypto1
ParameterPurposeExample
bitsThe length of the key generated. Common values are 1024, 2048, 4096, etc…1024
formatThe format of the key generated. This can be either object or base64”object”
asThe variable that you want to store the keycrypto1
    security.create_secret_key {
      bits = 1024
      format = "object"
    } as crypto1

/images/icons/xs_temp.svg Create RSA Key

    security.create_rsa_key {
      bits = 1024
      format = "object"
    } as $crypto1
ParameterPurposeExample
bitsThe length of the key generated. Common values are 1024, 2048, 4096, etc…1024
formatThe format of the key generated. This can be either object or base64”object”
asThe variable that you want to store the keycrypto1
    security.create_rsa_key {
      bits = 1024
      format = "object"
    } as crypto1

/images/icons/xs_temp.svg Create Elliptic Curve Key

    security.create_curve_key {
      curve = "P-256"
      format = "object"
    } as $crypto3

/images/icons/xs_temp.svg Encrypt Data

    security.encrypt {
      data = $sensitive_data
      algorithm = "aes-256-cbc"
      key = "encryption_key"
      iv = "init_vector"
    } as $encrypted_data
Encrypts a payload into binary data using the specified algorithm, key, and initialization vector. The result is stored in $encrypted_data.

/images/icons/xs_temp.svg Decrypt Data

    security.decrypt {
      data = $encrypted_data
      algorithm = "aes-256-cbc"
      key = "encryption_key"
      iv = "init_vector"
    } as $decrypted_data
Decrypts a payload back to its original form using the specified algorithm, key, and initialization vector. The result is stored in $decrypted_data.

/images/icons/xs_temp.svg JWS Encode

    security.jws_encode {
      headers = { "alg": "HS256" }
      claims = { "user_id": "123" }
      key = "signing_key"
      signature_algorithm = "HS256"
      ttl = 3600
    } as $signed_token
Encodes a payload as a JSON Web Signature (JWS) token with headers, claims, and a key. The result is stored in $signed_token.

/images/icons/xs_temp.svg JWS Decode

    security.jws_decode {
      token = $jws_token
      key = "signing_key"
      check_claims = { "user_id": "123" }
      signature_algorithm = "HS256"
      timeDrift = 0
    } as $verified_payload
Decodes a JWS token using the key and signature algorithm. The result is stored in $verified_payload.

/images/icons/xs_temp.svg JWE Encode

    security.jwe_encode {
      headers = { "alg": "A256KW" }
      claims = { "data": "secret" }
      key = "encryption_key"
      key_algorithm = "A256KW"
      content_algorithm = "A256GCM"
      ttl = 0
    } as $encrypted_token
Encodes a payload as a JSON Web Encryption (JWE) token with headers, claims, and a key. The result is stored in $encrypted_token.

/images/icons/xs_temp.svg JWE Decode

    security.jwe_decode {
      token = $jwe_token
      key = "decryption_key"
      check_claims = { "iss": "my_app" }
      key_algorithm = "A256KW"
      content_algorithm = "A256GCM"
      timeDrift = 0
    } as $decoded_payload
Decodes a JWE token using the key, key algorithm, and content algorithm. The result is stored in $decoded_payload.
ParameterPurposeExample
curveThe curve applied to the generated key. Can be P-256, P-384, or P-521P-256
formatThe format of the key generated. This can be either object or base64”object”
asThe variable that you want to store the keycrypto3
    security.create_curve_key {
      curve = "P-256"
      format = "object"
    } as crypto3
I