-
Notifications
You must be signed in to change notification settings - Fork 1
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
chore: Add optional parameter to packer.Unpack #60
base: main
Are you sure you want to change the base?
Conversation
packers/zkp.go
Outdated
@@ -30,11 +30,11 @@ func (f DataPreparerHandlerFunc) Prepare(hash []byte, id *w3c.DID, circuitID cir | |||
} | |||
|
|||
// VerificationHandlerFunc registers the handler function for state verification. | |||
type VerificationHandlerFunc func(id circuits.CircuitID, pubsignals []string) error | |||
type VerificationHandlerFunc func(id circuits.CircuitID, pubsignals []string, opts ...DefaultZKPUnpackerOption) 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.
Open question. Is it ok to use DefaultZKPUnpackerOption or we should create a new Option type?
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.
My proposal it's add UnpackerParams
in the same way how we did with PackerParams
and use them instead of DefaultZKPUnpackerOption
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.
I mean the function verificationKey.VerificationFn.Verify(circuits.CircuitID(token.CircuitID), token.ZkProof.PubSignals, verifyOpts...)
should accept ZKPPUnpackerParams
packers/zkp.go
Outdated
} | ||
verifications := make(map[jwz.ProvingMethodAlg]VerificationParams) | ||
verifications[jwz.AuthV2Groth16Alg] = NewVerificationParams(verificationKey, def.defaultZkpUnpackerVerificationFn) | ||
return NewZKPPacker(nil, verifications) | ||
} | ||
|
||
func (d *defaultZKPUnpacker) defaultZkpUnpackerVerificationFn(id circuits.CircuitID, pubsignals []string) error { | ||
func (d *defaultZKPUnpacker) defaultZkpUnpackerVerificationFn(id circuits.CircuitID, pubsignals []string, opts ...DefaultZKPUnpackerOption) 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.
If you will remove opts from defaultZKPUnpacker, you can refactor the method to 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.
I don't think so. It is using d.resolvers inside the method body.
…nstead of DefaultZKPUnpackerOption
use zkp unpacker params only
This PR adds an optional parameter to packer.Unpack function and change the implementation of the the ZKKPacker unpack code to support parameter with custom AuthVerifyDelay