package
0.0.0-20190517095446-cafed51b034b
Repository: https://github.com/fluidkeys/api.git
Documentation: pkg.go.dev

# Functions

CanSendWithRateLimit looks up the last time we sent a given (user profile + email template) combination in the database, and returns whether we're past the given rateLimit duration.
CreateRequestToJoinTeam creates a new request to add the given email and key fingerprint to the team.
CreateSecret stores the armoredEncryptedSecret (which must be encrypted to the given `recipientFingerprint`) against the recipient public key.
CreateVerification creates an email_verification for the given email address.
DeletePublicKey deletes a key by its fingerprint, returning found=true if a matching key was found and deleted.
DeleteRequestToJoinTeam deletes the given request to join team (by UUID).
DeleteSecret deletes the given secret (by UUID) if the recipientFingerprint matches the secret, or returns an error if not.
DeleteTeam deletes the team with the given UUID and returns true if it was deleted, or false if the team was not found.
DropAllTheTables drops all the tables in the database.
GetArmoredPublicKeyForEmail returns an ASCII-armored public key for the given email, if the email address has been verified.
GetArmoredPublicKeyForFingerprint returns an ASCII-armored public key for the given fingerprint, regardless of whether the email addresses in the key have been verified.
GetRequestsToJoinTeam returns a slice of RequestToJoinTeams.
GetRequestToJoinTeam searches for an existing request for the given team UUID and email address combination.
GetSecrets returns a slice of secrets for the given public key fingerprint.
GetTeam returns a Team from the database.
GetTimeLastSent returns the most recent the given email type was sent to the given key, or nil if there's no record of it being sent.
GetVerification returns the email and fingerprint of a currently-active email_verification for the given secret UUID token.
HasActiveVerificationForEmail returns whether we recently sent a verification email to the given email address, and if that verification is still valid, e.g.
Initialize initialises a postgres database from the given databaseURL.
LinkEmailToFingerprint records that the given public key should be returned when queried for the given email address.
ListExpiredKeys returns all PGP keys that have expired.
ListKeysExpiring lists keys expiring in the next 15 days.
MarkVerificationAsVerified sets the user agent and IP address from the verifying HTTP request.
Migrate runs all the database migration queries (create table etc).
MustReadDatabaseURL returns the value of DATABASE_URL from the environment or panics if it wasn't found.
Ping tests the database and returns an error if there's a problem.
QueryEmailVerifiedForFingerprint returns true if the given email is verified for the given fingerprint.
RecordSentEmail records that the given email type was sent to the given key.
RunInTransaction begins a new transaction and calls the given `fn` function with the transaction.
StoreSingleUseNumber saves the given singleUseUUID to the database with the given now time.
TeamExists returns true if the team with the given UUID already exists in the database.
UpsertPublicKey either inserts or updates a public key based on the fingerprint.
UpsertTeam creates a team in the database.
VerifySingleUseNumberNotStored returns an error if the given singleUseUUID already exists in the database.

# Variables

ErrNotFound indicates that the requested item wasn't found in the database (but the query was successful).

# Structs

EmailVerification represents the data in the email_verifications database table.
RequestToJoinTeam represents a request to join a team in the database.
Team represents a team in the database.
UserProfile represents data in the user_profiles table.