"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SHA256_HEX_LENGTH = void 0;
exports.timingSafeEqualHex = timingSafeEqualHex;
exports.hmacSha256Hex = hmacSha256Hex;
exports.hexPrefix = hexPrefix;
const crypto_1 = require("crypto");
exports.SHA256_HEX_LENGTH = 64;
function timingSafeEqualHex(aHex, bHex) {
    try {
        const a = Buffer.from(aHex, 'hex');
        const b = Buffer.from(bHex, 'hex');
        if (a.length !== b.length)
            return false;
        return (0, crypto_1.timingSafeEqual)(a, b);
    }
    catch {
        return false;
    }
}
function hmacSha256Hex(secret, message) {
    return (0, crypto_1.createHmac)('sha256', secret).update(message, 'utf8').digest('hex');
}
function hexPrefix(hex, length) {
    return hex.slice(0, length);
}
//# sourceMappingURL=has-token.js.map