updating client and crypto libraries (#75)

Co-authored-by: Ghous Amjad <gamjad@google.com>
diff --git a/anonymous_tokens/cpp/shared/BUILD b/anonymous_tokens/cpp/shared/BUILD
index bc31873..e2fd3be 100644
--- a/anonymous_tokens/cpp/shared/BUILD
+++ b/anonymous_tokens/cpp/shared/BUILD
@@ -15,6 +15,7 @@
         "@com_google_absl//absl/status:statusor",
         "@com_google_absl//absl/strings",
         "@com_google_absl//absl/time",
+        "@com_google_protobuf//:timestamp_cc_proto",
     ],
 )
 
@@ -29,6 +30,7 @@
         "@com_google_absl//absl/status",
         "@com_google_absl//absl/status:statusor",
         "@com_google_absl//absl/time",
+        "@com_google_protobuf//:timestamp_cc_proto",
     ],
 )
 
diff --git a/anonymous_tokens/cpp/shared/proto_utils.cc b/anonymous_tokens/cpp/shared/proto_utils.cc
index 2306e12..7732e26 100644
--- a/anonymous_tokens/cpp/shared/proto_utils.cc
+++ b/anonymous_tokens/cpp/shared/proto_utils.cc
@@ -34,7 +34,7 @@
 }
 
 absl::StatusOr<absl::Time> TimeFromProto(
-    const Timestamp& proto) {
+    const google::protobuf::Timestamp& proto) {
   const auto sec = proto.seconds();
   const auto ns = proto.nanos();
   // sec must be [0001-01-01T00:00:00Z, 9999-12-31T23:59:59.999999999Z]
@@ -48,8 +48,8 @@
          absl::Nanoseconds(proto.nanos());
 }
 
-absl::StatusOr<Timestamp> TimeToProto(absl::Time time) {
-  Timestamp proto;
+absl::StatusOr<google::protobuf::Timestamp> TimeToProto(absl::Time time) {
+  google::protobuf::Timestamp proto;
   const int64_t seconds = absl::ToUnixSeconds(time);
   proto.set_seconds(seconds);
   proto.set_nanos((time - absl::FromUnixSeconds(seconds)) /
diff --git a/anonymous_tokens/cpp/shared/proto_utils.h b/anonymous_tokens/cpp/shared/proto_utils.h
index e3f5c4e..d03b653 100644
--- a/anonymous_tokens/cpp/shared/proto_utils.h
+++ b/anonymous_tokens/cpp/shared/proto_utils.h
@@ -15,6 +15,7 @@
 #ifndef ANONYMOUS_TOKENS_CPP_SHARED_PROTO_UTILS_H_
 #define ANONYMOUS_TOKENS_CPP_SHARED_PROTO_UTILS_H_
 
+#include "google/protobuf/timestamp.pb.h"
 #include "absl/status/statusor.h"
 #include "absl/strings/string_view.h"
 #include "absl/time/time.h"
@@ -26,18 +27,18 @@
 absl::StatusOr<AnonymousTokensUseCase> ParseUseCase(
     absl::string_view use_case);
 
-// Takes in Timestamp and converts it to absl::Time.
+// Takes in google::protobuf::Timestamp and converts it to absl::Time.
 //
 // Timestamp is defined here:
 // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#timestamp
 absl::StatusOr<absl::Time> TimeFromProto(
-    const Timestamp& proto);
+    const google::protobuf::Timestamp& proto);
 
-// Takes in absl::Time and converts it to Timestamp.
+// Takes in absl::Time and converts it to google::protobuf::Timestamp.
 //
 // Timestamp is defined here:
 // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#timestamp
-absl::StatusOr<Timestamp> TimeToProto(
+absl::StatusOr<google::protobuf::Timestamp> TimeToProto(
     absl::Time time);
 
 }  // namespace anonymous_tokens
diff --git a/anonymous_tokens/cpp/shared/proto_utils_test.cc b/anonymous_tokens/cpp/shared/proto_utils_test.cc
index e942f77..0679195 100644
--- a/anonymous_tokens/cpp/shared/proto_utils_test.cc
+++ b/anonymous_tokens/cpp/shared/proto_utils_test.cc
@@ -14,6 +14,7 @@
 
 #include "anonymous_tokens/cpp/shared/proto_utils.h"
 
+#include "google/protobuf/timestamp.pb.h"
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 #include "absl/status/status.h"
@@ -48,7 +49,7 @@
 }
 
 TEST(ProtoUtilsTest, TimeFromProtoGood) {
-  Timestamp timestamp;
+  google::protobuf::Timestamp timestamp;
   timestamp.set_seconds(1234567890);
   timestamp.set_nanos(12345);
   ANON_TOKENS_ASSERT_OK_AND_ASSIGN(absl::Time time, TimeFromProto(timestamp));
@@ -56,7 +57,7 @@
 }
 
 TEST(ProtoUtilsTest, TimeFromProtoBad) {
-  Timestamp proto;
+  google::protobuf::Timestamp proto;
   proto.set_nanos(-1);
   EXPECT_THAT(TimeFromProto(proto).status().code(),
               absl::StatusCode::kInvalidArgument);
@@ -68,7 +69,7 @@
 }
 
 TEST(ProtoUtilsTest, TimeToProtoGood) {
-  Timestamp proto;
+  google::protobuf::Timestamp proto;
   ANON_TOKENS_ASSERT_OK_AND_ASSIGN(
       proto, TimeToProto(absl::FromUnixSeconds(1596762373)));
   EXPECT_EQ(proto.seconds(), 1596762373);
@@ -81,7 +82,7 @@
 }
 
 TEST(ProtoUtilsTest, TimeToProtoBad) {
-  absl::StatusOr<Timestamp> proto;
+  absl::StatusOr<google::protobuf::Timestamp> proto;
   proto = TimeToProto(absl::FromUnixSeconds(253402300800));
   EXPECT_THAT(proto.status().code(), absl::StatusCode::kInvalidArgument);
 }
diff --git a/anonymous_tokens/proto/BUILD b/anonymous_tokens/proto/BUILD
index 4e78fce..c695cd4 100644
--- a/anonymous_tokens/proto/BUILD
+++ b/anonymous_tokens/proto/BUILD
@@ -10,6 +10,9 @@
 proto_library(
     name = "anonymous_tokens_proto",
     srcs = ["anonymous_tokens.proto"],
+    deps = [
+        "@com_google_protobuf//:timestamp_proto",
+    ],
 )
 
 cc_proto_library(
diff --git a/anonymous_tokens/proto/anonymous_tokens.proto b/anonymous_tokens/proto/anonymous_tokens.proto
index ef0c085..f4d675e 100644
--- a/anonymous_tokens/proto/anonymous_tokens.proto
+++ b/anonymous_tokens/proto/anonymous_tokens.proto
@@ -17,14 +17,11 @@
 
 package anonymous_tokens;
 
+import "google/protobuf/timestamp.proto";
+
 option java_multiple_files = true;
 option java_package = "com.google.privacy.privatemembership.anonymoustokens.proto";
 
-message Timestamp {
- int64 seconds = 1;
- int32 nanos = 2;
-}
-
 // Different use cases for the Anonymous Tokens service.
 // Next ID: 20
 enum AnonymousTokensUseCase {
@@ -158,10 +155,10 @@
   // Timestamp of expiration.
   //
   // Note that we will not return keys whose expiration times are in the past.
-  Timestamp expiration_time = 3;
+  google.protobuf.Timestamp expiration_time = 3;
 
   // Key becomes valid at key_validity_start_time.
-  Timestamp key_validity_start_time = 8;
+  google.protobuf.Timestamp key_validity_start_time = 8;
 
   // Hash function used in computing hash of the signing message
   // (see https://tools.ietf.org/html/rfc8017#section-9.1.1)
@@ -228,12 +225,12 @@
   bytes deployment_id = 8;
 
   // Key becomes valid at key_validity_start_time.
-  Timestamp key_validity_start_time = 3;
+  google.protobuf.Timestamp key_validity_start_time = 3;
 
   // Timestamp of expiration.
   //
   // Note that we will not return keys whose expiration times are in the past.
-  Timestamp expiration_time = 4;
+  google.protobuf.Timestamp expiration_time = 4;
 }
 
 // Next ID: 5
@@ -257,7 +254,7 @@
   // requested key_validity_start_time.
   //
   // If unset it will be set to current time.
-  Timestamp key_validity_start_time = 3
+  google.protobuf.Timestamp key_validity_start_time = 3
       ;
 
   // Public key that is definitely not valid after this particular time. If
@@ -265,7 +262,7 @@
   //
   // Note: It is possible that the key becomes invalid before this time. But the
   // key should not be valid after this time.
-  Timestamp key_validity_end_time = 4
+  google.protobuf.Timestamp key_validity_end_time = 4
       ;
 }
 
@@ -371,7 +368,7 @@
     // have the key to create the final token from the serialized_token. Even if
     // the client has the key, the server will not redeem the newly created
     // token created using expired key.
-    Timestamp key_expiration_time = 7;
+    google.protobuf.Timestamp key_expiration_time = 7;
   }
 
   //  Next ID: 5
@@ -397,7 +394,7 @@
     // have the key to create the token from the token response. Even if the
     // client has the key, the server will not redeem the newly created token
     // created using expired key.
-    Timestamp key_expiration_time = 4;
+    google.protobuf.Timestamp key_expiration_time = 4;
   }
 
   // Returned anonymous token(s)