app-provision-structure.md 8.2 KB
Newer Older
E
ester.zhou 已提交
1 2 3 4 5 6
#  HarmonyAppProvision Configuration File
The **HarmonyAppProvision** configuration file (also called profile) is the file where you declare permission and signature information for your application.

## Configuration File Internal Structure
The **HarmonyAppProvision** file consists of several parts, which are described in the table below.

A
Annie_wang 已提交
7
| Name    | Description                                                                                    | Data Type| Mandatory | Initial Value Allowed|
E
ester.zhou 已提交
8
| ----------- | ---------------------------------------------------------------------------------------- | -------- | -------- | -------- |
A
Annie_wang 已提交
9 10
| version-code | Version number of the **HarmonyAppProvision** file format. The value is a positive integer containing 32 or less digits.| Number  | Yes | No                |
| version-name     | Description of the version number. It is recommended that the value consist of three segments, for example, **A.B.C**.       | String  | Yes | No|
A
Annie_wang 已提交
11
| uuid    | Unique ID of the **HarmonyAppProvision** file.                      | String    | Yes | No|
A
Annie_wang 已提交
12
| type | Type of the **HarmonyAppProvision** file. The value can be **debug** (for application debugging) or **release** (for application release). The recommended value is **debug**.| String    | Yes | No|
A
Annie_wang 已提交
13
| issuer | Issuer of the **HarmonyAppProvision** file.       | String    | Yes | No|
E
ester.zhou 已提交
14
| validity    | Validity period of the **HarmonyAppProvision** file. For details, see [Internal Structure of the validity Object](#internal-structure-of-the-validity-object). | Object    | Yes | No |
A
Annie_wang 已提交
15
| bundle-info | Information about the application bundle and developer. For details, see [Internal Structure of the bundle-info Object](#internal-structure-of-the-bundle-info-object).        | Object    | Yes | No |
A
Annie_wang 已提交
16 17 18
| acls        | Information about the Access Control Lists (ACLs). For details, see [Internal Structure of the acls Object](#internal-structure-of-the-acls-object).                          | Object    | No | Yes |
| permissions | Permissions required for your application. For details, see [Internal Structure of the permissions Object](#internal-structure-of-the-permissions-object).     | Object    | No | Yes |
| debug-info  | Additional information for application debugging. For details, see [Internal Structure of the debug-info Object](#internal-structure-of-the-debug-info-object).         | Object    | No | Yes |
A
Annie_wang 已提交
19
| app-privilege-capabilities | Privilege information required by the application bundle. For details, see the [Application Privilege Configuration Guide](../../device-dev/subsystems/subsys-app-privilege-config-guide.md).  | String array| No | Yes        |
E
ester.zhou 已提交
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

An example of the **HarmonyAppProvision** file is as follows:
```json
{
    "version-code": 1,
    "version-name": "1.0.0",
	"uuid": "string",
	"type": "debug",
	"validity": {
		"not-before": 1586422743,
		"not-after": 1617958743
	},
	"bundle-info" : {
		"developer-id": "OpenHarmony",
		"development-certificate": "Base64 string",
		"distribution-certificate": "Base64 string",
		"bundle-name": "com.OpenHarmony.app.test",
		"apl": "normal",
        "app-feature": "hos_normal_app"
	},
	"acls": {
		"allowed-acls": ["string"]
    },
	"permissions": {
		"restricted-permissions": ["string"]
    },
    "debug-info" : {
	    "device-id-type": "udid",
	    "device-ids": ["string"]
    },
A
Annie_wang 已提交
50
    "app-privilege-capabilities":["AllowAppUsePrivilegeExtension"],
E
ester.zhou 已提交
51 52 53 54 55 56 57
    "issuer": "OpenHarmony"
}

```


### Internal Structure of the validity Object
A
Annie_wang 已提交
58 59

| Name   | Description                           | Data Type| Mandatory | Initial Value Allowed|
E
ester.zhou 已提交
60
| ---------- | ------------------------------- | ------- | ------- | --------- |
A
Annie_wang 已提交
61 62
| not-before | Start time of the file validity period. The value is a Unix timestamp, which is a non-negative integer.| Number   | Yes | No |
| not-after  | End time of the file validity period. The value is a Unix timestamp, which is a non-negative integer.| Number   | Yes | No |
E
ester.zhou 已提交
63 64

### Internal Structure of the bundle-info Object
A
Annie_wang 已提交
65 66

| Name                 | Description                           | Data Type| Mandatory | Initial Value Allowed|
E
ester.zhou 已提交
67
| ------------------------ | ------------------------------- | ------- | -------- | --------- |
A
Annie_wang 已提交
68 69 70 71 72
| developer-id | Unique ID of the developer.| String   | Yes | No |
| development-certificate  | Information about the [debug certificate](hapsigntool-guidelines.md).| Number   | Yes if **type** is set to **debug** and no otherwise  | No |
| distribution-certificate  | Information about the [release certificate](hapsigntool-guidelines.md).| Number   | Yes if **type** is set to **release** and no otherwise| No |
| bundle-name  | Bundle name of the application.| String   | Yes | No |
| apl  | [Ability privilege level (APL)](accesstoken-overview.md) of your application. The value can be **normal**, **system_basic**, or **system_core**.| String   | Yes | No |
A
Annie_wang 已提交
73
| app-feature  | Type of your application. The value can be **hos_system_app** (system application) or **hos_normal_app** (normal application). Only system applications are allowed to call system APIs. If a normal application calls a system API, the call cannot be successful or the application may run abnormally.| String   | Yes | No  |
E
ester.zhou 已提交
74 75


E
ester.zhou 已提交
76
### Internal Structure of the acls Object
A
Annie_wang 已提交
77
The **acls** object contains the [ACL](accesstoken-overview.md) configured for your application. It should be noted that you still need to add the ACL information to the [**requestPermissions**](../quick-start/module-configuration-file.md#requestpermissions) attribute in the application configuration file.
E
ester.zhou 已提交
78

A
Annie_wang 已提交
79
| Name                 | Description                           | Data Type| Mandatory | Initial Value Allowed|
E
ester.zhou 已提交
80
| ------------------------ | ------------------------------- | ------- | ------- | --------- |
A
Annie_wang 已提交
81
| allowed-acls | [ACLs](../security/accesstoken-overview.md) configured for your application.| String array   | No | No |
E
ester.zhou 已提交
82 83

### Internal Structure of the permissions Object
A
Annie_wang 已提交
84
The **permissions** object contains restricted permissions required for your application. Different from the ACLs set in the **acls** object, these permissions need user authorization during the running of your application. It should be noted that you still need to add the ACL information to the [**requestPermissions**](../quick-start/module-configuration-file.md#requestpermissions) attribute in the application configuration file.
E
ester.zhou 已提交
85

A
Annie_wang 已提交
86
| Name                 | Description                           | Data Type| Mandatory | Initial Value Allowed|
E
ester.zhou 已提交
87
| ------------------------ | ------------------------------- | ------- | ------- | --------- |
A
Annie_wang 已提交
88
| restricted-permissions | [Restricted permissions](accesstoken-overview.md) required for your application.| String array   | No | No |
E
ester.zhou 已提交
89 90

### Internal Structure of the debug-info Object
E
ester.zhou 已提交
91
The **debug-info** object contains debugging information of your application, mainly device management and control information.
E
ester.zhou 已提交
92

A
Annie_wang 已提交
93
| Name                 | Description                           | Data Type| Mandatory | Initial Value Allowed|
E
ester.zhou 已提交
94
| ------------------------ | ------------------------------- | ------- | ------- | --------- |
A
Annie_wang 已提交
95 96
| device-id-type | Type of the device ID. Currently, only the udid type is supported.| String   | No | No |
| device-ids | IDs of devices on which your application can be debugged.| String array   | No | No |
A
Annie_wang 已提交
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111

## Modifying the HarmonyAppProvision Configuration File

When a development project is created, the default application type is **hos_normal_app** and the default APL level is **normal**.

To enable the application to use system APIs, you need to change the **app-feature** field to **hos_system_app** (system application). To apply for high-level permissions, you need to modify fields such as **apl** and **acl**. For details, see [Access Control Overview](accesstoken-overview.md).


To modify the HarmonyAppProvision configuration file, perform the following steps:

1. Open the directory where the OpenHarmony SDK is located. (You can choose **File** > **Settings** > **OpenHarmony SDK** on the menu bar of DevEco Studio to query the directory.)
2. In the SDK directory, go to the **Toolchains** > {Version} > **lib** directory and open the **UnsgnedReleasedProfileTemplate.json** file.
3. Modify the related fields as required.

After modifying the configuration file, [sign the application](hapsigntool-guidelines.md).