// ╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗ // ╚══╗ ╔══╝║ ╔╗ ╔╗ ║║ ╔═══╗ ║║ ╔═══╗ ║║ ╔═══╗ ║╚══╗ ╔══╝║ ╔═════╝ // ║ ║ ║ ║║ ║║ ║║ ╚═══╝ ║║ ║ ║ ║║ ╚═══╝ ║ ║ ║ ║ ╚═════╗ // ║ ║ ║ ║║ ║║ ║║ ╔═════╝║ ║ ║ ║║ ╔═╗ ╔═╝ ║ ║ ╚═════╗ ║ // ╔══╝ ╚══╗║ ║║ ║║ ║║ ║ ║ ╚═══╝ ║║ ║ ║ ╚═╗ ║ ║ ╔═════╝ ║ // ╚═══════╝╚═╝╚═╝╚═╝╚═╝ ╚═══════╝╚═╝ ╚═══╝ ╚═╝ ╚═══════╝ import * as credentialErrors from '../errors/credential-errors.js'; import * as utilityEngine from '@xyz.warpmatter.com/utility-engine'; // ╔═══════╗╔═══════╗╔═══════╗╔═╗ ╔═╗╔═══════╗╔═══════╗╔═══════╗ ╔═╗ ╔═╗ ╔═══════╗╔═╗ ╔═╗ // ║ ╔═══╗ ║║ ╔═══╗ ║╚══╗ ╔══╝║ ║ ║ ║║ ╔═══╗ ║╚══╗ ╔══╝║ ╔═════╝ ║ ║ ║ ║ ║ ╔═════╝║ ║ ║ ║ // ║ ╚═══╝ ║║ ╚═══╝ ║ ║ ║ ║ ╚╗ ╔╝ ║║ ╚═══╝ ║ ║ ║ ║ ╚═════╗╔═══════╗║ ╚═╝ ╚═╗║ ╚═════╗║ ╚═══╝ ║ // ║ ╔═════╝║ ╔═╗ ╔═╝ ║ ║ ╚╗ ║ ║ ╔╝║ ╔═══╗ ║ ║ ║ ║ ╔═════╝╚═══════╝║ ╔═══╗ ║║ ╔═════╝╚═════╗ ║ // ║ ║ ║ ║ ║ ╚═╗╔══╝ ╚══╗ ║ ╚═╝ ║ ║ ║ ║ ║ ║ ║ ║ ╚═════╗ ║ ║ ║ ║║ ╚═════╗╔═════╝ ║ // ╚═╝ ╚═╝ ╚═══╝╚═══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝╚═══════╝╚═══════╝ export function validatePrivateKey(value: any) { if (!isValidPrivateKey(value)) { credentialErrors.throwInvalidAbsorbLmsCredentialPrivateKeyError(); } } export function isValidPrivateKey(value: any): value is string { return utilityEngine.isFilledString(value); } // ╔═╗ ╔═╗╔═══════╗╔═══════╗╔═══════╗╔════╗╔═╗╔═══════╗╔═══════╗╔═══════╗ // ║ ║ ║ ║║ ╔═════╝║ ╔═════╝║ ╔═══╗ ║║ ╔╗ ║║ ║║ ╔═══╗ ║║ ╔╗ ╔╗ ║║ ╔═════╝ // ║ ║ ║ ║║ ╚═════╗║ ╚═════╗║ ╚═══╝ ║║ ║║ ║║ ║║ ╚═══╝ ║║ ║║ ║║ ║║ ╚═════╗ // ║ ║ ║ ║╚═════╗ ║║ ╔═════╝║ ╔═╗ ╔═╝║ ║║ ║║ ║║ ╔═══╗ ║║ ║║ ║║ ║║ ╔═════╝ // ║ ╚═══╝ ║╔═════╝ ║║ ╚═════╗║ ║ ║ ╚═╗║ ║║ ╚╝ ║║ ║ ║ ║║ ║║ ║║ ║║ ╚═════╗ // ╚═══════╝╚═══════╝╚═══════╝╚═╝ ╚═══╝╚═╝╚════╝╚═╝ ╚═╝╚═╝╚═╝╚═╝╚═══════╝ export function validateUsername(value: any) { if (!isValidUsername(value)) { credentialErrors.throwInvalidAbsorbLmsCredentialUsernameError(); } } export function isValidUsername(value: any): value is string { return utilityEngine.isFilledString(value); } // ╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═╗╔═╗╔═╗╔═══════╗╔═══════╗╔═══════╗ // ║ ╔═══╗ ║║ ╔═══╗ ║║ ╔═════╝║ ╔═════╝║ ║║ ║║ ║║ ╔═══╗ ║║ ╔═══╗ ║╚╗ ╔══╗ ║ // ║ ╚═══╝ ║║ ╚═══╝ ║║ ╚═════╗║ ╚═════╗║ ║║ ║║ ║║ ║ ║ ║║ ╚═══╝ ║ ║ ║ ║ ║ // ║ ╔═════╝║ ╔═══╗ ║╚═════╗ ║╚═════╗ ║║ ║║ ║║ ║║ ║ ║ ║║ ╔═╗ ╔═╝ ║ ║ ║ ║ // ║ ║ ║ ║ ║ ║╔═════╝ ║╔═════╝ ║║ ╚╝ ╚╝ ║║ ╚═══╝ ║║ ║ ║ ╚═╗╔╝ ╚══╝ ║ // ╚═╝ ╚═╝ ╚═╝╚═══════╝╚═══════╝╚═══════╝╚═══════╝╚═╝ ╚═══╝╚═══════╝ export function validatePassword(value: any) { if (!isValidPassword(value)) { credentialErrors.throwInvalidAbsorbLmsCredentialPasswordError(); } } export function isValidPassword(value: any): value is string { return utilityEngine.isFilledString(value); }