Skip to content

Commit

Permalink
AuthEnabled logic in Validate (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
volodymyr-basiuk committed Nov 21, 2023
1 parent 20a5243 commit ec8abd8
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions credentialAtomicQueryV3OnChain.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,24 +163,26 @@ func (a AtomicQueryV3OnChainInputs) Validate() error {
return errors.New(ErrorEmptyQueryValue)
}

if a.AuthClaimIncMtp == nil && a.AuthEnabled == 1 {
return errors.New(ErrorEmptyAuthClaimProof)
}
if a.AuthEnabled == 1 {
if a.AuthClaimIncMtp == nil {
return errors.New(ErrorEmptyAuthClaimProof)
}

if a.AuthClaimNonRevMtp == nil && a.AuthEnabled == 1 {
return errors.New(ErrorEmptyAuthClaimNonRevProof)
}
if a.AuthClaimNonRevMtp == nil {
return errors.New(ErrorEmptyAuthClaimNonRevProof)
}

if a.GISTProof.Proof == nil {
return errors.New(ErrorEmptyGISTProof)
}
if a.GISTProof.Proof == nil {
return errors.New(ErrorEmptyGISTProof)
}

if a.Signature == nil {
return errors.New(ErrorEmptyChallengeSignature)
}
if a.Signature == nil {
return errors.New(ErrorEmptyChallengeSignature)
}

if a.Challenge == nil {
return errors.New(ErrorEmptyChallenge)
if a.Challenge == nil {
return errors.New(ErrorEmptyChallenge)
}
}

switch a.ProofType {
Expand Down

0 comments on commit ec8abd8

Please sign in to comment.