identity.go

 1package entity
 2
 3//
 4// import (
 5// 	"github.com/ProtonMail/go-crypto/openpgp"
 6// 	"github.com/ProtonMail/go-crypto/openpgp/packet"
 7//
 8// 	"github.com/MichaelMure/git-bug/repository"
 9// 	"github.com/MichaelMure/git-bug/util/lamport"
10// 	"github.com/MichaelMure/git-bug/util/timestamp"
11// )
12//
13// type Key interface {
14// 	Public() *packet.PublicKey
15// 	Private() *packet.PrivateKey
16// 	Validate() error
17// 	Clone() Key
18// 	PGPEntity() *openpgp.Entity
19// }
20//
21// type Identity interface {
22// 	Bare
23//
24// 	// Name return the last version of the name
25// 	// Can be empty.
26// 	Name() string
27//
28// 	// DisplayName return a non-empty string to display, representing the
29// 	// identity, based on the non-empty values.
30// 	DisplayName() string
31//
32// 	// Email return the last version of the email
33// 	// Can be empty.
34// 	Email() string
35//
36// 	// Login return the last version of the login
37// 	// Can be empty.
38// 	// Warning: this login can be defined when importing from a bridge but should *not* be
39// 	// used to identify an identity as multiple bridge with different login can map to the same
40// 	// identity. Use the metadata system for that usage instead.
41// 	Login() string
42//
43// 	// AvatarUrl return the last version of the Avatar URL
44// 	// Can be empty.
45// 	AvatarUrl() string
46//
47// 	// Keys return the last version of the valid keys
48// 	// Can be empty.
49// 	Keys() []Key
50//
51// 	// SigningKey return the key that should be used to sign new messages. If no key is available, return nil.
52// 	SigningKey(repo repository.RepoKeyring) (Key, error)
53//
54// 	// ValidKeysAtTime return the set of keys valid at a given lamport time for a given clock of another entity
55// 	// Can be empty.
56// 	ValidKeysAtTime(clockName string, time lamport.Time) []Key
57//
58// 	// LastModification return the timestamp at which the last version of the identity became valid.
59// 	LastModification() timestamp.Timestamp
60//
61// 	// LastModificationLamports return the lamport times at which the last version of the identity became valid.
62// 	LastModificationLamports() map[string]lamport.Time
63//
64// 	// IsProtected return true if the chain of git commits started to be signed.
65// 	// If that's the case, only signed commit with a valid key for this identity can be added.
66// 	IsProtected() bool
67//
68// 	// Validate check if the Identity data is valid
69// 	Validate() error
70//
71// 	// NeedCommit indicate that the in-memory state changed and need to be committed in the repository
72// 	NeedCommit() bool
73// }