// Copyright 2026 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef EXTENSIONS_COMMON_API_MESSAGING_SIGNING_CERTIFICATE_H_
#define EXTENSIONS_COMMON_API_MESSAGING_SIGNING_CERTIFICATE_H_

#include <stdint.h>

#include <array>
#include <vector>

namespace extensions {

// A 32-byte SHA-256 digest of an Android application signing certificate.
using SigningCertificate = std::array<uint8_t, 32>;

// A collection of expected Android application signing certificate digests.
using SigningCertificates = std::vector<SigningCertificate>;

// The raw C++ container types generated by Mojo for `array<array<uint8, 32>>`.
// Mojo C++ bindings represent variable or fixed-length byte arrays as
// `std::vector<uint8_t>`.
using MojomSigningCertificate = std::vector<uint8_t>;
using MojomSigningCertificates = std::vector<MojomSigningCertificate>;

// Converts Mojo-deserialized certificate byte vectors into
// `SigningCertificates`. In Mojo interfaces, fixed-size arrays (such as
// `array<uint8, 32>`) are mapped to `std::vector<uint8_t>` in C++ bindings.
// This helper copies the 32-byte digests into fixed-size `SigningCertificate`
// arrays.
SigningCertificates ParseCertificatesFromMojom(
    const MojomSigningCertificates& certificates);

}  // namespace extensions

#endif  // EXTENSIONS_COMMON_API_MESSAGING_SIGNING_CERTIFICATE_H_
