"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateRandomPin = generateRandomPin;
exports.validatePinCode = validatePinCode;
const AppletSecurityError_1 = __importDefault(require("../../Error/AppletSecurityError"));
const ErrorCodes_1 = __importDefault(require("../../../FrontApplet/Error/ErrorCodes"));
const ErrorSuggestions_1 = __importDefault(require("../../../FrontApplet/Error/ErrorSuggestions"));
function generateRandomPin() {
    return Math.floor(Math.random() * 1e4)
        .toString()
        .padStart(4, '0');
}
function validatePinCode(pinCode) {
    if (!pinCode.match(/^\d{4}$/)) {
        throw new AppletSecurityError_1.default({
            kind: 'appletSecurityError',
            message: `Invalid PIN code: ${pinCode}`,
            code: ErrorCodes_1.default.SECURITY_PIN_CODE_INVALID,
            suggestion: ErrorSuggestions_1.default.SECURITY_PIN_CODE_FORMAT,
        });
    }
}
//# sourceMappingURL=SecurityHelper.js.map