aboutsummaryrefslogtreecommitdiffstats
path: root/identity/interface.go
blob: c784a7a68f1f1ec30cdd88b7fa13d59ae449f0e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package identity

import (
	"github.com/MichaelMure/git-bug/repository"
	"github.com/MichaelMure/git-bug/util/lamport"
)

type Interface interface {
	Id() string

	Name() string
	Email() string
	Login() string
	AvatarUrl() string

	// Keys return the last version of the valid keys
	Keys() []Key

	// ValidKeysAtTime return the set of keys valid at a given lamport time
	ValidKeysAtTime(time lamport.Time) []Key

	// DisplayName return a non-empty string to display, representing the
	// identity, based on the non-empty values.
	DisplayName() string

	// Match tell is the Person match the given query string
	Match(query string) bool

	// Validate check if the Identity data is valid
	Validate() error

	// Write the identity into the Repository. In particular, this ensure that
	// the Id is properly set.
	Commit(repo repository.Repo) error

	// IsProtected return true if the chain of git commits started to be signed.
	// If that's the case, only signed commit with a valid key for this identity can be added.
	IsProtected() bool
}