TypeScript API / laikacms/crypto / constantTimeEqual
Function: constantTimeEqual()
ts
function constantTimeEqual(a, b): Promise<boolean>;Constant-time string comparison to prevent timing attacks. Uses HMAC comparison - if two values produce the same HMAC with the same key, they are equal.
Parameters
| Parameter | Type | Description |
|---|---|---|
a | string | First string to compare |
b | string | Second string to compare |
Returns
Promise<boolean>
true if strings are equal, false otherwise