Documentation ¶
Index ¶
- Variables
- func Directory(t Team, fluidkeysDirectory string) (directory string, err error)
- func VerifyRoster(roster string, signature string, adminKeys []*pgpkey.PgpKey) error
- type Person
- type RequestToJoinTeam
- type RosterSaver
- type Team
- func (t Team) Admins() (admins []Person)
- func (t *Team) Fingerprints() []fpr.Fingerprint
- func (t *Team) GetPersonForFingerprint(fingerprint fpr.Fingerprint) (*Person, error)
- func (t *Team) GetUpsertPersonWarnings(newPerson Person) (err error, existingPerson *Person)
- func (t Team) IsAdmin(fingerprint fpr.Fingerprint) bool
- func (t Team) PreviewRoster() (roster string, err error)
- func (t Team) Roster() (roster string, signature string)
- func (t *Team) UpdateRoster(signingKey *pgpkey.PgpKey) error
- func (t *Team) UpsertPerson(newPerson Person)
- func (t *Team) Validate() error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrPersonWouldNotBeChanged means the person being upserted already exists in the team and would // be unchanged ErrPersonWouldNotBeChanged = fmt.Errorf("person already exists in roster") // ErrEmailWouldBeUpdated means there's already a key with a matching fingerprint, but a // different email address. Upserting this new person would change the email address. ErrEmailWouldBeUpdated = fmt.Errorf( "existing team member's email would be updated", ) // ErrKeyWouldBeUpdated means there's already a person with the same email address but a // different key fingerprint, so their key will be updated. ErrKeyWouldBeUpdated = fmt.Errorf( "existing team member's key would be updated", ) // ErrPersonWouldBeDemotedAsAdmin means the person is currently in the team as an admin. // Upserting this new person would demote them from being an admin. ErrPersonWouldBeDemotedAsAdmin = fmt.Errorf( "existing team member would be demoted as team admin", ) // ErrPersonWouldBePromotedToAdmin means the person is currently in the team, but is not an // admin. Upserting this new person would promote them to admin. ErrPersonWouldBePromotedToAdmin = fmt.Errorf( "existing team member would be promoted to team admin", ) )
Functions ¶
Types ¶
type Person ¶
type Person struct { Email string `toml:"email"` Fingerprint fpr.Fingerprint `toml:"fingerprint"` IsAdmin bool `toml:"is_admin"` }
Person represents a human team member
type RequestToJoinTeam ¶
type RequestToJoinTeam struct { UUID uuid.UUID TeamUUID uuid.UUID TeamName string Email string Fingerprint fpr.Fingerprint // RequestAt is the moment at which the local client made the request RequestedAt time.Time }
RequestToJoinTeam represents a request to join a team
type RosterSaver ¶
type RosterSaver struct { Directory string // contains filtered or unexported fields }
RosterSaver provides a way to do a 2-part save where a roster is saved as a "draft" which can be either committed or discarded.
func (*RosterSaver) CommitDraft ¶
func (rs *RosterSaver) CommitDraft() error
CommitDraft actually saves the previously saved draft roster and signature
func (*RosterSaver) DiscardDraft ¶
func (rs *RosterSaver) DiscardDraft() error
DiscardDraft deletes the previously saved draft roster and signature
type Team ¶
type Team struct { UUID uuid.UUID `toml:"uuid"` Name string `toml:"name"` People []Person `toml:"person"` // contains filtered or unexported fields }
Team represents a group of people in Fluidkeys
func LoadTeams ¶
LoadTeams scans the fluidkeys/teams directory for subdirectories, enters them and tries to load roster.toml Returns a slice of Team
func (*Team) Fingerprints ¶
func (t *Team) Fingerprints() []fpr.Fingerprint
Fingerprints returns the key fingerprints for all people in the team
func (*Team) GetPersonForFingerprint ¶
func (t *Team) GetPersonForFingerprint(fingerprint fpr.Fingerprint) (*Person, error)
GetPersonForFingerprint takes a fingerprint and returns the person in the team with the matching fingperint.
func (*Team) GetUpsertPersonWarnings ¶
GetUpsertPersonWarnings checks if the given request to join a team causes any other team member to be overwritten, returning an error if so.
func (Team) IsAdmin ¶
func (t Team) IsAdmin(fingerprint fpr.Fingerprint) bool
IsAdmin takes a given fingerprint and returns whether they are an administor of the team
func (Team) PreviewRoster ¶
PreviewRoster returns an (unsigned) roster based on the current state of the Team. Use this to preview the effect of any changes to the team, e.g. AddTeam, before actually updating and signing the roster.
func (Team) Roster ¶
Roster returns the TOML file representing the team roster, and the ASCII armored detached signature of that file.
func (*Team) UpdateRoster ¶
UpdateRoster updates and signs the roster based on the state of the team. Subsequent calls to Roster() will return the new roster and signature.
func (*Team) UpsertPerson ¶
UpsertPerson adds a Person to the team and removes anyone else that matches either the email or fingerprint.