Skip to content

Commit

Permalink
rename verifierSessionID to nullifierSessionID (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
volodymyr-basiuk authored Dec 6, 2023
1 parent 17aa80a commit 08f762e
Show file tree
Hide file tree
Showing 8 changed files with 683 additions and 692 deletions.
18 changes: 9 additions & 9 deletions credentialAtomicQueryV3.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type AtomicQueryV3Inputs struct {

VerifierID *core.ID

VerifierSessionID *big.Int
NullifierSessionID *big.Int
}

// atomicQueryV3CircuitInputs type represents credentialAtomicQueryV3.circom private inputs required by prover
Expand Down Expand Up @@ -110,7 +110,7 @@ type atomicQueryV3CircuitInputs struct {

VerifierID string `json:"verifierID"`

VerifierSessionID string `json:"verifierSessionID"`
NullifierSessionID string `json:"nullifierSessionID"`
}

func (a AtomicQueryV3Inputs) Validate() error {
Expand Down Expand Up @@ -289,9 +289,9 @@ func (a AtomicQueryV3Inputs) InputsMarshal() ([]byte, error) {
s.VerifierID = a.VerifierID.BigInt().String()
}

s.VerifierSessionID = "0"
if a.VerifierSessionID != nil {
s.VerifierSessionID = a.VerifierSessionID.String()
s.NullifierSessionID = "0"
if a.NullifierSessionID != nil {
s.NullifierSessionID = a.NullifierSessionID.String()
}

return json.Marshal(s)
Expand Down Expand Up @@ -344,7 +344,7 @@ type AtomicQueryV3PubSignals struct {
Nullifier *big.Int `json:"nullifier"`
OperatorOutput *big.Int `json:"operatorOutput"`
VerifierID *core.ID `json:"verifierID"`
VerifierSessionID *big.Int `json:"verifierSessionID"`
NullifierSessionID *big.Int `json:"nullifierSessionID"`
}

// PubSignalsUnmarshal unmarshal credentialAtomicQueryV3.circom public signals
Expand All @@ -369,7 +369,7 @@ func (ao *AtomicQueryV3PubSignals) PubSignalsUnmarshal(data []byte) error {
// operator
// value
// verifierID
// verifierSessionID
// nullifierSessionID

// 19 is a number of fields in AtomicQueryV3PubSignals, values length could be
// different base on the circuit configuration. The length could be modified by set value
Expand Down Expand Up @@ -512,8 +512,8 @@ func (ao *AtomicQueryV3PubSignals) PubSignalsUnmarshal(data []byte) error {
}
fieldIdx++

// - VerifierSessionID
if ao.VerifierSessionID, ok = big.NewInt(0).SetString(sVals[fieldIdx], 10); !ok {
// - NullifierSessionID
if ao.NullifierSessionID, ok = big.NewInt(0).SetString(sVals[fieldIdx], 10); !ok {
return fmt.Errorf("invalid verifier session ID: %s", sVals[fieldIdx])
}

Expand Down
18 changes: 9 additions & 9 deletions credentialAtomicQueryV3OnChain.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type AtomicQueryV3OnChainInputs struct {

VerifierID *core.ID

VerifierSessionID *big.Int
NullifierSessionID *big.Int

AuthEnabled int
}
Expand Down Expand Up @@ -144,7 +144,7 @@ type atomicQueryV3OnChainCircuitInputs struct {

VerifierID string `json:"verifierID"`

VerifierSessionID string `json:"verifierSessionID"`
NullifierSessionID string `json:"nullifierSessionID"`

AuthEnabled string `json:"authEnabled"`
}
Expand Down Expand Up @@ -382,9 +382,9 @@ func (a AtomicQueryV3OnChainInputs) InputsMarshal() ([]byte, error) {
s.VerifierID = a.VerifierID.BigInt().String()
}

s.VerifierSessionID = "0"
if a.VerifierSessionID != nil {
s.VerifierSessionID = a.VerifierSessionID.String()
s.NullifierSessionID = "0"
if a.NullifierSessionID != nil {
s.NullifierSessionID = a.NullifierSessionID.String()
}

s.AuthEnabled = strconv.Itoa(a.AuthEnabled)
Expand Down Expand Up @@ -464,7 +464,7 @@ type AtomicQueryV3OnChainPubSignals struct {
Nullifier *big.Int `json:"nullifier"`
OperatorOutput *big.Int `json:"operatorOutput"`
VerifierID *core.ID `json:"verifierID"`
VerifierSessionID *big.Int `json:"verifierSessionID"`
NullifierSessionID *big.Int `json:"nullifierSessionID"`
AuthEnabled int `json:"authEnabled"`
}

Expand All @@ -487,7 +487,7 @@ func (ao *AtomicQueryV3OnChainPubSignals) PubSignalsUnmarshal(data []byte) error
// issuerClaimNonRevState
// timestamp
// verifierID
// verifierSessionID
// nullifierSessionID
// authEnabled

var sVals []string
Expand Down Expand Up @@ -598,8 +598,8 @@ func (ao *AtomicQueryV3OnChainPubSignals) PubSignalsUnmarshal(data []byte) error
}
fieldIdx++

// - VerifierSessionID
if ao.VerifierSessionID, ok = big.NewInt(0).SetString(sVals[fieldIdx], 10); !ok {
// - NullifierSessionID
if ao.NullifierSessionID, ok = big.NewInt(0).SetString(sVals[fieldIdx], 10); !ok {
return fmt.Errorf("invalid verifier session ID: %s", sVals[fieldIdx])
}
fieldIdx++
Expand Down
16 changes: 8 additions & 8 deletions credentialAtomicQueryV3OnChain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ func TestAttrQueryV3OnChain_SigPart_PrepareInputs(t *testing.T) {
LinkNonce: big.NewInt(0),
VerifierID: it.IDFromStr(
t, "21929109382993718606847853573861987353620810345503358891473103689157378049"),
VerifierSessionID: big.NewInt(32),
AuthEnabled: 1,
NullifierSessionID: big.NewInt(32),
AuthEnabled: 1,
}

bytesInputs, err := in.InputsMarshal()
Expand Down Expand Up @@ -197,8 +197,8 @@ func TestAttrQueryV3OnChain_MTPPart_PrepareInputs(t *testing.T) {
LinkNonce: big.NewInt(0),
VerifierID: it.IDFromStr(
t, "21929109382993718606847853573861987353620810345503358891473103689157378049"),
VerifierSessionID: big.NewInt(32),
AuthEnabled: 1,
NullifierSessionID: big.NewInt(32),
AuthEnabled: 1,
}

bytesInputs, err := in.InputsMarshal()
Expand Down Expand Up @@ -270,8 +270,8 @@ func TestAtomicQueryV3OnChainOutputs_Sig_CircuitUnmarshal(t *testing.T) {
Nullifier: big.NewInt(0),
VerifierID: it.IDFromStr(
t, "21929109382993718606847853573861987353620810345503358891473103689157378049"),
VerifierSessionID: big.NewInt(32),
AuthEnabled: 1,
NullifierSessionID: big.NewInt(32),
AuthEnabled: 1,
}

jsonOut, err := json.Marshal(out)
Expand Down Expand Up @@ -343,8 +343,8 @@ func TestAtomicQueryV3OnChainOutputs_MTP_CircuitUnmarshal(t *testing.T) {
Nullifier: big.NewInt(0),
VerifierID: it.IDFromStr(
t, "21929109382993718606847853573861987353620810345503358891473103689157378049"),
VerifierSessionID: big.NewInt(32),
AuthEnabled: 1,
NullifierSessionID: big.NewInt(32),
AuthEnabled: 1,
}

jsonOut, err := json.Marshal(out)
Expand Down
8 changes: 4 additions & 4 deletions credentialAtomicQueryV3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func TestAttrQueryV3_SigPart_PrepareInputs(t *testing.T) {
LinkNonce: big.NewInt(0),
VerifierID: it.IDFromStr(
t, "21929109382993718606847853573861987353620810345503358891473103689157378049"),
VerifierSessionID: big.NewInt(32),
NullifierSessionID: big.NewInt(32),
}

bytesInputs, err := in.InputsMarshal()
Expand Down Expand Up @@ -150,7 +150,7 @@ func TestAttrQueryV3_MTPPart_PrepareInputs(t *testing.T) {
LinkNonce: big.NewInt(0),
VerifierID: it.IDFromStr(
t, "21929109382993718606847853573861987353620810345503358891473103689157378049"),
VerifierSessionID: big.NewInt(32),
NullifierSessionID: big.NewInt(32),
}

bytesInputs, err := in.InputsMarshal()
Expand Down Expand Up @@ -281,7 +281,7 @@ func TestAtomicQueryV3Outputs_Sig_CircuitUnmarshal(t *testing.T) {
OperatorOutput: big.NewInt(0),
VerifierID: it.IDFromStr(
t, "21929109382993718606847853573861987353620810345503358891473103689157378049"),
VerifierSessionID: big.NewInt(32),
NullifierSessionID: big.NewInt(32),
}

jsonOut, err := json.Marshal(out)
Expand Down Expand Up @@ -411,7 +411,7 @@ func TestAtomicQueryV3Outputs_MTP_CircuitUnmarshal(t *testing.T) {
OperatorOutput: big.NewInt(0),
VerifierID: it.IDFromStr(
t, "21929109382993718606847853573861987353620810345503358891473103689157378049"),
VerifierSessionID: big.NewInt(32),
NullifierSessionID: big.NewInt(32),
}

jsonOut, err := json.Marshal(out)
Expand Down
Loading

0 comments on commit 08f762e

Please sign in to comment.