Debian Codegraph @

plugin/sign.go

raw symbols SCIP
1 // Copyright The Notary Project Authors.
2 // Licensed under the Apache License, Version 2.0 (the "License");
3 // you may not use this file except in compliance with the License.
4 // You may obtain a copy of the License at
5 //
6 // http://www.apache.org/licenses/LICENSE-2.0
7 //
8 // Unless required by applicable law or agreed to in writing, software
9 // distributed under the License is distributed on an "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 // See the License for the specific language governing permissions and
12 // limitations under the License.
13
14 package pluginscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/
15
16 // GenerateSignatureRequest contains the parameters passed in a
17 // generate-signature request.
18 type GenerateSignatureRequestscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateSignatureRequest# struct {
19 ContractVersionscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateSignatureRequest#ContractVersion. string `json:"contractVersion"`
20 KeyIDscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateSignatureRequest#KeyID. string `json:"keyId"`
21 KeySpecscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateSignatureRequest#KeySpec. KeySpecscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/KeySpec# `json:"keySpec"`
22 Hashscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateSignatureRequest#Hash. HashAlgorithmscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/HashAlgorithm# `json:"hashAlgorithm"`
23 Payloadscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateSignatureRequest#Payload. []byte `json:"payload"`
24 PluginConfigscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateSignatureRequest#PluginConfig. map[string]string `json:"pluginConfig,omitempty"`
25 }
26
27 func (GenerateSignatureRequestscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateSignatureRequest#) Commandscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateSignatureRequest#Command().() Commandscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/Command# {
28 return CommandGenerateSignaturescip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/CommandGenerateSignature.
29 }
30
31 // Validate validates GenerateSignatureRequest struct
32 func (r GenerateSignatureRequestscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateSignatureRequest#) Validatescip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateSignatureRequest#Validate().() error {
33 if r.ContractVersionscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateSignatureRequest#ContractVersion. == "" {
34 return NewValidationErrorscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/NewValidationError().("contractVersion cannot be empty")
35 }
36
37 if r.KeyIDscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateSignatureRequest#KeyID. == "" {
38 return NewValidationErrorscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/NewValidationError().("keyId cannot be empty")
39 }
40
41 if r.KeySpecscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateSignatureRequest#KeySpec. == "" {
42 return NewValidationErrorscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/NewValidationError().("keySpec cannot be empty")
43 }
44
45 if r.Hashscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateSignatureRequest#Hash. == "" {
46 return NewValidationErrorscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/NewValidationError().("hashAlgorithm cannot be empty")
47 }
48
49 if len(r.Payloadscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateSignatureRequest#Payload.) == 0 {
50 return NewValidationErrorscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/NewValidationError().("payload cannot be empty")
51 }
52
53 return nil
54 }
55
56 // GenerateSignatureResponse is the response of a generate-signature request.
57 type GenerateSignatureResponsescip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateSignatureResponse# struct {
58 KeyIDscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateSignatureResponse#KeyID. string `json:"keyId"`
59 Signaturescip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateSignatureResponse#Signature. []byte `json:"signature"`
60 SigningAlgorithmscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateSignatureResponse#SigningAlgorithm. SignatureAlgorithmscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/SignatureAlgorithm# `json:"signingAlgorithm"`
61
62 // Ordered list of certificates starting with leaf certificate
63 // and ending with root certificate.
64 CertificateChainscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateSignatureResponse#CertificateChain. [][]byte `json:"certificateChain"`
65 }
66
67 // GenerateEnvelopeRequest contains the parameters passed in a generate-envelope
68 // request.
69 type GenerateEnvelopeRequestscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateEnvelopeRequest# struct {
70 ContractVersionscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateEnvelopeRequest#ContractVersion. string `json:"contractVersion"`
71 KeyIDscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateEnvelopeRequest#KeyID. string `json:"keyId"`
72 PayloadTypescip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateEnvelopeRequest#PayloadType. string `json:"payloadType"`
73 SignatureEnvelopeTypescip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateEnvelopeRequest#SignatureEnvelopeType. string `json:"signatureEnvelopeType"`
74 Payloadscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateEnvelopeRequest#Payload. []byte `json:"payload"`
75 ExpiryDurationInSecondsscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateEnvelopeRequest#ExpiryDurationInSeconds. uint64 `json:"expiryDurationInSeconds,omitempty"`
76 PluginConfigscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateEnvelopeRequest#PluginConfig. map[string]string `json:"pluginConfig,omitempty"`
77 }
78
79 func (GenerateEnvelopeRequestscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateEnvelopeRequest#) Commandscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateEnvelopeRequest#Command().() Commandscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/Command# {
80 return CommandGenerateEnvelopescip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/CommandGenerateEnvelope.
81 }
82
83 // Validate validates GenerateEnvelopeRequest struct
84 func (r GenerateEnvelopeRequestscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateEnvelopeRequest#) Validatescip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateEnvelopeRequest#Validate().() error {
85 if r.ContractVersionscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateEnvelopeRequest#ContractVersion. == "" {
86 return NewValidationErrorscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/NewValidationError().("contractVersion cannot be empty")
87 }
88
89 if r.KeyIDscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateEnvelopeRequest#KeyID. == "" {
90 return NewValidationErrorscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/NewValidationError().("keyId cannot be empty")
91 }
92
93 if r.PayloadTypescip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateEnvelopeRequest#PayloadType. == "" {
94 return NewValidationErrorscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/NewValidationError().("payloadType cannot be empty")
95 }
96
97 if r.SignatureEnvelopeTypescip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateEnvelopeRequest#SignatureEnvelopeType. == "" {
98 return NewValidationErrorscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/NewValidationError().("signatureEnvelopeType cannot be empty")
99 }
100
101 if len(r.Payloadscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateEnvelopeRequest#Payload.) == 0 {
102 return NewValidationErrorscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/NewValidationError().("payload cannot be empty")
103 }
104
105 return nil
106 }
107
108 // GenerateEnvelopeResponse is the response of a generate-envelope request.
109 type GenerateEnvelopeResponsescip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateEnvelopeResponse# struct {
110 SignatureEnvelopescip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateEnvelopeResponse#SignatureEnvelope. []byte `json:"signatureEnvelope"`
111 SignatureEnvelopeTypescip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateEnvelopeResponse#SignatureEnvelopeType. string `json:"signatureEnvelopeType"`
112 Annotationsscip-go gomod github.com/notaryproject/notation-plugin-framework-go . `github.com/notaryproject/notation-plugin-framework-go/plugin`/GenerateEnvelopeResponse#Annotations. map[string]string `json:"annotations,omitempty"`
113 }