-
Notifications
You must be signed in to change notification settings - Fork 74
Add client.AttestOpts #117
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
Conversation
This name is unnecessary and is inconsistent with how we handle other options structures Signed-off-by: Joe Richey <joerichey@google.com>
This is more consistent with Golang naming. Also, update the variable names to also be plural. Signed-off-by: Joe Richey <joerichey@google.com>
This will allow us to add options for attestation in the future. Right now the AttestOpts must be nil (the default). Signed-off-by: Joe Richey <joerichey@google.com>
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.
One pattern I've noticed in my (limited) experience with Go is methods taking in a opts ...FooOpt
as the last parameter to allow for a variadic number of option objects to be passed in. Does that makes sense here in the context of each of the XOpts in go-tpm-tools
rather than pluralizing all of the option structs?
If the current approach is preferable, then LGTM.
Ya I've seen this too, usually under the name "Functional Options" (see this Blog post by Rob Pike). Basically, each However, this isn't the best pattern if:
This is the case for Our eventual
So I think using |
Makes sense; I wasn't sure how each of the options would interact with one another or potentially expand in the future (on the point of orthogonality), so thanks for clarifying that! |
This will allow us to add functionality to
client.Atttest
in a backwards compatible way.Note that like many similar Go interfaces (e.g.
PublicKey
,PrivateKey
,DecrypterOpts
, etc...) thisAttestOpts
interface has no methods. This just means we have to use casts to switch functionality, rather than using common methods.Also, rename
SealOpt
toSealOpts
andCertifyOpt
toCertifyOpts
. This is the more consistent naming scheme.