1package identity
2
3import (
4 "github.com/MichaelMure/git-bug/entity"
5 "github.com/MichaelMure/git-bug/util/lamport"
6 "github.com/MichaelMure/git-bug/util/timestamp"
7)
8
9type Interface interface {
10 entity.Interface
11
12 // Name return the last version of the name
13 // Can be empty.
14 Name() string
15
16 // Email return the last version of the email
17 // Can be empty.
18 Email() string
19
20 // Login return the last version of the login
21 // Can be empty.
22 // Warning: this login can be defined when importing from a bridge but should *not* be
23 // used to identify an identity as multiple bridge with different login can map to the same
24 // identity. Use the metadata system for that usage instead.
25 Login() string
26
27 // AvatarUrl return the last version of the Avatar URL
28 // Can be empty.
29 AvatarUrl() string
30
31 // Keys return the last version of the valid keys
32 // Can be empty.
33 Keys() []*Key
34
35 // ValidKeysAtTime return the set of keys valid at a given lamport time
36 // Can be empty.
37 ValidKeysAtTime(time lamport.Time) []*Key
38
39 // DisplayName return a non-empty string to display, representing the
40 // identity, based on the non-empty values.
41 DisplayName() string
42
43 // Validate check if the Identity data is valid
44 Validate() error
45
46 // IsProtected return true if the chain of git commits started to be signed.
47 // If that's the case, only signed commit with a valid key for this identity can be added.
48 IsProtected() bool
49
50 // LastModificationLamportTime return the Lamport time at which the last version of the identity became valid.
51 LastModificationLamport() lamport.Time
52
53 // LastModification return the timestamp at which the last version of the identity became valid.
54 LastModification() timestamp.Timestamp
55
56 // Indicate that the in-memory state changed and need to be commit in the repository
57 NeedCommit() bool
58}