1package identity
2
3import (
4 "github.com/MichaelMure/git-bug/entity"
5 "github.com/MichaelMure/git-bug/repository"
6 "github.com/MichaelMure/git-bug/util/lamport"
7 "github.com/MichaelMure/git-bug/util/timestamp"
8)
9
10type Interface interface {
11 // Id return the Identity identifier
12 Id() entity.Id
13
14 // Name return the last version of the name
15 Name() string
16
17 // Email return the last version of the email
18 Email() string
19
20 // AvatarUrl return the last version of the Avatar URL
21 AvatarUrl() string
22
23 // Keys return the last version of the valid keys
24 Keys() []Key
25
26 // ValidKeysAtTime return the set of keys valid at a given lamport time
27 ValidKeysAtTime(time lamport.Time) []Key
28
29 // DisplayName return a non-empty string to display, representing the
30 // identity, based on the non-empty values.
31 DisplayName() string
32
33 // Validate check if the Identity data is valid
34 Validate() error
35
36 // Write the identity into the Repository. In particular, this ensure that
37 // the Id is properly set.
38 Commit(repo repository.ClockedRepo) error
39
40 // If needed, write the identity into the Repository. In particular, this
41 // ensure that the Id is properly set.
42 CommitAsNeeded(repo repository.ClockedRepo) error
43
44 // IsProtected return true if the chain of git commits started to be signed.
45 // If that's the case, only signed commit with a valid key for this identity can be added.
46 IsProtected() bool
47
48 // LastModificationLamportTime return the Lamport time at which the last version of the identity became valid.
49 LastModificationLamport() lamport.Time
50
51 // LastModification return the timestamp at which the last version of the identity became valid.
52 LastModification() timestamp.Timestamp
53}