blob: 74a0698fd22379c57cdf392f8d3d75abf1e25490 [file] [log] [blame]
// Copyright 2017 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef LOGIN_MANAGER_BLOB_UTIL_H_
#define LOGIN_MANAGER_BLOB_UTIL_H_
#include <stdint.h>
#include <string>
#include <vector>
#include <base/strings/string_piece.h>
namespace google {
namespace protobuf {
class MessageLite;
} // namespace protobuf
} // namespace google
namespace login_manager {
// Another variation of Protobuf's SerializeAs family. Returns blob containing
// serialized data of the given |message|.
std::vector<uint8_t> SerializeAsBlob(
const google::protobuf::MessageLite& message);
// Returns blob containing the same value of the given |str|.
std::vector<uint8_t> StringToBlob(base::StringPiece str);
// Returns string containing the same value of the given |blob|.
std::string BlobToString(const std::vector<uint8_t>& blob);
} // namespace login_manager
#endif // LOGIN_MANAGER_BLOB_UTIL_H_