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

Function policiesValidator

keyserver/src/utils/validation-utils.js:214–235  ·  view source on GitHub ↗
(
  viewer: Viewer,
  policies: $ReadOnlyArray<PolicyType>,
)

Source from the content-addressed store, hash-verified

212}
213
214async function policiesValidator(
215 viewer: Viewer,
216 policies: $ReadOnlyArray<PolicyType>,
217) {
218 if (!policies.length || !viewer.loggedIn) {
219 return;
220 }
221 if (!hasMinCodeVersion(viewer.platformDetails, { native: 181 })) {
222 return;
223 }
224
225 const notAcknowledgedPolicies = await fetchNotAcknowledgedPolicies(
226 viewer.id,
227 policies,
228 );
229
230 if (notAcknowledgedPolicies.length) {
231 throw new ServerError('policies_not_accepted', {
232 notAcknowledgedPolicies,
233 });
234 }
235}
236
237export {
238 validateInput,

Callers 3

jsonHandlerFunction · 0.90
SocketClass · 0.90

Calls 2

hasMinCodeVersionFunction · 0.90

Tested by

no test coverage detected