Documentation ¶
Index ¶
Constants ¶
View Source
const (
MaxConsecutiveClaimKeyFailures = 8
)
Variables ¶
View Source
var ErrDuplicateKey = errors.New("key is already registered")
View Source
var ErrInvalidKeyFormat = errors.New("argument had wrong size")
View Source
var ErrInvalidOneTimeCode = errors.New("argument had wrong size")
View Source
var ErrKeyConsumed = errors.New("keypair has uploaded maximum number of diagnosis keys")
View Source
var ErrNoRecordWritten = errors.New("we tried to write a transaction but no record was written")
ErrNoRecordWritten indicates that, though we should have been able to write a transaction to the DB, for some reason no record was created. This must be a bug with our query logic, because it should never happen.
View Source
var ErrTooManyKeys = errors.New("key limit for keypair exceeded")
ErrTooManyKeys is returned when the client tries to insert one or more keys past their limit, assigned on keypair creation. The entire batch is rejected.
Functions ¶
func MigrateDatabase ¶
MigrateDatabase creates the database and migrates it into the correct state.
Types ¶
type Conn ¶
type Conn interface { // Return keys that were SUBMITTED to the Diagnosis Server during the specified // UTC date. // // Only returns keys that correspond to a Key for a date // less than 14 days ago. FetchKeysForDateNumber(string, uint32, int32) ([]*pb.TemporaryExposureKey, error) StoreKeys(*[32]byte, []*pb.TemporaryExposureKey) error NewKeyClaim(string, string) (string, error) ClaimKey(string, []byte) ([]byte, error) PrivForPub([]byte) ([]byte, error) CheckClaimKeyBan(string) (triesRemaining int, banDuration time.Duration, err error) ClaimKeySuccess(string) error ClaimKeyFailure(string) (triesRemaining int, banDuration time.Duration, err error) DeleteOldDiagnosisKeys() (int64, error) DeleteOldEncryptionKeys() (int64, error) DeleteOldFailedClaimKeyAttempts() (int64, error) Close() error }
Conn mediates all access to a MySQL/CloudSQL connection. It exposes a method for each query we support. The one exception is database creation/migrations, which are handled separately.
Click to show internal directories.
Click to hide internal directories.