diff options
Diffstat (limited to 'identity/interface.go')
-rw-r--r-- | identity/interface.go | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/identity/interface.go b/identity/interface.go index a7174962..5b14295b 100644 --- a/identity/interface.go +++ b/identity/interface.go @@ -2,6 +2,7 @@ package identity import ( "github.com/MichaelMure/git-bug/entity" + "github.com/MichaelMure/git-bug/repository" "github.com/MichaelMure/git-bug/util/lamport" "github.com/MichaelMure/git-bug/util/timestamp" ) @@ -13,6 +14,10 @@ type Interface interface { // Can be empty. Name() string + // DisplayName return a non-empty string to display, representing the + // identity, based on the non-empty values. + DisplayName() string + // Email return the last version of the email // Can be empty. Email() string @@ -32,26 +37,25 @@ type Interface interface { // Can be empty. Keys() []*Key - // ValidKeysAtTime return the set of keys valid at a given lamport time + // SigningKey return the key that should be used to sign new messages. If no key is available, return nil. + SigningKey(repo repository.RepoKeyring) (*Key, error) + + // ValidKeysAtTime return the set of keys valid at a given lamport time for a given clock of another entity // Can be empty. - ValidKeysAtTime(time lamport.Time) []*Key + ValidKeysAtTime(clockName string, time lamport.Time) []*Key - // DisplayName return a non-empty string to display, representing the - // identity, based on the non-empty values. - DisplayName() string + // LastModification return the timestamp at which the last version of the identity became valid. + LastModification() timestamp.Timestamp - // Validate check if the Identity data is valid - Validate() error + // LastModificationLamports return the lamport times at which the last version of the identity became valid. + LastModificationLamports() map[string]lamport.Time // 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 - // LastModificationLamportTime return the Lamport time at which the last version of the identity became valid. - LastModificationLamport() lamport.Time - - // LastModification return the timestamp at which the last version of the identity became valid. - LastModification() timestamp.Timestamp + // Validate check if the Identity data is valid + Validate() error // Indicate that the in-memory state changed and need to be commit in the repository NeedCommit() bool |