Replace Cobalt's base64 library with the absl library.
Bug: 42098
Change-Id: Iba6ed40e5787df86b0a539dacd17a2aec839676b
diff --git a/keys/keys_tests.cc b/keys/keys_tests.cc
index 44304b1..c3ea319 100644
--- a/keys/keys_tests.cc
+++ b/keys/keys_tests.cc
@@ -4,7 +4,6 @@
#include "glog/logging.h"
#include "proto/tink.pb.h"
-#include "src/lib/crypto_util/base64.h"
#include "src/lib/util/encrypted_message_util.h"
#include "src/lib/util/file_util.h"
#include "src/pb/encrypted_message.pb.h"
diff --git a/src/bin/test_app/test_app_test.cc b/src/bin/test_app/test_app_test.cc
index 2bfac00..9d06580 100644
--- a/src/bin/test_app/test_app_test.cc
+++ b/src/bin/test_app/test_app_test.cc
@@ -13,11 +13,11 @@
#include "gflags/gflags.h"
#include "src/bin/test_app/test_registry/test_registry.cb.h"
-#include "src/lib/crypto_util/base64.h"
#include "src/logger/logger_test_utils.h"
#include "src/logger/project_context.h"
#include "src/logger/project_context_factory.h"
#include "src/logging.h"
+#include "third_party/abseil-cpp/absl/strings/escaping.h"
#include "third_party/googletest/googletest/include/gtest/gtest.h"
namespace cobalt {
@@ -41,7 +41,7 @@
bool PopulateCobaltRegistry(CobaltRegistry* cobalt_registry) {
std::string proto;
- if (!crypto::Base64Decode(test_app::testing::kConfig, &proto)) {
+ if (!absl::Base64Unescape(test_app::testing::kConfig, &proto)) {
return false;
}
diff --git a/src/lib/crypto_util/BUILD.gn b/src/lib/crypto_util/BUILD.gn
index bc148ae..d2e60c9 100644
--- a/src/lib/crypto_util/BUILD.gn
+++ b/src/lib/crypto_util/BUILD.gn
@@ -4,8 +4,6 @@
static_library("crypto_util") {
sources = [
- "base64.cc",
- "base64.h",
"cipher.cc",
"cipher.h",
"errors.cc",
@@ -25,7 +23,6 @@
source_set("tests") {
testonly = true
sources = [
- "base64_test.cc",
"cipher_test.cc",
"hash_test.cc",
"random_test.cc",
diff --git a/src/lib/crypto_util/base64.cc b/src/lib/crypto_util/base64.cc
deleted file mode 100644
index ca88433..0000000
--- a/src/lib/crypto_util/base64.cc
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright 2016 The Fuchsia Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "src/lib/crypto_util/base64.h"
-
-#include <algorithm>
-
-#include <openssl/base64.h>
-
-namespace cobalt::crypto {
-
-bool Base64Encode(const byte* data, int num_bytes, std::string* encoded_out) {
- if (!data || !encoded_out) {
- return false;
- }
- size_t required_length;
- if (!EVP_EncodedLength(&required_length, num_bytes)) {
- return false;
- }
- encoded_out->resize(required_length);
- bool success = EVP_EncodeBlock(reinterpret_cast<byte*>(&(*encoded_out)[0]), data, num_bytes);
- if (!success) {
- return false;
- }
- // Remove the trailing null EVP_EncodeBlock writes. It is trying to be
- // helpful by creating a C string but we don't need it in a std::string.
- encoded_out->resize(required_length - 1);
- return true;
-}
-
-bool Base64Encode(const std::vector<byte>& data, std::string* encoded_out) {
- return Base64Encode(data.data(), data.size(), encoded_out);
-}
-
-bool Base64Encode(const std::string& data, std::string* encoded_out) {
- return Base64Encode(reinterpret_cast<const byte*>(data.data()), data.size(), encoded_out);
-}
-
-bool Base64Decode(const std::string& encoded_in, std::vector<byte>* decoded_out) {
- size_t required_length;
- if (!EVP_DecodedLength(&required_length, encoded_in.size())) {
- return false;
- }
- decoded_out->resize(required_length);
- size_t actual_size;
- if (!EVP_DecodeBase64(decoded_out->data(), &actual_size, decoded_out->size(),
- reinterpret_cast<const byte*>(encoded_in.data()), encoded_in.size())) {
- return false;
- }
- decoded_out->resize(actual_size);
- return true;
-}
-
-bool Base64Decode(const std::string& encoded_in, std::string* decoded_out) {
- if (!decoded_out) {
- return false;
- }
- size_t required_length;
- if (!EVP_DecodedLength(&required_length, encoded_in.size())) {
- return false;
- }
- decoded_out->resize(required_length);
- size_t actual_size;
- if (!EVP_DecodeBase64(reinterpret_cast<byte*>(&(*decoded_out)[0]), &actual_size,
- decoded_out->size(), reinterpret_cast<const byte*>(encoded_in.data()),
- encoded_in.size())) {
- return false;
- }
- decoded_out->resize(actual_size);
- return true;
-}
-
-bool RegexEncode(const std::string& data, std::string* encoded_out) {
- if (!Base64Encode(data, encoded_out)) {
- return false;
- }
- std::replace(encoded_out->begin(), encoded_out->end(), '+', '_');
- return true;
-}
-
-bool RegexDecode(std::string encoded_in, std::string* decoded_out) {
- if (encoded_in.find('+') != std::string::npos) {
- return false;
- }
- std::replace(encoded_in.begin(), encoded_in.end(), '_', '+');
- return Base64Decode(encoded_in, decoded_out);
-}
-
-} // namespace cobalt::crypto
diff --git a/src/lib/crypto_util/base64.h b/src/lib/crypto_util/base64.h
deleted file mode 100644
index af00935..0000000
--- a/src/lib/crypto_util/base64.h
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2016 The Fuchsia Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef COBALT_SRC_LIB_CRYPTO_UTIL_BASE64_H_
-#define COBALT_SRC_LIB_CRYPTO_UTIL_BASE64_H_
-
-#include <string>
-#include <vector>
-
-#include "src/lib/crypto_util/types.h"
-
-namespace cobalt {
-namespace crypto {
-
-// Base64 encodes |num_bytes| from |data| and writes the result into
-// |encoded_out|.
-//
-// Returns true on success and false on failure.
-bool Base64Encode(const byte* data, int num_bytes, std::string* encoded_out);
-
-// Base64 encodes the bytes in |data| and writes the result into |encoded_out|.
-//
-// Returns true on success and false on failure.
-bool Base64Encode(const std::vector<byte>& data, std::string* encoded_out);
-
-// Base64 encodes the bytes in |data| and writes the result into |encoded_out|.
-//
-// Returns true on success and false on failure.
-bool Base64Encode(const std::string& data, std::string* encoded_out);
-
-// Base64 decodes |encoded_in| and writes the results into decoded_out.
-//
-// Returns true on success and false if |encoded_in| could not be decoded.
-bool Base64Decode(const std::string& encoded_in, std::vector<byte>* decoded_out);
-
-// Base64 decodes |encoded_in| and writes the results into decoded_out.
-//
-// Returns true on success and false if |encoded_in| could not be decoded.
-bool Base64Decode(const std::string& encoded_in, std::string* decoded_out);
-
-// Encodes the bytes in |data| and writes the result into |encoded_out|.
-// The encoding is identical to Base64Encode except that instead of using
-// the character '+' the character "_" is used. This yields a string that
-// does not contain any characters that have a special meaning in regular
-// expressions.
-//
-// Returns true on success and false on failure.
-bool RegexEncode(const std::string& data, std::string* encoded_out);
-
-// Decodes |encoded_in| and writes the results into decoded_out. The decoding
-// is the inverse of the encoding performed by RegexEncode(). Note that
-// unlike the other functions in this file |encoded_in| is not a reference.
-//
-// Returns true on success and false if |encoded_in| could not be decoded.
-bool RegexDecode(std::string encoded_in, std::string* decoded_out);
-
-} // namespace crypto
-} // namespace cobalt
-
-#endif // COBALT_SRC_LIB_CRYPTO_UTIL_BASE64_H_
diff --git a/src/lib/crypto_util/base64_test.cc b/src/lib/crypto_util/base64_test.cc
deleted file mode 100644
index ba59737..0000000
--- a/src/lib/crypto_util/base64_test.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2016 The Fuchsia Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-#include "src/lib/crypto_util/base64.h"
-
-#include <memory>
-#include <vector>
-
-#include "third_party/googletest/googletest/include/gtest/gtest.h"
-
-namespace cobalt::crypto {
-
-// Tests the basic functionality of Base64Encode and Base64Decode.
-TEST(Base64Test, BasicFunctionality) {
- // Encode
- std::vector<byte> data = {0, 1, 2, 3, 4, 5, 6, 255, 254, 253, 252, 251, 250};
- std::string encoded;
- EXPECT_TRUE(Base64Encode(data, &encoded));
- EXPECT_EQ(std::string("AAECAwQFBv/+/fz7+g=="), encoded);
-
- // Decode
- std::vector<byte> decoded;
- EXPECT_TRUE(Base64Decode(encoded, &decoded));
- EXPECT_EQ(data, decoded);
-}
-
-// Tests the function RegexEncode and RegexDecode.
-TEST(Base64Test, RegexEncode) {
- // Encode
- std::vector<byte> data = {0, 1, 2, 3, 4, 5, 6, 255, 254, 253, 252, 251, 250};
- std::string data_str(data.begin(), data.end());
- std::string encoded;
- EXPECT_TRUE(RegexEncode(data_str, &encoded));
-
- EXPECT_EQ(std::string("AAECAwQFBv/_/fz7_g=="), encoded);
- // Decode
- std::string decoded;
- EXPECT_TRUE(RegexDecode(encoded, &decoded));
- EXPECT_EQ(data_str, decoded);
-
- // Expect the decoding to fail if the input string contain a '+' since we are
- // using "_" instead of "+" in our regex-friendly version of the encoding.
- encoded = "AAECAwQFBv/+/fz7_g==";
- EXPECT_FALSE(RegexDecode(encoded, &decoded));
-
- // Expect the decoding to fail if the input string contain an '&' since "&"
- // is not used in Base64 encoding.
- encoded = "AAECAwQFBv/&/fz7_g==";
- EXPECT_FALSE(RegexDecode(encoded, &decoded));
-}
-
-} // namespace cobalt::crypto
diff --git a/src/lib/util/BUILD.gn b/src/lib/util/BUILD.gn
index 945ad30..d61784c 100644
--- a/src/lib/util/BUILD.gn
+++ b/src/lib/util/BUILD.gn
@@ -57,7 +57,7 @@
deps = [
"$cobalt_root/src/lib/crypto_util",
"$cobalt_root/src/lib/statusor",
- "//third_party/abseil-cpp",
+ "//third_party/abseil-cpp/absl/strings",
]
public_deps = [
@@ -247,7 +247,7 @@
configs += [ "$cobalt_root:cobalt_config" ]
deps = [
"$cobalt_root/src:logging",
- "$cobalt_root/src/lib/crypto_util",
+ "//third_party/abseil-cpp",
"//third_party/protobuf:protobuf_lite",
]
}
diff --git a/src/lib/util/encrypted_message_util_test.cc b/src/lib/util/encrypted_message_util_test.cc
index 2ba305d..8827dd1 100644
--- a/src/lib/util/encrypted_message_util_test.cc
+++ b/src/lib/util/encrypted_message_util_test.cc
@@ -7,7 +7,6 @@
#include <string>
#include <utility>
-#include "src/lib/crypto_util/base64.h"
#include "src/lib/crypto_util/cipher.h"
#include "src/pb/encrypted_message.pb.h"
#include "src/pb/envelope.pb.h"
diff --git a/src/lib/util/proto_util.cc b/src/lib/util/proto_util.cc
index e6380ce..c05684a 100644
--- a/src/lib/util/proto_util.cc
+++ b/src/lib/util/proto_util.cc
@@ -4,13 +4,11 @@
#include "src/lib/util/proto_util.h"
+#include "third_party/abseil-cpp/absl/strings/escaping.h"
+
using ::google::protobuf::MessageLite;
-namespace cobalt {
-
-using crypto::Base64Encode;
-
-namespace util {
+namespace cobalt::util {
bool SerializeToBase64(const MessageLite& message, std::string* encoded_message) {
std::string serialized_message;
@@ -18,12 +16,9 @@
LOG(ERROR) << "Failed to serialize proto message.";
return false;
}
- if (!Base64Encode(serialized_message, encoded_message)) {
- LOG(ERROR) << "Failed to base64-encode serialized message.";
- return false;
- }
+
+ absl::Base64Escape(serialized_message, encoded_message);
return true;
}
-} // namespace util
-} // namespace cobalt
+} // namespace cobalt::util
diff --git a/src/lib/util/proto_util.h b/src/lib/util/proto_util.h
index d614c9a..744dadd 100644
--- a/src/lib/util/proto_util.h
+++ b/src/lib/util/proto_util.h
@@ -9,7 +9,6 @@
#include <google/protobuf/message_lite.h>
-#include "src/lib/crypto_util/base64.h"
#include "src/logging.h"
namespace cobalt {
diff --git a/src/logger/BUILD.gn b/src/logger/BUILD.gn
index a595fc0..b2075f8 100644
--- a/src/logger/BUILD.gn
+++ b/src/logger/BUILD.gn
@@ -74,7 +74,7 @@
"$cobalt_root/src/registry:cobalt_registry_proto",
# This is for base64 decoding.
- "$cobalt_root/src/lib/crypto_util",
+ "//third_party/abseil-cpp/absl/strings",
]
public_deps = [
@@ -369,6 +369,7 @@
":encoder",
"$cobalt_root/src/local_aggregation:aggregation_utils",
"test_registries:encoder_test_registry",
+ "//third_party/abseil-cpp/absl/strings",
"//third_party/googletest:gtest",
"//third_party/protobuf:protobuf_lite",
]
@@ -381,9 +382,9 @@
]
public_deps = [
":project_context",
- "$cobalt_root/src/lib/crypto_util",
"$cobalt_root/src/pb",
"test_registries:project_context_test_registry",
+ "//third_party/abseil-cpp/absl/strings",
"//third_party/googletest:gtest",
]
}
@@ -398,6 +399,7 @@
"test_registries/project_context_factory_test_registry:a",
"test_registries/project_context_factory_test_registry:b",
"test_registries/project_context_factory_test_registry:c",
+ "//third_party/abseil-cpp/absl/strings",
"//third_party/googletest:gtest",
]
}
diff --git a/src/logger/encoder_test.cc b/src/logger/encoder_test.cc
index 38afd35..5243fb1 100644
--- a/src/logger/encoder_test.cc
+++ b/src/logger/encoder_test.cc
@@ -11,7 +11,6 @@
#include <google/protobuf/repeated_field.h>
-#include "src/lib/crypto_util/base64.h"
#include "src/local_aggregation/aggregation_utils.h"
#include "src/logger/project_context.h"
#include "src/logger/project_context_factory.h"
@@ -22,6 +21,7 @@
#include "src/pb/observation2.pb.h"
#include "src/registry/packed_event_codes.h"
#include "src/system_data/fake_system_data.h"
+#include "third_party/abseil-cpp/absl/strings/escaping.h"
#include "third_party/googletest/googletest/include/gtest/gtest.h"
namespace cobalt {
@@ -45,7 +45,7 @@
bool PopulateCobaltRegistry(CobaltRegistry* cobalt_registry) {
std::string cobalt_registry_bytes;
- if (!crypto::Base64Decode(kCobaltRegistryBase64, &cobalt_registry_bytes)) {
+ if (!absl::Base64Unescape(kCobaltRegistryBase64, &cobalt_registry_bytes)) {
return false;
}
return cobalt_registry->ParseFromString(cobalt_registry_bytes);
diff --git a/src/logger/project_context_factory.cc b/src/logger/project_context_factory.cc
index f627338..60ee3c7 100644
--- a/src/logger/project_context_factory.cc
+++ b/src/logger/project_context_factory.cc
@@ -6,11 +6,11 @@
#include <utility>
-#include "src/lib/crypto_util/base64.h"
#include "src/logging.h"
#include "src/registry/metric_definition.pb.h"
#include "src/registry/project.pb.h"
#include "src/registry/project_configs.h"
+#include "third_party/abseil-cpp/absl/strings/escaping.h"
namespace cobalt::logger {
@@ -31,7 +31,7 @@
std::unique_ptr<ProjectContextFactory> ProjectContextFactory::CreateFromCobaltRegistryBase64(
const std::string& cobalt_registry_base64) {
std::string cobalt_registry_bytes;
- if (!crypto::Base64Decode(cobalt_registry_base64, &cobalt_registry_bytes)) {
+ if (!absl::Base64Unescape(cobalt_registry_base64, &cobalt_registry_bytes)) {
LOG(ERROR) << "Unable to parse the provided string as base-64";
return nullptr;
}
diff --git a/src/logger/project_context_factory_test.cc b/src/logger/project_context_factory_test.cc
index efa7b99..f2a4560 100644
--- a/src/logger/project_context_factory_test.cc
+++ b/src/logger/project_context_factory_test.cc
@@ -9,11 +9,11 @@
#include <google/protobuf/text_format.h>
-#include "src/lib/crypto_util/base64.h"
#include "src/logger/test_registries/project_context_factory_test_registry/a.cb.h"
#include "src/logger/test_registries/project_context_factory_test_registry/b.cb.h"
#include "src/logger/test_registries/project_context_factory_test_registry/c.cb.h"
#include "src/logging.h"
+#include "third_party/abseil-cpp/absl/strings/escaping.h"
#include "third_party/googletest/googletest/include/gtest/gtest.h"
namespace cobalt::logger {
@@ -41,7 +41,7 @@
LOG(FATAL) << "Unexpected value for which_registry: " << which_registry;
}
std::string registry_bytes;
- EXPECT_TRUE(crypto::Base64Decode(registry_text, ®istry_bytes));
+ EXPECT_TRUE(absl::Base64Unescape(registry_text, ®istry_bytes));
return registry_bytes;
}
diff --git a/src/logger/project_context_test.cc b/src/logger/project_context_test.cc
index 332b68b..503779a 100644
--- a/src/logger/project_context_test.cc
+++ b/src/logger/project_context_test.cc
@@ -11,11 +11,11 @@
#include <google/protobuf/text_format.h>
-#include "src/lib/crypto_util/base64.h"
#include "src/logger/test_registries/project_context_test_registry.cb.h"
#include "src/logging.h"
#include "src/pb/observation2.pb.h"
#include "src/registry/project_configs.h"
+#include "third_party/abseil-cpp/absl/strings/escaping.h"
#include "third_party/googletest/googletest/include/gtest/gtest.h"
using cobalt::config::ProjectConfigs;
@@ -31,7 +31,7 @@
bool PopulateCobaltRegistry(CobaltRegistry* cobalt_registry) {
std::string cobalt_registry_bytes;
- if (!crypto::Base64Decode(kCobaltRegistryBase64, &cobalt_registry_bytes)) {
+ if (!absl::Base64Unescape(kCobaltRegistryBase64, &cobalt_registry_bytes)) {
return false;
}
return cobalt_registry->ParseFromString(cobalt_registry_bytes);
diff --git a/src/registry/BUILD.gn b/src/registry/BUILD.gn
index c8234f2..24affa8 100644
--- a/src/registry/BUILD.gn
+++ b/src/registry/BUILD.gn
@@ -94,8 +94,8 @@
public_deps = [
"$cobalt_root/src:logging",
- "$cobalt_root/src/lib/crypto_util",
"$cobalt_root/src/registry:cobalt_registry_proto",
+ "//third_party/abseil-cpp/absl/strings",
]
}
@@ -106,6 +106,7 @@
]
deps = [
":project_configs",
+ "//third_party/abseil-cpp/absl/strings",
"//third_party/googletest:gtest",
]
configs += [ "$cobalt_root:cobalt_config" ]
diff --git a/src/registry/project_configs.cc b/src/registry/project_configs.cc
index fab16ee..7856544 100644
--- a/src/registry/project_configs.cc
+++ b/src/registry/project_configs.cc
@@ -4,15 +4,15 @@
#include "src/registry/project_configs.h"
-#include "src/lib/crypto_util/base64.h"
#include "src/logging.h"
+#include "third_party/abseil-cpp/absl/strings/escaping.h"
namespace cobalt::config {
std::unique_ptr<ProjectConfigs> ProjectConfigs::CreateFromCobaltRegistryBase64(
const std::string& cobalt_registry_base64) {
std::string cobalt_registry_bytes;
- if (!crypto::Base64Decode(cobalt_registry_base64, &cobalt_registry_bytes)) {
+ if (!absl::Base64Unescape(cobalt_registry_base64, &cobalt_registry_bytes)) {
LOG(ERROR) << "Unable to parse the provided string as base-64";
return nullptr;
}
diff --git a/src/registry/project_configs_test.cc b/src/registry/project_configs_test.cc
index 72eb08f..6540075 100644
--- a/src/registry/project_configs_test.cc
+++ b/src/registry/project_configs_test.cc
@@ -6,8 +6,8 @@
#include <sstream>
-#include "src/lib/crypto_util/base64.h"
#include "src/logging.h"
+#include "third_party/abseil-cpp/absl/strings/escaping.h"
#include "third_party/googletest/googletest/include/gtest/gtest.h"
namespace cobalt::config {
@@ -307,7 +307,7 @@
std::string bytes;
cobalt_registry->SerializeToString(&bytes);
std::string cobalt_registry_base64;
- crypto::Base64Encode(bytes, &cobalt_registry_base64);
+ absl::Base64Escape(bytes, &cobalt_registry_base64);
auto project_configs = ProjectConfigs::CreateFromCobaltRegistryBase64(cobalt_registry_base64);
EXPECT_TRUE(CheckProjectConfigs(*project_configs));
}
diff --git a/src/system_data/client_secret.cc b/src/system_data/client_secret.cc
index 2bdce55..cfab8cf 100644
--- a/src/system_data/client_secret.cc
+++ b/src/system_data/client_secret.cc
@@ -16,7 +16,6 @@
#include <utility>
-#include "src/lib/crypto_util/base64.h"
#include "src/lib/crypto_util/random.h"
#include "third_party/abseil-cpp/absl/strings/escaping.h"
@@ -32,21 +31,17 @@
ClientSecret ClientSecret::GenerateNewSecret(crypto::Random* rand) {
ClientSecret client_secret;
client_secret.bytes_.resize(kNumSecretBytes);
- rand->RandomBytes(client_secret.bytes_.data(), kNumSecretBytes);
+ rand->RandomBytes(reinterpret_cast<byte*>(client_secret.bytes_.data()), kNumSecretBytes);
return client_secret;
}
// static
ClientSecret ClientSecret::FromToken(const std::string& token) {
ClientSecret client_secret;
- crypto::Base64Decode(token, &client_secret.bytes_);
+ absl::Base64Unescape(token, &client_secret.bytes_);
return client_secret;
}
-std::string ClientSecret::GetToken() {
- std::string token;
- crypto::Base64Encode(bytes_, &token);
- return token;
-}
+std::string ClientSecret::GetToken() { return absl::Base64Escape(bytes_); }
} // namespace cobalt::system_data
diff --git a/src/system_data/client_secret.h b/src/system_data/client_secret.h
index 9d94b88..a6994fe 100644
--- a/src/system_data/client_secret.h
+++ b/src/system_data/client_secret.h
@@ -68,7 +68,7 @@
// This method is not thread safe.
std::string GetToken();
- [[nodiscard]] const byte* data() const { return bytes_.data(); }
+ [[nodiscard]] const byte* data() const { return reinterpret_cast<const byte*>(bytes_.data()); }
static const size_t kNumSecretBytes = 16;
@@ -79,7 +79,7 @@
private:
// Private default constructor
ClientSecret() = default;
- std::vector<byte> bytes_;
+ std::string bytes_;
};
} // namespace cobalt::system_data