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 // Login return the last version of the login
21 Login() string
22
23 // AvatarUrl return the last version of the Avatar URL
24 AvatarUrl() string
25
26 // Keys return the last version of the valid keys
27 Keys() []Key
28
29 // ValidKeysAtTime return the set of keys valid at a given lamport time
30 ValidKeysAtTime(time lamport.Time) []Key
31
32 // DisplayName return a non-empty string to display, representing the
33 // identity, based on the non-empty values.
34 DisplayName() string
35
36 // Validate check if the Identity data is valid
37 Validate() error
38
39 // Write the identity into the Repository. In particular, this ensure that
40 // the Id is properly set.
41 Commit(repo repository.ClockedRepo) error
42
43 // If needed, write the identity into the Repository. In particular, this
44 // ensure that the Id is properly set.
45 CommitAsNeeded(repo repository.ClockedRepo) error
46
47 // IsProtected return true if the chain of git commits started to be signed.
48 // If that's the case, only signed commit with a valid key for this identity can be added.
49 IsProtected() bool
50
51 // LastModificationLamportTime return the Lamport time at which the last version of the identity became valid.
52 LastModificationLamport() lamport.Time
53
54 // LastModification return the timestamp at which the last version of the identity became valid.
55 LastModification() timestamp.Timestamp
56}