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 // ValidKeysAtTime return the set of keys valid at a given lamport time for a given clock of another entity
40 // Can be empty.
41 ValidKeysAtTime(clockName string, time lamport.Time) []*Key
42
43 // LastModification return the timestamp at which the last version of the identity became valid.
44 LastModification() timestamp.Timestamp
45
46 // LastModificationLamports return the lamport times at which the last version of the identity became valid.
47 LastModificationLamports() map[string]lamport.Time
48
49 // IsProtected return true if the chain of git commits started to be signed.
50 // If that's the case, only signed commit with a valid key for this identity can be added.
51 IsProtected() bool
52
53 // Validate check if the Identity data is valid
54 Validate() error
55
56 // Indicate that the in-memory state changed and need to be commit in the repository
57 NeedCommit() bool
58}