#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_integrity_block_data.h"
#include "base/base64.h"
#include "base/containers/to_value_list.h"
#include "base/containers/to_vector.h"
#include "base/functional/overloaded.h"
#include "base/strings/string_number_conversions.h"
#include "base/types/expected_macros.h"
#include "chrome/browser/web_applications/proto/web_app_isolation_data.pb.h"
#include "components/web_package/signed_web_bundles/ecdsa_p256_public_key.h"
#include "components/web_package/signed_web_bundles/ecdsa_p256_sha256_signature.h"
#include "components/web_package/signed_web_bundles/ed25519_public_key.h"
#include "components/web_package/signed_web_bundles/signed_web_bundle_signature_stack_entry.h"
namespace web_app {
namespace {
template <typename KeyType>
base::expected<KeyType, std::string> PublicKeyFromBase64Data(
const std::string& b64_data) { … }
template <typename SignatureType>
base::expected<SignatureType, std::string> SignatureFromHexData(
const std::string& hex_data) { … }
base::expected<web_package::SignedWebBundleSignatureInfo, std::string>
SignatureInfoFromProto(
const proto::IsolationData::IntegrityBlockData::SignatureInfo& si_proto) { … }
template <typename SignatureInfoProto>
SignatureInfoProto SignatureInfoToProto(const auto& signature_info) { … }
}
IsolatedWebAppIntegrityBlockData::IsolatedWebAppIntegrityBlockData(
std::vector<web_package::SignedWebBundleSignatureInfo> signatures)
: … { … }
IsolatedWebAppIntegrityBlockData::~IsolatedWebAppIntegrityBlockData() = default;
IsolatedWebAppIntegrityBlockData::IsolatedWebAppIntegrityBlockData(
const IsolatedWebAppIntegrityBlockData&) = default;
IsolatedWebAppIntegrityBlockData& IsolatedWebAppIntegrityBlockData::operator=(
const IsolatedWebAppIntegrityBlockData&) = default;
bool IsolatedWebAppIntegrityBlockData::operator==(
const IsolatedWebAppIntegrityBlockData& other) const = default;
IsolatedWebAppIntegrityBlockData
IsolatedWebAppIntegrityBlockData::FromIntegrityBlock(
const web_package::SignedWebBundleIntegrityBlock& integrity_block) { … }
base::expected<IsolatedWebAppIntegrityBlockData, std::string>
IsolatedWebAppIntegrityBlockData::FromProto(
const proto::IsolationData::IntegrityBlockData& proto) { … }
proto::IsolationData::IntegrityBlockData
IsolatedWebAppIntegrityBlockData::ToProto() const { … }
base::Value IsolatedWebAppIntegrityBlockData::AsDebugValue() const { … }
bool IsolatedWebAppIntegrityBlockData::HasPublicKey(
base::span<const uint8_t> public_key) const { … }
}