-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linked multi query #67
Conversation
auth.go
Outdated
|
||
if pubSignals.LinkID != nil && groupID != 0 { | ||
if existingLinks, exists := groupIDToLinkIDMap[groupID]; exists { | ||
linkIDMap := map[string]*big.Int{"linkID": pubSignals.LinkID, "requestID": new(big.Int).SetUint64(uint64(proofResponse.ID))} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is better to do a private struct with LinkID and requestID fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
auth.go
Outdated
if err != nil { | ||
return err | ||
} | ||
groupID := query.GroupID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
auth.go
Outdated
@@ -394,11 +473,48 @@ func (v *Verifier) VerifyAuthResponse( | |||
return err | |||
} | |||
|
|||
if response.From == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved
auth.go
Outdated
if groupID == 0 { | ||
return nil | ||
} | ||
if linkID != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else {
if linkID == nil
throw err
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
pubsignals/circuitsVerifier.go
Outdated
@@ -18,7 +18,7 @@ type StateResolver interface { | |||
|
|||
// Verifier is interface for verification of public signals of zkp | |||
type Verifier interface { | |||
VerifyQuery(ctx context.Context, query Query, schemaLoader ld.DocumentLoader, verifiablePresentation json.RawMessage, circuitParams map[string]interface{}, opts ...VerifyOpt) error | |||
VerifyQuery(ctx context.Context, query Query, schemaLoader ld.DocumentLoader, verifiablePresentation json.RawMessage, circuitParams map[string]interface{}, opts ...VerifyOpt) (CircuitOutputs, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- CircuitVerificationResult
- LinkID *big.Int
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
pubsignals/common.go
Outdated
if propertyQuery.OperatorValue != nil { | ||
if !IsValidOperation(datatype, propertyQuery.Operator) { | ||
operatorName, _ := getKeyByValue(circuits.QueryOperators, propertyQuery.Operator) | ||
return nil, fmt.Errorf("invalid operation '%s' for field type '%s'", operatorName, datatype) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
common for merklize / non-merklize
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
pubsignals/common.go
Outdated
} | ||
} | ||
|
||
query.Values, err = transformQueryValueToBigInts(ctx, propertyQuery.OperatorValue, datatype) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
common for merklize / non-merklize
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
pubsignals/common.go
Outdated
|
||
func transformQueryValueToBigInts(_ context.Context, value any, ldType string) (out []*big.Int, err error) { | ||
out = make([]*big.Int, 64) | ||
for i := 0; i < 64; i++ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted
pubsignals/linkedMultiQuery.go
Outdated
if !queriesMetadata[i].MerklizedSchema { | ||
merklizedSchema = big.NewInt(0) | ||
} | ||
queryHash, err := poseidon.Hash([]*big.Int{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to separate function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved
pubsignals/query.go
Outdated
if err != nil { | ||
return err | ||
if len(queriesMetadata) > 1 { | ||
if queriesMetadata[0].FieldName == queriesMetadata[1].FieldName { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
var metadata QueryMetadata | ||
|
||
if len(queriesMetadata) == 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if 0 is poosible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
possible,
then it will return nil on this check -
if metadata.Operator == circuits.NOOP { return nil }
there is also a test for this case `TestVerifyAuthResponseWithEmptyReq`
No description provided.