CONST_EQUALS

Performs a timing-safe comparison of two strings using OpenSSL.fixed_length_secure_compare. Returns true if the strings are identical, false otherwise. If objects that are not strings are passed in, they are stringified before comparison This method helps prevent timing attacks when comparing sensitive values like tokens or signatures. Please note that this formula is not resistant to timing attacks to determine secret length.

Syntax 

CONST_EQUALS(string1, string2)

Usage examples 

Example 1

Input

1
{
2
"my_action": {
3
"input": "secret_token",
4
"expected": "secret_token"
5
}
6
}

Formula

CONST_EQUALS(my_action.input, my_action.expected)

Output

true

Example 2

Input

1
{
2
"my_action": {
3
"input": "wrong_token",
4
"expected": "secret_token"
5
}
6
}

Formula

CONST_EQUALS(my_action.input, my_action.expected)

Output

false

Sample Actions 

Transform
My Action
Transform
CONST_EQUALS

Select an action to inspect

You can also click "Copy actions" and paste them in your Tines story to see how they work.

Was this helpful?