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

Function validateOutput

keyserver/src/utils/validation-utils.js:63–88  ·  view source on GitHub ↗
(
  platformDetails: ?PlatformDetails,
  outputValidator: TType<T>,
  data: T,
)

Source from the content-addressed store, hash-verified

61}
62
63async function validateOutput<T>(
64 platformDetails: ?PlatformDetails,
65 outputValidator: TType<T>,
66 data: T,
67): Promise<T> {
68 if (!outputValidator.is(data)) {
69 console.trace(
70 'Output validation failed, validator is:',
71 outputValidator.displayName,
72 );
73 return data;
74 }
75
76 const keyserverID = await thisKeyserverID();
77
78 if (
79 hasMinStateVersion(platformDetails, {
80 native: 43,
81 web: 3,
82 })
83 ) {
84 return convertServerIDsToClientIDs(keyserverID, outputValidator, data);
85 }
86
87 return data;
88}
89
90function checkInputValidator<T>(
91 inputValidator: TType<T>,

Callers 13

createJSONResponderFunction · 0.90
prepareAPNsNotificationFunction · 0.90
prepareWebNotificationFunction · 0.90
prepareWNSNotificationFunction · 0.90
prepareIOSNotificationFunction · 0.90
getServerInfoHashFunction · 0.90
getServerInfoHashFunction · 0.90
getHashFunction · 0.90
getServerInfoHashFunction · 0.90

Calls 3

thisKeyserverIDFunction · 0.90
hasMinStateVersionFunction · 0.90

Tested by

no test coverage detected