Documentation
¶
Overview ¶
Package identity resolves raw account identifiers (GitHub usernames, git commit emails, device-scoped local accounts) to a canonical personId, so period reports can aggregate one developer's activity across multiple accounts and machines without conflating people.
GitHub username is never the canonical identity: a developer may have multiple GitHub accounts, several git commit emails, and local OS accounts on more than one machine. Git emails are matched by hash so raw addresses never need to live in a config file.
Index ¶
Constants ¶
const ( TypeGitHub = "github" TypeGitEmail = "git_email" TypeLocalAccount = "local_account" )
Identity types.
Variables ¶
This section is empty.
Functions ¶
func HashEmail ¶
HashEmail returns the canonical hash for a git-email identity: lowercased and trimmed, then SHA-256, formatted as "sha256:<hex>". Callers store this in Identity.ValueHash instead of the raw email, and pass raw addresses to Map.ResolveGitEmail, which hashes them the same way before lookup.
Types ¶
type Identity ¶
type Identity struct {
Type string `json:"type"`
Value string `json:"value,omitempty"`
ValueHash string `json:"valueHash,omitempty"`
DeviceID string `json:"deviceId,omitempty"`
}
Identity links one account or device-scoped account to a person.
Value holds the identifier for GitHub and local-account identities; git-email identities are stored hashed (ValueHash) so raw emails never need to be committed to a config file. DeviceID scopes local-account identities, since OS usernames collide across machines.
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map resolves identities to person IDs.
func NewMap ¶
NewMap builds a Map from a set of people. A duplicate identity (the same account claimed by two people) is a configuration error, not a runtime fallback decision, and is rejected.
func (*Map) ResolveGitEmail ¶
ResolveGitEmail returns the personId for a git commit email, if known. The email is hashed before lookup so callers pass raw addresses.
func (*Map) ResolveGitHub ¶
ResolveGitHub returns the personId for a GitHub username, if known.