/* * Copyright (c) 2023, Sam Atkins * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include namespace Web::SRI { // https://w3c.github.io/webappsec-subresource-integrity/#integrity-metadata struct Metadata { String algorithm; // "alg" String base64_value; // "val" String options {}; // "opt" }; ErrorOr apply_algorithm_to_bytes(StringView algorithm, ByteBuffer const& bytes); ErrorOr> parse_metadata(StringView metadata); ErrorOr> get_strongest_metadata_from_set(Vector const& set); ErrorOr do_bytes_match_metadata_list(ByteBuffer const& bytes, StringView metadata_list); }