interface.go

 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() string
10
11	Name() string
12	Email() string
13	Login() string
14	AvatarUrl() string
15
16	// Keys return the last version of the valid keys
17	Keys() []Key
18
19	// ValidKeysAtTime return the set of keys valid at a given lamport time
20	ValidKeysAtTime(time lamport.Time) []Key
21
22	// DisplayName return a non-empty string to display, representing the
23	// identity, based on the non-empty values.
24	DisplayName() string
25
26	// Match tell is the Person match the given query string
27	Match(query string) bool
28
29	// Validate check if the Identity data is valid
30	Validate() error
31
32	// Write the identity into the Repository. In particular, this ensure that
33	// the Id is properly set.
34	Commit(repo repository.Repo) error
35
36	// IsProtected return true if the chain of git commits started to be signed.
37	// If that's the case, only signed commit with a valid key for this identity can be added.
38	IsProtected() bool
39}