From 7fb72e06dcb811ae6616d720f4e3060d5c28da1f Mon Sep 17 00:00:00 2001
From: CWA Technical User
 <67319337+Corona-Warn-App-Technical-User@users.noreply.github.com>
Date: Thu, 11 Mar 2021 17:53:15 +0100
Subject: [PATCH] Protocol Buffer update for release 2.0.x at Thu Mar 11
 10:00:42 UTC 2021 (#2575)

* Update from https://github.com/corona-warn-app/cwa-protocol-buffers/commit/30e2277c8d988d275bbb5c84dbcabab6044f67c2

* Update from https://github.com/corona-warn-app/cwa-protocol-buffers/commit/9b27a6aa6b616b3fcdc5bc531d8d6f1f83fc01d8

* Update from https://github.com/corona-warn-app/cwa-protocol-buffers/commit/611d75dcae6e72f4c0067d78e52b3eac50eafc40
---
 .../src/main/proto/internal/evreg/event.proto | 21 ++++++--
 .../internal/evreg/poster_template.proto      | 24 +++++++++
 .../src/main/proto/internal/pt/check_in.proto | 12 +++++
 .../internal/pt/qr_code_poster_template.proto | 50 +++++++++++++++++++
 .../proto/internal/pt/trace_location.proto    | 44 ++++++++++++++++
 .../proto/internal/pt/trace_warning.proto     | 22 ++++++++
 .../proto/internal/submission_payload.proto   |  4 +-
 .../internal/v2/app_config_android.proto      |  5 +-
 .../proto/internal/v2/app_config_ios.proto    |  4 +-
 .../internal/v2/key_download_parameters.proto |  7 +++
 .../v2/presence_tracing_parameters.proto      | 48 ++++++++++++++++++
 11 files changed, 231 insertions(+), 10 deletions(-)
 create mode 100644 Server-Protocol-Buffer/src/main/proto/internal/evreg/poster_template.proto
 create mode 100644 Server-Protocol-Buffer/src/main/proto/internal/pt/check_in.proto
 create mode 100644 Server-Protocol-Buffer/src/main/proto/internal/pt/qr_code_poster_template.proto
 create mode 100644 Server-Protocol-Buffer/src/main/proto/internal/pt/trace_location.proto
 create mode 100644 Server-Protocol-Buffer/src/main/proto/internal/pt/trace_warning.proto
 create mode 100644 Server-Protocol-Buffer/src/main/proto/internal/v2/presence_tracing_parameters.proto

diff --git a/Server-Protocol-Buffer/src/main/proto/internal/evreg/event.proto b/Server-Protocol-Buffer/src/main/proto/internal/evreg/event.proto
index c567f9550..6f27b5375 100644
--- a/Server-Protocol-Buffer/src/main/proto/internal/evreg/event.proto
+++ b/Server-Protocol-Buffer/src/main/proto/internal/evreg/event.proto
@@ -4,9 +4,22 @@ package de.rki.coronawarnapp.server.protocols.internal.evreg;
 
 
 message Event {
+  // 16 random bytes
   bytes guid = 1;
-  string description = 2;
-  uint32 start = 3;
-  uint32 end = 4;
-  uint32 defaultCheckInLengthInMinutes = 5;
+  EventType type = 2;
+  // max. 150 characters
+  string description = 3;
+  // max. 150 characters
+  string address = 4;
+  // UNIX timestamp (in seconds)
+  uint64 start = 5;
+  // UNIX timestamp (in seconds)
+  uint64 end = 6;
+  uint32 defaultCheckInLengthInMinutes = 7;
+}
+
+enum EventType {
+  EVENT_TYPE_UNSPECIFIED = 0;
+  EVENT_TYPE_OTHER_EVENT = 1;
+  EVENT_TYPE_OTHER_LOCATION = 2;
 }
\ No newline at end of file
diff --git a/Server-Protocol-Buffer/src/main/proto/internal/evreg/poster_template.proto b/Server-Protocol-Buffer/src/main/proto/internal/evreg/poster_template.proto
new file mode 100644
index 000000000..676245d60
--- /dev/null
+++ b/Server-Protocol-Buffer/src/main/proto/internal/evreg/poster_template.proto
@@ -0,0 +1,24 @@
+// This file is auto-generated, DO NOT make any changes here
+syntax = "proto3";
+package de.rki.coronawarnapp.server.protocols.internal.evreg;
+
+
+message PosterTemplateAndroid {
+  // SVG
+  bytes template = 1;
+
+  float offsetX = 2;
+  float offsetY = 3;
+
+  uint32 qrCodeSideLength = 4;
+}
+
+message PosterTemplateIOS {
+  // PDF
+  bytes template = 1;
+
+  uint32 offsetX = 2;
+  uint32 offsetY = 3;
+
+  uint32 qrCodeSideLength = 4;
+}
\ No newline at end of file
diff --git a/Server-Protocol-Buffer/src/main/proto/internal/pt/check_in.proto b/Server-Protocol-Buffer/src/main/proto/internal/pt/check_in.proto
new file mode 100644
index 000000000..6f8097446
--- /dev/null
+++ b/Server-Protocol-Buffer/src/main/proto/internal/pt/check_in.proto
@@ -0,0 +1,12 @@
+// This file is auto-generated, DO NOT make any changes here
+syntax = "proto3";
+package de.rki.coronawarnapp.server.protocols.internal.pt;
+
+import "internal/pt/trace_location.proto";
+
+message CheckIn {
+  SignedTraceLocation signedLocation = 1;
+  uint32 startIntervalNumber = 2;
+  uint32 endIntervalNumber = 3;
+  uint32 transmissionRiskLevel = 4;
+}
\ No newline at end of file
diff --git a/Server-Protocol-Buffer/src/main/proto/internal/pt/qr_code_poster_template.proto b/Server-Protocol-Buffer/src/main/proto/internal/pt/qr_code_poster_template.proto
new file mode 100644
index 000000000..dcc4a40cb
--- /dev/null
+++ b/Server-Protocol-Buffer/src/main/proto/internal/pt/qr_code_poster_template.proto
@@ -0,0 +1,50 @@
+// This file is auto-generated, DO NOT make any changes here
+syntax = "proto3";
+package de.rki.coronawarnapp.server.protocols.internal.pt;
+
+
+message QRCodePosterTemplateAndroid {
+  // SVG
+  bytes template = 1;
+
+  float offsetX = 2;
+  float offsetY = 3;
+
+  uint32 qrCodeSideLength = 4;
+
+  QRCodeTextBoxAndroid description = 5;
+
+  message QRCodeTextBoxAndroid {
+    uint32 offsetX = 1;
+    uint32 offsetY = 2;
+
+    uint32 width = 3;
+    uint32 height = 4;
+
+    uint32 fontSize = 5;
+    string fontColor = 6;
+  }
+}
+
+message QRCodePosterTemplateIOS {
+  // PDF
+  bytes template = 1;
+
+  uint32 offsetX = 2;
+  uint32 offsetY = 3;
+
+  uint32 qrCodeSideLength = 4;
+
+  QRCodeTextBoxIOS description = 5;
+
+  message QRCodeTextBoxIOS {
+    uint32 offsetX = 1;
+    uint32 offsetY = 2;
+
+    uint32 width = 3;
+    uint32 height = 4;
+
+    uint32 fontSize = 5;
+    string fontColor = 6;
+  }
+}
\ No newline at end of file
diff --git a/Server-Protocol-Buffer/src/main/proto/internal/pt/trace_location.proto b/Server-Protocol-Buffer/src/main/proto/internal/pt/trace_location.proto
new file mode 100644
index 000000000..3785e9a83
--- /dev/null
+++ b/Server-Protocol-Buffer/src/main/proto/internal/pt/trace_location.proto
@@ -0,0 +1,44 @@
+// This file is auto-generated, DO NOT make any changes here
+syntax = "proto3";
+package de.rki.coronawarnapp.server.protocols.internal.pt;
+
+
+message TraceLocation {
+  // uuid
+  string guid = 1;
+  uint32 version = 2;
+  TraceLocationType type = 3;
+  // max. 150 characters
+  string description = 4;
+  // max. 150 characters
+  string address = 5;
+  // UNIX timestamp (in seconds)
+  uint64 startTimestamp = 6;
+  // UNIX timestamp (in seconds)
+  uint64 endTimestamp = 7;
+  uint32 defaultCheckInLengthInMinutes = 8;
+}
+
+message SignedTraceLocation {
+  TraceLocation location = 1;
+  bytes signature = 2;
+}
+
+enum TraceLocationType {
+  LOCATION_TYPE_UNSPECIFIED = 0;
+  LOCATION_TYPE_PERMANENT_OTHER = 1;
+  LOCATION_TYPE_TEMPORARY_OTHER = 2;
+
+  LOCATION_TYPE_PERMANENT_RETAIL = 3;
+  LOCATION_TYPE_PERMANENT_FOOD_SERVICE = 4;
+  LOCATION_TYPE_PERMANENT_CRAFT = 5;
+  LOCATION_TYPE_PERMANENT_WORKPLACE = 6;
+  LOCATION_TYPE_PERMANENT_EDUCATIONAL_INSTITUTION = 7;
+  LOCATION_TYPE_PERMANENT_PUBLIC_BUILDING = 8;
+
+  LOCATION_TYPE_TEMPORARY_CULTURAL_EVENT = 9;
+  LOCATION_TYPE_TEMPORARY_CLUB_ACTIVITY = 10;
+  LOCATION_TYPE_TEMPORARY_PRIVATE_EVENT = 11;
+  LOCATION_TYPE_TEMPORARY_WORSHIP_SERVICE = 12;
+
+}
\ No newline at end of file
diff --git a/Server-Protocol-Buffer/src/main/proto/internal/pt/trace_warning.proto b/Server-Protocol-Buffer/src/main/proto/internal/pt/trace_warning.proto
new file mode 100644
index 000000000..be4b1346d
--- /dev/null
+++ b/Server-Protocol-Buffer/src/main/proto/internal/pt/trace_warning.proto
@@ -0,0 +1,22 @@
+// This file is auto-generated, DO NOT make any changes here
+syntax = "proto3";
+package de.rki.coronawarnapp.server.protocols.internal.pt;
+
+
+import "internal/pt/check_in.proto";
+
+message TraceWarningPackage {
+  // hours since UNIX Epoch
+  uint32 intervalNumber = 1;
+  string region = 2;
+  repeated TraceTimeIntervalWarning timeIntervalWarnings = 3;
+}
+
+message TraceTimeIntervalWarning {
+  string locationGuid = 1; // uuid
+  // 10-minute intervals since UNIX Epoch
+  uint32 startIntervalNumber = 2;
+  // 10-minute intervals since UNIX Epoch
+  uint32 endIntervalNumber = 3;
+  uint32 transmissionRiskLevel = 4;
+}
\ No newline at end of file
diff --git a/Server-Protocol-Buffer/src/main/proto/internal/submission_payload.proto b/Server-Protocol-Buffer/src/main/proto/internal/submission_payload.proto
index 5c7ce61c8..c307356d2 100644
--- a/Server-Protocol-Buffer/src/main/proto/internal/submission_payload.proto
+++ b/Server-Protocol-Buffer/src/main/proto/internal/submission_payload.proto
@@ -3,7 +3,7 @@ syntax = "proto2";
 package de.rki.coronawarnapp.server.protocols.internal;
 
 import "external/exposurenotification/temporary_exposure_key_export.proto";
-import "internal/evreg/check_in.proto";
+import "internal/pt/check_in.proto";
 
 message SubmissionPayload {
   repeated de.rki.coronawarnapp.server.protocols.external.exposurenotification.TemporaryExposureKey keys = 1;
@@ -11,5 +11,5 @@ message SubmissionPayload {
   repeated string visitedCountries = 3;
   optional string origin = 4;
   optional bool consentToFederation = 5;
-  repeated de.rki.coronawarnapp.server.protocols.internal.evreg.CheckIn checkIns = 6;
+  repeated de.rki.coronawarnapp.server.protocols.internal.pt.CheckIn checkIns = 6;
 }
diff --git a/Server-Protocol-Buffer/src/main/proto/internal/v2/app_config_android.proto b/Server-Protocol-Buffer/src/main/proto/internal/v2/app_config_android.proto
index 3a1c60885..910b687cd 100644
--- a/Server-Protocol-Buffer/src/main/proto/internal/v2/app_config_android.proto
+++ b/Server-Protocol-Buffer/src/main/proto/internal/v2/app_config_android.proto
@@ -3,12 +3,12 @@ syntax = "proto3";
 package de.rki.coronawarnapp.server.protocols.internal.v2;
 
 import "internal/v2/app_features.proto";
-import "internal/v2/event_registration_parameters.proto";
 import "internal/v2/exposure_detection_parameters.proto";
 import "internal/v2/key_download_parameters.proto";
 import "internal/v2/ppdd_edus_parameters.proto";
 import "internal/v2/ppdd_els_parameters.proto";
 import "internal/v2/ppdd_ppa_parameters.proto";
+import "internal/v2/presence_tracing_parameters.proto";
 import "internal/v2/risk_calculation_parameters.proto";
 
 message ApplicationConfigurationAndroid {
@@ -34,7 +34,8 @@ message ApplicationConfigurationAndroid {
   PPDDPrivacyPreservingAnalyticsParametersAndroid privacyPreservingAnalyticsParameters = 11;
   PPDDErrorLogSharingParametersAndroid errorLogSharingParameters = 12;
 
-  EventRegistrationParameters eventRegistrationParameters = 13;
+  PresenceTracingParameters presenceTracingParameters = 13;
+
 }
 
 message DiagnosisKeysDataMapping {
diff --git a/Server-Protocol-Buffer/src/main/proto/internal/v2/app_config_ios.proto b/Server-Protocol-Buffer/src/main/proto/internal/v2/app_config_ios.proto
index e57b4a2ea..903269ff8 100644
--- a/Server-Protocol-Buffer/src/main/proto/internal/v2/app_config_ios.proto
+++ b/Server-Protocol-Buffer/src/main/proto/internal/v2/app_config_ios.proto
@@ -3,13 +3,13 @@ syntax = "proto3";
 package de.rki.coronawarnapp.server.protocols.internal.v2;
 
 import "internal/v2/app_features.proto";
-import "internal/v2/event_registration_parameters.proto";
 import "internal/v2/exposure_detection_parameters.proto";
 import "internal/v2/key_download_parameters.proto";
 import "internal/v2/ppdd_edus_parameters.proto";
 import "internal/v2/ppdd_els_parameters.proto";
 import "internal/v2/ppdd_ppa_parameters.proto";
 import "internal/v2/risk_calculation_parameters.proto";
+import "internal/v2/presence_tracing_parameters.proto";
 import "internal/v2/semantic_version.proto";
 
 message ApplicationConfigurationIOS {
@@ -33,7 +33,7 @@ message ApplicationConfigurationIOS {
   PPDDPrivacyPreservingAnalyticsParametersIOS privacyPreservingAnalyticsParameters = 10;
   PPDDErrorLogSharingParametersIOS errorLogSharingParameters = 11;
 
-  EventRegistrationParameters eventRegistrationParameters = 12;
+  PresenceTracingParameters presenceTracingParameters = 12;
 }
 
 message ExposureConfiguration {
diff --git a/Server-Protocol-Buffer/src/main/proto/internal/v2/key_download_parameters.proto b/Server-Protocol-Buffer/src/main/proto/internal/v2/key_download_parameters.proto
index 88249e647..88bc4604b 100644
--- a/Server-Protocol-Buffer/src/main/proto/internal/v2/key_download_parameters.proto
+++ b/Server-Protocol-Buffer/src/main/proto/internal/v2/key_download_parameters.proto
@@ -7,6 +7,7 @@ message KeyDownloadParametersIOS {
 
   repeated DayPackageMetadata revokedDayPackages = 1;
   repeated HourPackageMetadata revokedHourPackages = 2;
+  repeated TraceWarningPackageMetadata revokedTraceWarningPackages = 3;
 }
 
 message KeyDownloadParametersAndroid {
@@ -17,6 +18,8 @@ message KeyDownloadParametersAndroid {
   int32 downloadTimeoutInSeconds = 3;
 
   int32 overallTimeoutInSeconds = 4;
+
+  repeated TraceWarningPackageMetadata revokedTraceWarningPackages = 5;
 }
 
 message DayPackageMetadata {
@@ -30,4 +33,8 @@ message HourPackageMetadata {
   string date = 2;
   int32 hour = 3;
   string etag = 4;
+}
+
+message TraceWarningPackageMetadata {
+  string etag = 1;
 }
\ No newline at end of file
diff --git a/Server-Protocol-Buffer/src/main/proto/internal/v2/presence_tracing_parameters.proto b/Server-Protocol-Buffer/src/main/proto/internal/v2/presence_tracing_parameters.proto
new file mode 100644
index 000000000..162a01f27
--- /dev/null
+++ b/Server-Protocol-Buffer/src/main/proto/internal/v2/presence_tracing_parameters.proto
@@ -0,0 +1,48 @@
+// This file is auto-generated, DO NOT make any changes here
+syntax = "proto3";
+package de.rki.coronawarnapp.server.protocols.internal.v2;
+
+import "internal/v2/risk_calculation_parameters.proto";
+
+message PresenceTracingParameters {
+
+  PresenceTracingRiskCalculationParameters riskCalculationParameters = 1;
+
+  PresenceTracingSubmissionParameters submissionParameters = 2;
+
+  QRCodeErrorCorrectionLevel qrCodeErrorCorrectionLevel = 3;
+
+  repeated uint32 revokedTraceLocationVersions = 4;
+
+  enum QRCodeErrorCorrectionLevel {
+    MEDIUM = 0;
+    LOW = 1;
+    QUANTILE = 2;
+    HIGH = 3;
+  }
+}
+message PresenceTracingRiskCalculationParameters {
+
+  repeated TransmissionRiskValueMapping transmissionRiskValueMapping = 1;
+
+  repeated NormalizedTimeToRiskLevelMapping normalizedTimePerCheckInToRiskLevelMapping = 2;
+
+  repeated NormalizedTimeToRiskLevelMapping normalizedTimePerDayToRiskLevelMapping = 3;
+}
+
+message PresenceTracingSubmissionParameters {
+
+  repeated DurationFilter durationFilters = 1;
+
+  repeated AerosoleDecayFunctionLinear aerosoleDecayLinearFunctions = 2;
+
+  message DurationFilter {
+    Range dropIfMinutesInRange = 1;
+  }
+
+  message AerosoleDecayFunctionLinear {
+    Range minutesRange = 1;
+    double slope = 2;
+    double intercept = 3;
+  }
+}
\ No newline at end of file
-- 
GitLab