blob: b8d2f949c8727017ea568e708a826766253490d9 [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
14namespace crypto {
15class RSAPrivateKey;
16} // namespace crypto
17
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,
33 crypto::RSAPrivateKey* signing_key,
34 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,
41 crypto::RSAPrivateKey* signing_key);
42
43} // namespace crx_file
44
45#endif // COMPONENTS_CRX_FILE_CRX_CREATOR_H_