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 // DisplayName return a non-empty string to display, representing the
17 // identity, based on the non-empty values.
18 DisplayName() string
19
20 // Email return the last version of the email
21 // Can be empty.
22 Email() string
23
24 // Login return the last version of the login
25 // Can be empty.
26 // Warning: this login can be defined when importing from a bridge but should *not* be
27 // used to identify an identity as multiple bridge with different login can map to the same
28 // identity. Use the metadata system for that usage instead.
29 Login() string
30
31 // AvatarUrl return the last version of the Avatar URL
32 // Can be empty.
33 AvatarUrl() string
34
35 // Keys return the last version of the valid keys
36 // Can be empty.
37 Keys() []*Key
38
39 // SigningKey return the key that should be used to sign new messages. If no key is available, return nil.
40 SigningKey() *Key
41
42 // ValidKeysAtTime return the set of keys valid at a given lamport time for a given clock of another entity
43 // Can be empty.
44 ValidKeysAtTime(clockName string, time lamport.Time) []*Key
45
46 // LastModification return the timestamp at which the last version of the identity became valid.
47 LastModification() timestamp.Timestamp
48
49 // LastModificationLamports return the lamport times at which the last version of the identity became valid.
50 LastModificationLamports() map[string]lamport.Time
51
52 // IsProtected return true if the chain of git commits started to be signed.
53 // If that's the case, only signed commit with a valid key for this identity can be added.
54 IsProtected() bool
55
56 // Validate check if the Identity data is valid
57 Validate() error
58
59 // Indicate that the in-memory state changed and need to be commit in the repository
60 NeedCommit() bool
61}