2018-11-21 20:56:12 +03:00
|
|
|
package identity
|
|
|
|
|
2019-01-16 23:23:49 +03:00
|
|
|
import (
|
2019-08-11 15:08:03 +03:00
|
|
|
"github.com/MichaelMure/git-bug/entity"
|
2021-01-24 21:45:21 +03:00
|
|
|
"github.com/MichaelMure/git-bug/repository"
|
2019-01-16 23:23:49 +03:00
|
|
|
"github.com/MichaelMure/git-bug/util/lamport"
|
2019-02-25 01:05:03 +03:00
|
|
|
"github.com/MichaelMure/git-bug/util/timestamp"
|
2019-01-16 23:23:49 +03:00
|
|
|
)
|
2018-11-21 20:56:12 +03:00
|
|
|
|
|
|
|
type Interface interface {
|
2020-09-16 17:22:02 +03:00
|
|
|
entity.Interface
|
2019-02-24 16:17:52 +03:00
|
|
|
|
2019-02-19 02:19:27 +03:00
|
|
|
// Name return the last version of the name
|
2020-02-25 23:35:57 +03:00
|
|
|
// Can be empty.
|
2018-11-21 20:56:12 +03:00
|
|
|
Name() string
|
2019-02-24 20:49:12 +03:00
|
|
|
|
2020-11-08 21:13:55 +03:00
|
|
|
// DisplayName return a non-empty string to display, representing the
|
|
|
|
// identity, based on the non-empty values.
|
|
|
|
DisplayName() string
|
|
|
|
|
2019-02-19 02:19:27 +03:00
|
|
|
// Email return the last version of the email
|
2020-02-25 23:35:57 +03:00
|
|
|
// Can be empty.
|
2018-11-21 20:56:12 +03:00
|
|
|
Email() string
|
2019-02-24 20:49:12 +03:00
|
|
|
|
2020-02-25 23:35:57 +03:00
|
|
|
// Login return the last version of the login
|
|
|
|
// Can be empty.
|
|
|
|
// Warning: this login can be defined when importing from a bridge but should *not* be
|
|
|
|
// used to identify an identity as multiple bridge with different login can map to the same
|
|
|
|
// identity. Use the metadata system for that usage instead.
|
|
|
|
Login() string
|
|
|
|
|
2019-02-19 02:19:27 +03:00
|
|
|
// AvatarUrl return the last version of the Avatar URL
|
2020-02-25 23:35:57 +03:00
|
|
|
// Can be empty.
|
2018-11-21 20:56:12 +03:00
|
|
|
AvatarUrl() string
|
2019-02-24 20:49:12 +03:00
|
|
|
|
2019-01-16 23:23:49 +03:00
|
|
|
// Keys return the last version of the valid keys
|
2020-02-25 23:35:57 +03:00
|
|
|
// Can be empty.
|
2020-01-24 02:30:13 +03:00
|
|
|
Keys() []*Key
|
2018-11-21 20:56:12 +03:00
|
|
|
|
2021-01-04 01:59:25 +03:00
|
|
|
// SigningKey return the key that should be used to sign new messages. If no key is available, return nil.
|
2021-01-24 21:45:21 +03:00
|
|
|
SigningKey(repo repository.RepoKeyring) (*Key, error)
|
2021-01-04 01:59:25 +03:00
|
|
|
|
2020-11-08 21:13:55 +03:00
|
|
|
// ValidKeysAtTime return the set of keys valid at a given lamport time for a given clock of another entity
|
2020-02-25 23:35:57 +03:00
|
|
|
// Can be empty.
|
2020-11-08 21:13:55 +03:00
|
|
|
ValidKeysAtTime(clockName string, time lamport.Time) []*Key
|
2018-11-21 20:56:12 +03:00
|
|
|
|
2020-11-08 21:13:55 +03:00
|
|
|
// 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
|
|
|
|
2020-11-08 21:13:55 +03:00
|
|
|
// LastModificationLamports return the lamport times at which the last version of the identity became valid.
|
|
|
|
LastModificationLamports() map[string]lamport.Time
|
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
|
2019-02-25 01:05:03 +03:00
|
|
|
|
2020-11-08 21:13:55 +03:00
|
|
|
// Validate check if the Identity data is valid
|
|
|
|
Validate() error
|
2020-09-16 17:22:02 +03:00
|
|
|
|
|
|
|
// Indicate that the in-memory state changed and need to be commit in the repository
|
|
|
|
NeedCommit() bool
|
2018-11-21 20:56:12 +03:00
|
|
|
}
|