git-bug/identity/interface.go

59 lines
1.8 KiB
Go
Raw Normal View History

2018-11-21 20:56:12 +03:00
package identity
import (
2019-01-19 21:23:31 +03:00
"github.com/MichaelMure/git-bug/repository"
"github.com/MichaelMure/git-bug/util/lamport"
"github.com/MichaelMure/git-bug/util/timestamp"
)
2018-11-21 20:56:12 +03:00
type Interface interface {
2019-02-19 02:19:27 +03:00
// Id return the Identity identifier
2019-01-17 04:05:50 +03:00
Id() string
// HumanId return the Identity identifier truncated for human consumption
HumanId() string
2019-02-19 02:19:27 +03:00
// Name return the last version of the name
2018-11-21 20:56:12 +03:00
Name() string
2019-02-24 20:49:12 +03:00
2019-02-19 02:19:27 +03:00
// Email return the last version of the email
2018-11-21 20:56:12 +03:00
Email() string
2019-02-24 20:49:12 +03:00
2019-02-19 02:19:27 +03:00
// Login return the last version of the login
2018-11-21 20:56:12 +03:00
Login() string
2019-02-24 20:49:12 +03:00
2019-02-19 02:19:27 +03:00
// AvatarUrl return the last version of the Avatar URL
2018-11-21 20:56:12 +03:00
AvatarUrl() string
2019-02-24 20:49:12 +03:00
// Keys return the last version of the valid keys
2018-11-21 20:56:12 +03:00
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
// Validate check if the Identity data is valid
Validate() error
2019-01-19 21:23:31 +03:00
// Write the identity into the Repository. In particular, this ensure that
// the Id is properly set.
2019-02-19 02:19:27 +03:00
Commit(repo repository.ClockedRepo) error
2019-01-19 21:23:31 +03:00
2019-02-16 19:32:30 +03:00
// If needed, write the identity into the Repository. In particular, this
// ensure that the Id is properly set.
2019-02-19 02:19:27 +03:00
CommitAsNeeded(repo repository.ClockedRepo) error
2019-02-16 19:32:30 +03:00
2018-11-21 20:56:12 +03:00
// 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
2018-11-21 20:56:12 +03:00
}