From 41daf9f7a7abd125ea7b93fa1f54248d8639c5c8 Mon Sep 17 00:00:00 2001 From: vmidyllic <74898029+vmidyllic@users.noreply.github.com> Date: Fri, 15 Dec 2023 16:04:00 +0200 Subject: [PATCH] rename group id --- pubsignals/atomicV3.go | 10 ++++------ pubsignals/query.go | 28 +--------------------------- 2 files changed, 5 insertions(+), 33 deletions(-) diff --git a/pubsignals/atomicV3.go b/pubsignals/atomicV3.go index ae09247..bc48103 100644 --- a/pubsignals/atomicV3.go +++ b/pubsignals/atomicV3.go @@ -88,11 +88,9 @@ func (c *AtomicQueryV3) VerifyQuery( if c.NullifierSessionID.Cmp(nullifierSessionID) != 0 { return errors.Errorf("wrong verifier session id is used for nullification: expected %s given %s,", nullifierSessionID.String(), c.NullifierSessionID.String()) } - } else { + } else if c.NullifierSessionID != nil && c.NullifierSessionID.Int64() != 0 { // if no nullifierSessionID in params - we need to verify that nullifier is zero - if c.NullifierSessionID != nil && c.NullifierSessionID.Int64() != 0 { - return errors.New("nullfifier id is generated but wasn't requested") - } + return errors.New("nullfifier id is generated but wasn't requested") } } @@ -105,8 +103,8 @@ func (c *AtomicQueryV3) VerifyQuery( } - if query.LinkSessionID != "" && c.LinkID == nil { - return errors.New("proof doesn't contain link id, but link session id is provided") + if query.GroupID != 0 && c.LinkID == nil { + return errors.New("proof doesn't contain link id, but group id is provided") } return nil diff --git a/pubsignals/query.go b/pubsignals/query.go index 096629d..b0168c5 100644 --- a/pubsignals/query.go +++ b/pubsignals/query.go @@ -68,7 +68,7 @@ type Query struct { ClaimID string `json:"claimId,omitempty"` SkipClaimRevocationCheck bool `json:"skipClaimRevocationCheck,omitempty"` ProofType string `json:"proofType"` - LinkSessionID string `json:"linkSessionId"` + GroupID int `json:"groupId"` } // CircuitOutputs pub signals from circuit. @@ -368,32 +368,6 @@ func (q Query) verifyEmptyCredentialSubject( return nil } -// func verifyLinkID(linkNonce string, claim *core.Claim, linkId string) error { -// linkIdCalc, err := CalculateLinkID(linkNonce, claim) -// if err != nil { -// return errors.Errorf("failed to calculate link ID: %v", err) -// } - -// if linkId != linkIdCalc { -// return errors.Errorf("invalid link ID") -// } - -// return nil -// } - -// func verifyNullify(genesisID, claimSubjectProfileNonce, claimSchema, fieldValue, verifierID, crs, operatorOutput *big.Int) error { -// nullify, err := CalculateNullify(genesisID, claimSubjectProfileNonce, claimSchema, fieldValue, verifierID, crs) -// if err != nil { -// return errors.Errorf("failed to calculate nullify: %v", err) -// } - -// if nullify != operatorOutput.String() { -// return errors.Errorf("invalid nullify value") -// } - -// return nil -// } - func (q Query) isSelectivityDisclosure( predicate map[string]interface{}) bool { return q.CredentialSubject != nil && len(predicate) == 0