blob: 516be2ca5b6dc2fc1cee6d83a03cc46edd956806 [file]
// Copyright 2026 Google LLC
//
// 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
//
// https://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 THIRD_PARTY_CREDENTIO_TESTING_CBOR_UTILS_H_
#define THIRD_PARTY_CREDENTIO_TESTING_CBOR_UTILS_H_
#include <string>
#include "absl/strings/string_view.h"
namespace cbor {
// Converts a JSON string to a CBOR string.
// On malformed input, records error via LOG(FATAL).
// This also replaces all base64-encoded strings, like "b64'Zm9v'", with their
// decoded values as byte strings.
std::string FromJson(absl::string_view json);
// Converts a CBOR string to a JSON string.
// On malformed input, records error via LOG(FATAL).
//
// Byte strings are represented as base64-encoded strings, like "b64'Zm9v'".
std::string ToJson(absl::string_view cbor);
} // namespace cbor
#endif // THIRD_PARTY_CREDENTIO_TESTING_CBOR_UTILS_H_