Skip to content

Commit

Permalink
fix ProofType naming for V3
Browse files Browse the repository at this point in the history
  • Loading branch information
volodymyr-basiuk committed Nov 20, 2023
1 parent dffd68a commit 0e13eb3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions credentialAtomicQueryV3.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
type ProofType string

const (
SigProotType ProofType = "sig"
MTPProofType ProofType = "mtp"
BJJSignatureProofType ProofType = "BJJSignature2021"
Iden3SparseMerkleProofType ProofType = "Iden3SparseMerkleProof"
)

// AtomicQueryV3Inputs ZK private inputs for credentialAtomicQuerySig.circom
Expand Down Expand Up @@ -128,7 +128,7 @@ func (a AtomicQueryV3Inputs) Validate() error {
}

switch a.ProofType {
case SigProotType:
case BJJSignatureProofType:
if a.Claim.SignatureProof == nil {
return errors.New(ErrorEmptySignatureProof)
}
Expand All @@ -144,7 +144,7 @@ func (a AtomicQueryV3Inputs) Validate() error {
if a.Claim.SignatureProof.Signature == nil {
return errors.New(ErrorEmptyClaimSignature)
}
case MTPProofType:
case Iden3SparseMerkleProofType:
if a.Claim.IncProof == nil {
return errors.New(ErrorEmptyMTPProof)
}
Expand Down Expand Up @@ -217,7 +217,7 @@ func (a AtomicQueryV3Inputs) InputsMarshal() ([]byte, error) {
}

switch a.ProofType {
case SigProotType:
case BJJSignatureProofType:
s.ProofType = "1"

if a.Claim.SignatureProof == nil {
Expand All @@ -244,7 +244,7 @@ func (a AtomicQueryV3Inputs) InputsMarshal() ([]byte, error) {
s.IssuerAuthState = a.Claim.SignatureProof.IssuerAuthIncProof.TreeState.State

a.fillMTPProofsWithZero(&s)
case MTPProofType:
case Iden3SparseMerkleProofType:
s.ProofType = "2"

if a.Claim.IncProof == nil {
Expand Down
8 changes: 4 additions & 4 deletions credentialAtomicQueryV3OnChain.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (a AtomicQueryV3OnChainInputs) Validate() error {
}

switch a.ProofType {
case SigProotType:
case BJJSignatureProofType:
if a.Claim.SignatureProof == nil {
return errors.New(ErrorEmptySignatureProof)
}
Expand All @@ -200,7 +200,7 @@ func (a AtomicQueryV3OnChainInputs) Validate() error {
if a.Claim.SignatureProof.Signature == nil {
return errors.New(ErrorEmptyClaimSignature)
}
case MTPProofType:
case Iden3SparseMerkleProofType:
if a.Claim.IncProof == nil {
return errors.New(ErrorEmptyMTPProof)
}
Expand Down Expand Up @@ -290,7 +290,7 @@ func (a AtomicQueryV3OnChainInputs) InputsMarshal() ([]byte, error) {
}

switch a.ProofType {
case SigProotType:
case BJJSignatureProofType:
s.ProofType = "1"

if a.Claim.SignatureProof == nil {
Expand All @@ -317,7 +317,7 @@ func (a AtomicQueryV3OnChainInputs) InputsMarshal() ([]byte, error) {
s.IssuerAuthState = a.Claim.SignatureProof.IssuerAuthIncProof.TreeState.State

a.fillMTPProofsWithZero(&s)
case MTPProofType:
case Iden3SparseMerkleProofType:
s.ProofType = "2"

if a.Claim.IncProof == nil {
Expand Down
4 changes: 2 additions & 2 deletions credentialAtomicQueryV3OnChain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func TestAttrQueryV3OnChain_SigPart_PrepareInputs(t *testing.T) {
SlotIndex: 2,
},
CurrentTimeStamp: timestamp,
ProofType: SigProotType,
ProofType: BJJSignatureProofType,
AuthClaim: user.AuthClaim,
AuthClaimIncMtp: authClaimIncMTP,
AuthClaimNonRevMtp: authClaimNonRevMTP,
Expand Down Expand Up @@ -183,7 +183,7 @@ func TestAttrQueryV3OnChain_MTPPart_PrepareInputs(t *testing.T) {
SlotIndex: 2,
},
CurrentTimeStamp: timestamp,
ProofType: MTPProofType,
ProofType: Iden3SparseMerkleProofType,
AuthClaim: user.AuthClaim,
AuthClaimIncMtp: authClaimIncMTP,
AuthClaimNonRevMtp: authClaimNonRevMTP,
Expand Down
4 changes: 2 additions & 2 deletions credentialAtomicQueryV3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestAttrQueryV3_SigPart_PrepareInputs(t *testing.T) {
SlotIndex: 2,
},
CurrentTimeStamp: timestamp,
ProofType: SigProotType,
ProofType: BJJSignatureProofType,
LinkNonce: big.NewInt(0),
VerifierID: it.IDFromStr(
t, "21929109382993718606847853573861987353620810345503358891473103689157378049"),
Expand Down Expand Up @@ -146,7 +146,7 @@ func TestAttrQueryV3_MTPPart_PrepareInputs(t *testing.T) {
SlotIndex: 2,
},
CurrentTimeStamp: timestamp,
ProofType: MTPProofType,
ProofType: Iden3SparseMerkleProofType,
LinkNonce: big.NewInt(0),
VerifierID: it.IDFromStr(
t, "21929109382993718606847853573861987353620810345503358891473103689157378049"),
Expand Down

0 comments on commit 0e13eb3

Please sign in to comment.