All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xyz.stratalab.sdk.models.box.AttestationValidator.scala Maven / Gradle / Ivy

The newest version!
package xyz.stratalab.sdk.models.box

object AttestationValidator extends scalapb.validate.Validator[xyz.stratalab.sdk.models.box.Attestation] {
  def validate(input: xyz.stratalab.sdk.models.box.Attestation): scalapb.validate.Result =
    scalapb.validate.Result.optional(input.value.predicate) { _value =>
      xyz.stratalab.sdk.models.box.AttestationValidator.PredicateValidator.validate(_value)
    } &&
    scalapb.validate.Result.optional(input.value.image) { _value =>
      xyz.stratalab.sdk.models.box.AttestationValidator.ImageValidator.validate(_value)
    } &&
    scalapb.validate.Result.optional(input.value.commitment) { _value =>
      xyz.stratalab.sdk.models.box.AttestationValidator.CommitmentValidator.validate(_value)
    }
  
  object PredicateValidator extends scalapb.validate.Validator[xyz.stratalab.sdk.models.box.Attestation.Predicate] {
    def validate(input: xyz.stratalab.sdk.models.box.Attestation.Predicate): scalapb.validate.Result =
      xyz.stratalab.sdk.models.box.LockValidator.PredicateValidator.validate(input.lock) &&
      scalapb.validate.Result.repeated(input.responses.iterator) { _value =>
        quivr.models.ProofValidator.validate(_value)
      }
    
  }
  object ImageValidator extends scalapb.validate.Validator[xyz.stratalab.sdk.models.box.Attestation.Image] {
    def validate(input: xyz.stratalab.sdk.models.box.Attestation.Image): scalapb.validate.Result =
      xyz.stratalab.sdk.models.box.LockValidator.ImageValidator.validate(input.lock) &&
      scalapb.validate.Result.repeated(input.known.iterator) { _value =>
        xyz.stratalab.sdk.models.box.ChallengeValidator.validate(_value)
      } &&
      scalapb.validate.Result.repeated(input.responses.iterator) { _value =>
        quivr.models.ProofValidator.validate(_value)
      }
    
  }
  object CommitmentValidator extends scalapb.validate.Validator[xyz.stratalab.sdk.models.box.Attestation.Commitment] {
    def validate(input: xyz.stratalab.sdk.models.box.Attestation.Commitment): scalapb.validate.Result =
      xyz.stratalab.sdk.models.box.LockValidator.CommitmentValidator.validate(input.lock) &&
      scalapb.validate.Result.repeated(input.known.iterator) { _value =>
        xyz.stratalab.sdk.models.box.ChallengeValidator.validate(_value)
      } &&
      scalapb.validate.Result.repeated(input.witness.iterator) { _value =>
        quivr.models.WitnessValidator.validate(_value)
      } &&
      scalapb.validate.Result.repeated(input.responses.iterator) { _value =>
        quivr.models.ProofValidator.validate(_value)
      }
    
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy