database

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2019 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrRequestNotFound is returned when a request to join a team is not found matching the given
	// team UUID and fingerprint
	ErrRequestNotFound = fmt.Errorf("no request to join team with that fingerprint found")
)

Functions

This section is empty.

Types

type Database

type Database struct {
	// contains filtered or unexported fields
}

Database is the user's Fluidkeys database. It points at the filepath for the jsonFilename

func New

func New(fluidkeysDirectory string) Database

New returns a database from the given fluidkeys directory

func (*Database) DeleteRequestToJoinTeam added in v1.0.0

func (db *Database) DeleteRequestToJoinTeam(teamUUID uuid.UUID, fingerprint fpr.Fingerprint) error

DeleteRequestToJoinTeam deletes all requests to join the team matching the given team UUID and fingerprint.

func (*Database) GetExistingRequestToJoinTeam added in v1.0.0

func (db *Database) GetExistingRequestToJoinTeam(teamUUID uuid.UUID, fingerprint fpr.Fingerprint) (
	request *team.RequestToJoinTeam, err error)

GetExistingRequestToJoinTeam returns a single request based on the teamUUID and fingerprint.

func (*Database) GetFingerprintsImportedIntoGnuPG

func (db *Database) GetFingerprintsImportedIntoGnuPG() (fingerprints []fpr.Fingerprint, err error)

GetFingerprintsImportedIntoGnuPG returns a slice of fingerprints that have been imported into GnuPG

func (*Database) GetLast added in v1.0.0

func (db *Database) GetLast(verb string, item interface{}) (EventTimes time.Time, err error)

GetLast akes a verb and item and returns the last time it was recorded as being 'done'.

func (*Database) GetRequestsToJoinTeams added in v1.0.0

func (db *Database) GetRequestsToJoinTeams() (requests []team.RequestToJoinTeam, err error)

GetRequestsToJoinTeams returns a slice of requests to join teams the user has made.

func (*Database) IsOlderThan added in v1.0.0

func (db *Database) IsOlderThan(verb string, item interface{}, age time.Duration, now time.Time) (
	isOlder bool, err error)

IsOlderThan takes a verb and item and returns true if it was last recorded more than `age` ago.

func (*Database) RecordFingerprintImportedIntoGnuPG

func (db *Database) RecordFingerprintImportedIntoGnuPG(newFingerprint fpr.Fingerprint) error

RecordFingerprintImportedIntoGnuPG takes a given fingperprint and records that it's been imported into GnuPG by writing an updated json database.

func (*Database) RecordLast added in v1.0.0

func (db *Database) RecordLast(verb string, item interface{}, now time.Time) error

RecordLast takes a verb and item and records the action in the database, e.g verb "fetched", item: key.

func (*Database) RecordRequestToJoinTeam added in v1.0.0

func (db *Database) RecordRequestToJoinTeam(
	teamUUID uuid.UUID, teamName string, fingerprint fpr.Fingerprint, now time.Time) error

RecordRequestToJoinTeam takes a given request to join a team and records that it's been sent by writing an updated json database.

type KeyImportedIntoGnuPGMessage

type KeyImportedIntoGnuPGMessage struct {
	Fingerprint fpr.Fingerprint
}

KeyImportedIntoGnuPGMessage represents a key the user has imported into GnuPG from Fluidkeys

type Message added in v1.0.0

type Message struct {
	KeysImportedIntoGnuPG []KeyImportedIntoGnuPGMessage
	RequestsToJoinTeams   []RequestToJoinTeamMessage
	EventTimes            map[string]time.Time
}

Message is the structure the database takes

type RequestToJoinTeamMessage added in v1.0.0

type RequestToJoinTeamMessage struct {
	TeamUUID    uuid.UUID       `json: "TeamUUID"`
	TeamName    string          `json: "TeamName"`
	Fingerprint fpr.Fingerprint `json: "Fingerprint"`
	RequestedAt time.Time       `json: "RequestedAt"`
}

RequestToJoinTeamMessage records a request to join a team.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL