File: simple.go

package info (click to toggle)
golang-github-containers-image 5.28.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 5,104 kB
  • sloc: sh: 194; makefile: 73
file content (29 lines) | stat: -rw-r--r-- 828 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package signature

import "golang.org/x/exp/slices"

// SimpleSigning is a “simple signing” signature.
type SimpleSigning struct {
	untrustedSignature []byte
}

// SimpleSigningFromBlob converts a “simple signing” signature into a SimpleSigning object.
func SimpleSigningFromBlob(blobChunk []byte) SimpleSigning {
	return SimpleSigning{
		untrustedSignature: slices.Clone(blobChunk),
	}
}

func (s SimpleSigning) FormatID() FormatID {
	return SimpleSigningFormat
}

// blobChunk returns a representation of signature as a []byte, suitable for long-term storage.
// Almost everyone should use signature.Blob() instead.
func (s SimpleSigning) blobChunk() ([]byte, error) {
	return slices.Clone(s.untrustedSignature), nil
}

func (s SimpleSigning) UntrustedSignature() []byte {
	return slices.Clone(s.untrustedSignature)
}