Skip to content
Snippets Groups Projects
Unverified Commit 2733d379 authored by Matthias Urhahn's avatar Matthias Urhahn Committed by GitHub
Browse files

Improve submission logging (EXPOSUREAPP-6641) (#2918)

parent fa1f8543
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,7 @@ class VerificationServer @Inject constructor(
key: String,
keyType: VerificationKeyType
): RegistrationToken = withContext(Dispatchers.IO) {
Timber.tag(TAG).v("retrieveRegistrationToken(key=%s, keyType=%s)", key, keyType)
val keyStr = if (keyType == VerificationKeyType.GUID) {
HashHelper.hash256(key)
} else {
......@@ -33,7 +34,7 @@ class VerificationServer @Inject constructor(
VerificationKeyType.TELETAN -> PADDING_LENGTH_BODY_REGISTRATION_TOKEN_TELETAN
}
api.getRegistrationToken(
val response = api.getRegistrationToken(
fake = "0",
headerPadding = requestPadding(PADDING_LENGTH_HEADER_REGISTRATION_TOKEN),
requestBody = VerificationApiV1.RegistrationTokenRequest(
......@@ -41,13 +42,16 @@ class VerificationServer @Inject constructor(
key = keyStr,
requestPadding = requestPadding(paddingLength)
)
).registrationToken
)
Timber.tag(TAG).d("retrieveRegistrationToken(key=%s, keyType=%s) -> %s", key, keyType, response)
response.registrationToken
}
suspend fun pollTestResult(
token: RegistrationToken
): CoronaTestResult = withContext(Dispatchers.IO) {
Timber.tag(TAG).d("retrieveTestResults(token=%s)", token)
Timber.tag(TAG).v("retrieveTestResults(token=%s)", token)
val response = api.getTestResult(
fake = "0",
headerPadding = requestPadding(PADDING_LENGTH_HEADER_TEST_RESULT),
......@@ -64,18 +68,23 @@ class VerificationServer @Inject constructor(
suspend fun retrieveTan(
registrationToken: RegistrationToken
): String = withContext(Dispatchers.IO) {
api.getTAN(
Timber.tag(TAG).v("retrieveTan(registrationToken=%s)", registrationToken)
val response = api.getTAN(
fake = "0",
headerPadding = requestPadding(PADDING_LENGTH_HEADER_TAN),
requestBody = VerificationApiV1.TanRequestBody(
registrationToken,
requestPadding(PADDING_LENGTH_BODY_TAN)
)
).tan
)
Timber.tag(TAG).d("retrieveTan(registrationToken=%s) -> %s", registrationToken, response)
response.tan
}
suspend fun retrieveTanFake() = withContext(Dispatchers.IO) {
api.getTAN(
Timber.tag(TAG).v("retrieveTanFake()")
val response = api.getTAN(
fake = "1",
headerPadding = requestPadding(PADDING_LENGTH_HEADER_TAN),
requestBody = VerificationApiV1.TanRequestBody(
......@@ -83,6 +92,8 @@ class VerificationServer @Inject constructor(
requestPadding = requestPadding(PADDING_LENGTH_BODY_TAN_FAKE)
)
)
Timber.tag(TAG).v("retrieveTanFake() -> %s", response)
response
}
companion object {
......
......@@ -37,13 +37,13 @@ class SubmissionServer @Inject constructor(
suspend fun submitPayload(
data: SubmissionData
) = withContext(Dispatchers.IO) {
Timber.d("submitPayload()")
Timber.tag(TAG).d("submitPayload(data=%s)", data)
val authCode = data.authCode
val keyList = data.keyList
val checkInList = data.checkIns
Timber.d(
Timber.tag(TAG).d(
"Writing %s Keys and %s CheckIns to the Submission Payload.",
keyList.size,
checkInList.size
......@@ -57,7 +57,7 @@ class SubmissionServer @Inject constructor(
val keyPadding = keyPadding(keyList.size)
val checkInPadding = checkInPadding(plausibleParameters, checkInList.size)
val requestPadding = keyPadding + checkInPadding
Timber.d(
Timber.tag(TAG).d(
"keyPadding=%s\ncheckInPadding=%s\nrequestPadding=%s",
keyPadding,
checkInPadding,
......@@ -82,7 +82,7 @@ class SubmissionServer @Inject constructor(
}
suspend fun submitFakePayload() = withContext(Dispatchers.IO) {
Timber.d("submitFakePayload()")
Timber.tag(TAG).d("submitFakePayload()")
val plausibleParameters = appConfigProvider
.getAppConfig()
......@@ -93,7 +93,7 @@ class SubmissionServer @Inject constructor(
val fakeCheckInPadding = checkInPadding(plausibleParameters, checkInListSize = 0)
val fakeRequestPadding = fakeKeyPadding + fakeCheckInPadding
Timber.d(
Timber.tag(TAG).v(
"fakeKeyPadding=%s\nfakeCheckInPadding=%s\nfakeRequestPadding=%s",
fakeKeyPadding,
fakeCheckInPadding,
......@@ -115,5 +115,6 @@ class SubmissionServer @Inject constructor(
companion object {
private const val EMPTY_STRING = ""
private const val PADDING_LENGTH_HEADER_SUBMISSION_FAKE = 36
private const val TAG = "SubmissionServer"
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment