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