MCPcopy Create free account
hub / github.com/CommE2E/comm / checkInputValidator

Function checkInputValidator

keyserver/src/utils/validation-utils.js:90–106  ·  view source on GitHub ↗
(
  inputValidator: TType<T>,
  input: mixed,
  source: string,
)

Source from the content-addressed store, hash-verified

88}
89
90function checkInputValidator<T>(
91 inputValidator: TType<T>,
92 input: mixed,
93 source: string,
94): T {
95 if (inputValidator.is(input)) {
96 return assertWithValidator(input, inputValidator);
97 }
98 const error = new ServerError('invalid_parameters');
99 try {
100 error.sanitizedInput = input ? sanitizeInput(inputValidator, input) : null;
101 } catch {
102 error.sanitizedInput = null;
103 }
104 console.log(`failed input validation on ${source}`);
105 throw error;
106}
107
108async function checkClientSupported<T>(
109 viewer: Viewer,

Callers 3

SocketClass · 0.90
validateInputFunction · 0.85

Calls 3

assertWithValidatorFunction · 0.90
sanitizeInputFunction · 0.85
logMethod · 0.45

Tested by

no test coverage detected