-
Notifications
You must be signed in to change notification settings - Fork 553
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
Add mutate.SignEntity
and friends.
#761
Conversation
9ec7548
to
b35f935
Compare
These mutators attach a new `oci.Signature` to the `oci.Signatures` hanging off of an `oci.SignedEntity`. A `DupeDetector` may optionally be passed via functional options, to elide the signature when a "dupe" already exists. Related: sigstore#666 Signed-off-by: Matt Moore <[email protected]>
b35f935
to
f5cfe48
Compare
internal/oci/mutate/mutate.go
Outdated
@@ -121,3 +122,81 @@ func (i *indexWrapper) SignedImageIndex(h v1.Hash) (oci.SignedImageIndex, error) | |||
return signed.ImageIndex(unsigned), nil | |||
} | |||
} | |||
|
|||
// SignEntity attaches the provided signature to the provided entity. | |||
func SignEntity(se oci.SignedEntity, sig oci.Signature, opts ...SignOption) (oci.SignedEntity, 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.
Let's replace things like SignFoo
with AttachSignatureToFoo
(or something) to avoid confusing these with the objects doing cryptographic operations. Think that "sign" conceptual space is already crowded enough in this library ecosystem
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.
Sure, I like the Attach
nuance. Let me just battle merge conflicts for a while 😉
@@ -108,7 +103,7 @@ LayerLoop: | |||
} | |||
|
|||
type UploadOpts struct { | |||
DupeDetector DupeDetector | |||
DupeDetector mutate.DupeDetector | |||
RemoteOpts []remote.Option |
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 know this was already here, but let's also standardize on clientOpts
or registryClientOpts
when we come across these to improve descriptiveness
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 can follow up to clean some of this stuff up
Signed-off-by: Matt Moore <[email protected]>
These mutators attach a new
oci.Signature
to theoci.Signatures
hanging off of anoci.SignedEntity
.A
DupeDetector
may optionally be passed via functional options, to elide the signature when a "dupe" already exists.Signed-off-by: Matt Moore [email protected]
Ticket Link
Related: #666
Release Note