(a: string, b: string)
| 11 | * timing does not leak the length mismatch. |
| 12 | */ |
| 13 | export function timingSafeEqual(a: string, b: string): boolean { |
| 14 | const bufA = Buffer.from(a); |
| 15 | const bufB = Buffer.from(b); |
| 16 | |
| 17 | if (bufA.length !== bufB.length) { |
| 18 | nodeTimingSafeEqual(bufA, bufA); |
| 19 | return false; |
| 20 | } |
| 21 | |
| 22 | return nodeTimingSafeEqual(bufA, bufB); |
| 23 | } |
no outgoing calls
no test coverage detected