UNPKG

aegis-auth

Version:

A credentials-based auth solution for Next.js (and other Node projects) with IP rate-limiting, account lockouts, and sessions in DB.

13 lines 429 B
export function timingSafeEqual(a, b) { const aBuffer = a instanceof Uint8Array ? a : new Uint8Array(a); const bBuffer = b instanceof Uint8Array ? b : new Uint8Array(b); if (aBuffer.length !== bBuffer.length) { return false; } let result = 0; for (let i = 0; i < aBuffer.length; i++) { result |= aBuffer[i] ^ bBuffer[i]; } return result === 0; } //# sourceMappingURL=compare.js.map