/**
 * modules/auth/pinLogin.js — Validación de PIN (PBKDF2).
 */
(function (g) {
    g.modules = g.modules || {};
    g.modules.auth = g.modules.auth || {};

    var crypto = g.modules.core.crypto;

    g.modules.auth.pinLogin = {
        verify: async function (user, pin) {
            if (!user || !user.pinHash) return false;
            var h = await crypto.hashSecret(String(pin || ''), user.pinSalt);
            return crypto.timingSafeEqualB64(h, user.pinHash);
        },
    };
})(typeof window !== 'undefined' ? window : this);
