未验证 提交 5e3507e1 编写于 作者: O openharmony_ci 提交者: Gitee

!16873 [翻译完成】#I6QUUP (16518+ 16505+ 16409 +16390+ 16294)

Merge pull request !16873 from Annie_wang/PR16363A
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
The **Bluetooth** module provides classic Bluetooth capabilities and Bluetooth Low Energy (BLE) scan and advertising. The **Bluetooth** module provides classic Bluetooth capabilities and Bluetooth Low Energy (BLE) scan and advertising.
> **NOTE** > **NOTE**
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. >
> The APIs provided by this module are no longer maintained since API version 9. You are advised to use [bluetoothManager](js-apis-bluetoothManager.md). > - The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs provided by this module are no longer maintained since API version 9. You are advised to use [bluetoothManager](js-apis-bluetoothManager.md).
...@@ -123,7 +124,7 @@ let state = bluetooth.getState(); ...@@ -123,7 +124,7 @@ let state = bluetooth.getState();
getBtConnectionState(): ProfileConnectionState getBtConnectionState(): ProfileConnectionState
Obtains the profile connection state of this Bluetooth device. Obtains the local profile connection state.
> **NOTE**<br> > **NOTE**<br>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.getBtConnectionState](js-apis-bluetoothManager.md#bluetoothmanagergetbtconnectionstate). > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.getBtConnectionState](js-apis-bluetoothManager.md#bluetoothmanagergetbtconnectionstate).
...@@ -214,9 +215,9 @@ let result = bluetooth.pairDevice("XX:XX:XX:XX:XX:XX"); ...@@ -214,9 +215,9 @@ let result = bluetooth.pairDevice("XX:XX:XX:XX:XX:XX");
getProfileConnState(profileId: ProfileId): ProfileConnectionState getProfileConnState(profileId: ProfileId): ProfileConnectionState
Obtains the connection state of a profile. Obtains the connection status of a specified profile.
> **NOTE**<br> > **NOTE**
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.getProfileConnectionState](js-apis-bluetoothManager.md#bluetoothmanagergetprofileconnectionstate). > This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.getProfileConnectionState](js-apis-bluetoothManager.md#bluetoothmanagergetprofileconnectionstate).
**Required permissions**: ohos.permission.USE_BLUETOOTH **Required permissions**: ohos.permission.USE_BLUETOOTH
...@@ -1513,7 +1514,7 @@ Subscribes to the A2DP connection state change events. ...@@ -1513,7 +1514,7 @@ Subscribes to the A2DP connection state change events.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- | | -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **connectionStateChange** indicates an A2DP connection state change event.| | type | string | Yes | Event type. The value **connectionStateChange** indicates an A2DP connection state change event.|
| callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | Yes | Callback used to return the A2DP connection state change event. | | callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | Yes | Callback invoked to return the A2DP connection state change event. |
**Return value** **Return value**
...@@ -1546,7 +1547,7 @@ Unsubscribes from the A2DP connection state change events. ...@@ -1546,7 +1547,7 @@ Unsubscribes from the A2DP connection state change events.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- | | -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **connectionStateChange** indicates an A2DP connection state change event.| | type | string | Yes | Event type. The value **connectionStateChange** indicates an A2DP connection state change event.|
| callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | No | Callback used to return the A2DP connection state change event. | | callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | No | Callback for the A2DP connection state change event. |
**Return value** **Return value**
...@@ -2141,8 +2142,7 @@ on(type: "characteristicWrite", callback: Callback&lt;CharacteristicWriteReq&gt; ...@@ -2141,8 +2142,7 @@ on(type: "characteristicWrite", callback: Callback&lt;CharacteristicWriteReq&gt;
Subscribes to the characteristic write request events. Subscribes to the characteristic write request events.
> **NOTE**<br> > **NOTE**<br>
> This API is supported since API version 7 and > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattServer.on('characteristicWrite')](js-apis-bluetoothManager.md#oncharacteristicwrite).
> deprecated since API version 9. You are advised to use [bluetoothManager.GattServer.on('characteristicWrite')](js-apis-bluetoothManager.md#oncharacteristicwrite).
**Required permissions**: ohos.permission.USE_BLUETOOTH **Required permissions**: ohos.permission.USE_BLUETOOTH
...@@ -3198,7 +3198,7 @@ let deviceName = gattClient.getDeviceName().then((data) => { ...@@ -3198,7 +3198,7 @@ let deviceName = gattClient.getDeviceName().then((data) => {
getRssiValue(callback: AsyncCallback&lt;number&gt;): void getRssiValue(callback: AsyncCallback&lt;number&gt;): void
Obtains the RSSI of the remote BLE device. This API uses an asynchronous callback to return the result. It can be used only after a connection is set up by calling [connect](#connect). Obtains the received signal strength indication (RSSI) of the remote BLE device. This API uses an asynchronous callback to return the result. It can be used only after a connection is set up by calling [connect](#connect).
> **NOTE**<br> > **NOTE**<br>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.getRssiValue](js-apis-bluetoothManager.md#getrssivalue). > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.getRssiValue](js-apis-bluetoothManager.md#getrssivalue).
...@@ -3553,7 +3553,7 @@ Defines the scan configuration parameters. ...@@ -3553,7 +3553,7 @@ Defines the scan configuration parameters.
## ScanDuty<sup>(deprecated)</sup> ## ScanDuty<sup>(deprecated)</sup>
Enumerates the scan modes. Enumerates the scan duty options.
> **NOTE**<br> > **NOTE**<br>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.ScanDuty](js-apis-bluetoothManager.md#scanduty). > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.ScanDuty](js-apis-bluetoothManager.md#scanduty).
...@@ -3882,7 +3882,7 @@ Enumerates the A2DP playing states. ...@@ -3882,7 +3882,7 @@ Enumerates the A2DP playing states.
## ProfileId<sup>8+</sup><sup>(deprecated)</sup><a name="ProfileId"></a> ## ProfileId<sup>8+</sup><sup>(deprecated)</sup><a name="ProfileId"></a>
Enumerates Bluetooth profiles. API version 9 is added with **PROFILE_HID_HOST** and **PROFILE_PAN_NETWORK**. Enumerates the Bluetooth profiles. API version 9 is added with **PROFILE_HID_HOST** and **PROFILE_PAN_NETWORK**.
> **NOTE**<br> > **NOTE**<br>
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.ProfileId](js-apis-bluetoothManager.md#profileid). > This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.ProfileId](js-apis-bluetoothManager.md#profileid).
......
...@@ -151,7 +151,7 @@ try { ...@@ -151,7 +151,7 @@ try {
getBtConnectionState(): ProfileConnectionState getBtConnectionState(): ProfileConnectionState
Obtains the profile connection state of this Bluetooth device. Obtains the local profile connection state.
**Required permissions**: ohos.permission.USE_BLUETOOTH **Required permissions**: ohos.permission.USE_BLUETOOTH
...@@ -1385,7 +1385,7 @@ Creates a **GattServer** instance. ...@@ -1385,7 +1385,7 @@ Creates a **GattServer** instance.
| Type | Description | | Type | Description |
| ------------------------- | ------------------------------------ | | ------------------------- | ------------------------------------ |
| [GattServer](#gattserver) | **GattServer** instance created. Before using a method of the server, you must create a **GattSever** instance.| | [GattServer](#gattserver) | **GattServer** instance created. Before using an API of the server, you must create a **GattSever** instance.|
**Example** **Example**
...@@ -1412,7 +1412,7 @@ Creates a **GattClientDevice** instance. ...@@ -1412,7 +1412,7 @@ Creates a **GattClientDevice** instance.
| Type | Description | | Type | Description |
| ------------------------------------- | ------------------------------------ | | ------------------------------------- | ------------------------------------ |
| [GattClientDevice](#gattclientdevice) | **GattClientDevice** instance created. Before using a method of the client, you must create a **GattClientDevice** instance.| | [GattClientDevice](#gattclientdevice) | **GattClientDevice** instance created. Before using an API of the client, you must create a **GattClientDevice** instance.|
**Example** **Example**
...@@ -1714,7 +1714,7 @@ try { ...@@ -1714,7 +1714,7 @@ try {
## A2dpSourceProfile ## A2dpSourceProfile
Before using a method of **A2dpSourceProfile**, you need to create an instance of this class by using the **getProfile()** method. Before using an API of **A2dpSourceProfile**, you need to create an instance of this class by using **getProfile()**.
### connect<a name="a2dp-connect"></a> ### connect<a name="a2dp-connect"></a>
...@@ -1901,7 +1901,7 @@ try { ...@@ -1901,7 +1901,7 @@ try {
## HandsFreeAudioGatewayProfile ## HandsFreeAudioGatewayProfile
Before using a method of **HandsFreeAudioGatewayProfile**, you need to create an instance of this class by using the **getProfile()** method. Before using an API of **HandsFreeAudioGatewayProfile**, you need to create an instance of this class by using **getProfile()**.
### connect<a name="hfp-connect"></a> ### connect<a name="hfp-connect"></a>
...@@ -1994,7 +1994,7 @@ Subscribes to the HFP connection state change events. ...@@ -1994,7 +1994,7 @@ Subscribes to the HFP connection state change events.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- | | -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **connectionStateChange** indicates an HFP connection state change event.| | type | string | Yes | Event type. The value **connectionStateChange** indicates an HFP connection state change event. |
| callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | Yes | Callback invoked to return the HFP connection state change event. | | callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | Yes | Callback invoked to return the HFP connection state change event. |
**Example** **Example**
...@@ -2021,7 +2021,7 @@ Unsubscribes from the HFP connection state change events. ...@@ -2021,7 +2021,7 @@ Unsubscribes from the HFP connection state change events.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- | | -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **connectionStateChange** indicates an HFP connection state change event.| | type | string | Yes | Event type. The value **connectionStateChange** indicates an HFP connection state change event. |
| callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | No | Callback for the HFP connection state change event. | | callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | No | Callback for the HFP connection state change event. |
**Example** **Example**
...@@ -2136,7 +2136,7 @@ Subscribes to the HidHost connection state change events. ...@@ -2136,7 +2136,7 @@ Subscribes to the HidHost connection state change events.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- | | -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **connectionStateChange** indicates a HidHost connection state change event.| | type | string | Yes | Event type. The value **connectionStateChange** indicates a HidHost connection state change event. |
| callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | Yes | Callback invoked to return the HidHost connection state change event. | | callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | Yes | Callback invoked to return the HidHost connection state change event. |
**Example** **Example**
...@@ -2162,7 +2162,7 @@ Unsubscribes from the HidHost connection state change events. ...@@ -2162,7 +2162,7 @@ Unsubscribes from the HidHost connection state change events.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------- | ---- | --------------------------------------------------------- | | -------- | ----------------------------------------------------- | ---- | --------------------------------------------------------- |
| type | string | Yes | Event type. The value **connectionStateChange** indicates a HidHost connection state change event.| | type | string | Yes | Event type. The value **connectionStateChange** indicates a HidHost connection state change event. |
| callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | No | Callback for the HidHost connection state change event. | | callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | No | Callback for the HidHost connection state change event. |
**Example** **Example**
...@@ -2235,7 +2235,7 @@ Subscribes to the PAN connection state change events. ...@@ -2235,7 +2235,7 @@ Subscribes to the PAN connection state change events.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- | | -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **connectionStateChange** indicates an PAN connection state change event. | | type | string | Yes | Event type. The value **connectionStateChange** indicates a PAN connection state change event. |
| callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | Yes | Callback invoked to return the PAN connection state change event. | | callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | Yes | Callback invoked to return the PAN connection state change event. |
**Example** **Example**
...@@ -2261,7 +2261,7 @@ Unsubscribes from the PAN connection state change events. ...@@ -2261,7 +2261,7 @@ Unsubscribes from the PAN connection state change events.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------- | ---- | --------------------------------------------------------- | | -------- | ----------------------------------------------------- | ---- | --------------------------------------------------------- |
| type | string | Yes | Event type. The value **connectionStateChange** indicates a PAN connection state change event.| | type | string | Yes | Event type. The value **connectionStateChange** indicates a PAN connection state change event. |
| callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | No | Callback for the PAN connection state change event. | | callback | Callback&lt;[StateChangeParam](#StateChangeParam)&gt; | No | Callback for the PAN connection state change event. |
**Example** **Example**
...@@ -2333,17 +2333,6 @@ Obtains the network sharing status. ...@@ -2333,17 +2333,6 @@ Obtains the network sharing status.
| --------------------- | --------------------------------- | | --------------------- | --------------------------------- |
| boolean | Returns **true** if tethering is available over a Bluetooth PAN; return **false** otherwise.| | boolean | Returns **true** if tethering is available over a Bluetooth PAN; return **false** otherwise.|
**Error codes**
For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md).
| ID| Error Message|
| -------- | ---------------------------- |
|2900001 | Service stopped. |
|2900003 | Bluetooth switch is off. |
|2900004 | Profile is not supported. |
|2900099 | Operation failed. |
**Example** **Example**
```js ```js
...@@ -2358,7 +2347,7 @@ try { ...@@ -2358,7 +2347,7 @@ try {
## GattServer ## GattServer
Implements the Generic Attribute Profile (GATT) server. Before using an API of this class, you need to create a **GattServer** instance using the **createGattServer()** method. Implements the Generic Attribute Profile (GATT) server. Before using an API of this class, you need to create a **GattServer** instance using **createGattServer()**.
### startAdvertising ### startAdvertising
...@@ -2860,7 +2849,7 @@ Subscribes to the descriptor read request events. ...@@ -2860,7 +2849,7 @@ Subscribes to the descriptor read request events.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | --------------------------------- | | -------- | ---------------------------------------- | ---- | --------------------------------- |
| type | string | Yes | Event type. The value **descriptorRead** indicates a descriptor read request event.| | type | string | Yes | Event type. The value **descriptorRead** indicates a descriptor read request event.|
| callback | Callback&lt;[DescriptorReadRequest](#descriptorreadrequest)&gt; | Yes | Callback invoked to return a characteristic read request event from the GATT client. | | callback | Callback&lt;[DescriptorReadRequest](#descriptorreadrequest)&gt; | Yes | Callback invoked to return a descriptor read request event from the GATT client. |
**Example** **Example**
...@@ -3661,7 +3650,7 @@ try { ...@@ -3661,7 +3650,7 @@ try {
on(type: "BLECharacteristicChange", callback: Callback&lt;BLECharacteristic&gt;): void on(type: "BLECharacteristicChange", callback: Callback&lt;BLECharacteristic&gt;): void
Subscribes to the BLE characteristic change events. The client can receive a notification from the server only after the **setNotifyCharacteristicChanged** API is called. Subscribes to the BLE characteristic change events. The client can receive a notification from the server only after **setNotifyCharacteristicChanged** is called.
**Required permissions**: ohos.permission.USE_BLUETOOTH **Required permissions**: ohos.permission.USE_BLUETOOTH
......
...@@ -131,7 +131,7 @@ Sets a session ID for synchronization. Automatic synchronization is performed fo ...@@ -131,7 +131,7 @@ Sets a session ID for synchronization. Automatic synchronization is performed fo
**Error codes** **Error codes**
For details about the error codes, see [Distributed Data Object Error Codes](../errorcodes/errorcode-distributed-dataObject.md). For details about the error codes, see [Distributed Data Object Error Codes](../errorcodes/errorcode-distributed-dataObject.md).
| ID| Error Message| | ID| Error Message|
| -------- | -------- | | -------- | -------- |
...@@ -288,7 +288,7 @@ g_object.off("change"); ...@@ -288,7 +288,7 @@ g_object.off("change");
on(type: 'status', callback: Callback<{ sessionId: string, networkId: string, status: 'online' | 'offline' }>): void on(type: 'status', callback: Callback<{ sessionId: string, networkId: string, status: 'online' | 'offline' }>): void
Subscribes to statue changes of this distributed data object. Subscribes to status changes of this distributed data object.
**System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
...@@ -363,7 +363,12 @@ The saved data will be released in the following cases: ...@@ -363,7 +363,12 @@ The saved data will be released in the following cases:
```ts ```ts
g_object.setSessionId("123456"); g_object.setSessionId("123456");
g_object.save("local", (result) => { g_object.save("local", (err, result) => {
if (err) {
console.info("save failed, error code = " + err.code);
console.info("save failed, error message: " + err.message);
return;
}
console.info("save callback"); console.info("save callback");
console.info("save sessionId: " + result.sessionId); console.info("save sessionId: " + result.sessionId);
console.info("save version: " + result.version); console.info("save version: " + result.version);
...@@ -408,8 +413,9 @@ g_object.save("local").then((result) => { ...@@ -408,8 +413,9 @@ g_object.save("local").then((result) => {
console.info("save sessionId " + result.sessionId); console.info("save sessionId " + result.sessionId);
console.info("save version " + result.version); console.info("save version " + result.version);
console.info("save deviceId " + result.deviceId); console.info("save deviceId " + result.deviceId);
}, () => { }).catch((err) => {
console.error("save failed"); console.info("save failed, error code = " + err.code);
console.info("save failed, error message: " + err.message);
}); });
``` ```
...@@ -435,14 +441,24 @@ If the object is stored on another device, the data on the local device will be ...@@ -435,14 +441,24 @@ If the object is stored on another device, the data on the local device will be
```js ```js
g_object.setSessionId("123456"); g_object.setSessionId("123456");
// Save data for persistence. // Save data for persistence.
g_object.save("local", (result) => { g_object.save("local", (err, result) => {
if (err) {
console.info("save failed, error code = " + err.code);
console.info("save failed, error message: " + err.message);
return;
}
console.info("save callback"); console.info("save callback");
console.info("save sessionId " + result.sessionId); console.info("save sessionId: " + result.sessionId);
console.info("save version " + result.version); console.info("save version: " + result.version);
console.info("save deviceId " + result.deviceId); console.info("save deviceId: " + result.deviceId);
}); });
// Delete the persistence data. // Delete the persistence data.
g_object.revokeSave((result) => { g_object.revokeSave((err, result) => {
if (err) {
console.info("revokeSave failed, error code = " + err.code);
console.info("revokeSave failed, error message: " + err.message);
return;
}
console.info("revokeSave callback"); console.info("revokeSave callback");
console.info("revokeSave sessionId " + result.sessionId); console.info("revokeSave sessionId " + result.sessionId);
}); });
...@@ -475,15 +491,17 @@ g_object.save("local").then((result) => { ...@@ -475,15 +491,17 @@ g_object.save("local").then((result) => {
console.info("save sessionId " + result.sessionId); console.info("save sessionId " + result.sessionId);
console.info("save version " + result.version); console.info("save version " + result.version);
console.info("save deviceId " + result.deviceId); console.info("save deviceId " + result.deviceId);
}, () => { }).catch((err) => {
console.error("save failed"); console.info("save failed, error code = " + err.code);
console.info("save failed, error message: " + err.message);
}); });
// Delete the persistence data. // Delete the persistence data.
g_object.revokeSave().then((result) => { g_object.revokeSave().then((result) => {
console.info("revokeSave callback"); console.info("revokeSave callback");
console.info("sessionId" + result.sessionId); console.info("sessionId" + result.sessionId);
}, () => { }).catch((err)=> {
console.error("revokeSave failed"); console.info("revokeSave failed, error code = " + err.code);
console.info("revokeSave failed, error message = " + err.message);
}); });
``` ```
...@@ -612,7 +630,7 @@ Unsubscribes from the data changes of this distributed data object. ...@@ -612,7 +630,7 @@ Unsubscribes from the data changes of this distributed data object.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type to unsubscribe from. The value is **change**, which indicates data changes. | | type | string | Yes| Event type to unsubscribe from. The value is **change**, which indicates data changes.|
| callback | Callback<{ sessionId: string, fields: Array&lt;string&gt; }> | No| Callback for data changes. If this parameter is not specified, all data change callbacks of this distributed data object will be unregistered.<br>**sessionId** indicates the session ID of the distributed data object.<br>**fields** indicates the changed attributes of the distributed data object.| | callback | Callback<{ sessionId: string, fields: Array&lt;string&gt; }> | No| Callback for data changes. If this parameter is not specified, all data change callbacks of this distributed data object will be unregistered.<br>**sessionId** indicates the session ID of the distributed data object.<br>**fields** indicates the changed attributes of the distributed data object.|
...@@ -673,7 +691,7 @@ Unsubscribes from the status change of this distributed data object. ...@@ -673,7 +691,7 @@ Unsubscribes from the status change of this distributed data object.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| type | string | Yes| Event type to unsubscribe from. The value is **status**, which indicates the status change (online or offline) of the distributed data object. | | type | string | Yes| Event type to unsubscribe from. The value is **status**, which indicates the status change (online or offline) of the distributed data object.|
| callback | Callback<{ sessionId: string, deviceId: string, status: 'online' \| 'offline' }> | No| Callback for status changes. If this parameter is not specified, all status change callbacks of this distributed data object will be unregistered.<br>**sessionId** indicates the session ID of the distributed data object.<br>**deviceId** indicates the device ID of the distributed data object.<br>**status** indicates the object status, which can be online or offline.| | callback | Callback<{ sessionId: string, deviceId: string, status: 'online' \| 'offline' }> | No| Callback for status changes. If this parameter is not specified, all status change callbacks of this distributed data object will be unregistered.<br>**sessionId** indicates the session ID of the distributed data object.<br>**deviceId** indicates the device ID of the distributed data object.<br>**status** indicates the object status, which can be online or offline.|
......
...@@ -3755,7 +3755,7 @@ try { ...@@ -3755,7 +3755,7 @@ try {
sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void
Synchronizes the KV store manually. For details about the synchronization modes of the distributed data service, see [Distributed Data Service Overview](../../database/database-mdds-overview.md). Synchronizes the KV store manually. For details about the synchronization modes of the distributed data service, see [Distributed Data Service Overview](../../database/database-mdds-overview.md).
> **NOTE** > **NOTE**<br/>
> >
> The value of **deviceIds** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications. > The value of **deviceIds** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
...@@ -5177,7 +5177,7 @@ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void ...@@ -5177,7 +5177,7 @@ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void
Synchronizes the KV store manually. For details about the synchronization modes of the distributed data service, see [Distributed Data Service Overview](../../database/database-mdds-overview.md). Synchronizes the KV store manually. For details about the synchronization modes of the distributed data service, see [Distributed Data Service Overview](../../database/database-mdds-overview.md).
> **NOTE** > **NOTE**<br/>
> >
> The value of **deviceIds** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications. > The value of **deviceIds** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
......
# @ohos.file.volumeManager (Volument Management) # @ohos.file.volumeManager (Volume Management)
The volumeManager module provides APIs for volume and disk management, including obtaining volume information, mounting or unmounting volumes, partitioning disks, and formatting volumes. The **volumeManager** module provides APIs for volume and disk management, including obtaining volume information, mounting or unmounting a volume, partitioning a disk, and formatting a volume.
> **NOTE** > **NOTE**
> >
...@@ -18,7 +18,7 @@ import volumemanager from "@ohos.file.volumeManager"; ...@@ -18,7 +18,7 @@ import volumemanager from "@ohos.file.volumeManager";
getAllVolumes(): Promise&lt;Array&lt;Volume&gt;&gt; getAllVolumes(): Promise&lt;Array&lt;Volume&gt;&gt;
Asynchronously obtains information about all available volumes. This API uses a promise to return the result. Obtains information about all volumes of this external storage device. This API uses a promise to return the result.
**Required permissions**: ohos.permission.STORAGE_MANAGER **Required permissions**: ohos.permission.STORAGE_MANAGER
...@@ -26,15 +26,17 @@ Asynchronously obtains information about all available volumes. This API uses a ...@@ -26,15 +26,17 @@ Asynchronously obtains information about all available volumes. This API uses a
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------------------- | -------------------------- | | ---------------------------------- | -------------------------- |
| Promise&lt;[Volume](#volume)[]&gt; | Promise used to return the execution result.| | Promise&lt;[Volume](#volume)[]&gt; | Promise used to return information about all available volumes.|
**Example** **Example**
```js ```js
volumemanager.getAllVolumes().then(function(volumes){ volumemanager.getAllVolumes().then(function(volumes){
// Do something. // Do something.
}).catch(function(error){
console.info("getAllVolumes failed");
}); });
``` ```
...@@ -42,7 +44,7 @@ Asynchronously obtains information about all available volumes. This API uses a ...@@ -42,7 +44,7 @@ Asynchronously obtains information about all available volumes. This API uses a
getAllVolumes(callback: AsyncCallback&lt;Array&lt;Volume&gt;&gt;): void getAllVolumes(callback: AsyncCallback&lt;Array&lt;Volume&gt;&gt;): void
Asynchronously obtains information about all available volumes. This API uses a callback to return the result. Obtains information about all volumes of this external storage device. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.STORAGE_MANAGER **Required permissions**: ohos.permission.STORAGE_MANAGER
...@@ -50,9 +52,9 @@ Asynchronously obtains information about all available volumes. This API uses a ...@@ -50,9 +52,9 @@ Asynchronously obtains information about all available volumes. This API uses a
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------- | ---- | ------------------------------------ | | -------- | ------------------------------------------------- | ---- | ------------------------------------ |
| callback | AsyncCallback&lt;[Volume](#volume)[]&gt; | Yes | Callback invoked to return the volume information obtained.| | callback | AsyncCallback&lt;[Volume](#volume)[]&gt; | Yes | Callback invoked to return information about all available volumes.|
**Example** **Example**
...@@ -68,7 +70,7 @@ Asynchronously obtains information about all available volumes. This API uses a ...@@ -68,7 +70,7 @@ Asynchronously obtains information about all available volumes. This API uses a
mount(volumeId: string): Promise&lt;void&gt; mount(volumeId: string): Promise&lt;void&gt;
Asynchronously mounts a volume. This API uses a promise to return the result. Asynchronously mounts a volume. This API uses a promise to return the result. Currently, only the File Allocation Table (FAT), Extensible FAT (exFAT), and New Technology File System (NTFS) file systems are supported.
**Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER **Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER
...@@ -76,22 +78,24 @@ Asynchronously mounts a volume. This API uses a promise to return the result. ...@@ -76,22 +78,24 @@ Asynchronously mounts a volume. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description| | Name | Type | Mandatory| Description|
| -------- | ------ | ---- | ---- | | -------- | ------ | ---- | ---- |
| volumeId | string | Yes | Volume ID.| | volumeId | string | Yes | Volume ID.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------- | ---------- | | ---------------------- | ---------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
```js ```js
let volumeId = ""; let volumeId = "";
volumemanager.mount(volumeId).then(function(flag){ volumemanager.mount(volumeId).then(function(){
// Do something // Do something.
}).catch(function(error){
console.info("mount failed");
}); });
``` ```
...@@ -99,7 +103,7 @@ Asynchronously mounts a volume. This API uses a promise to return the result. ...@@ -99,7 +103,7 @@ Asynchronously mounts a volume. This API uses a promise to return the result.
mount(volumeId: string, callback:AsyncCallback&lt;void&gt;):void mount(volumeId: string, callback:AsyncCallback&lt;void&gt;):void
Asynchronously obtains the available space of the specified volume. This API uses a callback to return the result. Asynchronously mounts a volume. This API uses an asynchronous callback to return the result. Currently, only the FAT, exFAT, and NTFS file systems are supported.
**Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER **Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER
...@@ -107,17 +111,17 @@ Asynchronously obtains the available space of the specified volume. This API use ...@@ -107,17 +111,17 @@ Asynchronously obtains the available space of the specified volume. This API use
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------- | ---- | -------------------- | | -------- | ------------------------------------- | ---- | -------------------- |
| volumeId | string | Yes | Volume ID. | | volumeId | string | Yes | Volume ID. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback that returns no value.|
**Example** **Example**
```js ```js
let volumeId = ""; let volumeId = "";
volumemanager.mount(volumeId, function(error, flag){ volumemanager.mount(volumeId, function(error){
// Do something // Do something.
}); });
``` ```
...@@ -133,22 +137,24 @@ Asynchronously unmounts a volume. This API uses a promise to return the result. ...@@ -133,22 +137,24 @@ Asynchronously unmounts a volume. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description| | Name | Type | Mandatory| Description|
| -------- | ------ | ---- | ---- | | -------- | ------ | ---- | ---- |
| volumeId | string | Yes | Volume ID.| | volumeId | string | Yes | Volume ID.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------- | ---------- | | ---------------------- | ---------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
```js ```js
let volumeId = ""; let volumeId = "";
volumemanager.unmount(volumeId).then(function(flag){ volumemanager.unmount(volumeId).then(function(){
// Do something // Do something.
}).catch(function(error){
console.info("mount failed");
}); });
``` ```
...@@ -156,7 +162,7 @@ Asynchronously unmounts a volume. This API uses a promise to return the result. ...@@ -156,7 +162,7 @@ Asynchronously unmounts a volume. This API uses a promise to return the result.
unmount(volumeId: string, callback: AsyncCallback&lt;void&gt;): void unmount(volumeId: string, callback: AsyncCallback&lt;void&gt;): void
Asynchronously unmounts a volume. This API uses a callback to return the result. Asynchronously unmounts a volume. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER **Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER
...@@ -164,17 +170,17 @@ Asynchronously unmounts a volume. This API uses a callback to return the result. ...@@ -164,17 +170,17 @@ Asynchronously unmounts a volume. This API uses a callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------- | ---- | -------------------- | | -------- | ------------------------------------- | ---- | -------------------- |
| volumeId | string | Yes | Volume ID. | | volumeId | string | Yes | Volume ID. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback that returns no value.|
**Example** **Example**
```js ```js
let volumeId = ""; let volumeId = "";
volumemanager.unmount(volumeId, function(error, flag){ volumemanager.unmount(volumeId, function(error){
// Do something // Do something.
}); });
``` ```
...@@ -182,7 +188,7 @@ Asynchronously unmounts a volume. This API uses a callback to return the result. ...@@ -182,7 +188,7 @@ Asynchronously unmounts a volume. This API uses a callback to return the result.
getVolumeByUuid(uuid: string): Promise&lt;Volume&gt; getVolumeByUuid(uuid: string): Promise&lt;Volume&gt;
Asynchronously obtains volume information based on the universally unique identifier (UUID). This API uses a promise to return the result. Obtains information about a volume based on the universally unique identifier (UUID). This API uses a promise to return the result.
**Required permissions**: ohos.permission.STORAGE_MANAGER **Required permissions**: ohos.permission.STORAGE_MANAGER
...@@ -190,15 +196,15 @@ Asynchronously obtains volume information based on the universally unique identi ...@@ -190,15 +196,15 @@ Asynchronously obtains volume information based on the universally unique identi
**Parameters** **Parameters**
| Name | Type | Mandatory| Description| | Name | Type | Mandatory| Description|
| -------- | ------ | ---- | ---- | | -------- | ------ | ---- | ---- |
| uuid | string | Yes | UUID of the volume.| | uuid | string | Yes | UUID of the volume.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------------------- | -------------------------- | | ---------------------------------- | -------------------------- |
| Promise&lt;[Volume](#volume)&gt; | Promise used to return the volume information obtained.| | Promise&lt;[Volume](#volume)&gt; | Promise used to return the volume information obtained.|
**Example** **Example**
...@@ -215,7 +221,7 @@ Asynchronously obtains volume information based on the universally unique identi ...@@ -215,7 +221,7 @@ Asynchronously obtains volume information based on the universally unique identi
getVolumeByUuid(uuid: string, callback: AsyncCallback&lt;Volume&gt;): void getVolumeByUuid(uuid: string, callback: AsyncCallback&lt;Volume&gt;): void
Asynchronously obtains volume information based on the UUID. This API uses a callback to return the result. Obtains information about a volume based on the UUID. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.STORAGE_MANAGER **Required permissions**: ohos.permission.STORAGE_MANAGER
...@@ -223,10 +229,10 @@ Asynchronously obtains volume information based on the UUID. This API uses a cal ...@@ -223,10 +229,10 @@ Asynchronously obtains volume information based on the UUID. This API uses a cal
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------ | ---- | -------------------- | | -------- | ------------------------------------------------ | ---- | -------------------- |
| uuid | string | Yes | UUID of the volume. | | uuid | string | Yes | UUID of the volume. |
| callback | AsyncCallback&lt;[Volume](#volume)&gt; | Yes | Callback invoked to return the volume information obtained.| | callback | AsyncCallback&lt;[Volume](#volume)&gt; | Yes | Callback invoked to return the volume information obtained.|
**Example** **Example**
...@@ -241,7 +247,7 @@ Asynchronously obtains volume information based on the UUID. This API uses a cal ...@@ -241,7 +247,7 @@ Asynchronously obtains volume information based on the UUID. This API uses a cal
getVolumeById(volumeId: string): Promise&lt;Volume&gt; getVolumeById(volumeId: string): Promise&lt;Volume&gt;
Asynchronously obtains volume information based on the volume ID. This API uses a promise to return the result. Obtains information about a volume based on the volume ID. This API uses a promise to return the result.
**Required permissions**: ohos.permission.STORAGE_MANAGER **Required permissions**: ohos.permission.STORAGE_MANAGER
...@@ -249,15 +255,15 @@ Asynchronously obtains volume information based on the volume ID. This API uses ...@@ -249,15 +255,15 @@ Asynchronously obtains volume information based on the volume ID. This API uses
**Parameters** **Parameters**
| Name | Type | Mandatory | Description| | Name | Type | Mandatory | Description|
| -------- | ------ | ---- | ---- | | -------- | ------ | ---- | ---- |
| volumeId | string | Yes | Volume ID.| | volumeId | string | Yes | Volume ID.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------------------- | -------------------------- | | ---------------------------------- | -------------------------- |
| Promise&lt;[Volume](#volume)&gt; | Promise used to return the volume information obtained.| | Promise&lt;[Volume](#volume)&gt; | Promise used to return the volume information obtained.|
**Example** **Example**
...@@ -274,7 +280,7 @@ Asynchronously obtains volume information based on the volume ID. This API uses ...@@ -274,7 +280,7 @@ Asynchronously obtains volume information based on the volume ID. This API uses
getVolumeById(volumeId: string, callback: AsyncCallback&lt;Volume&gt;): void getVolumeById(volumeId: string, callback: AsyncCallback&lt;Volume&gt;): void
Asynchronously obtains volume information based on the volume ID. This API uses a callback to return the result. Obtains information about a volume based on the volume ID. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.STORAGE_MANAGER **Required permissions**: ohos.permission.STORAGE_MANAGER
...@@ -282,10 +288,10 @@ Asynchronously obtains volume information based on the volume ID. This API uses ...@@ -282,10 +288,10 @@ Asynchronously obtains volume information based on the volume ID. This API uses
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ----------------------------- | | -------- | ------------------------- | ---- | ----------------------------- |
| volumeId | string | Yes | Volume ID. | | volumeId | string | Yes | Volume ID. |
| callback | AsyncCallback&lt;[Volume](#volume)&gt; | Yes | Callback invoked to return the volume information obtained. | | callback | AsyncCallback&lt;[Volume](#volume)&gt; | Yes | Callback invoked to return the volume information obtained. |
**Example** **Example**
...@@ -300,7 +306,7 @@ Asynchronously obtains volume information based on the volume ID. This API uses ...@@ -300,7 +306,7 @@ Asynchronously obtains volume information based on the volume ID. This API uses
setVolumeDescription(uuid: string, description: string): Promise&lt;void&gt; setVolumeDescription(uuid: string, description: string): Promise&lt;void&gt;
Asynchronously sets the volume description based on the UUID. This API uses a promise to return the result. Sets volume description. This API uses a promise to return the result.
**Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER **Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER
...@@ -308,16 +314,16 @@ Asynchronously sets the volume description based on the UUID. This API uses a pr ...@@ -308,16 +314,16 @@ Asynchronously sets the volume description based on the UUID. This API uses a pr
**Parameters** **Parameters**
| Name | Type | Mandatory| Description| | Name | Type | Mandatory| Description|
| --------- | ------ | ---- | ---- | | --------- | ------ | ---- | ---- |
| uuid | string | Yes | UUID of the volume.| | uuid | string | Yes | UUID of the volume.|
| description | string | Yes | Volume description.| | description | string | Yes | Volume description to set.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------- | -------------------------- | | ---------------------- | -------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. | | Promise&lt;void&gt; | Promise that returns no value. |
**Example** **Example**
...@@ -335,7 +341,7 @@ Asynchronously sets the volume description based on the UUID. This API uses a pr ...@@ -335,7 +341,7 @@ Asynchronously sets the volume description based on the UUID. This API uses a pr
setVolumeDescription(uuid: string, description: string, callback: AsyncCallback&lt;void&gt;): void setVolumeDescription(uuid: string, description: string, callback: AsyncCallback&lt;void&gt;): void
Asynchronously sets the volume description based on the UUID. This API uses a callback to return the result. Sets volume description. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER **Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER
...@@ -343,18 +349,18 @@ Asynchronously sets the volume description based on the UUID. This API uses a ca ...@@ -343,18 +349,18 @@ Asynchronously sets the volume description based on the UUID. This API uses a ca
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | --------------------------------------- | ---- | ---------------- | | ---------- | --------------------------------------- | ---- | ---------------- |
| uuid | string | Yes | UUID of the volume. | | uuid | string | Yes | UUID of the volume. |
| description | string | Yes | Volume description. | | description | string | Yes | Volume description to set. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback that returns no value.|
**Example** **Example**
```js ```js
let uuid = ""; let uuid = "";
let description = ""; let description = "";
volumemanager.setVolumeDescription(uuid, description, (error, bool) => { volumemanager.setVolumeDescription(uuid, description, (error) => {
// Do something. // Do something.
}); });
``` ```
...@@ -363,7 +369,7 @@ Asynchronously sets the volume description based on the UUID. This API uses a ca ...@@ -363,7 +369,7 @@ Asynchronously sets the volume description based on the UUID. This API uses a ca
format(volumeId: string, fsType: string): Promise&lt;void&gt; format(volumeId: string, fsType: string): Promise&lt;void&gt;
Asynchronously formats a volume. This API uses a promise to return the result. Formats a volume. This API uses a promise to return the result. Currently, only the virtual file allocation table (VFAT) and exFAT file systems are supported. Only unmounted volumes can be formatted. After a volume is formatted, the UUID, mounting path, and description of the volume change.
**Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER **Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER
...@@ -371,16 +377,16 @@ Asynchronously formats a volume. This API uses a promise to return the result. ...@@ -371,16 +377,16 @@ Asynchronously formats a volume. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description| | Name | Type | Mandatory| Description|
| ----------- | ------ | ---- | ---- | | ----------- | ------ | ---- | ---- |
| volumeId | string | Yes | Volume ID.| | volumeId | string | Yes | Volume ID.|
| fsType | string | Yes | File system type.| | fsType | string | Yes | File system type, which can be VFAT or exFAT.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------- | ---------- | | ---------------------- | ---------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise that returns no value.|
**Example** **Example**
...@@ -398,7 +404,7 @@ Asynchronously formats a volume. This API uses a promise to return the result. ...@@ -398,7 +404,7 @@ Asynchronously formats a volume. This API uses a promise to return the result.
format(volumeId: string, fsType: string, callback: AsyncCallback&lt;void&gt;): void format(volumeId: string, fsType: string, callback: AsyncCallback&lt;void&gt;): void
Asynchronously formats a volume. This API uses a callback to return the result. Formats a volume. This API uses an asynchronous callback to return the result. Currently, only the VFAT and exFAT file systems are supported. Only unmounted volumes can be formatted. After a volume is formatted, the UUID, mounting path, and description of the volume change.
**Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER **Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER
...@@ -406,18 +412,18 @@ Asynchronously formats a volume. This API uses a callback to return the result. ...@@ -406,18 +412,18 @@ Asynchronously formats a volume. This API uses a callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ----------------------------- | | -------- | ------------------------- | ---- | ----------------------------- |
| volumeId | string | Yes | Volume ID. | | volumeId | string | Yes | Volume ID. |
| fsType | string | Yes | File system type.| | fsType | string | Yes | File system type, which can be VFAT or exFAT.|
| callback | AsyncCallback&lt;void&gt; | Yes | Called after the volume is formatted. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback that returns no value. |
**Example** **Example**
```js ```js
let volumeId = ""; let volumeId = "";
let fsType = ""; let fsType = "";
volumemanager.format(volumeId, fsType, (error, bool) => { volumemanager.format(volumeId, fsType, (error) => {
// Do something. // Do something.
}); });
``` ```
...@@ -426,7 +432,7 @@ Asynchronously formats a volume. This API uses a callback to return the result. ...@@ -426,7 +432,7 @@ Asynchronously formats a volume. This API uses a callback to return the result.
partition(diskId: string, type: number): Promise&lt;void&gt; partition(diskId: string, type: number): Promise&lt;void&gt;
Asynchronously partitions a disk. This API uses a promise to return the result. Partitions a disk. This API uses a promise to return the result. The system supports access to multi-partition disks. Currently, this API can partition a disk into only one partition.
**Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER **Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER
...@@ -434,16 +440,16 @@ Asynchronously partitions a disk. This API uses a promise to return the result. ...@@ -434,16 +440,16 @@ Asynchronously partitions a disk. This API uses a promise to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description| | Name | Type | Mandatory| Description|
| ----------- | ------ | ---- | ---- | | ----------- | ------ | ---- | ---- |
| diskId | string | Yes | ID of the disk to which the volume belongs.| | diskId | string | Yes | ID of the disk to partition.|
| type | number | Yes | Partition type. | | type | number | Yes | Partition type. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| --------------------- | ----------------------- | | --------------------- | ----------------------- |
| Promise&lt;void&gt; | Promise used to return the result. | | Promise&lt;void&gt; | Promise used to return the result. |
**Example** **Example**
...@@ -461,7 +467,7 @@ Asynchronously partitions a disk. This API uses a promise to return the result. ...@@ -461,7 +467,7 @@ Asynchronously partitions a disk. This API uses a promise to return the result.
partition(diskId: string, type: number, callback: AsyncCallback&lt;void&gt;): void partition(diskId: string, type: number, callback: AsyncCallback&lt;void&gt;): void
Asynchronously partitions a disk. This API uses a callback to return the result. Asynchronously partitions a disk. This API uses a callback to return the result. The system supports access to multi-partition disks. Currently, this API can partition a disk into only one partition.
**Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER **Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER
...@@ -469,18 +475,18 @@ Asynchronously partitions a disk. This API uses a callback to return the result. ...@@ -469,18 +475,18 @@ Asynchronously partitions a disk. This API uses a callback to return the result.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ---------------- | | -------- | --------------------------------------- | ---- | ---------------- |
| diskId | string | Yes | ID of the disk to which the volume belongs. | | diskId | string | Yes | ID of the disk to partition. |
| type | number | Yes | Partition type. | | type | number | Yes | Partition type. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback that returns no value. |
**Example** **Example**
```js ```js
let diskId = ""; let diskId = "";
let type = 0; let type = 0;
volumemanager.partition(diskId, type, (error, bool) => { volumemanager.partition(diskId, type, (error) => {
// Do something. // Do something.
}); });
``` ```
...@@ -493,10 +499,10 @@ Asynchronously partitions a disk. This API uses a callback to return the result. ...@@ -493,10 +499,10 @@ Asynchronously partitions a disk. This API uses a callback to return the result.
| Name | Type | Readable | Writable | Description | | Name | Type | Readable | Writable | Description |
| ----------- | ------- | ------- | ----- | -------------------- | | ----------- | ------- | ------- | ----- | -------------------- |
| id | string | Yes| No| Volume ID. | | id | string | Yes| No| Volume ID, in the vol-{Primary device ID}-{Secondary device ID} format. The primary device IDs identify devices of different types. The secondary device IDs identify different devices of the same type. The volume IDs vary depending on the card insertion sequence. |
| uuid | string | Yes| No| UUID of the volume. | | uuid | string | Yes| No| Volume UUID, which uniquely identifies a volume irrespective of the card insertion sequence. However, the UUID of a volume will change after the volume is formatted. |
| diskId | string | Yes| No| ID of the disk to which the volume belongs. | | diskId | string | Yes| No| ID of the disk to which the volume belongs. A disk can have one or more volumes. The disk ID is in the disk-{Primary device ID}-{Secondary device ID} format, which is similar to the volume ID. |
| description | string | Yes| No| Description of the volume. | | description | string | Yes| No| Description of the volume. |
| removable | boolean | Yes| No| Whether the volume is a removable storage device.| | removable | boolean | Yes| No| Whether the volume can be removed. Currently, only removable storage devices are supported.|
| state | number | Yes| No| Volume state. | | state | number | Yes| No| Volume status.<br>**0**: The volume is unmounted.<br> **1**: The volume is being checked.<br> **2**: The volume is mounted.<br> **3**: The volume is being ejected. |
| path | string | Yes| No| Mount address of the volume. | | path | string | Yes| No| Path of the volume mounted. Generally, the path is **/mnt/external/{uuid}**. |
...@@ -75,7 +75,7 @@ Generates a key. This API uses an asynchronous callback to return the result. ...@@ -75,7 +75,7 @@ Generates a key. This API uses an asynchronous callback to return the result.
| -------- | --------------------------- | ---- | --------------------------------------------- | | -------- | --------------------------- | ---- | --------------------------------------------- |
| keyAlias | string | Yes | Alias of the key. | | keyAlias | string | Yes | Alias of the key. |
| options | [HuksOptions](#huksoptions) | Yes | Tags required for generating the key. The algorithm, key purpose, and key length are mandatory.| | options | [HuksOptions](#huksoptions) | Yes | Tags required for generating the key. The algorithm, key purpose, and key length are mandatory.|
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation fails, **err** is returned.| | callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned.|
**Example** **Example**
...@@ -186,7 +186,7 @@ Deletes a key. This API uses an asynchronous callback to return the result. ...@@ -186,7 +186,7 @@ Deletes a key. This API uses an asynchronous callback to return the result.
| -------- | --------------------------- | ---- | --------------------------------------------- | | -------- | --------------------------- | ---- | --------------------------------------------- |
| keyAlias | string | Yes | Key alias passed in when the key was generated. | | keyAlias | string | Yes | Key alias passed in when the key was generated. |
| options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). | | options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation fails, **err** is returned.| | callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned.|
**Example** **Example**
...@@ -289,7 +289,7 @@ Imports a key in plaintext. This API uses an asynchronous callback to return the ...@@ -289,7 +289,7 @@ Imports a key in plaintext. This API uses an asynchronous callback to return the
| -------- | --------------------------- | ---- | --------------------------------------------- | | -------- | --------------------------- | ---- | --------------------------------------------- |
| keyAlias | string | Yes | Alias of the key. | | keyAlias | string | Yes | Alias of the key. |
| options | [HuksOptions](#huksoptions) | Yes | Tags required for the import and key to import. The algorithm, key purpose, and key length are mandatory.| | options | [HuksOptions](#huksoptions) | Yes | Tags required for the import and key to import. The algorithm, key purpose, and key length are mandatory.|
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation fails, **err** is returned.| | callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned.|
**Example** **Example**
...@@ -426,7 +426,7 @@ Obtains the certificate used to verify a key. This API uses an asynchronous call ...@@ -426,7 +426,7 @@ Obtains the certificate used to verify a key. This API uses an asynchronous call
| -------- | ---------------------------------------------------- | ---- | --------------------------------------------- | | -------- | ---------------------------------------------------- | ---- | --------------------------------------------- |
| keyAlias | string | Yes | Alias of the key. The certificate to be obtained stores the key. | | keyAlias | string | Yes | Alias of the key. The certificate to be obtained stores the key. |
| options | [HuksOptions](#huksoptions) | Yes | Parameters and data required for obtaining the certificate. | | options | [HuksOptions](#huksoptions) | Yes | Parameters and data required for obtaining the certificate. |
| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result. If the operation fails, **err** is returned.| | callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned.|
**Example** **Example**
...@@ -553,7 +553,7 @@ Obtains the certificate used to verify a key. This API uses a promise to return ...@@ -553,7 +553,7 @@ Obtains the certificate used to verify a key. This API uses a promise to return
| Type | Description | | Type | Description |
| ---------------------------------------------- | --------------------------------------------- | | ---------------------------------------------- | --------------------------------------------- |
| Promise<[HuksReturnResult](#huksreturnresult9)> | Promise used to return the result. If the operation fails, **err** is returned.| | Promise<[HuksReturnResult](#huksreturnresult9)> | Promise used to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned.|
**Example** **Example**
...@@ -676,7 +676,7 @@ Imports a wrapped key. This API uses an asynchronous callback to return the resu ...@@ -676,7 +676,7 @@ Imports a wrapped key. This API uses an asynchronous callback to return the resu
| keyAlias | string | Yes | Alias of the wrapped key to import. | | keyAlias | string | Yes | Alias of the wrapped key to import. |
| wrappingKeyAlias | string | Yes | Alias of the data used to unwrap the key imported. | | wrappingKeyAlias | string | Yes | Alias of the data used to unwrap the key imported. |
| options | [HuksOptions](#huksoptions) | Yes | Tags required for the import and the wrapped key to import. The algorithm, key purpose, and key length are mandatory.| | options | [HuksOptions](#huksoptions) | Yes | Tags required for the import and the wrapped key to import. The algorithm, key purpose, and key length are mandatory.|
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation fails, **err** is returned.| | callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned.|
**Example** **Example**
...@@ -926,7 +926,7 @@ Exports a key. This API uses an asynchronous callback to return the result. ...@@ -926,7 +926,7 @@ Exports a key. This API uses an asynchronous callback to return the result.
| -------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ |
| keyAlias | string | Yes | Key alias, which must be the same as the alias used when the key was generated. | | keyAlias | string | Yes | Key alias, which must be the same as the alias used when the key was generated. |
| options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). | | options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). |
| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result. If the operation is successful, **HUKS_SUCCESS** is returned and **outData** contains the public key exported. If the operation fails, an error code is returned.| | callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned. **outData** contains the public key exported.|
**Example** **Example**
...@@ -1005,7 +1005,7 @@ Obtains key properties. This API uses an asynchronous callback to return the res ...@@ -1005,7 +1005,7 @@ Obtains key properties. This API uses an asynchronous callback to return the res
| -------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ |
| keyAlias | string | Yes | Key alias, which must be the same as the alias used when the key was generated. | | keyAlias | string | Yes | Key alias, which must be the same as the alias used when the key was generated. |
| options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). | | options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). |
| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result. If the operation is successful, **errorCode** is **HUKS_SUCCESS**; otherwise, an error code is returned.| | callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result. If the operation is successful, no **err** value is returned and **properties** contains the parameters required for generating the key. If the operation fails, an error code is returned. |
**Example** **Example**
...@@ -1084,7 +1084,7 @@ Checks whether a key exists. This API uses an asynchronous callback to return th ...@@ -1084,7 +1084,7 @@ Checks whether a key exists. This API uses an asynchronous callback to return th
| -------- | --------------------------- | ---- | --------------------------------------- | | -------- | --------------------------- | ---- | --------------------------------------- |
| keyAlias | string | Yes | Alias of the key to check. | | keyAlias | string | Yes | Alias of the key to check. |
| options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). | | options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). |
| callback | AsyncCallback\<boolean> | Yes | Callback invoked to return the result. **TRUE** means that the key exists; **FALSE** means the opposite.| | callback | AsyncCallback\<boolean> | Yes | Callback invoked to return the result. The value **TRUE** means that the key exists; **FALSE** means the opposite.|
**Example** **Example**
...@@ -1161,9 +1161,9 @@ Initializes the data for a key operation. This API uses an asynchronous callback ...@@ -1161,9 +1161,9 @@ Initializes the data for a key operation. This API uses an asynchronous callback
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------- | ---- | ---------------------------------------------------- | | -------- | ------------------------------------------------------- | ---- | ---------------------------------------------------- |
| keyAlias | string | Yes | Alias of the target key. | | keyAlias | string | Yes | Alias of the key involved in the **initSession** operation. |
| options | [HuksOptions](#huksoptions) | Yes | Parameters used for initialization. | | options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **initSession** operation. |
| callback | AsyncCallback\<[HuksSessionHandle](#hukssessionhandle9)> | Yes | Callback invoked to return the handle obtained through the initialization operation.| | callback | AsyncCallback\<[HuksSessionHandle](#hukssessionhandle9)> | Yes | Callback invoked to return a session handle for subsequent operations.|
## huks.initSession<sup>9+</sup> ## huks.initSession<sup>9+</sup>
...@@ -1177,14 +1177,14 @@ Initializes the data for a key operation. This API uses a promise to return the ...@@ -1177,14 +1177,14 @@ Initializes the data for a key operation. This API uses a promise to return the
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------- | ---- | ------------------------------------------------ | | -------- | ------------------------------------------------- | ---- | ------------------------------------------------ |
| keyAlias | string | Yes | Alias of the target key. | | keyAlias | string | Yes | Alias of the key involved in the **initSession** operation. |
| options | [HuksOptions](#huksoptions) | Yes | Parameters used for initialization. | | options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **initSession** operation. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| ----------------------------------- | -------------------------------------------------- | | ----------------------------------- | -------------------------------------------------- |
| Promise\<[HuksSessionHandle](#hukssessionhandle9)> | Promise used to return the handle obtained through the initialization operation.| | Promise\<[HuksSessionHandle](#hukssessionhandle9)> | Promise used to return a session handle for subsequent operations.|
## huks.updateSession<sup>9+</sup> ## huks.updateSession<sup>9+</sup>
...@@ -1198,9 +1198,9 @@ Updates the key operation by segment. This API uses an asynchronous callback to ...@@ -1198,9 +1198,9 @@ Updates the key operation by segment. This API uses an asynchronous callback to
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------------- | ---- | -------------------------------------------- | | -------- | ---------------------------------------------------- | ---- | -------------------------------------------- |
| handle | number | Yes | Handle of the **Update** operation. | | handle | number | Yes | Handle for the **updateSession** operation. |
| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Update** operation. | | options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **updateSession** operation. |
| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result.| | callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the **updateSession** operation result.|
## huks.updateSession<sup>9+</sup> ## huks.updateSession<sup>9+</sup>
...@@ -1215,16 +1215,16 @@ Updates the key operation by segment. This API uses an asynchronous callback to ...@@ -1215,16 +1215,16 @@ Updates the key operation by segment. This API uses an asynchronous callback to
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------------- | ---- | -------------------------------------------- | | -------- | ---------------------------------------------------- | ---- | -------------------------------------------- |
| handle | number | Yes | Handle of the **Update** operation. | | handle | number | Yes | Handle for the **updateSession** operation. |
| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Update** operation. | | options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **updateSession** operation. |
| token | Uint8Array | Yes | Token of the **Update** operation. | | token | Uint8Array | Yes | Token of the **updateSession** operation. |
| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result.| | callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the **updateSession** operation result.|
## huks.updateSession<sup>9+</sup> ## huks.updateSession<sup>9+</sup>
updateSession(handle: number, options: HuksOptions, token?: Uint8Array) : Promise\<HuksReturnResult> updateSession(handle: number, options: HuksOptions, token?: Uint8Array) : Promise\<HuksReturnResult>
Updates the key operation data by segment. This API uses a promise to return the result. **huks.initSession**, **huks.updateSession**, and **huks.finishSession** must be used together. Updates the key operation by segment. This API uses a promise to return the result. **huks.initSession**, **huks.updateSession**, and **huks.finishSession** must be used together.
**System capability**: SystemCapability.Security.Huks **System capability**: SystemCapability.Security.Huks
...@@ -1232,15 +1232,15 @@ Updates the key operation data by segment. This API uses a promise to return the ...@@ -1232,15 +1232,15 @@ Updates the key operation data by segment. This API uses a promise to return the
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ---------------------------------------------- | ---- | -------------------------------------------- | | ------- | ---------------------------------------------- | ---- | -------------------------------------------- |
| handle | number | Yes | Handle of the **Update** operation. | | handle | number | Yes | Handle for the **updateSession** operation. |
| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Update** operation. | | options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **updateSession** operation. |
| token | Uint8Array | No | Token of the **Update** operation. | | token | Uint8Array | No | Token of the **updateSession** operation. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| ----------------------------------- | -------------------------------------------------- | | ----------------------------------- | -------------------------------------------------- |
| Promise<[HuksReturnResult](#huksreturnresult9)> | Promise used to return the result.| | Promise<[HuksReturnResult](#huksreturnresult9)> | Promise used to return the **updateSession** operation result.|
## huks.finishSession<sup>9+</sup> ## huks.finishSession<sup>9+</sup>
...@@ -1254,10 +1254,10 @@ Completes the key operation and releases resources. This API uses an asynchronou ...@@ -1254,10 +1254,10 @@ Completes the key operation and releases resources. This API uses an asynchronou
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------------- | ---- | -------------------------------------------- | | -------- | ---------------------------------------------------- | ---- | -------------------------------------------- |
| handle | number | Yes | Handle of the **Finish** operation. | | handle | number | Yes | Handle for the **finishSession** operation. |
| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Finish** operation. | | options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **finishSession** operation. |
| token | Uint8Array | Yes | Token for the **Finish** operation. | | token | Uint8Array | Yes | Token of the **finishSession** operation. |
| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result.| | callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the **finishSession** operation result. |
## huks.finishSession<sup>9+</sup> ## huks.finishSession<sup>9+</sup>
...@@ -1271,10 +1271,10 @@ Completes the key operation and releases resources. This API uses an asynchronou ...@@ -1271,10 +1271,10 @@ Completes the key operation and releases resources. This API uses an asynchronou
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------- | ---- | -------------------------------------------- | | -------- | ----------------------------------------------------- | ---- | -------------------------------------------- |
| handle | number | Yes | Handle of the **Finish** operation. | | handle | number | Yes | Handle for the **finishSession** operation. |
| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Finish** operation. | | options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **finishSession** operation. |
| token | Uint8Array | Yes | Token for the **Finish** operation. | | token | Uint8Array | Yes | Token of the **finishSession** operation. |
| callback | AsyncCallback\<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result.| | callback | AsyncCallback\<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the **finishSession** operation result. |
## huks.finishSession<sup>9+</sup> ## huks.finishSession<sup>9+</sup>
...@@ -1288,9 +1288,9 @@ Completes the key operation and releases resources. This API uses a promise to r ...@@ -1288,9 +1288,9 @@ Completes the key operation and releases resources. This API uses a promise to r
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ----------------------------------------------- | ---- | ----------------------------------- | | ------- | ----------------------------------------------- | ---- | ----------------------------------- |
| handle | number | Yes | Handle of the **Finish** operation. | | handle | number | Yes | Handle for the **finishSession** operation. |
| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Finish** operation. | | options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **finishSession** operation. |
| token | Uint8Array | No | Token for the **Finish** operation. | | token | Uint8Array | No | Token of the **finishSession** operation. |
**Return value** **Return value**
...@@ -1302,7 +1302,7 @@ Completes the key operation and releases resources. This API uses a promise to r ...@@ -1302,7 +1302,7 @@ Completes the key operation and releases resources. This API uses a promise to r
abortSession(handle: number, options: HuksOptions, callback: AsyncCallback\<void>) : void abortSession(handle: number, options: HuksOptions, callback: AsyncCallback\<void>) : void
Aborts the use of the key. This API uses an asynchronous callback to return the result. Aborts a key operation. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Security.Huks **System capability**: SystemCapability.Security.Huks
...@@ -1310,16 +1310,16 @@ Aborts the use of the key. This API uses an asynchronous callback to return the ...@@ -1310,16 +1310,16 @@ Aborts the use of the key. This API uses an asynchronous callback to return the
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | ------------------------------------------- | | -------- | --------------------------- | ---- | ------------------------------------------- |
| handle | number | Yes | Handle of the **Abort** operation. | | handle | number | Yes | Handle for the **abortSession** operation. |
| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Abort** operation. | | options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **abortSession** operation. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation fails, **err** is returned.| | callback | AsyncCallback\<void> | Yes | Callback that returns no value. |
**Example** **Example**
```js ```js
/* huks.initSession, huks.updateSession, and huks.finishSession must be used together. /* huks.initSession, huks.updateSession, and huks.finishSession must be used together.
* If an error occurs in any of huks.initSession, huks.updateSession, * If an error occurs in any of huks.initSession, huks.updateSession,
* and huks.finishSession operation, * and huks.finishSession operations,
* huks.abortSession must be called to terminate the use of the key. * huks.abortSession must be called to terminate the use of the key.
* *
* The following uses the callback of an RSA1024 key as an example. * The following uses the callback of an RSA1024 key as an example.
...@@ -1447,7 +1447,7 @@ async function huksAbort() { ...@@ -1447,7 +1447,7 @@ async function huksAbort() {
abortSession(handle: number, options: HuksOptions) : Promise\<void>; abortSession(handle: number, options: HuksOptions) : Promise\<void>;
Aborts the use of the key. This API uses a promise to return the result. Aborts a key operation. This API uses a promise to return the result.
**System capability**: SystemCapability.Security.Huks **System capability**: SystemCapability.Security.Huks
...@@ -1455,21 +1455,21 @@ Aborts the use of the key. This API uses a promise to return the result. ...@@ -1455,21 +1455,21 @@ Aborts the use of the key. This API uses a promise to return the result.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | --------------------------- | ---- | ------------------------------------------- | | ------- | --------------------------- | ---- | ------------------------------------------- |
| handle | number | Yes | Handle of the **Abort** operation. | | handle | number | Yes | Handle for the **abortSession** operation. |
| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Abort** operation. | | options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **abortSession** operation. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| ----------------------------------- | -------------------------------------------------- | | ----------------------------------- | -------------------------------------------------- |
| Promise\<void> | Promise that returns no value.| | Promise\<void> | Promise used to return the **abortSession** operation result.|
**Example** **Example**
```js ```js
/* huks.initSession, huks.updateSession, and huks.finishSession must be used together. /* huks.initSession, huks.updateSession, and huks.finishSession must be used together.
* If an error occurs in any of huks.initSession, huks.updateSession, * If an error occurs in any of huks.initSession, huks.updateSession,
* and huks.finishSession operation, * and huks.finishSession operations,
* huks.abortSession must be called to terminate the use of the key. * huks.abortSession must be called to terminate the use of the key.
* *
* The following uses the callback of an RSA1024 key as an example. * The following uses the callback of an RSA1024 key as an example.
...@@ -1890,7 +1890,7 @@ Enumerates the tags used to invoke parameters. ...@@ -1890,7 +1890,7 @@ Enumerates the tags used to invoke parameters.
**System capability**: SystemCapability.Security.Huks **System capability**: SystemCapability.Security.Huks
| Name | Value | Description | | Name | Value | Description |
| -------------------------------------------- | ---------------------------------------- | -------------------------------------- | | -------------------------------------------- | ---------------------------------------- | ------------------------------------------------------------ |
| HUKS_TAG_INVALID | HuksTagType.HUKS_TAG_TYPE_INVALID \| 0 | Invalid tag. | | HUKS_TAG_INVALID | HuksTagType.HUKS_TAG_TYPE_INVALID \| 0 | Invalid tag. |
| HUKS_TAG_ALGORITHM | HuksTagType.HUKS_TAG_TYPE_UINT \| 1 | Algorithm. | | HUKS_TAG_ALGORITHM | HuksTagType.HUKS_TAG_TYPE_UINT \| 1 | Algorithm. |
| HUKS_TAG_PURPOSE | HuksTagType.HUKS_TAG_TYPE_UINT \| 2 | Purpose of the key. | | HUKS_TAG_PURPOSE | HuksTagType.HUKS_TAG_TYPE_UINT \| 2 | Purpose of the key. |
...@@ -1925,13 +1925,13 @@ Enumerates the tags used to invoke parameters. ...@@ -1925,13 +1925,13 @@ Enumerates the tags used to invoke parameters.
| HUKS_TAG_ALL_USERS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 301 | Reserved. | | HUKS_TAG_ALL_USERS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 301 | Reserved. |
| HUKS_TAG_USER_ID | HuksTagType.HUKS_TAG_TYPE_UINT \| 302 | Reserved. | | HUKS_TAG_USER_ID | HuksTagType.HUKS_TAG_TYPE_UINT \| 302 | Reserved. |
| HUKS_TAG_NO_AUTH_REQUIRED | HuksTagType.HUKS_TAG_TYPE_BOOL \| 303 | Reserved. | | HUKS_TAG_NO_AUTH_REQUIRED | HuksTagType.HUKS_TAG_TYPE_BOOL \| 303 | Reserved. |
| HUKS_TAG_USER_AUTH_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 304 | User authentication type. For details, see [HuksUserAuthType](#huksuserauthtype9). This parameter must be set together with [HuksAuthAccessType](#huksauthaccesstype9). You can set a maximum of two user authentication types at a time. For example, if **HuksAuthAccessType** is **HKS_SECURE_ACCESS_INVALID_NEW_BIO_ENROLL**, you can set two of **HKS_USER_AUTH_TYPE_FACE**, **HKS_USER_AUTH_TYPE_FINGERPRINT**, and **HKS_USER_AUTH_TYPE_FACE\**.| HKS_USER_AUTH_TYPE_FINGERPRINT | | HUKS_TAG_USER_AUTH_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 304 | User authentication type. For details, see [HuksUserAuthType](#huksuserauthtype9). This parameter must be set together with [HuksAuthAccessType](#huksauthaccesstype9). You can set a maximum of two user authentication types at a time. For example, if **HuksAuthAccessType** is **HKS_SECURE_ACCESS_INVALID_NEW_BIO_ENROLL**, you can set two of **HKS_USER_AUTH_TYPE_FACE**, **HKS_USER_AUTH_TYPE_FINGERPRINT**, and **HKS_USER_AUTH_TYPE_FACE**. |
| HUKS_TAG_AUTH_TIMEOUT | HuksTagType.HUKS_TAG_TYPE_UINT \| 305 | Reserved. | | HUKS_TAG_AUTH_TIMEOUT | HuksTagType.HUKS_TAG_TYPE_UINT \| 305 | Reserved. |
| HUKS_TAG_AUTH_TOKEN | HuksTagType.HUKS_TAG_TYPE_BYTES \| 306 | Reserved. | | HUKS_TAG_AUTH_TOKEN | HuksTagType.HUKS_TAG_TYPE_BYTES \| 306 | Reserved. |
| HUKS_TAG_KEY_AUTH_ACCESS_TYPE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 307 | Access control type. For details, see [HuksAuthAccessType](#huksauthaccesstype9). This parameter must be set together with [HuksUserAuthType](#huksuserauthtype9).| | HUKS_TAG_KEY_AUTH_ACCESS_TYPE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 307 | Access control type. For details, see [HuksAuthAccessType](#huksauthaccesstype9). This parameter must be set together with [HuksUserAuthType](#huksuserauthtype9). |
| HUKS_TAG_KEY_SECURE_SIGN_TYPE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 308 | Signature type of the key generated or imported.| | HUKS_TAG_KEY_SECURE_SIGN_TYPE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 308 | Signature type of the key generated or imported. |
| HUKS_TAG_CHALLENGE_TYPE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 309 | Type of the challenge generated for a key. For details, see [HuksChallengeType](#hukschallengetype9).| | HUKS_TAG_CHALLENGE_TYPE<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 309 | Type of the challenge generated for a key. For details, see [HuksChallengeType](#hukschallengetype9). |
| HUKS_TAG_CHALLENGE_POS<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 310 | Position of the 8-byte valid value in a custom challenge. For details, see [HuksChallengePosition](#hukschallengeposition9).| | HUKS_TAG_CHALLENGE_POS<sup>9+</sup> | HuksTagType.HUKS_TAG_TYPE_UINT \| 310 | Position of the 8-byte valid value in a custom challenge. For details, see [HuksChallengePosition](#hukschallengeposition9). |
| HUKS_TAG_ATTESTATION_CHALLENGE | HuksTagType.HUKS_TAG_TYPE_BYTES \| 501 | Challenge value used in the attestation. | | HUKS_TAG_ATTESTATION_CHALLENGE | HuksTagType.HUKS_TAG_TYPE_BYTES \| 501 | Challenge value used in the attestation. |
| HUKS_TAG_ATTESTATION_APPLICATION_ID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 502 | Application ID used in the attestation. | | HUKS_TAG_ATTESTATION_APPLICATION_ID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 502 | Application ID used in the attestation. |
| HUKS_TAG_ATTESTATION_ID_BRAND | HuksTagType.HUKS_TAG_TYPE_BYTES \| 503 | Brand of the device. | | HUKS_TAG_ATTESTATION_ID_BRAND | HuksTagType.HUKS_TAG_TYPE_BYTES \| 503 | Brand of the device. |
...@@ -1947,7 +1947,7 @@ Enumerates the tags used to invoke parameters. ...@@ -1947,7 +1947,7 @@ Enumerates the tags used to invoke parameters.
| HUKS_TAG_ATTESTATION_ID_UDID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 513 | Unique device identifier (UDID) of the device. | | HUKS_TAG_ATTESTATION_ID_UDID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 513 | Unique device identifier (UDID) of the device. |
| HUKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 514 | Security level used in the attestation. | | HUKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 514 | Security level used in the attestation. |
| HUKS_TAG_ATTESTATION_ID_VERSION_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 515 | Version information used in the attestation. | | HUKS_TAG_ATTESTATION_ID_VERSION_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 515 | Version information used in the attestation. |
| HUKS_TAG_IS_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1001 | Whether to use the alias passed in during key generation.| | HUKS_TAG_IS_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1001 | Whether to use the alias passed in during key generation. |
| HUKS_TAG_KEY_STORAGE_FLAG | HuksTagType.HUKS_TAG_TYPE_UINT \| 1002 | Key storage mode. | | HUKS_TAG_KEY_STORAGE_FLAG | HuksTagType.HUKS_TAG_TYPE_UINT \| 1002 | Key storage mode. |
| HUKS_TAG_IS_ALLOWED_WRAP | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1003 | Reserved. | | HUKS_TAG_IS_ALLOWED_WRAP | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1003 | Reserved. |
| HUKS_TAG_KEY_WRAP_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 1004 | Reserved. | | HUKS_TAG_KEY_WRAP_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 1004 | Reserved. |
...@@ -2285,7 +2285,7 @@ Exports a key. This API uses an asynchronous callback to return the result. ...@@ -2285,7 +2285,7 @@ Exports a key. This API uses an asynchronous callback to return the result.
| -------- | ----------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | ----------------------------------------- | ---- | ------------------------------------------------------------ |
| keyAlias | string | Yes | Key alias, which must be the same as the alias used when the key was generated. | | keyAlias | string | Yes | Key alias, which must be the same as the alias used when the key was generated. |
| options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). | | options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). |
| callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes | Callback invoked to return the result. If the operation is successful, **HUKS_SUCCESS** is returned and **outData** contains the public key exported. If the operation fails, an error code is returned.| | callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes | Callback invoked to return the result. If the operation is successful, **HUKS_SUCCESS** is returned and **outData** contains the public key exported. If the operation fails, an error code is returned. |
**Example** **Example**
...@@ -2411,7 +2411,7 @@ Checks whether a key exists. This API uses an asynchronous callback to return th ...@@ -2411,7 +2411,7 @@ Checks whether a key exists. This API uses an asynchronous callback to return th
| -------- | ---------------------- | ---- | ------------------------------------- | | -------- | ---------------------- | ---- | ------------------------------------- |
| keyAlias | string | Yes | Alias of the key to check.| | keyAlias | string | Yes | Alias of the key to check.|
| options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty).| | options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty).|
| callback | AsyncCallback\<boolean> | Yes | Callback invoked to return the result. **TRUE** means that the key exists; **FALSE** means the opposite.| | callback | AsyncCallback\<boolean> | Yes | Callback invoked to return the result. The value **TRUE** means that the key exists; **FALSE** means the opposite.|
**Example** **Example**
...@@ -2473,8 +2473,8 @@ Initializes the data for a key operation. This API uses an asynchronous callback ...@@ -2473,8 +2473,8 @@ Initializes the data for a key operation. This API uses an asynchronous callback
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------------------- | | -------- | ---------------------- | ---- | ------------------------------------- |
| keyAlias | string | Yes | Alias of the target key.| | keyAlias | string | Yes | Alias of the target key.|
| options | [HuksOptions](#huksoptions) | Yes | Parameters used for initialization.| | options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **init** operation.|
| callback | AsyncCallback\<[HuksHandle](#hukshandledeprecated)> | Yes | Callback invoked to return the handle obtained through the initialization operation.| | callback | AsyncCallback\<[HuksHandle](#hukshandledeprecated)> | Yes | Callback invoked to return a session handle for subsequent operations.|
## huks.init<sup>(deprecated)</sup> ## huks.init<sup>(deprecated)</sup>
...@@ -2491,13 +2491,13 @@ Initializes the data for a key operation. This API uses a promise to return the ...@@ -2491,13 +2491,13 @@ Initializes the data for a key operation. This API uses a promise to return the
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------------------- | | -------- | ---------------------- | ---- | ------------------------------------- |
| keyAlias | string | Yes | Alias of the target key.| | keyAlias | string | Yes | Alias of the target key.|
| options | [HuksOptions](#huksoptions) | Yes | Parameters used for initialization.| | options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **init** operation.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ----------------------------------- | -------------------------------------------------- | | ----------------------------------- | -------------------------------------------------- |
| Promise\<[HuksHandle](#hukshandledeprecated)> | Promise used to return the handle obtained through the initialization operation.| | Promise\<[HuksHandle](#hukshandledeprecated)> | Promise used to return a session handle for subsequent operations.|
## huks.update<sup>(deprecated)</sup> ## huks.update<sup>(deprecated)</sup>
...@@ -2513,10 +2513,10 @@ Updates the key operation by segment. This API uses an asynchronous callback to ...@@ -2513,10 +2513,10 @@ Updates the key operation by segment. This API uses an asynchronous callback to
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------------------------------------- | ---- | -------------------------------------------- | | -------- | ----------------------------------------- | ---- | -------------------------------------------- |
| handle | number | Yes | Handle of the **Update** operation. | | handle | number | Yes | Handle for the **update** operation. |
| token | Uint8Array | No | Token of the **Update** operation. | | token | Uint8Array | No | Token of the **update** operation. |
| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Update** operation. | | options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **update** operation. |
| callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes | Callback invoked to return the result.| | callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes | Callback invoked to return the **update** operation result. |
## huks.update<sup>(deprecated)</sup> ## huks.update<sup>(deprecated)</sup>
...@@ -2532,15 +2532,15 @@ Updates the key operation by segment. This API uses a promise to return the resu ...@@ -2532,15 +2532,15 @@ Updates the key operation by segment. This API uses a promise to return the resu
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ----------------------------------- | ---- | -------------------------------------------- | | ------- | ----------------------------------- | ---- | -------------------------------------------- |
| handle | number | Yes | Handle of the **Update** operation. | | handle | number | Yes | Handle for the **update** operation. |
| token | Uint8Array | No | Token of the **Update** operation. | | token | Uint8Array | No | Token of the **update** operation. |
| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Update** operation. | | options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **update** operation. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| ----------------------------------- | -------------------------------------------------- | | ----------------------------------- | -------------------------------------------------- |
| Promise\<[HuksResult](#huksresultdeprecated)> | Promise used to return the result.| | Promise\<[HuksResult](#huksresultdeprecated)> | Promise used to return the **update** operation result. |
## huks.finish<sup>(deprecated)</sup> ## huks.finish<sup>(deprecated)</sup>
...@@ -2556,9 +2556,9 @@ Completes the key operation and releases resources. This API uses an asynchronou ...@@ -2556,9 +2556,9 @@ Completes the key operation and releases resources. This API uses an asynchronou
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------------------- | | -------- | ---------------------- | ---- | ------------------------------------- |
| handle | number | Yes | Handle of the **Finish** operation.| | handle | number | Yes | Handle for the **finish** operation.|
| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Finish** operation.| | options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **finish** operation.|
| callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes| Callback invoked to return the result.| | callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes| Callback invoked to return the **finish** operation result.|
## huks.finish<sup>(deprecated)</sup> ## huks.finish<sup>(deprecated)</sup>
...@@ -2574,8 +2574,8 @@ Completes the key operation and releases resources. This API uses a promise to r ...@@ -2574,8 +2574,8 @@ Completes the key operation and releases resources. This API uses a promise to r
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------------------- | | -------- | ---------------------- | ---- | ------------------------------------- |
| handle | number | Yes | Handle of the **Finish** operation.| | handle | number | Yes | Handle for the **finish** operation.|
| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Finish** operation.| | options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **finish** operation.|
**Return value** **Return value**
...@@ -2597,9 +2597,9 @@ Aborts the use of the key. This API uses an asynchronous callback to return the ...@@ -2597,9 +2597,9 @@ Aborts the use of the key. This API uses an asynchronous callback to return the
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------------------- | | -------- | ---------------------- | ---- | ------------------------------------- |
| handle | number | Yes | Handle of the **Abort** operation.| | handle | number | Yes | Handle for the **abort** operation.|
| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Abort** operation.| | options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **abort** operation.|
| callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes| Callback invoked to return the result.| | callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes| Callback invoked to return the **abort** operation result. |
**Example** **Example**
...@@ -2607,7 +2607,7 @@ Aborts the use of the key. This API uses an asynchronous callback to return the ...@@ -2607,7 +2607,7 @@ Aborts the use of the key. This API uses an asynchronous callback to return the
/* huks.init, huks.update, and huks.finish must be used together. /* huks.init, huks.update, and huks.finish must be used together.
* If an error occurs in any of them, huks.abort must be called to terminate the use of the key. * If an error occurs in any of them, huks.abort must be called to terminate the use of the key.
* *
* The following uses the callback of an RSA 1024-bit key as an example. * The following uses the callback of an RSA 1024 key as an example.
*/ */
let keyalias = "HuksDemoRSA"; let keyalias = "HuksDemoRSA";
let properties = new Array(); let properties = new Array();
...@@ -2708,14 +2708,14 @@ Aborts the use of the key. This API uses a promise to return the result. ...@@ -2708,14 +2708,14 @@ Aborts the use of the key. This API uses a promise to return the result.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------------------- | | -------- | ---------------------- | ---- | ------------------------------------- |
| handle | number | Yes | Handle of the **Abort** operation.| | handle | number | Yes | Handle for the **abort** operation.|
| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Abort** operation.| | options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **abort** operation.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ----------------------------------- | -------------------------------------------------- | | ----------------------------------- | -------------------------------------------------- |
| Promise\<[HuksResult](#huksresultdeprecated)> | Promise used to return the result.| | Promise\<[HuksResult](#huksresultdeprecated)> | Promise used to return the **abort** operation result.|
**Example** **Example**
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
The **userIAM.userAuth** module provides user authentication capabilities in identity authentication scenarios, such as device unlocking, payment, and app login. The **userIAM.userAuth** module provides user authentication capabilities in identity authentication scenarios, such as device unlocking, payment, and app login.
> **NOTE**<br> > **NOTE**
>
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -399,44 +400,6 @@ try { ...@@ -399,44 +400,6 @@ try {
} }
``` ```
## userIAM_userAuth.getVersion<sup>9+</sup>
getVersion(): number
Obtains the version of this authenticator.
**Required permissions**: ohos.permission.ACCESS_BIOMETRIC
**System capability**: SystemCapability.UserIAM.UserAuth.Core
**Return value**
| Type | Description |
| ------ | ---------------------- |
| number | Authenticator version obtained.|
For details about the error codes, see [User Authentication Error Codes](../errorcodes/errorcode-useriam.md).
**Error codes**
| ID| Error Message|
| -------- | ------- |
| 201 | Permission verification failed. |
| 12500002 | General operation error. |
**Example**
```js
import userIAM_userAuth from '@ohos.userIAM.userAuth';
try {
let version = userIAM_userAuth.getVersion();
console.info("auth version = " + version);
} catch (error) {
console.info("get version failed, error = " + error);
}
```
## userIAM_userAuth.getAvailableStatus<sup>9+</sup> ## userIAM_userAuth.getAvailableStatus<sup>9+</sup>
getAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel): void getAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel): void
...@@ -535,7 +498,7 @@ getVersion() : number ...@@ -535,7 +498,7 @@ getVersion() : number
Obtains the version of this authenticator. Obtains the version of this authenticator.
> **NOTE**<br> > **NOTE**<br>
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getVersion](#useriam_userauthgetversion9). > This API is supported since API version 8 and deprecated since API version 9.
**Required permissions**: ohos.permission.ACCESS_BIOMETRIC **Required permissions**: ohos.permission.ACCESS_BIOMETRIC
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册