Skip to content

Commit 9cd36d6

Browse files
author
zaihaoyin
committed
nit:fix typo
Signed-off-by: zaihaoyin <[email protected]>
1 parent 4b812a5 commit 9cd36d6

File tree

4 files changed

+18
-22
lines changed

4 files changed

+18
-22
lines changed

plugin/plugin.go

-3
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,6 @@ type DescribeKeyResponse struct {
126126
// One of following supported key types:
127127
// https://github.com/notaryproject/notaryproject/blob/main/signature-specification.md#algorithm-selection
128128
KeySpec string `json:"keySpec"`
129-
130-
// Ordered list of certificates starting with leaf certificate
131-
// and ending with root certificate.
132129
}
133130

134131
// GenerateSignatureRequest contains the parameters passed in a generate-signature request.

signature/algorithm.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/notaryproject/notation-core-go/signature"
77
)
88

9-
// one of the following key spec name.
9+
// one of the following supported key spec names.
1010
//
1111
// https://github.com/notaryproject/notaryproject/blob/main/signature-specification.md#algorithm-selection
1212
const (
@@ -18,7 +18,7 @@ const (
1818
EC_521 = "EC-521"
1919
)
2020

21-
// one of the following hash name.
21+
// one of the following supported hash algorithm names.
2222
//
2323
// https://github.com/notaryproject/notaryproject/blob/main/signature-specification.md#algorithm-selection
2424
const (
@@ -27,7 +27,7 @@ const (
2727
SHA_512 = "SHA-512"
2828
)
2929

30-
// one of the following signing algorithm name.
30+
// one of the following supported signing algorithm names.
3131
//
3232
// https://github.com/notaryproject/notaryproject/blob/main/signature-specification.md#algorithm-selection
3333
const (

signature/envelope_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ func init() {
2525
validCoseSignatureEnvelope, _ = msg.MarshalCBOR()
2626
}
2727

28-
// func setU
2928
const invalidMediaType = "invalid"
3029

3130
func checkErrorEqual(expected, got error) bool {

signature/provider.go

+15-15
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/notaryproject/notation-go/plugin"
1111
)
1212

13+
// builtInPluginMetaData is the builtin metadata used by builtinProvider.
1314
var builtInPluginMetaData = plugin.Metadata{
1415
SupportedContractVersions: []string{plugin.ContractVersion},
1516
Capabilities: []plugin.Capability{plugin.CapabilitySignatureGenerator},
@@ -26,14 +27,14 @@ type provider interface {
2627
SetConfig(map[string]string)
2728
}
2829

29-
// builtinPlugin is a builtin provider implementation.
30-
//
30+
// builtinProvider is a builtin provider implementation
31+
// which wraps the signature.Signature to support builtin signing method.
3132
// It only supports describe key and metadata command.
32-
// It wraps signature.Signature to support builtin signing method.
3333
type builtinProvider struct {
3434
signature.LocalSigner
3535
}
3636

37+
// newBuiltinProvider creates a builtinProvider to support local signing.
3738
func newBuiltinProvider(key crypto.PrivateKey, certChain []*x509.Certificate) (provider, error) {
3839
builtinSigner, err := signature.NewLocalSigner(certChain, key)
3940
if err != nil {
@@ -44,21 +45,20 @@ func newBuiltinProvider(key crypto.PrivateKey, certChain []*x509.Certificate) (p
4445
}, nil
4546
}
4647

48+
// metadata provides metadata for builtinProvider.
4749
func (*builtinProvider) metadata() *plugin.Metadata {
4850
// The only properties that are really relevant
4951
// are the supported contract version and the capabilities.
5052
// All other are just filled with meaningful data.
5153
return &builtInPluginMetaData
5254
}
5355

54-
// SetConfig set config when signing.
55-
func (*builtinProvider) SetConfig(map[string]string) {
56-
57-
}
56+
// SetConfig sets config when signing.
57+
func (*builtinProvider) SetConfig(map[string]string) {}
5858

59-
// Run implement the plugin workflow.
59+
// Run implements the plugin workflow.
6060
//
61-
// builtinProvider only support metadata and describe key.
61+
// builtinProvider only supports metadata and describe key.
6262
func (p *builtinProvider) Run(_ context.Context, req plugin.Request) (interface{}, error) {
6363
switch req.Command() {
6464
case plugin.CommandGetMetadata:
@@ -75,10 +75,10 @@ func (p *builtinProvider) Run(_ context.Context, req plugin.Request) (interface{
7575
}
7676
}
7777

78-
// externalProvider is a external provider implementation which will interact with plugin.
78+
// externalProvider is an external provider implementation which will interact with plugin.
7979
// It supports all plugin commands.
8080
//
81-
// The detail implementation depends on the real plugin.
81+
// The detail implementation depends on the underlying plugin.
8282
//
8383
// It wraps a signature.Signature to support external signing.
8484
type externalProvider struct {
@@ -96,12 +96,12 @@ func newExternalProvider(runner plugin.Runner, keyID string) provider {
9696
}
9797
}
9898

99-
// SetConfig setups config used by signing.
99+
// SetConfig sets up config used by signing.
100100
func (p *externalProvider) SetConfig(cfg map[string]string) {
101101
p.config = cfg
102102
}
103103

104-
// describeKey invokes plugin's DescribleKey command.
104+
// describeKey invokes plugin's DescribeKey command.
105105
func (p *externalProvider) describeKey(ctx context.Context) (*plugin.DescribeKeyResponse, error) {
106106
req := &plugin.DescribeKeyRequest{
107107
ContractVersion: plugin.ContractVersion,
@@ -119,7 +119,7 @@ func (p *externalProvider) describeKey(ctx context.Context) (*plugin.DescribeKey
119119
return resp, nil
120120
}
121121

122-
// Sign sign the digest by calling the underlying plugin.
122+
// Sign signs the digest by calling the underlying plugin.
123123
func (p *externalProvider) Sign(payload []byte) ([]byte, []*x509.Certificate, error) {
124124
// Execute plugin sign command.
125125
keySpec, err := p.KeySpec()
@@ -157,7 +157,7 @@ func (p *externalProvider) Sign(payload []byte) ([]byte, []*x509.Certificate, er
157157
return resp.Signature, certs, nil
158158
}
159159

160-
// KeySpec returns the keySpec of a keyID by calling describleKey and do some keySpec validation.
160+
// KeySpec returns the keySpec of a keyID by calling describeKey and do some keySpec validation.
161161
func (p *externalProvider) KeySpec() (signature.KeySpec, error) {
162162
if p.keySpec != InvalidKeySpec {
163163
return p.keySpec, nil

0 commit comments

Comments
 (0)