Skip to content
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

Merged
merged 2 commits into from
Sep 23, 2021

Conversation

mattmoor
Copy link
Member

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.

Signed-off-by: Matt Moore [email protected]

Ticket Link

Related: #666

Release Note

NONE

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]>
@@ -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) {
Copy link
Member

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

Copy link
Member Author

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
Copy link
Member

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

Copy link
Member Author

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

@mattmoor mattmoor merged commit 513328c into sigstore:main Sep 23, 2021
@mattmoor mattmoor deleted the mutate-sign-entity branch September 23, 2021 16:18
@github-actions github-actions bot added this to the v1.3.0 milestone Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants