Documentation
¶
Overview ¶
Package api defines the JSON-RPC API between the browser and the server as well as between mobile devices and the server.
Index ¶
Constants ¶
const ( // TestTypeConfirmed is the string that represents a confirmed covid-19 test. TestTypeConfirmed = "confirmed" // TestTypeLikely is the string that represents a clinical diagnosis. TestTypeLikely = "likely" // TestTypeNegative is the string that represents a netgative test. TestTypeNegative = "negative" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CSRFResponse ¶
CSRFResponse is the return type when requesting an AJAX CSRF token.
type ErrorReturn ¶
type ErrorReturn struct {
Error string `json:"error"`
}
ErrorReturn defines the common error type.
func Errorf ¶
func Errorf(msg string, vars ...interface{}) *ErrorReturn
Errorf creates an ErrorReturn w/ the formateed message.
type IssueCodeRequest ¶
type IssueCodeRequest struct {
TestType string `json:"testType"`
SymptomDate string `json:"symptomDate"` // ISO 8601 formatted date, YYYY-MM-DD
Phone string `json:"phone"`
}
IssueCodeRequest defines the parameters to request an new OTP (short term) code. This is called by the Web frontend. API is served at /api/issue
type IssueCodeResponse ¶
type IssueCodeResponse struct {
VerificationCode string `json:"code"`
ExpiresAt string `json:"expiresAt"` // RFC1123 string formatted timestamp, in UTC.
ExpiresAtTimestamp int64 `json:"expiresAtTimestamp"` // Unix, seconds since the epoch. Still UTC.
Error string `json:"error"`
}
IssueCodeResponse defines the response type for IssueCodeRequest.
type VerificationCertificateRequest ¶
type VerificationCertificateRequest struct {
VerificationToken string `json:"token"`
ExposureKeyHMAC string `json:"ekeyhmac"`
}
VerificationCertificateRequest is used to accept a long term token and an HMAC of the TEKs. The details of the HMAC calculation are avialble at: https://github.com/google/exposure-notifications-server/blob/main/docs/design/verification_protocol.md
Requires API key in a HTTP header, X-API-Key: APIKEY
type VerificationCertificateResponse ¶
type VerificationCertificateResponse struct {
Certificate string `json:"certificate"`
Error string `json:"error"`
}
VerificationCertificateResponse either contains an error or contains a signed certificate that can be presented to the configured exposure notifications server to publish keys along w/ the certified diagnosis.
type VerifyCodeRequest ¶
type VerifyCodeRequest struct {
VerificationCode string `json:"code"`
}
VerifyCodeRequest is the request structure for exchanging a shor term Verification Code (OTP) for a long term token (a JWT) that can later be used to sign TEKs.
Requires API key in a HTTP header, X-API-Key: APIKEY
type VerifyCodeResponse ¶
type VerifyCodeResponse struct {
TestType string `json:"testtype"`
SymptomDate string `json:"symptomDate"` // ISO 8601 formatted date, YYYY-MM-DD
VerificationToken string `json:"token"` // JWT - signed, not encrypted.
Error string `json:"error"`
}
VerifyCodeResponse either contains an error, or contains the test parameters (type and [optional] date) as well as the verification token. The verification token may be snet back on a valid VerificationCertificateRequest later.