blob: 6cfd59c99e5cea5e31ea08ac532678b5f25d6c35 [file] [log] [blame]
Avi Drissman8ba1bad2022-09-13 19:22:361// Copyright 2017 The Chromium Authors
Joshua Pawlickib8bc9f92017-10-16 17:23:522// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef COMPONENTS_CRX_FILE_CRX_CREATOR_H_
6#define COMPONENTS_CRX_FILE_CRX_CREATOR_H_
7
Swapnile28f8ea72021-02-03 21:43:278#include <string>
9
Joshua Pawlickib8bc9f92017-10-16 17:23:5210namespace base {
11class FilePath;
12} // namespace base
13
Elly8ff5b0d2025-06-25 00:52:2714namespace crypto::keypair {
15class PrivateKey;
16} // namespace crypto::keypair
Joshua Pawlickib8bc9f92017-10-16 17:23:5217
18namespace crx_file {
19
20enum class CreatorResult {
21 OK, // The CRX file was successfully created.
22 ERROR_SIGNING_FAILURE,
23 ERROR_FILE_NOT_READABLE,
24 ERROR_FILE_NOT_WRITABLE,
25 ERROR_FILE_WRITE_FAILURE,
26};
27
Swapnile28f8ea72021-02-03 21:43:2728// Similar to `Create` method but also injects `verified_contents` into the
Swapnil79763c42021-04-01 09:54:1029// header.
30CreatorResult CreateCrxWithVerifiedContentsInHeader(
Swapnile28f8ea72021-02-03 21:43:2731 const base::FilePath& output_path,
32 const base::FilePath& zip_path,
Elly8ff5b0d2025-06-25 00:52:2733 const crypto::keypair::PrivateKey& signing_key,
Swapnile28f8ea72021-02-03 21:43:2734 const std::string& verified_contents);
35
Joshua Pawlickib8bc9f92017-10-16 17:23:5236// Create a CRX3 file at |output_path|, using the contents of the ZIP archive
37// located at |zip_path| and signing with (and deriving the CRX ID from)
38// |signing_key|.
39CreatorResult Create(const base::FilePath& output_path,
40 const base::FilePath& zip_path,
Elly8ff5b0d2025-06-25 00:52:2741 const crypto::keypair::PrivateKey& signing_key);
Joshua Pawlickib8bc9f92017-10-16 17:23:5242
43} // namespace crx_file
44
45#endif // COMPONENTS_CRX_FILE_CRX_CREATOR_H_