UNPKG

@waku/rln

Version:

RLN (Rate Limiting Nullifier) implementation for Waku

21 lines (18 loc) 640 B
import { Credential } from './credential_validation_generated.js'; import { Keystore } from './keystore_validation_generated.js'; const _validateKeystore = Keystore; const _validateCredential = Credential; function schemaValidationErrors(validator, data) { const validated = validator(data); if (validated) { return null; } return validator.errors; } function isKeystoreValid(keystore) { return !schemaValidationErrors(_validateKeystore, keystore); } function isCredentialValid(credential) { return !schemaValidationErrors(_validateCredential, credential); } export { isCredentialValid, isKeystoreValid };