...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package newentry
16
17 import (
18 "strings"
19 "time"
20
21 "github.com/sigstore/rekor/pkg/events"
22 "golang.org/x/exp/slices"
23
24 rekor_pb "github.com/sigstore/protobuf-specs/gen/pb-go/rekor/v1"
25 )
26
27 const (
28 Name = "dev.sigstore.rekor.events.v1.NewEntry"
29 Source = "/createLogEntry"
30 )
31
32 var ty *events.EventType
33
34 func init() {
35 empty := &rekor_pb.TransparencyLogEntry{}
36 ty = events.RegisterType(Name, Source, empty.ProtoReflect().Descriptor())
37 }
38
39 func New(id string, entry *rekor_pb.TransparencyLogEntry, subjects []string) (*events.Event, error) {
40 slices.Sort(subjects)
41 attrs := map[string]any{
42 "time": time.Unix(entry.GetIntegratedTime(), 0),
43 "rekor_entry_kind": entry.GetKindVersion().GetKind(),
44 "rekor_signing_subjects": strings.Join(subjects, ","),
45 }
46 return ty.New(id, entry, attrs)
47 }
48
View as plain text