// ╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗╔═══════╗ // ╚══╗ ╔══╝║ ╔╗ ╔╗ ║║ ╔═══╗ ║║ ╔═══╗ ║║ ╔═══╗ ║╚══╗ ╔══╝║ ╔═════╝ // ║ ║ ║ ║║ ║║ ║║ ╚═══╝ ║║ ║ ║ ║║ ╚═══╝ ║ ║ ║ ║ ╚═════╗ // ║ ║ ║ ║║ ║║ ║║ ╔═════╝║ ║ ║ ║║ ╔═╗ ╔═╝ ║ ║ ╚═════╗ ║ // ╔══╝ ╚══╗║ ║║ ║║ ║║ ║ ║ ╚═══╝ ║║ ║ ║ ╚═╗ ║ ║ ╔═════╝ ║ // ╚═══════╝╚═╝╚═╝╚═╝╚═╝ ╚═══════╝╚═╝ ╚═══╝ ╚═╝ ╚═══════╝ import * as requestTypings from '../../typings/request-typings.js'; import * as requestErrors from '../../errors/request-errors.js'; import * as credentialModule from '../../../credential/credential-module.js'; import * as hostnameModule from '../../../hostname/hostname-module.js'; import * as tokenModule from '../../../token/token-module.js'; import * as utilityEngine from '@xyz.warpmatter.com/utility-engine'; // ╔═══════╗╔═══════╗╔════╗╔═╗╔═══════╗╔═══════╗╔════╗╔═╗╔═══════╗ // ║ ╔═════╝║ ╔═══╗ ║║ ╔╗ ║║ ║╚══╗ ╔══╝║ ╔═════╝╚══╗ ║║ ║╚══╗ ╔══╝ // ║ ║ ║ ║ ║ ║║ ║║ ║║ ║ ║ ║ ║ ╚═════╗╔══╝ ╚╝ ║ ║ ║ // ║ ║ ║ ║ ║ ║║ ║║ ║║ ║ ║ ║ ║ ╔═════╝║ ╔╗ ╔══╝ ║ ║ // ║ ╚═════╗║ ╚═══╝ ║║ ║║ ╚╝ ║ ║ ║ ║ ╚═════╗║ ║║ ╚══╗ ║ ║ // ╚═══════╝╚═══════╝╚═╝╚════╝ ╚═╝ ╚═══════╝╚═╝╚════╝ ╚═╝ export function validateRequestContext(value: any) { if (!isValidRequestContext(value)) { requestErrors.throwInvalidAbsorbLmsRequestContextError(); } } export function isValidRequestContext( value: any, ): value is requestTypings.RequestContext { return utilityEngine.isObjectLiteral(value) && tokenModule.isValidToken(value.token) && hostnameModule.isValidHostname(value.hostname) && credentialModule.isValidPrivateKey(value.privateKey); }