Skip to content

Commit 0720470

Browse files
refactor(typo): TrustStore -> TrustPolicy
Signed-off-by: Jason <[email protected]>
1 parent eb26003 commit 0720470

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

internal/oci/notation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func WithInsecureRegistry(insecure bool) Options {
3333
// WithTrustStore sets the trust store configuration.
3434
func WithTrustStore(trustStore *trustpolicy.Document) Options {
3535
return func(opts *options) {
36-
opts.TrustStore = trustStore
36+
opts.TrustPolicy = trustStore
3737
}
3838
}
3939

@@ -112,7 +112,7 @@ func NewNotaryVerifier(opts ...Options) (*NotaryVerifier, error) {
112112
cert: o.PublicKey,
113113
}
114114

115-
verifier, err := verifier.New(o.TrustStore, store, nil)
115+
verifier, err := verifier.New(o.TrustPolicy, store, nil)
116116
if err != nil {
117117
return nil, err
118118
}

internal/oci/notation_test.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -86,48 +86,48 @@ func TestOptionsForNotary(t *testing.T) {
8686
name: "truststore, empty document",
8787
opts: []Options{WithTrustStore(&trustpolicy.Document{})},
8888
want: &options{
89-
PublicKey: nil,
90-
ROpt: nil,
91-
TrustStore: &trustpolicy.Document{},
89+
PublicKey: nil,
90+
ROpt: nil,
91+
TrustPolicy: &trustpolicy.Document{},
9292
},
9393
},
9494
{
9595
name: "truststore, dummy document",
9696
opts: []Options{WithTrustStore(dummyPolicyDocument())},
9797
want: &options{
98-
PublicKey: nil,
99-
ROpt: nil,
100-
TrustStore: dummyPolicyDocument(),
98+
PublicKey: nil,
99+
ROpt: nil,
100+
TrustPolicy: dummyPolicyDocument(),
101101
},
102102
},
103103
{
104104
name: "insecure, false",
105105
opts: []Options{WithInsecureRegistry(false)},
106106
want: &options{
107-
PublicKey: nil,
108-
ROpt: nil,
109-
TrustStore: nil,
110-
Insecure: false,
107+
PublicKey: nil,
108+
ROpt: nil,
109+
TrustPolicy: nil,
110+
Insecure: false,
111111
},
112112
},
113113
{
114114
name: "insecure, true",
115115
opts: []Options{WithInsecureRegistry(true)},
116116
want: &options{
117-
PublicKey: nil,
118-
ROpt: nil,
119-
TrustStore: nil,
120-
Insecure: true,
117+
PublicKey: nil,
118+
ROpt: nil,
119+
TrustPolicy: nil,
120+
Insecure: true,
121121
},
122122
},
123123
{
124124
name: "insecure, default",
125125
opts: []Options{},
126126
want: &options{
127-
PublicKey: nil,
128-
ROpt: nil,
129-
TrustStore: nil,
130-
Insecure: false,
127+
PublicKey: nil,
128+
ROpt: nil,
129+
TrustPolicy: nil,
130+
Insecure: false,
131131
},
132132
},
133133
}
@@ -143,8 +143,8 @@ func TestOptionsForNotary(t *testing.T) {
143143
t.Errorf("got %#v, want %#v", &o.PublicKey, tc.want.PublicKey)
144144
}
145145

146-
if !reflect.DeepEqual(o.TrustStore, tc.want.TrustStore) {
147-
t.Errorf("got %#v, want %#v", &o.TrustStore, tc.want.TrustStore)
146+
if !reflect.DeepEqual(o.TrustPolicy, tc.want.TrustPolicy) {
147+
t.Errorf("got %#v, want %#v", &o.TrustPolicy, tc.want.TrustPolicy)
148148
}
149149

150150
if tc.want.ROpt != nil {

internal/oci/verifier.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ type Verifier interface {
4242

4343
// options is a struct that holds options for verifier.
4444
type options struct {
45-
PublicKey []byte
46-
ROpt []remote.Option
47-
Identities []cosign.Identity
48-
TrustStore *trustpolicy.Document
49-
Auth authn.Authenticator
50-
Keychain authn.Keychain
51-
Insecure bool
45+
PublicKey []byte
46+
ROpt []remote.Option
47+
Identities []cosign.Identity
48+
TrustPolicy *trustpolicy.Document
49+
Auth authn.Authenticator
50+
Keychain authn.Keychain
51+
Insecure bool
5252
}
5353

5454
// Options is a function that configures the options applied to a Verifier.

0 commit comments

Comments
 (0)