@@ -50,7 +50,7 @@ func Root(expires ...time.Time) *Metadata[RootType] {
50
50
Threshold : 1 ,
51
51
}
52
52
}
53
- log .V ( 5 ). Info ("Created metadata" , "type" , ROOT )
53
+ log .Info ("Created metadata" , "type" , ROOT )
54
54
return & Metadata [RootType ]{
55
55
Signed : RootType {
56
56
Type : ROOT ,
@@ -71,7 +71,7 @@ func Snapshot(expires ...time.Time) *Metadata[SnapshotType] {
71
71
if len (expires ) == 0 {
72
72
expires = []time.Time {time .Now ().UTC ()}
73
73
}
74
- log .V ( 5 ). Info ("Created metadata" , "type" , SNAPSHOT )
74
+ log .Info ("Created metadata" , "type" , SNAPSHOT )
75
75
return & Metadata [SnapshotType ]{
76
76
Signed : SnapshotType {
77
77
Type : SNAPSHOT ,
@@ -94,7 +94,7 @@ func Timestamp(expires ...time.Time) *Metadata[TimestampType] {
94
94
if len (expires ) == 0 {
95
95
expires = []time.Time {time .Now ().UTC ()}
96
96
}
97
- log .V ( 5 ). Info ("Created metadata" , "type" , TIMESTAMP )
97
+ log .Info ("Created metadata" , "type" , TIMESTAMP )
98
98
return & Metadata [TimestampType ]{
99
99
Signed : TimestampType {
100
100
Type : TIMESTAMP ,
@@ -117,7 +117,7 @@ func Targets(expires ...time.Time) *Metadata[TargetsType] {
117
117
if len (expires ) == 0 {
118
118
expires = []time.Time {time .Now ().UTC ()}
119
119
}
120
- log .V ( 5 ). Info ("Created metadata" , "type" , TARGETS )
120
+ log .Info ("Created metadata" , "type" , TARGETS )
121
121
return & Metadata [TargetsType ]{
122
122
Signed : TargetsType {
123
123
Type : TARGETS ,
@@ -142,7 +142,7 @@ func TargetFile() *TargetFiles {
142
142
func MetaFile (version int64 ) * MetaFiles {
143
143
if version < 1 {
144
144
// attempting to set incorrect version
145
- log .V ( 5 ). Info ("Attempting to set incorrect version for MetaFile" , "version" , version )
145
+ log .Info ("Attempting to set incorrect version for MetaFile" , "version" , version )
146
146
version = 1
147
147
}
148
148
return & MetaFiles {
@@ -168,7 +168,7 @@ func (meta *Metadata[T]) FromFile(name string) (*Metadata[T], error) {
168
168
return nil , err
169
169
}
170
170
* meta = * m
171
- log .V ( 5 ). Info ("Loaded metadata from file" , "name" , name )
171
+ log .Info ("Loaded metadata from file" , "name" , name )
172
172
return meta , nil
173
173
}
174
174
@@ -179,13 +179,13 @@ func (meta *Metadata[T]) FromBytes(data []byte) (*Metadata[T], error) {
179
179
return nil , err
180
180
}
181
181
* meta = * m
182
- log .V ( 5 ). Info ("Loaded metadata from bytes" )
182
+ log .Info ("Loaded metadata from bytes" )
183
183
return meta , nil
184
184
}
185
185
186
186
// ToBytes serialize metadata to bytes
187
187
func (meta * Metadata [T ]) ToBytes (pretty bool ) ([]byte , error ) {
188
- log .V ( 5 ). Info ("Writing metadata to bytes" )
188
+ log .Info ("Writing metadata to bytes" )
189
189
if pretty {
190
190
return json .MarshalIndent (* meta , "" , "\t " )
191
191
}
@@ -194,7 +194,7 @@ func (meta *Metadata[T]) ToBytes(pretty bool) ([]byte, error) {
194
194
195
195
// ToFile save metadata to file
196
196
func (meta * Metadata [T ]) ToFile (name string , pretty bool ) error {
197
- log .V ( 5 ). Info ("Writing metadata to file" , "name" , name )
197
+ log .Info ("Writing metadata to file" , "name" , name )
198
198
data , err := meta .ToBytes (pretty )
199
199
if err != nil {
200
200
return err
@@ -232,7 +232,7 @@ func (meta *Metadata[T]) Sign(signer signature.Signer) (*Signature, error) {
232
232
// update the Signatures part
233
233
meta .Signatures = append (meta .Signatures , * sig )
234
234
// return the new signature
235
- log .V ( 4 ). Info ("Signed metadata with key" , "ID" , key .ID ())
235
+ log .Info ("Signed metadata with key" , "ID" , key .ID ())
236
236
return sig , nil
237
237
}
238
238
@@ -245,7 +245,7 @@ func (meta *Metadata[T]) VerifyDelegate(delegatedRole string, delegatedMetadata
245
245
var roleKeyIDs []string
246
246
var roleThreshold int
247
247
248
- log .V ( 5 ). Info ("Verifying" , "role" , delegatedRole )
248
+ log .Info ("Verifying" , "role" , delegatedRole )
249
249
250
250
// collect keys, keyIDs and threshold based on delegator type
251
251
switch i := i .(type ) {
@@ -362,19 +362,19 @@ func (meta *Metadata[T]) VerifyDelegate(delegatedRole string, delegatedMetadata
362
362
// verify if the signature for that payload corresponds to the given key
363
363
if err := verifier .VerifySignature (bytes .NewReader (sign .Signature ), bytes .NewReader (payload )); err != nil {
364
364
// failed to verify the metadata with that key ID
365
- log .V ( 5 ). Info ("Failed to verify %s with key ID %s" , delegatedRole , keyID )
365
+ log .Info ("Failed to verify %s with key ID %s" , delegatedRole , keyID )
366
366
} else {
367
367
// save the verified keyID only if verification passed
368
368
signingKeys [keyID ] = true
369
- log .V ( 5 ). Info ("Verified with key" , "role" , delegatedRole , "ID" , keyID )
369
+ log .Info ("Verified with key" , "role" , delegatedRole , "ID" , keyID )
370
370
}
371
371
}
372
372
// check if the amount of valid signatures is enough
373
373
if len (signingKeys ) < roleThreshold {
374
- log .V ( 4 ). Info ("Verifying failed, not enough signatures" , "role" , delegatedRole , "got" , len (signingKeys ), "want" , roleThreshold )
374
+ log .Info ("Verifying failed, not enough signatures" , "role" , delegatedRole , "got" , len (signingKeys ), "want" , roleThreshold )
375
375
return ErrUnsignedMetadata {Msg : fmt .Sprintf ("Verifying %s failed, not enough signatures, got %d, want %d" , delegatedRole , len (signingKeys ), roleThreshold )}
376
376
}
377
- log .V ( 4 ). Info ("Verified successfully" , "role" , delegatedRole )
377
+ log .Info ("Verified successfully" , "role" , delegatedRole )
378
378
return nil
379
379
}
380
380
@@ -445,7 +445,7 @@ func (source *TargetFiles) Equal(expected TargetFiles) bool {
445
445
446
446
// FromFile generate TargetFiles from file
447
447
func (t * TargetFiles ) FromFile (localPath string , hashes ... string ) (* TargetFiles , error ) {
448
- log .V ( 5 ). Info ("Generating target file from file" , "path" , localPath )
448
+ log .Info ("Generating target file from file" , "path" , localPath )
449
449
// open file
450
450
in , err := os .Open (localPath )
451
451
if err != nil {
@@ -462,7 +462,7 @@ func (t *TargetFiles) FromFile(localPath string, hashes ...string) (*TargetFiles
462
462
463
463
// FromBytes generate TargetFiles from bytes
464
464
func (t * TargetFiles ) FromBytes (localPath string , data []byte , hashes ... string ) (* TargetFiles , error ) {
465
- log .V ( 5 ). Info ("Generating target file from bytes" , "path" , localPath )
465
+ log .Info ("Generating target file from bytes" , "path" , localPath )
466
466
var hasher hash.Hash
467
467
targetFile := & TargetFiles {
468
468
Hashes : map [string ]HexBytes {},
@@ -498,7 +498,7 @@ func (t *TargetFiles) FromBytes(localPath string, data []byte, hashes ...string)
498
498
499
499
// ClearSignatures clears Signatures
500
500
func (meta * Metadata [T ]) ClearSignatures () {
501
- log .V ( 5 ). Info ("Cleared signatures" )
501
+ log .Info ("Cleared signatures" )
502
502
meta .Signatures = []Signature {}
503
503
}
504
504
@@ -713,7 +713,7 @@ func (signed *TargetsType) AddKey(key *Key, role string) error {
713
713
signed .Delegations .Keys [key .ID ()] = key // TODO: should we check if we don't accidentally override an existing keyID with another key value?
714
714
return nil
715
715
}
716
- log .V ( 5 ). Info ("Delegated role already has keyID" , "role" , role , "ID" , key .ID ())
716
+ log .Info ("Delegated role already has keyID" , "role" , role , "ID" , key .ID ())
717
717
}
718
718
}
719
719
if ! isDelegatedRole {
@@ -726,7 +726,7 @@ func (signed *TargetsType) AddKey(key *Key, role string) error {
726
726
signed .Delegations .Keys [key .ID ()] = key // TODO: should we check if we don't accidentally override an existing keyID with another key value?
727
727
return nil
728
728
}
729
- log .V ( 5 ). Info ("SuccinctRoles role already has keyID" , "ID" , key .ID ())
729
+ log .Info ("SuccinctRoles role already has keyID" , "ID" , key .ID ())
730
730
731
731
}
732
732
signed .Delegations .Keys [key .ID ()] = key // TODO: should we check if we don't accidentally override an existing keyID with another key value?
0 commit comments