diff --git a/en/application-dev/reference/apis/Readme-EN.md b/en/application-dev/reference/apis/Readme-EN.md
index dcdf21aac6d90857581f834a821364b8f2516f2c..1e54b4855892e964dd3445764e0b5abc39c66d3b 100644
--- a/en/application-dev/reference/apis/Readme-EN.md
+++ b/en/application-dev/reference/apis/Readme-EN.md
@@ -230,8 +230,6 @@
- [@ohos.data.preferences (Preferences)](js-apis-data-preferences.md)
- [@ohos.data.relationalStore (RDB Store)](js-apis-data-relationalStore.md)
- [@ohos.data.ValuesBucket (Value Bucket)](js-apis-data-valuesBucket.md)
- - data/rdb
- - [resultSet (Result Set)](js-apis-data-resultset.md)
- File Management
- [@ohos.file.environment (Directory Environment Capability)](js-apis-file-environment.md)
@@ -447,3 +445,5 @@
- [PermissionDef](js-apis-bundle-PermissionDef.md)
- [remoteAbilityInfo](js-apis-bundle-remoteAbilityInfo.md)
- [shortcutInfo](js-apis-bundle-ShortcutInfo.md)
+ - data/rdb
+ - [resultSet (Result Set)](js-apis-data-resultset.md)
\ No newline at end of file
diff --git a/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md b/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md
index 874518b0e5ca7692fd902f26bcf49b07719eefc5..b02b9397aea367ddedb856a78975382306db8c21 100644
--- a/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md
+++ b/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md
@@ -207,8 +207,8 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256, or the flags value is invalid. |
-| 12100002 | TokenId does not exist. |
-| 12100003 | Permission does not exist. |
+| 12100002 | The specified tokenID does not exist. |
+| 12100003 | The specified permission does not exist. |
| 12100006 | The application specified by the tokenID is not allowed to be granted with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. |
| 12100007 | Service is abnormal. |
@@ -318,8 +318,8 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256, or the flags value is invalid. |
-| 12100002 | TokenId does not exist. |
-| 12100003 | Permission does not exist. |
+| 12100002 | The specified tokenID does not exist. |
+| 12100003 | The specified permission does not exist. |
| 12100006 | The application specified by the tokenID is not allowed to be revoked with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. |
| 12100007 | Service is abnormal. |
@@ -693,6 +693,44 @@ promise.then(data => {
});
```
+### checkAccessTokenSync10+
+
+checkAccessTokenSync(tokenID: number, permissionName: Permissions): GrantStatus;
+
+Checks whether a permission is granted to an application. This API returns the result synchronously.
+
+**System capability**: SystemCapability.Security.AccessToken
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------- | ---- | ------------------------------------------ |
+| tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md). |
+| permissionName | Permissions | Yes | Permission to check. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).|
+
+**Return value**
+
+| Type | Description |
+| :------------ | :---------------------------------- |
+| [GrantStatus](#grantstatus) | Permission grant state.|
+
+**Error codes**
+
+For details about the error codes, see [Application Access Control Error Codes](../errorcodes/errorcode-access-token.md).
+
+| ID| Error Message|
+| -------- | -------- |
+| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. |
+
+**Example**
+
+```js
+let atManager = abilityAccessCtrl.createAtManager();
+let tokenID = 0; // Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application.
+let data = atManager.checkAccessTokenSync(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS");
+console.log(`data->${JSON.stringify(data)}`);
+```
+
### GrantStatus
Enumerates the permission grant states.
@@ -719,7 +757,7 @@ Enumerates the operations that trigger permission grant state changes.
### PermissionStateChangeInfo9+
-Defines detailed information about the permission grant state change.
+Defines information about the permission grant state change.
**System API**: This is a system API.
@@ -730,4 +768,3 @@ Defines detailed information about the permission grant state change.
| change | [PermissionStateChangeType](#permissionstatechangetype9) | Yes | No | Operation that triggers the permission grant state change. |
| tokenID | number | Yes | No | Token ID of the application. |
| permissionName | Permissions | Yes | No | Permission whose grant state changes. For details about the permissions, see the [Application Permission List](../../security/permission-list.md). |
-
diff --git a/en/application-dev/reference/apis/js-apis-appAccount.md b/en/application-dev/reference/apis/js-apis-appAccount.md
index 5b2b923deeb737e90cd173b822e65a35b00e741a..8c8b4c4c6e4bf167b513a2956e3a5df8c282fa22 100644
--- a/en/application-dev/reference/apis/js-apis-appAccount.md
+++ b/en/application-dev/reference/apis/js-apis-appAccount.md
@@ -148,7 +148,6 @@ Creates an app account with custom data. This API uses a promise to return the r
| 12300002 | Invalid name or options. |
| 12300004 | Account already exists. |
| 12300007 | The number of accounts reaches the upper limit. |
-| 12400003 | The number of custom data reaches the upper limit. |
**Example**
@@ -248,7 +247,7 @@ Creates an app account implicitly based on the specified account owner and optio
| ID| Error Message|
| ------- | ------- |
| 12300001 | System service exception. |
-| 12300002 | Invalid name or options. |
+| 12300002 | Invalid owner or options. |
| 12300007 | The number of accounts reaches the upper limit. |
| 12300010 | Account service busy. |
| 12300113 | Authenticator service not found. |
@@ -481,7 +480,6 @@ Checks whether an app can access the data of an account. This API uses an asynch
| 12300001 | System service exception. |
| 12300002 | Invalid name or bundleName. |
| 12300003 | Account not found. |
-| 12400001 | Application not found. |
**Example**
@@ -527,7 +525,6 @@ Checks whether an app can access the data of an account. This API uses a promise
| 12300001 | System service exception. |
| 12300002 | Invalid name or bundleName. |
| 12300003 | Account not found. |
-| 12400001 | Application not found. |
**Example**
@@ -903,7 +900,7 @@ Sets custom data for an app account. This API uses an asynchronous callback to r
| ID| Error Message|
| ------- | -------|
| 12300001 | System service exception. |
-| 12300002 | Invalid name or key or value. |
+| 12300002 | Invalid name, key, or value. |
| 12300003 | Account not found. |
| 12400003 | The number of custom data reaches the upper limit. |
@@ -950,7 +947,7 @@ Sets custom data for an app account. This API uses a promise to return the resul
| ID| Error Message|
| ------- | -------|
| 12300001 | System service exception. |
-| 12300002 | Invalid name or key or value. |
+| 12300002 | Invalid name, key, or value. |
| 12300003 | Account not found. |
| 12400003 | The number of custom data reaches the upper limit. |
@@ -1267,7 +1264,6 @@ Subscribes to account information changes of apps.
| ------- | ------- |
| 12300001 | System service exception. |
| 12300002 | Invalid type or owners. |
-| 12300011 | Callback has been registered. |
| 12400001 | Application not found. |
**Example**
@@ -1304,7 +1300,6 @@ Unsubscribes from account information changes.
| ------- | -------|
| 12300001 | System service exception. |
| 12300002 | Invalid type. |
-| 12300012 | Callback has not been registered. |
**Example**
@@ -1347,7 +1342,7 @@ Authenticates an app account. This API uses an asynchronous callback to return t
| ID| Error Message|
| ------- | -------|
| 12300001 | System service exception. |
-| 12300002 | Invalid name or owner or authType. |
+| 12300002 | Invalid name, owner, or authType. |
| 12300003 | Account not found. |
| 12300010 | Account service busy. |
| 12300113 | Authenticator service not found. |
@@ -1410,8 +1405,8 @@ Authenticates an app account with customized options. This API uses an asynchron
| ID| Error Message|
| ------- | -------|
| 12300001 | System service exception. |
-| 12300002 | Invalid name or owner or authType. |
-| 12300003 | Account not exist. |
+| 12300002 | Invalid name, owner, authType, or options. |
+| 12300003 | Account not found. |
| 12300010 | Account service busy. |
| 12300113 | Authenticator service not found. |
| 12300114 | Authenticator service exception. |
@@ -1522,7 +1517,7 @@ Obtains the authorization token of the specified authentication type for an app
| ID| Error Message|
| ------- | ------- |
| 12300001 | System service exception. |
-| 12300002 | Invalid name or owner or authType. |
+| 12300002 | Invalid name, owner, or authType. |
| 12300003 | Account not found. |
| 12300107 | AuthType not found. |
@@ -1562,7 +1557,7 @@ Sets an authorization token of the specific authentication type for an app accou
| ID| Error Message|
| ------- | -------|
| 12300001 | System service exception. |
-| 12300002 | Invalid name or authType or token. |
+| 12300002 | Invalid name, authType, or token. |
| 12300003 | Account not found. |
| 12400004 | The number of token reaches the upper limit. |
@@ -1609,7 +1604,7 @@ Sets an authorization token of the specific authentication type for an app accou
| ID| Error Message|
| ------- | -------|
| 12300001 | System service exception. |
-| 12300002 | Invalid name or authType or token. |
+| 12300002 | Invalid name, authType, or token. |
| 12300003 | Account not found. |
| 12400004 | The number of token reaches the upper limit. |
@@ -1650,7 +1645,7 @@ Deletes the authorization token of the specified authentication type for an app
| ID| Error Message|
| ------- | ------- |
| 12300001 | System service exception. |
-| 12300002 | Invalid name or owner or authType or token. |
+| 12300002 | Invalid name, owner, authType, or token. |
| 12300003 | Account not found. |
| 12300107 | AuthType not found. |
@@ -1698,7 +1693,7 @@ Deletes the authorization token of the specified authentication type for an app
| ID| Error Message|
| ------- | ------- |
| 12300001 | System service exception. |
-| 12300002 | Invalid name or owner or authType or token. |
+| 12300002 | Invalid name, owner, authType, or token. |
| 12300003 | Account not found. |
| 12300107 | AuthType not found. |
@@ -1739,7 +1734,7 @@ Sets the visibility of an authorization token to an app. This API uses an asynch
| ID| Error Message|
| ------- | -------|
| 12300001 | System service exception. |
-| 12300002 | Invalid name or authType or bundleName. |
+| 12300002 | Invalid name, authType, or bundleName. |
| 12300003 | Account not found. |
| 12300107 | AuthType not found. |
| 12400001 | Application not found. |
@@ -1789,7 +1784,7 @@ Sets the visibility of an authorization token to an app. This API uses a promise
| ID| Error Message|
| ------- | -------|
| 12300001 | System service exception. |
-| 12300002 | Invalid name or authType or bundleName. |
+| 12300002 | Invalid name, authType, or bundleName. |
| 12300003 | Account not found. |
| 12300107 | AuthType not found. |
| 12400001 | Application not found. |
@@ -1831,10 +1826,9 @@ Checks the visibility of an authorization token of the specified authentication
| ID| Error Message|
| ------- | -------|
| 12300001 | System service exception. |
-| 12300002 | Invalid name or authType or bundleName. |
+| 12300002 | Invalid name, authType, or bundleName. |
| 12300003 | Account not found. |
| 12300107 | AuthType not found. |
-| 12400001 | Application not found. |
**Example**
@@ -1879,10 +1873,9 @@ Checks the visibility of an authorization token of the specified authentication
| ID| Error Message|
| ------- | -------|
| 12300001 | System service exception. |
-| 12300002 | Invalid name or authType or bundleName. |
+| 12300002 | Invalid name, authType, or bundleName. |
| 12300003 | Account not found. |
| 12300107 | AuthType not found. |
-| 12400001 | Application not found. |
**Example**
@@ -2281,7 +2274,7 @@ Checks whether an app account has specific labels. This API uses an asynchronous
| ID| Error Message|
| ------- | ------- |
| 12300001 | System service exception. |
-| 12300002 | Invalid name or owner or labels. |
+| 12300002 | Invalid name, owner, or labels. |
| 12300003 | Account not found. |
| 12300010 | Account service busy. |
| 12300113 | Authenticator service not found. |
@@ -2331,7 +2324,7 @@ Checks whether an app account has specific labels. This API uses a promise to re
| ID| Error Message|
| ------- | ------- |
| 12300001 | System service exception. |
-| 12300002 | Invalid name or owner or labels. |
+| 12300002 | Invalid name, owner, or labels. |
| 12300003 | Account not found. |
| 12300010 | Account service busy. |
| 12300113 | Authenticator service not found. |
@@ -2594,7 +2587,7 @@ Verifies the user credential. This API uses an asynchronous callback to return t
| ID| Error Message|
| ------- | -------|
| 12300001 | System service exception. |
-| 12300002 | Invalid name or owner or options. |
+| 12300002 | Invalid name, owner, or options. |
| 12300003 | Account not found. |
| 12300010 | Account service busy. |
| 12300113 | Authenticator service not found. |
diff --git a/en/application-dev/reference/apis/js-apis-data-distributedobject.md b/en/application-dev/reference/apis/js-apis-data-distributedobject.md
index 5c27d183e38680ec392471f55e374a5127714e82..978cbffcf74444d9c902a91d72017d316f5ae5e8 100644
--- a/en/application-dev/reference/apis/js-apis-data-distributedobject.md
+++ b/en/application-dev/reference/apis/js-apis-data-distributedobject.md
@@ -131,7 +131,7 @@ Sets a session ID for synchronization. Automatic synchronization is performed fo
**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|
| -------- | -------- |
@@ -288,7 +288,7 @@ g_object.off("change");
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
@@ -363,7 +363,12 @@ The saved data will be released in the following cases:
```ts
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 sessionId: " + result.sessionId);
console.info("save version: " + result.version);
@@ -408,8 +413,9 @@ g_object.save("local").then((result) => {
console.info("save sessionId " + result.sessionId);
console.info("save version " + result.version);
console.info("save deviceId " + result.deviceId);
-}, () => {
- console.error("save failed");
+}).catch((err) => {
+ console.info("save failed, error code = " + err.code);
+ console.info("save failed, error message: " + err.message);
});
```
@@ -435,16 +441,26 @@ If the object is stored on another device, the data on the local device will be
```js
g_object.setSessionId("123456");
// 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 sessionId " + result.sessionId);
- console.info("save version " + result.version);
- console.info("save deviceId " + result.deviceId);
+ console.info("save sessionId: " + result.sessionId);
+ console.info("save version: " + result.version);
+ console.info("save deviceId: " + result.deviceId);
});
// Delete the persistence data.
-g_object.revokeSave((result) => {
- console.info("revokeSave callback");
- console.info("revokeSave sessionId " + result.sessionId);
+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 sessionId " + result.sessionId);
});
```
@@ -475,15 +491,17 @@ g_object.save("local").then((result) => {
console.info("save sessionId " + result.sessionId);
console.info("save version " + result.version);
console.info("save deviceId " + result.deviceId);
-}, () => {
- console.error("save failed");
+}).catch((err) => {
+ console.info("save failed, error code = " + err.code);
+ console.info("save failed, error message: " + err.message);
});
// Delete the persistence data.
g_object.revokeSave().then((result) => {
console.info("revokeSave callback");
console.info("sessionId" + result.sessionId);
-}, () => {
- console.error("revokeSave failed");
+}).catch((err)=> {
+ console.info("revokeSave failed, error code = " + err.code);
+ console.info("revokeSave failed, error message = " + err.message);
});
```
@@ -583,7 +601,7 @@ Subscribes to data changes of this distributed data object.
**Example**
```js
-import distributedObject from '@ohos.data.distributedDataObject';
+import distributedObject from '@ohos.data.distributedDataObject';
let g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}});
globalThis.changeCallback = (sessionId, changeData) => {
console.info("change" + sessionId);
@@ -612,14 +630,14 @@ Unsubscribes from the data changes of this distributed data object.
| 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<string> }> | No| Callback for data changes. If this parameter is not specified, all data change callbacks of this distributed data object will be unregistered.
**sessionId** indicates the session ID of the distributed data object.
**fields** indicates the changed attributes of the distributed data object.|
**Example**
```js
-import distributedObject from '@ohos.data.distributedDataObject';
+import distributedObject from '@ohos.data.distributedDataObject';
let g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}});
// Unregister the specified data change callback.
g_object.off("change", globalThis.changeCallback);
@@ -673,14 +691,14 @@ Unsubscribes from the status change of this distributed data object.
| 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.
**sessionId** indicates the session ID of the distributed data object.
**deviceId** indicates the device ID of the distributed data object.
**status** indicates the object status, which can be online or offline.|
**Example**
```js
-import distributedObject from '@ohos.data.distributedDataObject';
+import distributedObject from '@ohos.data.distributedDataObject';
let g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}});
globalThis.statusCallback = (sessionId, networkId, status) => {
globalThis.response += "status changed " + sessionId + " " + status + " " + networkId;
diff --git a/en/application-dev/reference/apis/js-apis-data-rdb.md b/en/application-dev/reference/apis/js-apis-data-rdb.md
index bcebd097f34c1337e5826e866302af9626696a32..04dcfb83d02cc263ff739c4e2618a65b2eeee181 100644
--- a/en/application-dev/reference/apis/js-apis-data-rdb.md
+++ b/en/application-dev/reference/apis/js-apis-data-rdb.md
@@ -7,7 +7,7 @@ This module provides the following RDB-related functions:
- [RdbPredicates](#rdbpredicates): provides predicates indicating the nature, feature, or relationship of a data entity in an RDB store. It is used to define the operation conditions for an RDB store.
- [RdbStore](#rdbstore): provides APIs for managing an RDB store.
-> **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.
>
@@ -31,7 +31,7 @@ Obtains an RDB store. This API uses an asynchronous callback to return the resul
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------ | ---- | ------------------------------------------------------------ |
-| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-app-context.md).|
| config | [StoreConfig](#storeconfig) | Yes | Configuration of the RDB store. |
| version | number | Yes | RDB store version.
Currently, automatic RDB upgrades and downgrades performed based on **version** is not supported. |
| callback | AsyncCallback<[RdbStore](#rdbstore)> | Yes | Callback invoked to return the RDB store obtained. |
@@ -92,7 +92,7 @@ Obtains an RDB store. This API uses a promise to return the result. You can set
| Name | Type | Mandatory| Description |
| ------- | --------------------------- | ---- | ------------------------------------------------------------ |
-| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-app-context.md).|
| config | [StoreConfig](#storeconfig) | Yes | Configuration of the RDB store. |
| version | number | Yes | RDB store version.
Currently, automatic RDB upgrades and downgrades performed based on **version** is not supported. |
@@ -156,7 +156,7 @@ Deletes an RDB store. This API uses an asynchronous callback to return the resul
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ------------------------------------------------------------ |
-| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-app-context.md).|
| name | string | Yes | Name of the RDB store to delete. |
| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. |
@@ -214,7 +214,7 @@ Deletes an RDB store. This API uses a promise to return the result.
| Name | Type | Mandatory| Description |
| ------- | ------- | ---- | ------------------------------------------------------------ |
-| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-app-context.md).|
| name | string | Yes | Name of the RDB store to delete. |
**Return value**
@@ -349,6 +349,10 @@ inDevices(devices: Array<string>): RdbPredicates
Sets an **RdbPredicates** to specify the remote devices to connect on the network during distributed database synchronization.
+> **NOTE**
+>
+> The value of **devices** 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.
+
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
@@ -366,8 +370,24 @@ Sets an **RdbPredicates** to specify the remote devices to connect on the networ
**Example**
```js
-let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
-predicates.inDevices(['12345678abcde'])
+import deviceManager from '@ohos.distributedHardware.deviceManager';
+let dmInstance = null;
+
+deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
+ if (err) {
+ console.log("create device manager failed, err=" + err);
+ return;
+ }
+ dmInstance = manager;
+ let devices = dmInstance.getTrustedDeviceListSync();
+ let deviceIds = [];
+ for (var i = 0; i < devices.length; i++) {
+ deviceIds[i] = devices[i].deviceId;
+ }
+})
+
+let predicates = new data_rdb.RdbPredicates("EMPLOYEE");
+predicates.inDevices(deviceIds);
```
### inAllDevices8+
@@ -1269,10 +1289,10 @@ const valueBucket3 = {
let valueBuckets = new Array(valueBucket1, valueBucket2, valueBucket3);
rdbStore.batchInsert("EMPLOYEE", valueBuckets, function(status, insertNum) {
if (status) {
- console.log("Failed to batch insert data, status = " + status);
+ console.log("batchInsert is failed, status = " + status);
return;
}
- console.log("Batch inserted data successfully. The number of values that were inserted = " + insertNum);
+ console.log("batchInsert is successful, the number of values that were inserted = " + insertNum);
})
```
@@ -1322,9 +1342,9 @@ const valueBucket3 = {
let valueBuckets = new Array(valueBucket1, valueBucket2, valueBucket3);
let promise = rdbStore.batchInsert("EMPLOYEE", valueBuckets);
promise.then((insertNum) => {
- console.log("Batch inserted data successfully. The number of values that were inserted = " + insertNum);
+ console.log("batchInsert is successful, the number of values that were inserted = " + insertNum);
}).catch((status) => {
- console.log("Failed to batch insert data, status = " + status);
+ console.log("batchInsert is failed, status = " + status);
})
```
@@ -1340,7 +1360,7 @@ Updates data in the RDB store based on the specified **RdbPredicates** object. T
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| values | [ValuesBucket](#valuesbucket) | Yes| Data to update in the RDB store. The key-value pair is associated with the column name in the target table.|
+| values | [ValuesBucket](#valuesbucket) | Yes| Rows of data to update in the RDB store. The key-value pair is associated with the column name in the target table.|
| predicates | [RdbPredicates](#rdbpredicates) | Yes| Update conditions specified by the **RdbPredicates** object.|
| callback | AsyncCallback<number> | Yes| Callback invoked to return the number of rows updated.|
@@ -1376,7 +1396,7 @@ Updates data based on the specified **RdbPredicates** object. This API uses a pr
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| values | [ValuesBucket](#valuesbucket) | Yes| Data to update in the RDB store. The key-value pair is associated with the column name in the target table.|
+| values | [ValuesBucket](#valuesbucket) | Yes| Rows of data to update in the RDB store. The key-value pair is associated with the column name in the target table.|
| predicates | [RdbPredicates](#rdbpredicates) | Yes| Update conditions specified by the **RdbPredicates** object.|
**Return value**
@@ -1619,7 +1639,7 @@ rdbStore.executeSql(SQL_CREATE_TABLE, null, function(err) {
console.info("Failed to execute SQL, err: " + err)
return
}
- console.info('Created table successfully.')
+ console.info('Create table done.')
})
```
@@ -1650,7 +1670,7 @@ Executes an SQL statement that contains specified arguments but returns no value
const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)"
let promise = rdbStore.executeSql(SQL_CREATE_TABLE)
promise.then(() => {
- console.info('Created table successfully.')
+ console.info('Create table done.')
}).catch((err) => {
console.info("Failed to execute SQL, err: " + err)
})
@@ -1808,7 +1828,11 @@ promise.then(() => {
obtainDistributedTableName(device: string, table: string, callback: AsyncCallback<string>): void
-Obtains the distributed table name for a remote device based on the local table name. This API uses an asynchronous callback to return the result. The distributed table name is required when the RDB store of a remote device is queried.
+Obtains the distributed table name for a remote device based on the local table name. The distributed table name is required when the RDB store of a remote device is queried.
+
+> **NOTE**
+>
+> The value of **device** 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.
**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC
@@ -1818,14 +1842,28 @@ Obtains the distributed table name for a remote device based on the local table
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| device | string | Yes| Remote device.|
-| table | string | Yes| Local table name.|
+| device | string | Yes| ID of the remote device.|
+| table | string | Yes| Local table name of the remote device.|
| callback | AsyncCallback<string> | Yes| Callback invoked to return the result. If the operation succeeds, the distributed table name of the remote device is returned.|
**Example**
```js
-rdbStore.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, tableName) {
+import deviceManager from '@ohos.distributedHardware.deviceManager';
+let dmInstance = null;
+
+deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
+ if (err) {
+ console.log("create device manager failed, err=" + err);
+ return;
+ }
+ dmInstance = manager;
+ let devices = dmInstance.getTrustedDeviceListSync();
+ let deviceId = devices[0].deviceId;
+})
+
+
+rdbStore.obtainDistributedTableName(deviceId, "EMPLOYEE", function (err, tableName) {
if (err) {
console.info('Failed to obtain DistributedTableName, err: ' + err)
return
@@ -1838,7 +1876,11 @@ rdbStore.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err,
obtainDistributedTableName(device: string, table: string): Promise<string>
-Obtains the distributed table name for a remote device based on the local table name. This API uses a promise to return the result. The distributed table name is required when the RDB store of a remote device is queried.
+Obtains the distributed table name for a remote device based on the local table name. The distributed table name is required when the RDB store of a remote device is queried.
+
+> **NOTE**
+>
+> The value of **device** 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.
**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC
@@ -1848,8 +1890,8 @@ Obtains the distributed table name for a remote device based on the local table
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| device | string | Yes| Remote device.|
-| table | string | Yes| Local table name.|
+| device | string | Yes| ID of the remote device.|
+| table | string | Yes| Local table name of the remote device.|
**Return value**
@@ -1860,7 +1902,20 @@ Obtains the distributed table name for a remote device based on the local table
**Example**
```js
-let promise = rdbStore.obtainDistributedTableName("12345678abcde", "EMPLOYEE")
+import deviceManager from '@ohos.distributedHardware.deviceManager';
+let dmInstance = null;
+
+deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
+ if (err) {
+ console.log("create device manager failed, err=" + err);
+ return;
+ }
+ dmInstance = manager;
+ let devices = dmInstance.getTrustedDeviceListSync();
+ let deviceId = devices[0].deviceId;
+})
+
+let promise = rdbStore.obtainDistributedTableName(deviceId, "EMPLOYEE")
promise.then((tableName) => {
console.info('Obtained distributed table name successfully, tableName= ' + tableName)
}).catch((err) => {
@@ -1889,8 +1944,24 @@ Synchronizes data between devices. This API uses an asynchronous callback to ret
**Example**
```js
+import deviceManager from '@ohos.distributedHardware.deviceManager';
+let dmInstance = null;
+
+deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
+ if (err) {
+ console.log("create device manager failed, err=" + err);
+ return;
+ }
+ dmInstance = manager;
+ let devices = dmInstance.getTrustedDeviceListSync();
+ let deviceIds = [];
+ for (var i = 0; i < devices.length; i++) {
+ deviceIds[i] = devices[i].deviceId;
+ }
+})
+
let predicates = new data_rdb.RdbPredicates('EMPLOYEE')
-predicates.inDevices(['12345678abcde'])
+predicates.inDevices(deviceIds)
rdbStore.sync(data_rdb.SyncMode.SYNC_MODE_PUSH, predicates, function (err, result) {
if (err) {
console.log('Sync failed, err: ' + err)
@@ -1924,13 +1995,29 @@ Synchronizes data between devices. This API uses a promise to return the result.
| Type| Description|
| -------- | -------- |
-| Promise<Array<[string, number]>> | Promise used to return the synchronization result to the caller.
**string** indicates the device ID.
**number** indicates the synchronization status of that device. The value **0** indicates a successful synchronization. Other values indicate a synchronization failure. |
+| Promise<Array<[string, number]>> | Promise used to return the synchronization result.
**string** indicates the device ID.
**number** indicates the synchronization status of that device. The value **0** indicates a successful synchronization. Other values indicate a synchronization failure. |
**Example**
```js
+import deviceManager from '@ohos.distributedHardware.deviceManager';
+let dmInstance = null;
+
+deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
+ if (err) {
+ console.log("create device manager failed, err=" + err);
+ return;
+ }
+ dmInstance = manager;
+ let devices = dmInstance.getTrustedDeviceListSync();
+ let deviceIds = [];
+ for (var i = 0; i < devices.length; i++) {
+ deviceIds[i] = devices[i].deviceId;
+ }
+})
+
let predicates = new data_rdb.RdbPredicates('EMPLOYEE')
-predicates.inDevices(['12345678abcde'])
+predicates.inDevices(deviceIds)
let promise = rdbStore.sync(data_rdb.SyncMode.SYNC_MODE_PUSH, predicates)
promise.then((result) =>{
console.log('Sync done.')
diff --git a/en/application-dev/reference/apis/js-apis-data-relationalStore.md b/en/application-dev/reference/apis/js-apis-data-relationalStore.md
index e49fa27eb58c01d5ccfaa905159c9124f7812687..56d3c8c76f75b69818788c3744a396114279302f 100644
--- a/en/application-dev/reference/apis/js-apis-data-relationalStore.md
+++ b/en/application-dev/reference/apis/js-apis-data-relationalStore.md
@@ -115,7 +115,7 @@ Obtains an RDB store. This API uses a promise to return the result. You can set
| Type | Description |
| ----------------------------------------- | --------------------------------- |
-| Promise<[RdbStore](#rdbstore)> | Promise used to return the RDB store obtained.|
+| Promise<[RdbStore](#rdbstore)> | Promise used to return the **RdbStore** object.|
**Error codes**
@@ -414,9 +414,12 @@ let predicates = new relationalStore.RdbPredicates("EMPLOYEE");
inDevices(devices: Array<string>): RdbPredicates
-
Sets an **RdbPredicates** to specify the remote devices to connect on the network during distributed database synchronization.
+> **NOTE**
+>
+> The value of **devices** 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.
+
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
@@ -434,8 +437,24 @@ Sets an **RdbPredicates** to specify the remote devices to connect on the networ
**Example**
```js
+import deviceManager from '@ohos.distributedHardware.deviceManager';
+let dmInstance = null;
+
+deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
+ if (err) {
+ console.log("create device manager failed, err=" + err);
+ return;
+ }
+ dmInstance = manager;
+ let devices = dmInstance.getTrustedDeviceListSync();
+ let deviceIds = [];
+ for (var i = 0; i < devices.length; i++) {
+ deviceIds[i] = devices[i].deviceId;
+ }
+})
+
let predicates = new relationalStore.RdbPredicates("EMPLOYEE");
-predicates.inDevices(['12345678abcde']);
+predicates.inDevices(deviceIds);
```
### inAllDevices
@@ -2008,24 +2027,41 @@ remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: A
Queries data from the RDB store of a remote device based on specified conditions. This API uses an asynchronous callback to return the result.
+> **NOTE**
+>
+> The value of **device** 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.
+
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
-| Name | Type | Mandatory| Description |
-| ---------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- |
-| device | string | Yes | Network ID of the remote device. |
-| table | string | Yes | Name of the target table. |
-| predicates | [RdbPredicates](#rdbpredicates) | Yes | Query conditions specified by the **RdbPredicates** object. |
-| columns | Array<string> | Yes | Columns to query. If this parameter is not specified, the query applies to all columns. |
+| Name | Type | Mandatory| Description |
+| ---------- | -------------------------------------------- | ---- | --------------------------------------------------------- |
+| device | string | Yes | ID of the remote device. |
+| table | string | Yes | Name of the target table. |
+| predicates | [RdbPredicates](#rdbpredicates) | Yes | Query conditions specified by the **RdbPredicates** object. |
+| columns | Array<string> | Yes | Columns to query. If this parameter is not specified, the query applies to all columns. |
| callback | AsyncCallback<[ResultSet](#resultset)> | Yes | Callback invoked to return the result. If the operation is successful, a **ResultSet** object will be returned.|
**Example**
```js
+import deviceManager from '@ohos.distributedHardware.deviceManager';
+let dmInstance = null;
+
+deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
+ if (err) {
+ console.log("create device manager failed, err=" + err);
+ return;
+ }
+ dmInstance = manager;
+ let devices = dmInstance.getTrustedDeviceListSync();
+ let deviceId = devices[0].deviceId;
+})
+
let predicates = new relationalStore.RdbPredicates('EMPLOYEE');
predicates.greaterThan("id", 0);
-store.remoteQuery("deviceId", "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"],
+store.remoteQuery(deviceId, "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"],
function(err, resultSet) {
if (err) {
console.error(`Failed to remoteQuery, err: ${err}`);
@@ -2043,13 +2079,17 @@ remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: A
Queries data from the RDB store of a remote device based on specified conditions. This API uses a promise to return the result.
+> **NOTE**
+>
+> The value of **device** 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.
+
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ------------------------------------ | ---- | ------------------------------------------------ |
-| device | string | Yes | Network ID of the remote device. |
+| device | string | Yes | ID of the remote device. |
| table | string | Yes | Name of the target table. |
| predicates | [RdbPredicates](#rdbpredicates) | Yes | Query conditions specified by the **RdbPredicates** object. |
| columns | Array<string> | Yes | Columns to query. If this parameter is not specified, the query applies to all columns.|
@@ -2063,6 +2103,19 @@ Queries data from the RDB store of a remote device based on specified conditions
**Example**
```js
+import deviceManager from '@ohos.distributedHardware.deviceManager';
+let dmInstance = null;
+
+deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
+ if (err) {
+ console.log("create device manager failed, err=" + err);
+ return;
+ }
+ dmInstance = manager;
+ let devices = dmInstance.getTrustedDeviceListSync();
+ let deviceId = devices[0].deviceId;
+})
+
let predicates = new relationalStore.RdbPredicates('EMPLOYEE');
predicates.greaterThan("id", 0);
let promise = store.remoteQuery("deviceId", "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
@@ -2488,7 +2541,11 @@ promise.then(() => {
obtainDistributedTableName(device: string, table: string, callback: AsyncCallback<string>): void
-Obtains the distributed table name for a remote device based on the local table name. This API uses an asynchronous callback to return the result. The distributed table name is required when the RDB store of a remote device is queried.
+Obtains the distributed table name for a remote device based on the local table name. The distributed table name is required when the RDB store of a remote device is queried.
+
+> **NOTE**
+>
+> The value of **device** 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.
**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC
@@ -2498,14 +2555,27 @@ Obtains the distributed table name for a remote device based on the local table
| Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | ------------------------------------------------------------ |
-| device | string | Yes | Remote device. |
-| table | string | Yes | Local table name. |
+| device | string | Yes | ID of the remote device. |
+| table | string | Yes | Local table name of the remote device. |
| callback | AsyncCallback<string> | Yes | Callback invoked to return the result. If the operation succeeds, the distributed table name of the remote device is returned.|
**Example**
```js
-store.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, tableName) {
+import deviceManager from '@ohos.distributedHardware.deviceManager';
+let dmInstance = null;
+
+deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
+ if (err) {
+ console.log("create device manager failed, err=" + err);
+ return;
+ }
+ dmInstance = manager;
+ let devices = dmInstance.getTrustedDeviceListSync();
+ let deviceId = devices[0].deviceId;
+})
+
+store.obtainDistributedTableName(deviceId, "EMPLOYEE", function (err, tableName) {
if (err) {
console.error(`ObtainDistributedTableName failed, err: ${err}`);
return;
@@ -2518,7 +2588,11 @@ store.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, tab
obtainDistributedTableName(device: string, table: string): Promise<string>
-Obtains the distributed table name for a remote device based on the local table name. This API uses a promise to return the result. The distributed table name is required when the RDB store of a remote device is queried.
+Obtains the distributed table name for a remote device based on the local table name. The distributed table name is required when the RDB store of a remote device is queried.
+
+> **NOTE**
+>
+> The value of **device** 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.
**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC
@@ -2526,10 +2600,10 @@ Obtains the distributed table name for a remote device based on the local table
**Parameters**
-| Name| Type | Mandatory| Description |
-| ------ | ------ | ---- | ---------- |
-| device | string | Yes | Remote device.|
-| table | string | Yes | Local table name.|
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | -------------------- |
+| device | string | Yes | ID of the remote device. |
+| table | string | Yes | Local table name of the remote device.|
**Return value**
@@ -2540,7 +2614,20 @@ Obtains the distributed table name for a remote device based on the local table
**Example**
```js
-let promise = store.obtainDistributedTableName("12345678abcde", "EMPLOYEE");
+import deviceManager from '@ohos.distributedHardware.deviceManager';
+let dmInstance = null;
+
+deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
+ if (err) {
+ console.log("create device manager failed, err=" + err);
+ return;
+ }
+ dmInstance = manager;
+ let devices = dmInstance.getTrustedDeviceListSync();
+ let deviceId = devices[0].deviceId;
+})
+
+let promise = store.obtainDistributedTableName(deviceId, "EMPLOYEE");
promise.then((tableName) => {
console.info(`ObtainDistributedTableName successfully, tableName= ${tableName}`);
}).catch((err) => {
@@ -2569,8 +2656,24 @@ Synchronizes data between devices. This API uses an asynchronous callback to ret
**Example**
```js
+import deviceManager from '@ohos.distributedHardware.deviceManager';
+let dmInstance = null;
+
+deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
+ if (err) {
+ console.log("create device manager failed, err=" + err);
+ return;
+ }
+ dmInstance = manager;
+ let devices = dmInstance.getTrustedDeviceListSync();
+ let deviceIds = [];
+ for (var i = 0; i < devices.length; i++) {
+ deviceIds[i] = devices[i].deviceId;
+ }
+})
+
let predicates = new relationalStore.RdbPredicates('EMPLOYEE');
-predicates.inDevices(['12345678abcde']);
+predicates.inDevices(deviceIds);
store.sync(relationalStore.SyncMode.SYNC_MODE_PUSH, predicates, function (err, result) {
if (err) {
console.error(`Sync failed, err: ${err}`);
@@ -2609,8 +2712,24 @@ Synchronizes data between devices. This API uses a promise to return the result.
**Example**
```js
+import deviceManager from '@ohos.distributedHardware.deviceManager';
+let dmInstance = null;
+
+deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => {
+ if (err) {
+ console.log("create device manager failed, err=" + err);
+ return;
+ }
+ dmInstance = manager;
+ let devices = dmInstance.getTrustedDeviceListSync();
+ let deviceIds = [];
+ for (var i = 0; i < devices.length; i++) {
+ deviceIds[i] = devices[i].deviceId;
+ }
+})
+
let predicates = new relationalStore.RdbPredicates('EMPLOYEE');
-predicates.inDevices(['12345678abcde']);
+predicates.inDevices(deviceIds);
let promise = store.sync(relationalStore.SyncMode.SYNC_MODE_PUSH, predicates);
promise.then((result) =>{
console.info(`Sync done.`);
@@ -2634,9 +2753,9 @@ Registers an observer for this RDB store. When the data in the RDB store changes
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------- | ---- | ------------------------------------------- |
-| event | string | Yes | Event to observe. The value is **dataChange**, which indicates a data change event. |
+| event | string | Yes | Event to observe. The value is **dataChange**, which indicates a data change event. |
| type | [SubscribeType](#subscribetype) | Yes | Subscription type to register.|
-| observer | Callback<Array<string>> | Yes | Callback invoked to return the data change event. |
+| observer | Callback<Array<string>> | Yes | Callback invoked to return the data change event. |
**Example**
@@ -2657,7 +2776,7 @@ try {
off(event:'dataChange', type: SubscribeType, observer: Callback<Array<string>>): void
-Unregisters the observer of the specified type from the RDB store. This API uses an asynchronous callback to return the result.
+Unregisters the observer of the specified type from the RDB store. This API uses a callback to return the result.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
diff --git a/en/application-dev/reference/apis/js-apis-distributed-account.md b/en/application-dev/reference/apis/js-apis-distributed-account.md
index b1a3996627f88c46e0657102ad33bd6ed27855a6..0ec67bc229c124cdf36a289e7321acaa9c2fcd43 100644
--- a/en/application-dev/reference/apis/js-apis-distributed-account.md
+++ b/en/application-dev/reference/apis/js-apis-distributed-account.md
@@ -232,7 +232,8 @@ Sets the distributed account information. This API uses a promise to return the
| ID| Error Message|
| -------- | ------------------- |
| 12300001 | System service exception. |
-| 12300002 | invalid accountInfo. |
+| 12300002 | Invalid accountInfo. |
+| 12300003 | Account not found. |
**Example**
```js
@@ -325,4 +326,4 @@ Defines distributed OS account information.
| event | string | Yes| Login state of the distributed account. The state can be login, logout, token invalid, or logoff, which correspond to the following strings respectively:
- Ohos.account.event.LOGIN
- Ohos.account.event.LOGOUT
- Ohos.account.event.TOKEN_INVALID
- Ohos.account.event.LOGOFF |
| nickname9+ | string | No| Nickname of the distributed account. It must be a non-null string.|
| avatar9+ | string | No| Avatar of the distributed account. It must be a non-null string.|
-| scalableData | object | No| Extended information about the distributed account, passed in key-value (KV) pairs.
**NOTE**
This parameter is reserved and not used in the setters and getters.|
+| scalableData8+ | object | No| Extended information about the distributed account, passed in key-value (KV) pairs.
**NOTE**
This parameter is reserved and not used in the setters and getters.|
diff --git a/en/application-dev/reference/apis/js-apis-distributed-data.md b/en/application-dev/reference/apis/js-apis-distributed-data.md
index 23ee9ed06ec230543ed4ee8594954bc3d72871cf..736a41901b6c74fc06bca36eeb1cee01456e1f49 100644
--- a/en/application-dev/reference/apis/js-apis-distributed-data.md
+++ b/en/application-dev/reference/apis/js-apis-distributed-data.md
@@ -11,9 +11,9 @@ This module provides the following functions:
- [SingleKVStore](#singlekvstore): provides methods to query and synchronize data in a single KV store. This class inherits from [KVStore](#kvstore), and data is not distinguished by device.
- [DeviceKVStore8+ ](#devicekvstore8): provides methods to query and synchronize data in a device KV store. This class inherits from [KVStore](#kvstore), and data is distinguished by device.
->**NOTE**
+>**NOTE**
>
->- The APIs provided by this module are no longer maintained since API version 9. You are advised to use `@ohos.data.distributedKVStore`](js-apis-distributedKVStore.md).
+>- The APIs provided by this module are no longer maintained since API version 9. You are advised to use [@ohos.data.distributedKVStore](js-apis-distributedKVStore.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.
@@ -162,7 +162,7 @@ Creates and obtains a KV store. This API uses an asynchronous callback to return
| ----- | ------ | ------ | ------ |
| storeId | string | Yes | Unique identifier of the KV store. The length cannot exceed [MAX_STORE_ID_LENGTH](#constants).|
| options | [Options](#options) | Yes | Configuration of the KV store.|
-| callback | AsyncCallback<T> | Yes | Callback invoked to return the KV store created.|
+| callback | AsyncCallback<T> | Yes | Callback invoked to return the KV store instance created.|
**Example**
@@ -212,7 +212,7 @@ Creates and obtains a KV store. This API uses a promise to return the result.
| Type | Description |
| -------------------------------------- | ------------------------ |
-| Promise<T>, <T extends [KVStore](#kvstore)> | Promise used to return the KV store created.|
+| Promise<T>, <T extends [KVStore](#kvstore)> | Promise used to return the KV store instance created. |
**Example**
@@ -449,7 +449,7 @@ Obtains the IDs of all KV stores that are created by [getKVStore()](#getkvstore)
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
| appId | string | Yes | Bundle name of the app that invokes the KV store. |
-| callback | AsyncCallback<string[]> | Yes |Callback invoked to return the KV store IDs obtained.|
+| callback | AsyncCallback<string[]> | Yes |Callback invoked to return the IDs of all created KV stores.|
**Example**
@@ -485,7 +485,7 @@ Obtains the IDs of all KV stores that are created by [getKVStore()](#getkvstore)
| Type | Description |
| ------------- | -------------- |
-| Promise<string[]>| Promise used to return the KV store IDs obtained.|
+| Promise<string[]>| Promise used to return the IDs of all created KV stores. |
**Example**
@@ -578,7 +578,7 @@ Provides KV store configuration.
| createIfMissing | boolean | No| Whether to create a KV store if no database file exists. By default, a KV store is created.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core |
| encrypt | boolean | No|Whether to encrypt database files. By default, database files are not encrypted.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core |
| backup | boolean | No|Whether to back up database files. By default, database files are backed up.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core |
-| autoSync | boolean | No|Whether database files are automatically synchronized. By default, database files are not automatically synchronized.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC |
+| autoSync | boolean | No|Whether to automatically synchronize database files. The value **false** (default) means to manually synchronize database files; the value **true** means to automatically synchronize database files.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC |
| kvStoreType | [KVStoreType](#kvstoretype) | No|Type of the KV store to create. By default, a device KV store is created. The device KV store stores data for multiple devices that collaborate with each other.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core|
| securityLevel | [SecurityLevel](#securitylevel) | No|Security level of the KV store. By default, the security level is not set.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core |
| schema8+ | [Schema](#schema8) | No| Schema used to define the values stored in a KV store.
**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore|
@@ -3074,7 +3074,7 @@ Obtains all KV pairs that match the specified key prefix. This API uses an async
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
| keyPrefix |string | Yes |Key prefix to match. |
-| callback |AsyncCallback<[Entry](#entry)[]> | Yes |Callback invoked to return the KV pairs obtained. |
+| callback |AsyncCallback<[Entry](#entry)[]> | Yes |Callback invoked to return the KV pairs that match the specified prefix. |
**Example**
@@ -3125,7 +3125,7 @@ Obtains all KV pairs that match the specified key prefix. This API uses a promis
| Type | Description |
| ------ | ------- |
-|Promise<[Entry](#entry)[]> |Promise used to return the KV pairs obtained.|
+|Promise<[Entry](#entry)[]> |Promise used to return the KV pairs that match the specified prefix.|
**Example**
@@ -3178,7 +3178,7 @@ Obtains the KV pairs that match the specified **Query** object. This API uses an
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
| query |[Query](#query8) | Yes |Key prefix to match. |
-| callback |AsyncCallback<[Entry](#entry)[]> | Yes |Callback invoked to return the KV pairs obtained. |
+| callback |AsyncCallback<[Entry](#entry)[]> | Yes |Callback invoked to return the KV pairs that match the specified **Query** object. |
**Example**
@@ -3234,7 +3234,7 @@ Obtains the KV pairs that match the specified **Query** object. This API uses a
| Type | Description |
| ------ | ------- |
-|Promise<[Entry](#entry)[]> |Promise used to return the KV pairs obtained.|
+|Promise<[Entry](#entry)[]> |Promise used to return the KV pairs that match the specified **Query** object.|
**Example**
@@ -3287,7 +3287,7 @@ Obtains the result set with the specified prefix. This API uses an asynchronous
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
| keyPrefix |string | Yes |Key prefix to match.|
-| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)> | Yes |Callback invoked to return the result set obtained.|
+| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)> | Yes |Callback invoked to return the result set with the specified prefix.|
**Example**
@@ -3341,7 +3341,7 @@ Obtains the result set with the specified prefix. This API uses a promise to ret
| Type | Description |
| ------ | ------- |
-|Promise<[KvStoreResultSet](#kvstoreresultset8)> |Promise used to return the result set obtained.|
+|Promise<[KvStoreResultSet](#kvstoreresultset8)> |Promise used to return the result set with the specified prefix.|
**Example**
@@ -3571,7 +3571,7 @@ Obtains the number of results that matches the specified **Query** object. This
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
| query |[Query](#query8) | Yes |**Query** object to match. |
-| callback |AsyncCallback<number> | Yes |Callback invoked to return the number of results obtained. |
+| callback |AsyncCallback<number> | Yes |Callback invoked to return the number of results that match the specified **Query** object. |
**Example**
@@ -3755,6 +3755,9 @@ try {
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).
+> **NOTE**
+>
+> 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.
**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC
@@ -3771,8 +3774,41 @@ Synchronizes the KV store manually. For details about the synchronization modes
**Example**
```js
+import deviceManager from '@ohos.distributedHardware.deviceManager';
+
+let devManager;
let kvStore;
-kvStore.sync(['deviceIds'], distributedData.SyncMode.PULL_ONLY, 1000);
+const KEY_TEST_SYNC_ELEMENT = 'key_test_sync';
+const VALUE_TEST_SYNC_ELEMENT = 'value-string-001';
+// create deviceManager
+deviceManager.createDeviceManager('bundleName', (err, value) => {
+ if (!err) {
+ devManager = value;
+ let deviceIds = [];
+ if (devManager != null) {
+ var devices = devManager.getTrustedDeviceListSync();
+ for (var i = 0; i < devices.length; i++) {
+ deviceIds[i] = devices[i].deviceId;
+ }
+ }
+ try {
+ kvStore.on('syncComplete', function (data) {
+ console.log('Sync dataChange');
+ });
+ kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err, data) {
+ if (err != undefined) {
+ console.log("put err: " + JSON.stringify(err));
+ return;
+ }
+ console.log('Succeeded in putting data');
+ const mode = distributedData.SyncMode.PULL_ONLY;
+ kvStore.sync(deviceIds, mode, 1000);
+ });
+ } catch (e) {
+ console.log('Sync e' + e);
+ }
+ }
+});
```
### on('dataChange')8+
@@ -3884,7 +3920,7 @@ Unsubscribes from synchronization complete events.
| Name | Type | Mandatory| Description |
| ------------ | --------------------------------------------- | ---- | ---------------------------------------------------------- |
| event | string | Yes | Event to unsubscribe from. The value is **syncComplete**, which indicates a synchronization complete event.|
-| syncCallback | Callback<Array<[string, number]>> | No | Callback for a synchronization complete event. |
+| syncCallback | Callback<Array<[string, number]>> | No | Callback for the synchronization complete event. |
**Example**
@@ -3987,7 +4023,7 @@ Obtains the security level of this KV store. This API uses an asynchronous callb
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
-| callback |AsyncCallback<[SecurityLevel](#securitylevel)> | Yes |Callback invoked to return the security level obtained. |
+| callback |AsyncCallback<[SecurityLevel](#securitylevel)> | Yes |Callback invoked to return the security level of the KV store. |
**Example**
@@ -4015,7 +4051,7 @@ Obtains the security level of this KV store. This API uses a promise to return t
| Type | Description |
| ------ | ------- |
-|Promise<[SecurityLevel](#securitylevel)> |Promise used to return the security level obtained.|
+|Promise<[SecurityLevel](#securitylevel)> |Promise used to return the security level of the KV store.|
**Example**
@@ -4097,7 +4133,7 @@ Obtains a string value that matches the specified device ID and key. This API us
| Type | Description |
| ------ | ------- |
-|Promise<boolean\|string\|number\|Uint8Array> |Promise used to return the string value obtained.|
+|Promise<boolean\|string\|number\|Uint8Array> |Promise used to return the string value that matches the given condition.|
**Example**
@@ -4189,7 +4225,7 @@ Obtains all KV pairs that match the specified device ID and key prefix. This API
| Type | Description |
| ------ | ------- |
-|Promise<[Entry](#entry)[]> |Promise used to return the KV pairs obtained.|
+|Promise<[Entry](#entry)[]> |Promise used to return all the KV pairs that match the given condition.|
**Example**
@@ -4299,7 +4335,7 @@ Obtains the KV pairs that match the specified **Query** object. This API uses a
| Type | Description |
| ------ | ------- |
-|Promise<[Entry](#entry)[]> |Promise used to return the KV pairs obtained.|
+|Promise<[Entry](#entry)[]> |Promise used to return the KV pairs that match the specified **Query** object.|
**Example**
@@ -4353,7 +4389,7 @@ Obtains the KV pairs that match the specified device ID and **Query** object. Th
| ----- | ------ | ---- | ----------------------- |
| deviceId |string | Yes |ID of the target device. |
| query |[Query](#query8) | Yes |**Query** object to match. |
-| callback |AsyncCallback<[Entry](#entry)[]> | Yes |Callback invoked to return the KV pairs obtained. |
+| callback |AsyncCallback<[Entry](#entry)[]> | Yes |Callback invoked to return the KV pairs that match the specified device ID and **Query** object. |
**Example**
@@ -4411,7 +4447,7 @@ Obtains the KV pairs that match the specified device ID and **Query** object. Th
| Type | Description |
| ------ | ------- |
-|Promise<[Entry](#entry)[]> |Promise used to return the KV pairs obtained.|
+|Promise<[Entry](#entry)[]> |Promise used to return the KV pairs that match the specified device ID and **Query** object.|
**Example**
@@ -4466,7 +4502,7 @@ Obtains a **KvStoreResultSet** object that matches the specified device ID and k
| ----- | ------ | ---- | ----------------------- |
| deviceId |string | Yes |ID of the target device. |
| keyPrefix |string | Yes |Key prefix to match. |
-| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)> | Yes |Callback invoked to return the **KvStoreResultSet** object obtained. |
+| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)> | Yes |Callback invoked to return the **KvStoreResultSet** object that matches the specified device ID and key prefix. |
**Example**
@@ -4506,7 +4542,7 @@ Obtains a **KvStoreResultSet** object that matches the specified device ID and k
| Type | Description |
| ------ | ------- |
-|Promise<[KvStoreResultSet](#kvstoreresultset8)> |Promise used to return the **KvStoreResultSet** object obtained.|
+|Promise<[KvStoreResultSet](#kvstoreresultset8)> |Promise used to return the **KvStoreResultSet** object that matches the specified device ID and key prefix.|
**Example**
@@ -4601,7 +4637,7 @@ Obtains a **KvStoreResultSet** object that matches the specified **Query** objec
| Type | Description |
| ------ | ------- |
-|Promise<[KvStoreResultSet](#kvstoreresultset8)> |Promise used to return the **KvStoreResultSet** object obtained.|
+|Promise<[KvStoreResultSet](#kvstoreresultset8)> |Promise used to return the **KvStoreResultSet** object that matches the specified **Query** object.|
**Example**
@@ -4661,7 +4697,7 @@ Obtains a **KvStoreResultSet** object that matches the specified device ID and *
| ----- | ------ | ---- | ----------------------- |
| deviceId |string | Yes |ID of the target device. |
| query |[Query](#query8) | Yes |**Query** object to match. |
-| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)> | Yes |Callback invoked to return the **KvStoreResultSet** object obtained. |
+| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)> | Yes |Callback invoked to return the **KvStoreResultSet** object that matches the specified device ID and **Query** object. |
**Example**
@@ -4718,7 +4754,7 @@ Obtains a **KvStoreResultSet** object that matches the specified device ID and *
| Type | Description |
| ------ | ------- |
-|Promise<[KvStoreResultSet](#kvstoreresultset8)> |Promise used to return the **KvStoreResultSet** object obtained.|
+|Promise<[KvStoreResultSet](#kvstoreresultset8)> |Promise used to return the **KvStoreResultSet** object that matches the specified device ID and **Query** object.|
**Example**
@@ -5141,6 +5177,10 @@ 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).
+> **NOTE**
+>
+> 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.
+
**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
@@ -5156,22 +5196,41 @@ Synchronizes the KV store manually. For details about the synchronization modes
**Example**
```js
+import deviceManager from '@ohos.distributedHardware.deviceManager';
+
+let devManager;
let kvStore;
const KEY_TEST_SYNC_ELEMENT = 'key_test_sync';
const VALUE_TEST_SYNC_ELEMENT = 'value-string-001';
-try {
- kvStore.on('syncComplete', function (data) {
+// create deviceManager
+deviceManager.createDeviceManager('bundleName', (err, value) => {
+ if (!err) {
+ devManager = value;
+ let deviceIds = [];
+ if (devManager != null) {
+ var devices = devManager.getTrustedDeviceListSync();
+ for (var i = 0; i < devices.length; i++) {
+ deviceIds[i] = devices[i].deviceId;
+ }
+ }
+ try {
+ kvStore.on('syncComplete', function (data) {
console.log('Sync dataChange');
- });
- kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err,data) {
- console.log('Sync put success');
- const devices = ['deviceList'];
+ });
+ kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err, data) {
+ if (err != undefined) {
+ console.log("put err: " + JSON.stringify(err));
+ return;
+ }
+ console.log('Succeeded in putting data');
const mode = distributedData.SyncMode.PULL_ONLY;
- kvStore.sync(devices, mode);
- });
-}catch(e) {
- console.log('Sync e' + e);
-}
+ kvStore.sync(deviceIds, mode, 1000);
+ });
+ } catch (e) {
+ console.log('Sync e' + e);
+ }
+ }
+});
```
### on('dataChange')8+
@@ -5283,7 +5342,7 @@ Unsubscribes from synchronization complete events.
| Name | Type | Mandatory| Description |
| ------------ | --------------------------------------------- | ---- | ---------------------------------------------------------- |
| event | string | Yes | Event to unsubscribe from. The value is **syncComplete**, which indicates a synchronization complete event.|
-| syncCallback | Callback<Array<[string, number]>> | No | Callback for a synchronization complete event. |
+| syncCallback | Callback<Array<[string, number]>> | No | Callback for the synchronization complete event. |
**Example**
diff --git a/en/application-dev/reference/apis/js-apis-distributedKVStore.md b/en/application-dev/reference/apis/js-apis-distributedKVStore.md
index aa475afa50fe07e03f9a8341b1429a16f7151658..004ae7c0e58348787b80e7fd3013ff18c82f6b13 100644
--- a/en/application-dev/reference/apis/js-apis-distributedKVStore.md
+++ b/en/application-dev/reference/apis/js-apis-distributedKVStore.md
@@ -151,7 +151,7 @@ Provides KV store configuration.
| createIfMissing | boolean | No | Whether to create a KV store if no database file exists. By default, a KV store is created.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core|
| encrypt | boolean | No | Whether to encrypt database files. By default, database files are not encrypted.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core|
| backup | boolean | No | Whether to back up database files. By default, database files are backed up.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core|
-| autoSync | boolean | No | Whether database files are automatically synchronized. By default, database files are not automatically synchronized.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC|
+| autoSync | boolean | No | Whether to automatically synchronize database files. The value **false** (default) means to manually synchronize database files; the value **true** means to automatically synchronize database files.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC|
| kvStoreType | [KVStoreType](#kvstoretype) | No | Type of the KV store to create. By default, a device KV store is created. The device KV store stores data for multiple devices that collaborate with each other.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core|
| securityLevel | [SecurityLevel](#securitylevel) | Yes |Security level of the KV store.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core|
| schema | [Schema](#schema) | No | Schema used to define the values stored in the KV store. By default, **schema** is not used.
**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore|
@@ -258,7 +258,7 @@ Creates a **KVManager** instance to manage KV stores.
| Name| Type | Mandatory| Description |
| ------ | ----------------------------- | ---- | --------------------------------------------------------- |
-| config | [KVManagerConfig](#kvmanagerconfig) | Yes | **KVManager** instance configuration, including the bundle name of the caller and user information.|
+| config | [KVManagerConfig](#kvmanagerconfig) | Yes | **KVManager** instance configuration, including the bundle name and user information of the caller.|
**Return value**
@@ -271,7 +271,8 @@ Creates a **KVManager** instance to manage KV stores.
Stage model:
```js
-import UIAbility from '@ohos.app.ability.UIAbility'
+import UIAbility from '@ohos.app.ability.UIAbility';
+
let kvManager;
export default class EntryAbility extends UIAbility {
onCreate() {
@@ -294,7 +295,7 @@ export default class EntryAbility extends UIAbility {
FA model:
```js
-import featureAbility from '@ohos.ability.featureAbility'
+import featureAbility from '@ohos.ability.featureAbility';
let kvManager;
let context = featureAbility.getContext()
const kvManagerConfig = {
@@ -327,7 +328,7 @@ Creates and obtains a distributed KV store. This API uses an asynchronous callba
| -------- | ---------------------- | ---- | ------------------------------------------------------------ |
| storeId | string | Yes | Unique identifier of the KV store. The length cannot exceed [MAX_STORE_ID_LENGTH](#constants).|
| options | [Options](#options) | Yes | Configuration of the KV store to create. |
-| callback | AsyncCallback<T> | Yes | Callback invoked to return the distributed KV store (**SingleKVStore** or **DeviceKVStore**) instance created.|
+| callback | AsyncCallback<T> | Yes | Callback invoked to return the **SingleKVStore** or **DeviceKVStore** instance created.|
**Error codes**
@@ -384,7 +385,7 @@ Creates and obtains a distributed KV store. This API uses a promise to return th
| Type | Description |
| ---------------- | ------------------------------------------------------------ |
-| Promise<T> | Promise used to return the distributed KV store (**SingleKVStore** or **DeviceKVStore**) instance created.|
+| Promise<T> | Promise used to return the **SingleKVStore** or **DeviceKVStore** instance created.|
**Error codes**
@@ -651,7 +652,7 @@ Obtains the IDs of all distributed KV stores that are created by [getKVStore](#g
| Name | Type | Mandatory| Description |
| -------- | ----------------------------- | ---- | --------------------------------------------------- |
| appId | string | Yes | Bundle name of the app that invokes the KV store. |
-| callback | AsyncCallback<string[]> | Yes | Callback invoked to return the IDs of the distributed KV stores obtained.|
+| callback | AsyncCallback<string[]> | Yes | Callback invoked to return the IDs of all the distributed KV stores created.|
**Example**
@@ -689,7 +690,7 @@ Obtains the IDs of all distributed KV stores that are created by [getKVStore](#g
| Type | Description |
| ----------------------- | ------------------------------------------------------ |
-| Promise<string[]> | Promise used to return the IDs of the distributed KV stores obtained.|
+| Promise<string[]> | Promise used to return the IDs of all the distributed KV stores created. |
**Example**
@@ -2960,7 +2961,7 @@ Obtains all KV pairs that match the specified key prefix. This API uses an async
| Name | Type | Mandatory| Description |
| --------- | -------------------------------------- | ---- | ---------------------------------------- |
| keyPrefix | string | Yes | Key prefix to match. |
-| callback | AsyncCallback<[Entry](#entry)[]> | Yes | Callback invoked to return the KV pairs obtained.|
+| callback | AsyncCallback<[Entry](#entry)[]> | Yes | Callback invoked to return the KV pairs that match the specified prefix.|
**Error codes**
@@ -3028,7 +3029,7 @@ Obtains all KV pairs that match the specified key prefix. This API uses a promis
| Type | Description |
| -------------------------------- | ------------------------------------------- |
-| Promise<[Entry](#entry)[]> | Promise used to return the KV pairs obtained.|
+| Promise<[Entry](#entry)[]> | Promise used to return the KV pairs that match the specified prefix.|
**Error codes**
@@ -3086,7 +3087,7 @@ Obtains the KV pairs that match the specified **Query** object. This API uses an
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | ----------------------------------------------- |
| query | [Query](#query) | Yes | Key prefix to match. |
-| callback | AsyncCallback<[Entry](#entry)[]> | Yes | Callback invoked to return the KV pairs obtained.|
+| callback | AsyncCallback<[Entry](#entry)[]> | Yes | Callback invoked to return the KV pairs that match the specified **Query** object.|
**Error codes**
@@ -3153,7 +3154,7 @@ Obtains the KV pairs that match the specified **Query** object. This API uses a
| Type | Description |
| -------------------------------- | -------------------------------------------------- |
-| Promise<[Entry](#entry)[]> | Promise used to return the KV pairs obtained.|
+| Promise<[Entry](#entry)[]> | Promise used to return the KV pairs that match the specified **Query** object.|
**Error codes**
@@ -3214,7 +3215,7 @@ Obtains a result set with the specified prefix from this single KV store. This A
| Name | Type | Mandatory| Description |
| --------- | ---------------------------------------------------------- | ---- | ------------------------------------ |
| keyPrefix | string | Yes | Key prefix to match. |
-| callback | AsyncCallback<[KVStoreResultSet](#kvstoreresultset)> | Yes | Callback invoked to return the result set obtained.|
+| callback | AsyncCallback<[KVStoreResultSet](#kvstoreresultset)> | Yes | Callback invoked to return the result set with the specified prefix.|
**Error codes**
@@ -3288,7 +3289,7 @@ Obtains a result set with the specified prefix from this single KV store. This A
| Type | Description |
| ---------------------------------------------------- | --------------------------------------- |
-| Promise<[KVStoreResultSet](#kvstoreresultset)> | Promise used to return the result set obtained.|
+| Promise<[KVStoreResultSet](#kvstoreresultset)> | Promise used to return the result set with the specified prefix.|
**Error codes**
@@ -4484,6 +4485,9 @@ try {
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).
+> **NOTE**
+>
+> 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.
**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC
@@ -4509,26 +4513,41 @@ For details about the error codes, see [Distributed KV Store Error Codes](../err
**Example**
```js
+import deviceManager from '@ohos.distributedHardware.deviceManager';
+
+let devManager;
let kvStore;
const KEY_TEST_SYNC_ELEMENT = 'key_test_sync';
const VALUE_TEST_SYNC_ELEMENT = 'value-string-001';
-try {
- kvStore.on('syncComplete', function (data) {
+// create deviceManager
+deviceManager.createDeviceManager('bundleName', (err, value) => {
+ if (!err) {
+ devManager = value;
+ let deviceIds = [];
+ if (devManager != null) {
+ var devices = devManager.getTrustedDeviceListSync();
+ for (var i = 0; i < devices.length; i++) {
+ deviceIds[i] = devices[i].deviceId;
+ }
+ }
+ try {
+ kvStore.on('syncComplete', function (data) {
console.log('Sync dataChange');
- });
- kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err, data) {
+ });
+ kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err, data) {
if (err != undefined) {
- console.error(`Fail to sync.code is ${err.code},message is ${err.message}`);
- return;
+ console.error(`Fail to sync.code is ${err.code},message is ${err.message}`);
+ return;
}
console.log('Succeeded in putting data');
- const devices = ['deviceList'];
const mode = distributedKVStore.SyncMode.PULL_ONLY;
- kvStore.sync(devices, mode, 1000);
- });
-} catch (e) {
- console.error(`Fail to sync.code is ${e.code},message is ${e.message}`);
-}
+ kvStore.sync(deviceIds, mode, 1000);
+ });
+ } catch (e) {
+ console.error(`Fail to sync.code is ${e.code},message is ${e.message}`);
+ }
+ }
+});
```
### sync
@@ -4536,6 +4555,9 @@ try {
sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void
Synchronizes the KV store manually. This API returns the result synchronously. For details about the synchronization modes of the distributed data service, see [Distributed Data Service Overview](../../database/database-mdds-overview.md).
+> **NOTE**
+>
+> 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.
**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC
@@ -4562,29 +4584,44 @@ For details about the error codes, see [Distributed KV Store Error Codes](../err
**Example**
```js
+import deviceManager from '@ohos.distributedHardware.deviceManager';
+
+let devManager;
let kvStore;
const KEY_TEST_SYNC_ELEMENT = 'key_test_sync';
const VALUE_TEST_SYNC_ELEMENT = 'value-string-001';
-try {
- kvStore.on('syncComplete', function (data) {
+// create deviceManager
+deviceManager.createDeviceManager('bundleName', (err, value) => {
+ if (!err) {
+ devManager = value;
+ let deviceIds = [];
+ if (devManager != null) {
+ var devices = devManager.getTrustedDeviceListSync();
+ for (var i = 0; i < devices.length; i++) {
+ deviceIds[i] = devices[i].deviceId;
+ }
+ }
+ try {
+ kvStore.on('syncComplete', function (data) {
console.log('Sync dataChange');
- });
- kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err, data) {
+ });
+ kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err, data) {
if (err != undefined) {
- console.error(`Fail to sync.code is ${err.code},message is ${err.message}`);
- return;
+ console.error(`Fail to sync.code is ${err.code},message is ${err.message}`);
+ return;
}
console.log('Succeeded in putting data');
- const devices = ['deviceList'];
const mode = distributedKVStore.SyncMode.PULL_ONLY;
const query = new distributedKVStore.Query();
query.prefixKey("batch_test");
query.deviceId('localDeviceId');
- kvStore.sync(devices, query, mode, 1000);
- });
-} catch (e) {
- console.error(`Fail to sync.code is ${e.code},message is ${e.message}`);
-}
+ kvStore.sync(deviceIds, query, mode, 1000);
+ });
+ } catch (e) {
+ console.error(`Fail to sync.code is ${e.code},message is ${e.message}`);
+ }
+ }
+});
```
### on('dataChange')
@@ -5020,7 +5057,7 @@ Obtains a string value that matches the specified device ID and key. This API us
| Type | Description |
| ------ | ------- |
-|Promise<boolean\|string\|number\|Uint8Array> |Promise used to return the string value obtained.|
+|Promise<boolean\|string\|number\|Uint8Array> |Promise used to return the string value that matches the given condition.|
**Error codes**
@@ -5067,7 +5104,7 @@ Obtains all KV pairs that match the specified key prefix for this device. This A
| Name | Type | Mandatory| Description |
| --------- | -------------------------------------- | ---- | ---------------------------------------- |
| keyPrefix | string | Yes | Key prefix to match. |
-| callback | AsyncCallback<[Entry](#entry)[]> | Yes | Callback invoked to return the KV pairs obtained.|
+| callback | AsyncCallback<[Entry](#entry)[]> | Yes | Callback invoked to return the KV pairs that match the specified prefix.|
**Error codes**
@@ -5135,7 +5172,7 @@ Obtains all KV pairs that match the specified key prefix for this device. This A
| Type | Description |
| -------------------------------- | ------------------------------------------- |
-| Promise<[Entry](#entry)[]> | Promise used to return the KV pairs obtained.|
+| Promise<[Entry](#entry)[]> | Promise used to return the KV pairs that match the specified prefix.|
**Error codes**
@@ -5263,7 +5300,7 @@ Obtains all KV pairs that match the specified device ID and key prefix. This API
| Type | Description |
| -------------------------------- | ------------------------------------------------- |
-| Promise<[Entry](#entry)[]> | Promise used to return the KV pairs obtained.|
+| Promise<[Entry](#entry)[]> | Promise used to return all the KV pairs that match the given condition.|
**Error codes**
@@ -5324,7 +5361,7 @@ Obtains all KV pairs that match the specified **Query** object for this device.
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | ----------------------------------------------------- |
| query | [Query](#query) | Yes | Key prefix to match. |
-| callback | AsyncCallback<[Entry](#entry)[]> | Yes | Callback invoked to return the KV pairs obtained.|
+| callback | AsyncCallback<[Entry](#entry)[]> | Yes | Callback invoked to return the KV pairs that match the specified **Query** object on the local device.|
**Error codes**
@@ -5391,7 +5428,7 @@ Obtains all KV pairs that match the specified **Query** object for this device.
| Type | Description |
| -------------------------------- | -------------------------------------------------------- |
-| Promise<[Entry](#entry)[]> | Promise used to return the KV pairs obtained.|
+| Promise<[Entry](#entry)[]> | Promise used to return the KV pairs that match the specified **Query** object on the local device.|
**Error codes**
@@ -5453,7 +5490,7 @@ Obtains the KV pairs that match the specified device ID and **Query** object. Th
| -------- | -------------------------------------- | ---- | ------------------------------------------------------- |
| deviceId | string | Yes | ID of the target device. |
| query | [Query](#query) | Yes | **Query** object to match. |
-| callback | AsyncCallback<[Entry](#entry)[]> | Yes | Callback invoked to return the KV pairs obtained.|
+| callback | AsyncCallback<[Entry](#entry)[]> | Yes | Callback invoked to return the KV pairs that match the specified device ID and **Query** object.|
**Error codes**
@@ -5527,7 +5564,7 @@ Obtains the KV pairs that match the specified device ID and **Query** object. Th
| Type | Description |
| -------------------------------- | ---------------------------------------------------------- |
-| Promise<[Entry](#entry)[]> | Promise used to return the KV pairs obtained.|
+| Promise<[Entry](#entry)[]> | Promise used to return the KV pairs that match the specified device ID and **Query** object.|
**Error codes**
@@ -5589,7 +5626,7 @@ Obtains a result set with the specified prefix for this device. This API uses an
| Name | Type | Mandatory| Description |
| --------- | ---------------------------------------------------------- | ---- | ------------------------------------ |
| keyPrefix | string | Yes | Key prefix to match. |
-| callback | AsyncCallback<[KVStoreResultSet](#kvstoreresultset)> | Yes | Callback invoked to return the result set obtained.|
+| callback | AsyncCallback<[KVStoreResultSet](#kvstoreresultset)> | Yes | Callback invoked to return the result set with the specified prefix.|
**Error codes**
@@ -5663,7 +5700,7 @@ Obtains a result set with the specified prefix for this device. This API uses a
| Type | Description |
| ---------------------------------------------------- | --------------------------------------- |
-| Promise<[KVStoreResultSet](#kvstoreresultset)> | Promise used to return the result set obtained.|
+| Promise<[KVStoreResultSet](#kvstoreresultset)> | Promise used to return the result set with the specified prefix.|
**Error codes**
@@ -5727,7 +5764,7 @@ Obtains a **KVStoreResultSet** object that matches the specified device ID and k
| --------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| deviceId | string | Yes | ID of the target device. |
| keyPrefix | string | Yes | Key prefix to match. |
-| callback | AsyncCallback<[KVStoreResultSet](#kvstoreresultset)> | Yes | Callback invoked to return the **KVStoreResultSet** object obtained.|
+| callback | AsyncCallback<[KVStoreResultSet](#kvstoreresultset)> | Yes | Callback invoked to return the **KVStoreResultSet** object that matches the specified device ID and key prefix.|
**Error codes**
@@ -5783,7 +5820,7 @@ Obtains a **KVStoreResultSet** object that matches the specified device ID and k
| Type | Description |
| ------------------------------------------------------ | ------------------------------------------------------------ |
-| Promise<[KVStoreResultSet](#kvstoreresultset)> | Promise used to return the **KVStoreResultSet** object obtained.|
+| Promise<[KVStoreResultSet](#kvstoreresultset)> | Promise used to return the **KVStoreResultSet** object that matches the specified device ID and key prefix.|
**Error codes**
@@ -5830,7 +5867,7 @@ Obtains a **KVStoreResultSet** object that matches the specified device ID and *
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs. |
| query | [Query](#query) | Yes | **Query** object to match. |
-| callback | AsyncCallback<[KVStoreResultSet](#kvstoreresultset)> | Yes | Callback invoked to return the **KVStoreResultSet** object obtained.|
+| callback | AsyncCallback<[KVStoreResultSet](#kvstoreresultset)> | Yes | Callback invoked to return the **KVStoreResultSet** object that matches the specified device ID and **Query** object.|
**Error codes**
@@ -5907,7 +5944,7 @@ Obtains a **KVStoreResultSet** object that matches the specified device ID and *
| Type | Description |
| ------------------------------------------------------ | ------------------------------------------------------------ |
-| Promise<[KVStoreResultSet](#kvstoreresultset)> | Promise used to return the **KVStoreResultSet** object obtained.|
+| Promise<[KVStoreResultSet](#kvstoreresultset)> | Promise used to return the **KVStoreResultSet** object that matches the specified device ID and **Query** object.|
**Error codes**
@@ -5980,7 +6017,7 @@ Obtains a **KVStoreResultSet** object that matches the specified **Query** objec
| Type | Description |
| ---------------------------------------------------- | ------------------------------------------------------------ |
-| Promise<[KVStoreResultSet](#kvstoreresultset)> | Promise used to return Obtains a **KVStoreResultSet** object that matches the specified **Query** object for this device.|
+| Promise<[KVStoreResultSet](#kvstoreresultset)> | Promise used to return the **KVStoreResultSet** object obtained.|
**Error codes**
@@ -6341,7 +6378,7 @@ Obtains the number of results that match the specified **Query** object for this
| Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | ------------------------------------------------- |
| query | [Query](#query) | Yes | **Query** object to match. |
-| callback | AsyncCallback<number> | Yes | Callback invoked to return the number of results that match the specified **Query** object.|
+| callback | AsyncCallback<number> | Yes | Callback invoked to return the number of results obtained.|
**Error codes**
@@ -6404,7 +6441,7 @@ Obtains the number of results that match the specified **Query** object for this
| Type | Description |
| --------------------- | ---------------------------------------------------- |
-| Promise<number> | Promise used to return the number of results that match the specified **Query** object.|
+| Promise<number> | Promise used to return the number of results obtained.|
**Error codes**
@@ -6463,7 +6500,7 @@ Obtains the number of results that matches the specified device ID and **Query**
| -------- | --------------------------- | ---- | --------------------------------------------------- |
| deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs. |
| query | [Query](#query) | Yes | **Query** object to match. |
-| callback | AsyncCallback<number> | Yes | Callback invoked to return the number of results obtained.|
+| callback | AsyncCallback<number> | Yes | Callback invoked to return the number of results obtained. |
**Error codes**
@@ -6532,7 +6569,7 @@ Obtains the number of results that matches the specified device ID and **Query**
| Type | Description |
| --------------------- | ------------------------------------------------------ |
-| Promise<number> | Promise used to return the number of results obtained.|
+| Promise<number> | Promise used to return the number of results obtained. |
**Error codes**
diff --git a/en/application-dev/reference/apis/js-apis-file-picker.md b/en/application-dev/reference/apis/js-apis-file-picker.md
index 7b1b76c5e5a7d4ef0dd8601e5a525dbe10fd62a9..08a1e1bca160c10d9aa96c08c80082d6d78916ab 100644
--- a/en/application-dev/reference/apis/js-apis-file-picker.md
+++ b/en/application-dev/reference/apis/js-apis-file-picker.md
@@ -1,10 +1,11 @@
# @ohos.file.picker (File Picker)
+The File Picker encapsulates system applications, such as **PhotoViewPicker**, **DocumentViewPicker**, and **AudioViewPicker**, and provides capabilities of selecting and saving photos, documents, and audio clips. The application can select the picker as required.
+
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
-The File Picker encapsulates system applications, such as **PhotoViewPicker**, **DocumentViewPicker**, and **AudioViewPicker**, and provides capabilities of selecting and saving photos, documents, and audio clips. The application can select the picker as required.
## Modules to Import
```js
diff --git a/en/application-dev/reference/apis/js-apis-file-statvfs.md b/en/application-dev/reference/apis/js-apis-file-statvfs.md
index f431f3cb17d8d82a88a0b9bde7e2a3e3d8e66c86..b7809c5f9f10fa9904ec0f64367ff025e7aafc94 100644
--- a/en/application-dev/reference/apis/js-apis-file-statvfs.md
+++ b/en/application-dev/reference/apis/js-apis-file-statvfs.md
@@ -22,15 +22,15 @@ Obtains the number of free bytes of the specified file system in asynchronous mo
**Parameters**
-| Name| Type | Mandatory| Description |
-| ------ | ------ | ---- | ---------------------------- |
-| path | string | Yes | File path of the file system.|
+ | Name| Type | Mandatory| Description |
+ | ------ | ------ | ---- | ---------------------------- |
+ | path | string | Yes | File path of the file system.|
**Return value**
-| Type | Description |
-| --------------------- | -------------- |
-| Promise<number> | Promise used to return the number of free bytes obtained.|
+ | Type | Description |
+ | --------------------- | -------------- |
+ | Promise<number> | Promise used to return the number of free bytes obtained.|
**Example**
@@ -53,10 +53,10 @@ Obtains the number of free bytes of the specified file system in asynchronous mo
**Parameters**
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------- | ---- | ---------------------------- |
-| path | string | Yes | File path of the file system.|
-| callback | AsyncCallback<number> | Yes | Callback invoked to return the number of free bytes obtained.|
+ | Name | Type | Mandatory| Description |
+ | -------- | --------------------------- | ---- | ---------------------------- |
+ | path | string | Yes | File path of the file system.|
+ | callback | AsyncCallback<number> | Yes | Callback invoked to return the number of free bytes obtained.|
**Example**
@@ -81,15 +81,15 @@ Obtains the total number of bytes of the specified file system in asynchronous m
**Parameters**
-| Name| Type | Mandatory| Description |
-| ---- | ------ | ---- | ---------------------------- |
-| path | string | Yes | File path of the file system.|
+ | Name| Type | Mandatory| Description |
+ | ---- | ------ | ---- | ---------------------------- |
+ | path | string | Yes | File path of the file system.|
**Return value**
-| Type | Description |
-| --------------------- | ------------ |
-| Promise<number> | Promise used to return the total number of bytes obtained.|
+ | Type | Description |
+ | --------------------- | ------------ |
+ | Promise<number> | Promise used to return the total number of bytes obtained.|
**Example**
@@ -112,10 +112,10 @@ Obtains the total number of bytes of the specified file system in asynchronous m
**Parameters**
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------- | ---- | ---------------------------- |
-| path | string | Yes | File path of the file system.|
-| callback | AsyncCallback<number> | Yes | Callback invoked to return the total number of bytes obtained. |
+ | Name | Type | Mandatory| Description |
+ | -------- | --------------------------- | ---- | ---------------------------- |
+ | path | string | Yes | File path of the file system.|
+ | callback | AsyncCallback<number> | Yes | Callback invoked to return the total number of bytes obtained. |
**Example**
diff --git a/en/application-dev/reference/apis/js-apis-file-volumemanager.md b/en/application-dev/reference/apis/js-apis-file-volumemanager.md
index bf1e5c9c417ecc5940e75d4876def5ffd7b4b210..c2628ce063d93233af5ee6f6641a422e1a163c37 100644
--- a/en/application-dev/reference/apis/js-apis-file-volumemanager.md
+++ b/en/application-dev/reference/apis/js-apis-file-volumemanager.md
@@ -1,6 +1,6 @@
-# @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**
>
@@ -18,7 +18,7 @@ import volumemanager from "@ohos.file.volumeManager";
getAllVolumes(): Promise<Array<Volume>>
-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
@@ -26,15 +26,17 @@ Asynchronously obtains information about all available volumes. This API uses a
**Return value**
- | Type | Description |
- | ---------------------------------- | -------------------------- |
- | Promise<[Volume](#volume)[]> | Promise used to return the execution result.|
+| Type | Description |
+| ---------------------------------- | -------------------------- |
+| Promise<[Volume](#volume)[]> | Promise used to return information about all available volumes.|
**Example**
```js
volumemanager.getAllVolumes().then(function(volumes){
// Do something.
+ }).catch(function(error){
+ console.info("getAllVolumes failed");
});
```
@@ -42,7 +44,7 @@ Asynchronously obtains information about all available volumes. This API uses a
getAllVolumes(callback: AsyncCallback<Array<Volume>>): 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
@@ -50,9 +52,9 @@ Asynchronously obtains information about all available volumes. This API uses a
**Parameters**
- | Name | Type | Mandatory| Description |
- | -------- | ------------------------------------------------- | ---- | ------------------------------------ |
- | callback | AsyncCallback<[Volume](#volume)[]> | Yes | Callback invoked to return the volume information obtained.|
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------------- | ---- | ------------------------------------ |
+| callback | AsyncCallback<[Volume](#volume)[]> | Yes | Callback invoked to return information about all available volumes.|
**Example**
@@ -68,7 +70,7 @@ Asynchronously obtains information about all available volumes. This API uses a
mount(volumeId: string): Promise<void>
-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
@@ -76,22 +78,24 @@ Asynchronously mounts a volume. This API uses a promise to return the result.
**Parameters**
- | Name | Type | Mandatory| Description|
- | -------- | ------ | ---- | ---- |
- | volumeId | string | Yes | Volume ID.|
+| Name | Type | Mandatory| Description|
+| -------- | ------ | ---- | ---- |
+| volumeId | string | Yes | Volume ID.|
**Return value**
- | Type | Description |
- | ---------------------- | ---------- |
- | Promise<void> | Promise used to return the result.|
+| Type | Description |
+| ---------------------- | ---------- |
+| Promise<void> | Promise that returns no value.|
**Example**
```js
let volumeId = "";
- volumemanager.mount(volumeId).then(function(flag){
- // Do something
+ volumemanager.mount(volumeId).then(function(){
+ // 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.
mount(volumeId: string, callback:AsyncCallback<void>):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
@@ -107,17 +111,17 @@ Asynchronously obtains the available space of the specified volume. This API use
**Parameters**
- | Name | Type | Mandatory| Description |
- | -------- | ------------------------------------- | ---- | -------------------- |
- | volumeId | string | Yes | Volume ID. |
- | callback | AsyncCallback<void> | Yes | Callback invoked to return the result.|
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------- | ---- | -------------------- |
+| volumeId | string | Yes | Volume ID. |
+| callback | AsyncCallback<void> | Yes | Callback that returns no value.|
**Example**
```js
let volumeId = "";
- volumemanager.mount(volumeId, function(error, flag){
- // Do something
+ volumemanager.mount(volumeId, function(error){
+ // Do something.
});
```
@@ -133,22 +137,24 @@ Asynchronously unmounts a volume. This API uses a promise to return the result.
**Parameters**
- | Name | Type | Mandatory| Description|
- | -------- | ------ | ---- | ---- |
- | volumeId | string | Yes | Volume ID.|
+| Name | Type | Mandatory| Description|
+| -------- | ------ | ---- | ---- |
+| volumeId | string | Yes | Volume ID.|
**Return value**
- | Type | Description |
- | ---------------------- | ---------- |
- | Promise<void> | Promise used to return the result.|
+| Type | Description |
+| ---------------------- | ---------- |
+| Promise<void> | Promise that returns no value.|
**Example**
```js
let volumeId = "";
- volumemanager.unmount(volumeId).then(function(flag){
- // Do something
+ volumemanager.unmount(volumeId).then(function(){
+ // 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.
unmount(volumeId: string, callback: AsyncCallback<void>): 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
@@ -164,17 +170,17 @@ Asynchronously unmounts a volume. This API uses a callback to return the result.
**Parameters**
- | Name | Type | Mandatory| Description |
- | -------- | ------------------------------------- | ---- | -------------------- |
- | volumeId | string | Yes | Volume ID. |
- | callback | AsyncCallback<void> | Yes | Callback invoked to return the result.|
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------- | ---- | -------------------- |
+| volumeId | string | Yes | Volume ID. |
+| callback | AsyncCallback<void> | Yes | Callback that returns no value.|
**Example**
```js
let volumeId = "";
- volumemanager.unmount(volumeId, function(error, flag){
- // Do something
+ volumemanager.unmount(volumeId, function(error){
+ // Do something.
});
```
@@ -182,7 +188,7 @@ Asynchronously unmounts a volume. This API uses a callback to return the result.
getVolumeByUuid(uuid: string): Promise<Volume>
-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
@@ -190,15 +196,15 @@ Asynchronously obtains volume information based on the universally unique identi
**Parameters**
- | Name | Type | Mandatory| Description|
- | -------- | ------ | ---- | ---- |
- | uuid | string | Yes | UUID of the volume.|
+| Name | Type | Mandatory| Description|
+| -------- | ------ | ---- | ---- |
+| uuid | string | Yes | UUID of the volume.|
**Return value**
- | Type | Description |
- | ---------------------------------- | -------------------------- |
- | Promise<[Volume](#volume)> | Promise used to return the volume information obtained.|
+| Type | Description |
+| ---------------------------------- | -------------------------- |
+| Promise<[Volume](#volume)> | Promise used to return the volume information obtained.|
**Example**
@@ -215,7 +221,7 @@ Asynchronously obtains volume information based on the universally unique identi
getVolumeByUuid(uuid: string, callback: AsyncCallback<Volume>): 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
@@ -223,10 +229,10 @@ Asynchronously obtains volume information based on the UUID. This API uses a cal
**Parameters**
- | Name | Type | Mandatory| Description |
- | -------- | ------------------------------------------------ | ---- | -------------------- |
- | uuid | string | Yes | UUID of the volume. |
- | callback | AsyncCallback<[Volume](#volume)> | Yes | Callback invoked to return the volume information obtained.|
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------------ | ---- | -------------------- |
+| uuid | string | Yes | UUID of the volume. |
+| callback | AsyncCallback<[Volume](#volume)> | Yes | Callback invoked to return the volume information obtained.|
**Example**
@@ -241,7 +247,7 @@ Asynchronously obtains volume information based on the UUID. This API uses a cal
getVolumeById(volumeId: string): Promise<Volume>
-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
@@ -249,15 +255,15 @@ Asynchronously obtains volume information based on the volume ID. This API uses
**Parameters**
- | Name | Type | Mandatory | Description|
- | -------- | ------ | ---- | ---- |
- | volumeId | string | Yes | Volume ID.|
+| Name | Type | Mandatory | Description|
+| -------- | ------ | ---- | ---- |
+| volumeId | string | Yes | Volume ID.|
**Return value**
- | Type | Description |
- | ---------------------------------- | -------------------------- |
- | Promise<[Volume](#volume)> | Promise used to return the volume information obtained.|
+| Type | Description |
+| ---------------------------------- | -------------------------- |
+| Promise<[Volume](#volume)> | Promise used to return the volume information obtained.|
**Example**
@@ -274,7 +280,7 @@ Asynchronously obtains volume information based on the volume ID. This API uses
getVolumeById(volumeId: string, callback: AsyncCallback<Volume>): 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
@@ -282,10 +288,10 @@ Asynchronously obtains volume information based on the volume ID. This API uses
**Parameters**
- | Name | Type | Mandatory| Description |
- | -------- | ------------------------- | ---- | ----------------------------- |
- | volumeId | string | Yes | Volume ID. |
- | callback | AsyncCallback<[Volume](#volume)> | Yes | Callback invoked to return the volume information obtained. |
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ----------------------------- |
+| volumeId | string | Yes | Volume ID. |
+| callback | AsyncCallback<[Volume](#volume)> | Yes | Callback invoked to return the volume information obtained. |
**Example**
@@ -300,7 +306,7 @@ Asynchronously obtains volume information based on the volume ID. This API uses
setVolumeDescription(uuid: string, description: string): Promise<void>
-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
@@ -308,16 +314,16 @@ Asynchronously sets the volume description based on the UUID. This API uses a pr
**Parameters**
- | Name | Type | Mandatory| Description|
- | --------- | ------ | ---- | ---- |
- | uuid | string | Yes | UUID of the volume.|
- | description | string | Yes | Volume description.|
+| Name | Type | Mandatory| Description|
+| --------- | ------ | ---- | ---- |
+| uuid | string | Yes | UUID of the volume.|
+| description | string | Yes | Volume description to set.|
**Return value**
- | Type | Description |
- | ---------------------- | -------------------------- |
- | Promise<void> | Promise used to return the result. |
+| Type | Description |
+| ---------------------- | -------------------------- |
+| Promise<void> | Promise that returns no value. |
**Example**
@@ -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<void>): 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
@@ -343,18 +349,18 @@ Asynchronously sets the volume description based on the UUID. This API uses a ca
**Parameters**
- | Name | Type | Mandatory| Description |
- | ---------- | --------------------------------------- | ---- | ---------------- |
- | uuid | string | Yes | UUID of the volume. |
- | description | string | Yes | Volume description. |
- | callback | AsyncCallback<void> | Yes | Callback invoked to return the result.|
+| Name | Type | Mandatory| Description |
+| ---------- | --------------------------------------- | ---- | ---------------- |
+| uuid | string | Yes | UUID of the volume. |
+| description | string | Yes | Volume description to set. |
+| callback | AsyncCallback<void> | Yes | Callback that returns no value.|
**Example**
```js
let uuid = "";
let description = "";
- volumemanager.setVolumeDescription(uuid, description, (error, bool) => {
+ volumemanager.setVolumeDescription(uuid, description, (error) => {
// Do something.
});
```
@@ -363,7 +369,7 @@ Asynchronously sets the volume description based on the UUID. This API uses a ca
format(volumeId: string, fsType: string): Promise<void>
-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
@@ -371,16 +377,16 @@ Asynchronously formats a volume. This API uses a promise to return the result.
**Parameters**
- | Name | Type | Mandatory| Description|
- | ----------- | ------ | ---- | ---- |
- | volumeId | string | Yes | Volume ID.|
- | fsType | string | Yes | File system type.|
+| Name | Type | Mandatory| Description|
+| ----------- | ------ | ---- | ---- |
+| volumeId | string | Yes | Volume ID.|
+| fsType | string | Yes | File system type, which can be VFAT or exFAT.|
**Return value**
- | Type | Description |
- | ---------------------- | ---------- |
- | Promise<void> | Promise used to return the result.|
+| Type | Description |
+| ---------------------- | ---------- |
+| Promise<void> | Promise that returns no value.|
**Example**
@@ -398,7 +404,7 @@ Asynchronously formats a volume. This API uses a promise to return the result.
format(volumeId: string, fsType: string, callback: AsyncCallback<void>): 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
@@ -406,18 +412,18 @@ Asynchronously formats a volume. This API uses a callback to return the result.
**Parameters**
- | Name | Type | Mandatory| Description |
- | -------- | ------------------------- | ---- | ----------------------------- |
- | volumeId | string | Yes | Volume ID. |
- | fsType | string | Yes | File system type.|
- | callback | AsyncCallback<void> | Yes | Called after the volume is formatted. |
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | ----------------------------- |
+| volumeId | string | Yes | Volume ID. |
+| fsType | string | Yes | File system type, which can be VFAT or exFAT.|
+| callback | AsyncCallback<void> | Yes | Callback that returns no value. |
**Example**
```js
let volumeId = "";
let fsType = "";
- volumemanager.format(volumeId, fsType, (error, bool) => {
+ volumemanager.format(volumeId, fsType, (error) => {
// Do something.
});
```
@@ -426,7 +432,7 @@ Asynchronously formats a volume. This API uses a callback to return the result.
partition(diskId: string, type: number): Promise<void>
-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
@@ -434,16 +440,16 @@ Asynchronously partitions a disk. This API uses a promise to return the result.
**Parameters**
- | Name | Type | Mandatory| Description|
- | ----------- | ------ | ---- | ---- |
- | diskId | string | Yes | ID of the disk to which the volume belongs.|
- | type | number | Yes | Partition type. |
+| Name | Type | Mandatory| Description|
+| ----------- | ------ | ---- | ---- |
+| diskId | string | Yes | ID of the disk to partition.|
+| type | number | Yes | Partition type. |
**Return value**
- | Type | Description |
- | --------------------- | ----------------------- |
- | Promise<void> | Promise used to return the result. |
+| Type | Description |
+| --------------------- | ----------------------- |
+| Promise<void> | Promise used to return the result. |
**Example**
@@ -461,7 +467,7 @@ Asynchronously partitions a disk. This API uses a promise to return the result.
partition(diskId: string, type: number, callback: AsyncCallback<void>): 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
@@ -469,18 +475,18 @@ Asynchronously partitions a disk. This API uses a callback to return the result.
**Parameters**
- | Name | Type | Mandatory| Description |
- | -------- | --------------------------------------- | ---- | ---------------- |
- | diskId | string | Yes | ID of the disk to which the volume belongs. |
- | type | number | Yes | Partition type. |
- | callback | AsyncCallback<void> | Yes | Callback invoked to return the result. |
+| Name | Type | Mandatory| Description |
+| -------- | --------------------------------------- | ---- | ---------------- |
+| diskId | string | Yes | ID of the disk to partition. |
+| type | number | Yes | Partition type. |
+| callback | AsyncCallback<void> | Yes | Callback that returns no value. |
**Example**
```js
let diskId = "";
let type = 0;
- volumemanager.partition(diskId, type, (error, bool) => {
+ volumemanager.partition(diskId, type, (error) => {
// Do something.
});
```
@@ -493,10 +499,10 @@ Asynchronously partitions a disk. This API uses a callback to return the result.
| Name | Type | Readable | Writable | Description |
| ----------- | ------- | ------- | ----- | -------------------- |
-| id | string | Yes| No| Volume ID. |
-| uuid | string | Yes| No| UUID of the volume. |
-| diskId | string | Yes| No| ID of the disk to which the volume belongs. |
+| 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| 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. 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. |
-| removable | boolean | Yes| No| Whether the volume is a removable storage device.|
-| state | number | Yes| No| Volume state. |
-| path | string | Yes| No| Mount address of the volume. |
+| removable | boolean | Yes| No| Whether the volume can be removed. Currently, only removable storage devices are supported.|
+| state | number | Yes| No| Volume status.
**0**: The volume is unmounted.
**1**: The volume is being checked.
**2**: The volume is mounted.
**3**: The volume is being ejected. |
+| path | string | Yes| No| Path of the volume mounted. Generally, the path is **/mnt/external/{uuid}**. |
diff --git a/en/application-dev/reference/apis/js-apis-huks.md b/en/application-dev/reference/apis/js-apis-huks.md
index 0dfcc793a2d005d34501735f320e78ab421b1a08..f297c8c29bbcd4822d2f34030b1c6e9bec2b124d 100644
--- a/en/application-dev/reference/apis/js-apis-huks.md
+++ b/en/application-dev/reference/apis/js-apis-huks.md
@@ -75,7 +75,7 @@ Generates a key. This API uses an asynchronous callback to return the result.
| -------- | --------------------------- | ---- | --------------------------------------------- |
| 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.|
-| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation fails, **err** is returned.|
+| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned.|
**Example**
@@ -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. |
| options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). |
-| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation fails, **err** is returned.|
+| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned.|
**Example**
@@ -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. |
| options | [HuksOptions](#huksoptions) | Yes | Tags required for the import and key to import. The algorithm, key purpose, and key length are mandatory.|
-| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation fails, **err** is returned.|
+| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned.|
**Example**
@@ -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. |
| 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**
@@ -553,7 +553,7 @@ Obtains the certificate used to verify a key. This API uses a promise to return
| 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**
@@ -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. |
| 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.|
-| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation fails, **err** is returned.|
+| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned.|
**Example**
@@ -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. |
| 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**
@@ -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. |
| 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**
@@ -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. |
| options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). |
-| callback | AsyncCallback\ | Yes | Callback invoked to return the result. **TRUE** means that the key exists; **FALSE** means the opposite.|
+| callback | AsyncCallback\ | Yes | Callback invoked to return the result. The value **TRUE** means that the key exists; **FALSE** means the opposite.|
**Example**
@@ -1161,9 +1161,9 @@ Initializes the data for a key operation. This API uses an asynchronous callback
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------- | ---- | ---------------------------------------------------- |
-| keyAlias | string | Yes | Alias of the target key. |
-| options | [HuksOptions](#huksoptions) | Yes | Parameters used for initialization. |
-| callback | AsyncCallback\<[HuksSessionHandle](#hukssessionhandle9)> | Yes | Callback invoked to return the handle obtained through the initialization operation.|
+| keyAlias | string | Yes | Alias of the key involved in the **initSession** operation. |
+| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **initSession** operation. |
+| callback | AsyncCallback\<[HuksSessionHandle](#hukssessionhandle9)> | Yes | Callback invoked to return a session handle for subsequent operations.|
## huks.initSession9+
@@ -1177,14 +1177,14 @@ Initializes the data for a key operation. This API uses a promise to return the
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------- | ---- | ------------------------------------------------ |
-| keyAlias | string | Yes | Alias of the target key. |
-| options | [HuksOptions](#huksoptions) | Yes | Parameters used for initialization. |
+| keyAlias | string | Yes | Alias of the key involved in the **initSession** operation. |
+| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **initSession** operation. |
**Return value**
| 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.updateSession9+
@@ -1198,9 +1198,9 @@ Updates the key operation by segment. This API uses an asynchronous callback to
| Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------------- | ---- | -------------------------------------------- |
-| handle | number | Yes | Handle of the **Update** operation. |
-| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Update** operation. |
-| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result.|
+| handle | number | Yes | Handle for the **updateSession** operation. |
+| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **updateSession** operation. |
+| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the **updateSession** operation result.|
## huks.updateSession9+
@@ -1215,16 +1215,16 @@ Updates the key operation by segment. This API uses an asynchronous callback to
| Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------------- | ---- | -------------------------------------------- |
-| handle | number | Yes | Handle of the **Update** operation. |
-| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Update** operation. |
-| token | Uint8Array | Yes | Token of the **Update** operation. |
-| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result.|
+| handle | number | Yes | Handle for the **updateSession** operation. |
+| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **updateSession** operation. |
+| token | Uint8Array | Yes | Token of the **updateSession** operation. |
+| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the **updateSession** operation result.|
## huks.updateSession9+
updateSession(handle: number, options: HuksOptions, token?: Uint8Array) : Promise\
-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
@@ -1232,15 +1232,15 @@ Updates the key operation data by segment. This API uses a promise to return the
| Name | Type | Mandatory| Description |
| ------- | ---------------------------------------------- | ---- | -------------------------------------------- |
-| handle | number | Yes | Handle of the **Update** operation. |
-| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Update** operation. |
-| token | Uint8Array | No | Token of the **Update** operation. |
+| handle | number | Yes | Handle for the **updateSession** operation. |
+| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **updateSession** operation. |
+| token | Uint8Array | No | Token of the **updateSession** operation. |
**Return value**
| Type | Description |
| ----------------------------------- | -------------------------------------------------- |
-| Promise<[HuksReturnResult](#huksreturnresult9)> | Promise used to return the result.|
+| Promise<[HuksReturnResult](#huksreturnresult9)> | Promise used to return the **updateSession** operation result.|
## huks.finishSession9+
@@ -1254,10 +1254,10 @@ Completes the key operation and releases resources. This API uses an asynchronou
| Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------------- | ---- | -------------------------------------------- |
-| handle | number | Yes | Handle of the **Finish** operation. |
-| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Finish** operation. |
-| token | Uint8Array | Yes | Token for the **Finish** operation. |
-| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result.|
+| handle | number | Yes | Handle for the **finishSession** operation. |
+| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **finishSession** operation. |
+| token | Uint8Array | Yes | Token of the **finishSession** operation. |
+| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the **finishSession** operation result. |
## huks.finishSession9+
@@ -1271,10 +1271,10 @@ Completes the key operation and releases resources. This API uses an asynchronou
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------- | ---- | -------------------------------------------- |
-| handle | number | Yes | Handle of the **Finish** operation. |
-| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Finish** operation. |
-| token | Uint8Array | Yes | Token for the **Finish** operation. |
-| callback | AsyncCallback\<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result.|
+| handle | number | Yes | Handle for the **finishSession** operation. |
+| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **finishSession** operation. |
+| token | Uint8Array | Yes | Token of the **finishSession** operation. |
+| callback | AsyncCallback\<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the **finishSession** operation result. |
## huks.finishSession9+
@@ -1288,9 +1288,9 @@ Completes the key operation and releases resources. This API uses a promise to r
| Name | Type | Mandatory| Description |
| ------- | ----------------------------------------------- | ---- | ----------------------------------- |
-| handle | number | Yes | Handle of the **Finish** operation. |
-| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Finish** operation. |
-| token | Uint8Array | No | Token for the **Finish** operation. |
+| handle | number | Yes | Handle for the **finishSession** operation. |
+| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **finishSession** operation. |
+| token | Uint8Array | No | Token of the **finishSession** operation. |
**Return value**
@@ -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
-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
@@ -1310,16 +1310,16 @@ Aborts the use of the key. This API uses an asynchronous callback to return the
| Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | ------------------------------------------- |
-| handle | number | Yes | Handle of the **Abort** operation. |
-| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Abort** operation. |
-| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation fails, **err** is returned.|
+| handle | number | Yes | Handle for the **abortSession** operation. |
+| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **abortSession** operation. |
+| callback | AsyncCallback\ | Yes | Callback that returns no value. |
**Example**
```js
/* huks.initSession, huks.updateSession, and huks.finishSession must be used together.
* 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.
*
* The following uses the callback of an RSA1024 key as an example.
@@ -1447,7 +1447,7 @@ async function huksAbort() {
abortSession(handle: number, options: HuksOptions) : Promise\;
-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
@@ -1455,21 +1455,21 @@ Aborts the use of the key. This API uses a promise to return the result.
| Name | Type | Mandatory| Description |
| ------- | --------------------------- | ---- | ------------------------------------------- |
-| handle | number | Yes | Handle of the **Abort** operation. |
-| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Abort** operation. |
+| handle | number | Yes | Handle for the **abortSession** operation. |
+| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **abortSession** operation. |
**Return value**
| Type | Description |
| ----------------------------------- | -------------------------------------------------- |
-| Promise\ | Promise that returns no value.|
+| Promise\ | Promise used to return the **abortSession** operation result.|
**Example**
```js
/* huks.initSession, huks.updateSession, and huks.finishSession must be used together.
* 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.
*
* The following uses the callback of an RSA1024 key as an example.
@@ -1889,90 +1889,90 @@ Enumerates the tags used to invoke parameters.
**System capability**: SystemCapability.Security.Huks
-| Name | Value | Description |
-| -------------------------------------------- | ---------------------------------------- | -------------------------------------- |
-| HUKS_TAG_INVALID | HuksTagType.HUKS_TAG_TYPE_INVALID \| 0 | Invalid tag. |
-| 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_KEY_SIZE | HuksTagType.HUKS_TAG_TYPE_UINT \| 3 | Key size. |
-| HUKS_TAG_DIGEST | HuksTagType.HUKS_TAG_TYPE_UINT \| 4 | Digest algorithm. |
-| HUKS_TAG_PADDING | HuksTagType.HUKS_TAG_TYPE_UINT \| 5 | Padding algorithm. |
-| HUKS_TAG_BLOCK_MODE | HuksTagType.HUKS_TAG_TYPE_UINT \| 6 | Cipher mode. |
-| HUKS_TAG_KEY_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 7 | Key type. |
-| HUKS_TAG_ASSOCIATED_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 8 | Associated authentication data. |
-| HUKS_TAG_NONCE | HuksTagType.HUKS_TAG_TYPE_BYTES \| 9 | Field for key encryption and decryption. |
-| HUKS_TAG_IV | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10 | IV. |
-| HUKS_TAG_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 11 | Information generated during key derivation. |
-| HUKS_TAG_SALT | HuksTagType.HUKS_TAG_TYPE_BYTES \| 12 | Salt value used for key derivation. |
-| HUKS_TAG_PWD | HuksTagType.HUKS_TAG_TYPE_BYTES \| 13 | Password used for key derivation. |
-| HUKS_TAG_ITERATION | HuksTagType.HUKS_TAG_TYPE_UINT \| 14 | Number of iterations for key derivation. |
-| HUKS_TAG_KEY_GENERATE_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 15 | Key generation type. |
-| HUKS_TAG_DERIVE_MAIN_KEY | HuksTagType.HUKS_TAG_TYPE_BYTES \| 16 | Main key for key derivation. |
-| HUKS_TAG_DERIVE_FACTOR | HuksTagType.HUKS_TAG_TYPE_BYTES \| 17 | Factor for key derivation. |
-| HUKS_TAG_DERIVE_ALG | HuksTagType.HUKS_TAG_TYPE_UINT \| 18 | Type of the algorithm used for key derivation. |
-| HUKS_TAG_AGREE_ALG | HuksTagType.HUKS_TAG_TYPE_UINT \| 19 | Type of the algorithm used for key agreement. |
-| HUKS_TAG_AGREE_PUBLIC_KEY_IS_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 20 | Public key alias used in key agreement. |
-| HUKS_TAG_AGREE_PRIVATE_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BYTES \| 21 | Private key alias used in key agreement. |
-| HUKS_TAG_AGREE_PUBLIC_KEY | HuksTagType.HUKS_TAG_TYPE_BYTES \| 22 | Public key used in key agreement. |
-| HUKS_TAG_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BYTES \| 23 | Key alias. |
-| HUKS_TAG_DERIVE_KEY_SIZE | HuksTagType.HUKS_TAG_TYPE_UINT \| 24 | Size of the derived key. |
-| HUKS_TAG_IMPORT_KEY_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 25 | Type of the imported key. |
-| HUKS_TAG_UNWRAP_ALGORITHM_SUITE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 26 | Algorithm suite required for encrypted imports. |
-| HUKS_TAG_ACTIVE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 201 | Reserved. |
-| HUKS_TAG_ORIGINATION_EXPIRE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 202 | Reserved. |
-| HUKS_TAG_USAGE_EXPIRE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 203 | Reserved. |
-| HUKS_TAG_CREATION_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 204 | 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_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_AUTH_TIMEOUT | HuksTagType.HUKS_TAG_TYPE_UINT \| 305 | Reserved. |
-| HUKS_TAG_AUTH_TOKEN | HuksTagType.HUKS_TAG_TYPE_BYTES \| 306 | Reserved. |
-| HUKS_TAG_KEY_AUTH_ACCESS_TYPE9+ | 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_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 308 | Signature type of the key generated or imported.|
-| HUKS_TAG_CHALLENGE_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 309 | Type of the challenge generated for a key. For details, see [HuksChallengeType](#hukschallengetype9).|
-| HUKS_TAG_CHALLENGE_POS9+ | 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_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_DEVICE | HuksTagType.HUKS_TAG_TYPE_BYTES \| 504 | ID of the device. |
-| HUKS_TAG_ATTESTATION_ID_PRODUCT | HuksTagType.HUKS_TAG_TYPE_BYTES \| 505 | Product name of the device. |
-| HUKS_TAG_ATTESTATION_ID_SERIAL | HuksTagType.HUKS_TAG_TYPE_BYTES \| 506 | SN of the device. |
-| HUKS_TAG_ATTESTATION_ID_IMEI | HuksTagType.HUKS_TAG_TYPE_BYTES \| 507 | International mobile equipment identity (IMEI) of the device. |
-| HUKS_TAG_ATTESTATION_ID_MEID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 508 | Mobile equipment identity (MEID) of the device. |
-| HUKS_TAG_ATTESTATION_ID_MANUFACTURER | HuksTagType.HUKS_TAG_TYPE_BYTES \| 509 | Manufacturer of the device. |
-| HUKS_TAG_ATTESTATION_ID_MODEL | HuksTagType.HUKS_TAG_TYPE_BYTES \| 510 | Device model. |
-| HUKS_TAG_ATTESTATION_ID_ALIAS | HuksTagType.HUKS_TAG_TYPE_BYTES \| 511 | Key alias used in the attestation. |
-| HUKS_TAG_ATTESTATION_ID_SOCID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 512 | System-on-a-chip (SoCID) 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_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_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_KEY_WRAP_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 1004 | Reserved. |
-| HUKS_TAG_KEY_AUTH_ID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 1005 | Reserved. |
-| HUKS_TAG_KEY_ROLE | HuksTagType.HUKS_TAG_TYPE_UINT \| 1006 | Reserved. |
-| HUKS_TAG_KEY_FLAG | HuksTagType.HUKS_TAG_TYPE_UINT \| 1007 | Flag of the key. |
-| HUKS_TAG_IS_ASYNCHRONIZED | HuksTagType.HUKS_TAG_TYPE_UINT \| 1008 | Reserved. |
-| HUKS_TAG_SECURE_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1009 | Reserved. |
-| HUKS_TAG_SECURE_KEY_UUID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 1010 | Reserved. |
-| HUKS_TAG_KEY_DOMAIN | HuksTagType.HUKS_TAG_TYPE_UINT \| 1011 | Reserved. |
-| HUKS_TAG_PROCESS_NAME | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10001 | Process name. |
-| HUKS_TAG_PACKAGE_NAME | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10002 | Reserved. |
-| HUKS_TAG_ACCESS_TIME | HuksTagType.HUKS_TAG_TYPE_UINT \| 10003 | Reserved. |
-| HUKS_TAG_USES_TIME | HuksTagType.HUKS_TAG_TYPE_UINT \| 10004 | Reserved. |
-| HUKS_TAG_CRYPTO_CTX | HuksTagType.HUKS_TAG_TYPE_ULONG \| 10005 | Reserved. |
-| HUKS_TAG_KEY | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10006 | Reserved. |
-| HUKS_TAG_KEY_VERSION | HuksTagType.HUKS_TAG_TYPE_UINT \| 10007 | Key version. |
-| HUKS_TAG_PAYLOAD_LEN | HuksTagType.HUKS_TAG_TYPE_UINT \| 10008 | Reserved. |
-| HUKS_TAG_AE_TAG | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10009 | Reserved. |
-| HUKS_TAG_IS_KEY_HANDLE | HuksTagType.HUKS_TAG_TYPE_ULONG \| 10010 | Reserved. |
-| HUKS_TAG_OS_VERSION | HuksTagType.HUKS_TAG_TYPE_UINT \| 10101 | OS version. |
-| HUKS_TAG_OS_PATCHLEVEL | HuksTagType.HUKS_TAG_TYPE_UINT \| 10102 | OS patch level. |
-| HUKS_TAG_SYMMETRIC_KEY_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 20001 | Reserved. |
-| HUKS_TAG_ASYMMETRIC_PUBLIC_KEY_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 20002 | Reserved. |
-| HUKS_TAG_ASYMMETRIC_PRIVATE_KEY_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 20003 | Reserved. |
+| Name | Value | Description |
+| -------------------------------------------- | ---------------------------------------- | ------------------------------------------------------------ |
+| HUKS_TAG_INVALID | HuksTagType.HUKS_TAG_TYPE_INVALID \| 0 | Invalid tag. |
+| 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_KEY_SIZE | HuksTagType.HUKS_TAG_TYPE_UINT \| 3 | Key size. |
+| HUKS_TAG_DIGEST | HuksTagType.HUKS_TAG_TYPE_UINT \| 4 | Digest algorithm. |
+| HUKS_TAG_PADDING | HuksTagType.HUKS_TAG_TYPE_UINT \| 5 | Padding algorithm. |
+| HUKS_TAG_BLOCK_MODE | HuksTagType.HUKS_TAG_TYPE_UINT \| 6 | Cipher mode. |
+| HUKS_TAG_KEY_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 7 | Key type. |
+| HUKS_TAG_ASSOCIATED_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 8 | Associated authentication data. |
+| HUKS_TAG_NONCE | HuksTagType.HUKS_TAG_TYPE_BYTES \| 9 | Field for key encryption and decryption. |
+| HUKS_TAG_IV | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10 | IV. |
+| HUKS_TAG_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 11 | Information generated during key derivation. |
+| HUKS_TAG_SALT | HuksTagType.HUKS_TAG_TYPE_BYTES \| 12 | Salt value used for key derivation. |
+| HUKS_TAG_PWD | HuksTagType.HUKS_TAG_TYPE_BYTES \| 13 | Password used for key derivation. |
+| HUKS_TAG_ITERATION | HuksTagType.HUKS_TAG_TYPE_UINT \| 14 | Number of iterations for key derivation. |
+| HUKS_TAG_KEY_GENERATE_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 15 | Key generation type. |
+| HUKS_TAG_DERIVE_MAIN_KEY | HuksTagType.HUKS_TAG_TYPE_BYTES \| 16 | Main key for key derivation. |
+| HUKS_TAG_DERIVE_FACTOR | HuksTagType.HUKS_TAG_TYPE_BYTES \| 17 | Factor for key derivation. |
+| HUKS_TAG_DERIVE_ALG | HuksTagType.HUKS_TAG_TYPE_UINT \| 18 | Type of the algorithm used for key derivation. |
+| HUKS_TAG_AGREE_ALG | HuksTagType.HUKS_TAG_TYPE_UINT \| 19 | Type of the algorithm used for key agreement. |
+| HUKS_TAG_AGREE_PUBLIC_KEY_IS_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 20 | Public key alias used in key agreement. |
+| HUKS_TAG_AGREE_PRIVATE_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BYTES \| 21 | Private key alias used in key agreement. |
+| HUKS_TAG_AGREE_PUBLIC_KEY | HuksTagType.HUKS_TAG_TYPE_BYTES \| 22 | Public key used in key agreement. |
+| HUKS_TAG_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BYTES \| 23 | Key alias. |
+| HUKS_TAG_DERIVE_KEY_SIZE | HuksTagType.HUKS_TAG_TYPE_UINT \| 24 | Size of the derived key. |
+| HUKS_TAG_IMPORT_KEY_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 25 | Type of the imported key. |
+| HUKS_TAG_UNWRAP_ALGORITHM_SUITE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 26 | Algorithm suite required for encrypted imports. |
+| HUKS_TAG_ACTIVE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 201 | Reserved. |
+| HUKS_TAG_ORIGINATION_EXPIRE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 202 | Reserved. |
+| HUKS_TAG_USAGE_EXPIRE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 203 | Reserved. |
+| HUKS_TAG_CREATION_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 204 | 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_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**. |
+| HUKS_TAG_AUTH_TIMEOUT | HuksTagType.HUKS_TAG_TYPE_UINT \| 305 | Reserved. |
+| HUKS_TAG_AUTH_TOKEN | HuksTagType.HUKS_TAG_TYPE_BYTES \| 306 | Reserved. |
+| HUKS_TAG_KEY_AUTH_ACCESS_TYPE9+ | 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_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 308 | Signature type of the key generated or imported. |
+| HUKS_TAG_CHALLENGE_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 309 | Type of the challenge generated for a key. For details, see [HuksChallengeType](#hukschallengetype9). |
+| HUKS_TAG_CHALLENGE_POS9+ | 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_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_DEVICE | HuksTagType.HUKS_TAG_TYPE_BYTES \| 504 | ID of the device. |
+| HUKS_TAG_ATTESTATION_ID_PRODUCT | HuksTagType.HUKS_TAG_TYPE_BYTES \| 505 | Product name of the device. |
+| HUKS_TAG_ATTESTATION_ID_SERIAL | HuksTagType.HUKS_TAG_TYPE_BYTES \| 506 | SN of the device. |
+| HUKS_TAG_ATTESTATION_ID_IMEI | HuksTagType.HUKS_TAG_TYPE_BYTES \| 507 | International mobile equipment identity (IMEI) of the device. |
+| HUKS_TAG_ATTESTATION_ID_MEID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 508 | Mobile equipment identity (MEID) of the device. |
+| HUKS_TAG_ATTESTATION_ID_MANUFACTURER | HuksTagType.HUKS_TAG_TYPE_BYTES \| 509 | Manufacturer of the device. |
+| HUKS_TAG_ATTESTATION_ID_MODEL | HuksTagType.HUKS_TAG_TYPE_BYTES \| 510 | Device model. |
+| HUKS_TAG_ATTESTATION_ID_ALIAS | HuksTagType.HUKS_TAG_TYPE_BYTES \| 511 | Key alias used in the attestation. |
+| HUKS_TAG_ATTESTATION_ID_SOCID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 512 | System-on-a-chip (SoCID) 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_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_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_KEY_WRAP_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 1004 | Reserved. |
+| HUKS_TAG_KEY_AUTH_ID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 1005 | Reserved. |
+| HUKS_TAG_KEY_ROLE | HuksTagType.HUKS_TAG_TYPE_UINT \| 1006 | Reserved. |
+| HUKS_TAG_KEY_FLAG | HuksTagType.HUKS_TAG_TYPE_UINT \| 1007 | Flag of the key. |
+| HUKS_TAG_IS_ASYNCHRONIZED | HuksTagType.HUKS_TAG_TYPE_UINT \| 1008 | Reserved. |
+| HUKS_TAG_SECURE_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1009 | Reserved. |
+| HUKS_TAG_SECURE_KEY_UUID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 1010 | Reserved. |
+| HUKS_TAG_KEY_DOMAIN | HuksTagType.HUKS_TAG_TYPE_UINT \| 1011 | Reserved. |
+| HUKS_TAG_PROCESS_NAME | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10001 | Process name. |
+| HUKS_TAG_PACKAGE_NAME | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10002 | Reserved. |
+| HUKS_TAG_ACCESS_TIME | HuksTagType.HUKS_TAG_TYPE_UINT \| 10003 | Reserved. |
+| HUKS_TAG_USES_TIME | HuksTagType.HUKS_TAG_TYPE_UINT \| 10004 | Reserved. |
+| HUKS_TAG_CRYPTO_CTX | HuksTagType.HUKS_TAG_TYPE_ULONG \| 10005 | Reserved. |
+| HUKS_TAG_KEY | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10006 | Reserved. |
+| HUKS_TAG_KEY_VERSION | HuksTagType.HUKS_TAG_TYPE_UINT \| 10007 | Key version. |
+| HUKS_TAG_PAYLOAD_LEN | HuksTagType.HUKS_TAG_TYPE_UINT \| 10008 | Reserved. |
+| HUKS_TAG_AE_TAG | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10009 | Reserved. |
+| HUKS_TAG_IS_KEY_HANDLE | HuksTagType.HUKS_TAG_TYPE_ULONG \| 10010 | Reserved. |
+| HUKS_TAG_OS_VERSION | HuksTagType.HUKS_TAG_TYPE_UINT \| 10101 | OS version. |
+| HUKS_TAG_OS_PATCHLEVEL | HuksTagType.HUKS_TAG_TYPE_UINT \| 10102 | OS patch level. |
+| HUKS_TAG_SYMMETRIC_KEY_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 20001 | Reserved. |
+| HUKS_TAG_ASYMMETRIC_PUBLIC_KEY_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 20002 | Reserved. |
+| HUKS_TAG_ASYMMETRIC_PRIVATE_KEY_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 20003 | Reserved. |
## huks.generateKey(deprecated)
@@ -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. |
| 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**
@@ -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.|
| options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty).|
-| callback | AsyncCallback\ | Yes | Callback invoked to return the result. **TRUE** means that the key exists; **FALSE** means the opposite.|
+| callback | AsyncCallback\ | Yes | Callback invoked to return the result. The value **TRUE** means that the key exists; **FALSE** means the opposite.|
**Example**
@@ -2473,8 +2473,8 @@ Initializes the data for a key operation. This API uses an asynchronous callback
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------------------- |
| keyAlias | string | Yes | Alias of the target key.|
-| options | [HuksOptions](#huksoptions) | Yes | Parameters used for initialization.|
-| callback | AsyncCallback\<[HuksHandle](#hukshandledeprecated)> | Yes | Callback invoked to return the handle obtained through the initialization operation.|
+| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **init** operation.|
+| callback | AsyncCallback\<[HuksHandle](#hukshandledeprecated)> | Yes | Callback invoked to return a session handle for subsequent operations.|
## huks.init(deprecated)
@@ -2491,13 +2491,13 @@ Initializes the data for a key operation. This API uses a promise to return the
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------------------- |
| 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**
| 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(deprecated)
@@ -2513,10 +2513,10 @@ Updates the key operation by segment. This API uses an asynchronous callback to
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------- | ---- | -------------------------------------------- |
-| handle | number | Yes | Handle of the **Update** operation. |
-| token | Uint8Array | No | Token of the **Update** operation. |
-| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Update** operation. |
-| callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes | Callback invoked to return the result.|
+| handle | number | Yes | Handle for the **update** operation. |
+| token | Uint8Array | No | Token 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 **update** operation result. |
## huks.update(deprecated)
@@ -2532,15 +2532,15 @@ Updates the key operation by segment. This API uses a promise to return the resu
| Name | Type | Mandatory| Description |
| ------- | ----------------------------------- | ---- | -------------------------------------------- |
-| handle | number | Yes | Handle of the **Update** operation. |
-| token | Uint8Array | No | Token of the **Update** operation. |
-| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Update** operation. |
+| handle | number | Yes | Handle for the **update** operation. |
+| token | Uint8Array | No | Token of the **update** operation. |
+| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **update** operation. |
**Return value**
| Type | Description |
| ----------------------------------- | -------------------------------------------------- |
-| Promise\<[HuksResult](#huksresultdeprecated)> | Promise used to return the result.|
+| Promise\<[HuksResult](#huksresultdeprecated)> | Promise used to return the **update** operation result. |
## huks.finish(deprecated)
@@ -2556,9 +2556,9 @@ Completes the key operation and releases resources. This API uses an asynchronou
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------------------- |
-| handle | number | Yes | Handle of the **Finish** operation.|
-| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Finish** operation.|
-| callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes| Callback invoked to return the result.|
+| handle | number | Yes | Handle for the **finish** operation.|
+| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **finish** operation.|
+| callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes| Callback invoked to return the **finish** operation result.|
## huks.finish(deprecated)
@@ -2574,8 +2574,8 @@ Completes the key operation and releases resources. This API uses a promise to r
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------------------- |
-| handle | number | Yes | Handle of the **Finish** operation.|
-| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Finish** operation.|
+| handle | number | Yes | Handle for the **finish** operation.|
+| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **finish** operation.|
**Return value**
@@ -2597,9 +2597,9 @@ Aborts the use of the key. This API uses an asynchronous callback to return the
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------------------- |
-| handle | number | Yes | Handle of the **Abort** operation.|
-| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Abort** operation.|
-| callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes| Callback invoked to return the result.|
+| handle | number | Yes | Handle for the **abort** operation.|
+| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **abort** operation.|
+| callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes| Callback invoked to return the **abort** operation result. |
**Example**
@@ -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.
* 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 properties = new Array();
@@ -2708,14 +2708,14 @@ Aborts the use of the key. This API uses a promise to return the result.
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------------------- |
-| handle | number | Yes | Handle of the **Abort** operation.|
-| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Abort** operation.|
+| handle | number | Yes | Handle for the **abort** operation.|
+| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **abort** operation.|
**Return value**
| Type | Description |
| ----------------------------------- | -------------------------------------------------- |
-| Promise\<[HuksResult](#huksresultdeprecated)> | Promise used to return the result.|
+| Promise\<[HuksResult](#huksresultdeprecated)> | Promise used to return the **abort** operation result.|
**Example**
diff --git a/en/application-dev/reference/apis/js-apis-osAccount.md b/en/application-dev/reference/apis/js-apis-osAccount.md
index 692e834592970b9a7bdf92dc84a291c0fd2135a1..750977a24244be831048e8055b39fc1daf0219c7 100644
--- a/en/application-dev/reference/apis/js-apis-osAccount.md
+++ b/en/application-dev/reference/apis/js-apis-osAccount.md
@@ -326,9 +326,9 @@ Checks whether the specified constraint is enabled for an OS account. This API u
| ID| Error Message |
| -------- | ------------------- |
-| 12300001 | system service exception. |
-| 12300002 | invalid localId or constraint. |
-| 12300003 | the account indicated by localId dose not exist. |
+| 12300001 | System service exception. |
+| 12300002 | Invalid localId or constraint. |
+| 12300003 | Account not found. |
**Example**: Check whether OS account 100 is forbidden to use Wi-Fi.
@@ -376,9 +376,9 @@ Checks whether the specified constraint is enabled for an OS account. This API u
| ID| Error Message |
| -------- | ------------------- |
-| 12300001 | system service exception. |
-| 12300002 | invalid localId or constraint. |
-| 12300003 | the account indicated by localId dose not exist. |
+| 12300001 | System service exception. |
+| 12300002 | Invalid localId or constraint. |
+| 12300003 | Account not found. |
**Example**: Check whether OS account 100 is forbidden to use Wi-Fi.
@@ -487,7 +487,7 @@ Checks whether this OS account has been verified. This API uses an asynchronous
| ID| Error Message |
| -------- | ------------------- |
-| 12300001 | system service exception. |
+| 12300001 | System service exception. |
**Example**
@@ -527,9 +527,9 @@ Checks whether an OS account has been verified. This API uses an asynchronous ca
| ID| Error Message |
| -------- | ------------------- |
-| 12300001 | system service exception. |
-| 12300002 | invalid localId. |
-| 12300003 | the account indicated by localId dose not exist. |
+| 12300001 | System service exception. |
+| 12300002 | Invalid localId. |
+| 12300003 | Account not found. |
**Example**
@@ -575,9 +575,9 @@ Checks whether an OS account has been verified. This API uses a promise to retur
| ID| Error Message |
| -------- | ------------------- |
-| 12300001 | system service exception. |
-| 12300002 | invalid localId. |
-| 12300003 | the account indicated by localId dose not exist. |
+| 12300001 | System service exception. |
+| 12300002 | Invalid localId. |
+| 12300003 | Account not found. |
**Example**
@@ -720,7 +720,7 @@ Sets or removes constraints for an OS account. This API uses an asynchronous cal
| ID| Error Message |
| -------- | ------------------- |
| 12300001 | System service exception. |
-| 12300002 | Invalid localId. |
+| 12300002 | Invalid localId or constraints. |
| 12300003 | Account not found. |
| 12300008 | Restricted Account. |
@@ -774,7 +774,7 @@ Sets or removes constraints for an OS account. This API uses a promise to return
| ID| Error Message |
| -------- | ------------------- |
| 12300001 | System service exception. |
-| 12300002 | Invalid localId. |
+| 12300002 | Invalid localId or constraints. |
| 12300003 | Account not found. |
| 12300008 | Restricted Account. |
@@ -987,7 +987,7 @@ Obtains the ID of the OS account to which the current process belongs. This API
| ID| Error Message |
| -------- | ------------------- |
-| 12300001 | system service exception. |
+| 12300001 | System service exception. |
**Example**
@@ -1024,7 +1024,7 @@ Obtains the ID of the OS account to which the current process belongs. This API
| ID| Error Message |
| -------- | ------------------- |
-| 12300001 | system service exception. |
+| 12300001 | System service exception. |
**Example**
@@ -1060,8 +1060,8 @@ Obtains the OS account ID based on the process UID. This API uses an asynchronou
| ID| Error Message |
| -------- | --------------- |
-| 12300001 | system service exception. |
-| 12300002 | invalid uid. |
+| 12300001 | System service exception. |
+| 12300002 | Invalid uid. |
**Example**: Obtain the ID of the OS account whose process UID is **12345678**.
@@ -1104,8 +1104,8 @@ Obtains the OS account ID based on the process UID. This API uses a promise to r
| ID| Error Message |
| -------- | ------------- |
-| 12300001 | system service exception. |
-| 12300002 | invalid uid. |
+| 12300001 | System service exception. |
+| 12300002 | Invalid uid. |
**Example**: Obtain the ID of the OS account whose process UID is **12345678**.
@@ -1144,8 +1144,8 @@ Obtains the OS account ID based on the domain account information. This API uses
| ID| Error Message |
| -------- | ------------- |
-| 12300001 | system service exception. |
-| 12300002 | invalid domainInfo. |
+| 12300001 | System service exception. |
+| 12300002 | Invalid domainInfo. |
**Example**
@@ -1191,8 +1191,8 @@ Obtains the OS account ID based on the domain account information. This API uses
| ID| Error Message |
| -------- | ------------- |
-| 12300001 | system service exception. |
-| 12300002 | invalid domainInfo. |
+| 12300001 | System service exception. |
+| 12300002 | Invalid domainInfo. |
**Example**
@@ -1470,7 +1470,7 @@ Obtains information about all activated OS accounts. This API uses an asynchrono
| ID| Error Message |
| -------- | ------------- |
-| 12300001 | system service exception. |
+| 12300001 | System service exception. |
**Example**
@@ -1507,7 +1507,7 @@ Obtains information about all activated OS accounts. This API uses a promise to
| ID| Error Message |
| -------- | ------------- |
-| 12300001 | system service exception. |
+| 12300001 | System service exception. |
**Example**
@@ -1858,7 +1858,7 @@ Obtains information about the OS account of the given ID. This API uses a promis
| ID| Error Message |
| -------- | ------------------- |
| 12300001 | System service exception. |
-| 12300002 | Invalid localId. |
+| 12300002 | Invalid localId. |
| 12300003 | Account not found. |
**Example**: Query information about OS account 100.
@@ -2229,9 +2229,9 @@ Obtains the OS account ID based on the serial number (SN). This API uses an asyn
| ID| Error Message |
| -------- | ------------------- |
-| 12300001 | system service exception. |
-| 12300002 | invalid serialNumber. |
-| 12300003 | the account indicated by serialNumber dose not exist. |
+| 12300001 | System service exception. |
+| 12300002 | Invalid serialNumber. |
+| 12300003 | The account indicated by serialNumber dose not exist. |
**Example**: Obtain the ID of the OS account whose SN is 12345.
@@ -2272,9 +2272,9 @@ Obtains the OS account ID based on the SN. This API uses a promise to return the
| ID| Error Message |
| -------- | ------------------- |
-| 12300001 | system service exception. |
-| 12300002 | invalid serialNumber. |
-| 12300003 | the account indicated by serialNumber dose not exist. |
+| 12300001 | System service exception. |
+| 12300002 | Invalid serialNumber. |
+| 12300003 | The account indicated by serialNumber dose not exist. |
**Example**: Obtain the ID of the OS account whose SN is 12345.
@@ -2311,9 +2311,9 @@ Obtains the SN of an OS account based on the account ID. This API uses an asynch
| ID| Error Message |
| -------- | ------------------- |
-| 12300001 | system service exception. |
-| 12300002 | invalid localId. |
-| 12300003 | the account indicated by localId dose not exist. |
+| 12300001 | System service exception. |
+| 12300002 | Invalid localId. |
+| 12300003 | Account not found. |
**Example**: Obtain the SN of the OS account 100.
@@ -2354,9 +2354,9 @@ Obtains the SN of an OS account based on the account ID. This API uses a promise
| ID| Error Message |
| -------- | ------------------- |
-| 12300001 | system service exception. |
-| 12300002 | invalid localId. |
-| 12300003 | the account indicated by localId dose not exist. |
+| 12300001 | System service exception. |
+| 12300002 | Invalid localId. |
+| 12300003 | Account not found. |
**Example**: Obtain the SN of the OS account 100.
@@ -2400,7 +2400,6 @@ Subscribes to the OS account activation states, including the states of the acco
| -------- | ------------- |
| 12300001 | System service exception. |
| 12300002 | Invalid type or name. |
-| 12300011 | Callback has been registered. |
**Example**
@@ -2442,7 +2441,6 @@ Unsubscribes from the OS account activation states, including the states of the
| -------- | ------------- |
| 12300001 | System service exception. |
| 12300002 | Invalid type or name. |
-| 12300012 | Callback has not been registered. |
**Example**
@@ -2479,8 +2477,8 @@ Obtains the bundle ID based on the UID. This API uses an asynchronous callback t
| ID| Error Message |
| -------- | ------------- |
-| 12300001 | system service exception. |
-| 12300002 | invalid uid. |
+| 12300001 | System service exception. |
+| 12300002 | Invalid uid. |
**Example**
@@ -2522,8 +2520,8 @@ Obtains the bundle ID based on the UID. This API uses a promise to return the re
| ID| Error Message |
| -------- | ------------- |
-| 12300001 | system service exception. |
-| 12300002 | invalid uid. |
+| 12300001 | System service exception. |
+| 12300002 | Invalid uid. |
**Example**
@@ -2640,9 +2638,9 @@ Obtains the constraint source information of an OS account. This API uses an asy
| ID| Error Message |
| -------- | ------------- |
-| 12300001 | system service exception. |
-| 12300002 | invalid name or constraint. |
-| 12300003 | the account indicated by localId dose not exist. |
+| 12300001 | System service exception. |
+| 12300002 | Invalid name or constraint. |
+| 12300003 | Account not found. |
**Example**
@@ -2687,9 +2685,9 @@ Obtains the constraint source information of an OS account. This API uses a prom
| ID| Error Message |
| -------- | ------------- |
-| 12300001 | system service exception. |
-| 12300002 | invalid name or constraint. |
-| 12300003 | the account indicated by localId dose not exist. |
+| 12300001 | System service exception. |
+| 12300002 | Invalid name or constraint. |
+| 12300003 | Account not found. |
**Example**
@@ -4113,9 +4111,9 @@ Performs authentication of the current user. This API uses an asynchronous callb
| 12300101 | Credential is incorrect. |
| 12300105 | Unsupported authTrustLevel. |
| 12300106 | Unsupported authType. |
-| 12300110 | Authentication locked. |
+| 12300110 | Authentication is locked. |
| 12300111 | Authentication timeout. |
-| 12300112 | Authentication service busy. |
+| 12300112 | Authentication service is busy. |
**Example**
```js
@@ -4172,9 +4170,9 @@ Performs authentication of the specified user. This API uses an asynchronous cal
| 12300101 | Credential is incorrect. |
| 12300105 | Unsupported authTrustLevel. |
| 12300106 | Unsupported authType. |
-| 12300110 | Authentication locked. |
+| 12300110 | Authentication is locked. |
| 12300111 | Authentication timeout. |
-| 12300112 | Authentication service busy. |
+| 12300112 | Authentication service is busy. |
**Example**
```js
@@ -4282,7 +4280,7 @@ Register a PIN inputer.
| ID| Error Message |
| -------- | --------------------------- |
| 12300001 | System service exception. |
-| 12300102 | Invalid inputer. |
+| 12300002 | Invalid inputer. |
| 12300103 | Inputer already registered. |
**Example**
@@ -4347,7 +4345,7 @@ Register a credential inputer.
| ID| Error Message |
| -------- | --------------------------- |
| 12300001 | System service exception. |
-| 12300102 | Invalid authType or inputer. |
+| 12300002 | Invalid authType or inputer. |
| 12300103 | The credential inputer has been registered. |
| 12300106 | Unsupported authType. |
@@ -4716,7 +4714,7 @@ Registers a domain plug-in.
| ID| Error Message |
| -------- | --------------------------- |
-| 12300201 | the domain plugin has been registered. |
+| 12300201 | The domain plugin has been registered. |
**Example**
```js
@@ -4783,17 +4781,17 @@ Authenticates a domain account.
| ID| Error Message |
| -------- | --------------------------- |
-| 12300001 | system service exception. |
-| 12300002 | invalid domainAccountInfo or credential. |
-| 12300003 | domain account does not exist. |
-| 12300013 | network exception. |
-| 12300101 | authentication failed. |
-| 12300109 | authentication is canceled. |
-| 12300110 | authentication is locked. |
-| 12300111 | authentication timeout. |
-| 12300112 | authentication service is busy. |
-| 12300113 | authentication service does not exist. |
-| 12300114 | authentication service exception. |
+| 12300001 | System service exception. |
+| 12300002 | Invalid domainAccountInfo or credential. |
+| 12300003 | Domain account does not exist. |
+| 12300013 | Network exception. |
+| 12300101 | Authentication failed. |
+| 12300109 | Authentication is canceled. |
+| 12300110 | Authentication is locked. |
+| 12300111 | Authentication timeout. |
+| 12300112 | Authentication service is busy. |
+| 12300113 | Authentication service does not exist. |
+| 12300114 | Authentication service exception. |
**Example**
```js
@@ -4836,16 +4834,16 @@ Authenticates this domain account in a pop-up window.
| ID| Error Message |
| -------- | --------------------------- |
-| 12300001 | system service exception. |
-| 12300003 | no domain account is bound. |
-| 12300013 | network exception. |
-| 12300101 | authentication failed. |
-| 12300109 | authentication is canceled. |
-| 12300110 | authentication is locked. |
-| 12300111 | authentication timeout. |
-| 12300112 | authentication service is busy. |
-| 12300113 | authentication service does not exist. |
-| 12300114 | authentication service exception. |
+| 12300001 | System service exception. |
+| 12300003 | No domain account is bound. |
+| 12300013 | Network exception. |
+| 12300101 | Authentication failed. |
+| 12300109 | Authentication is canceled. |
+| 12300110 | Authentication is locked. |
+| 12300111 | Authentication timeout. |
+| 12300112 | Authentication service is busy. |
+| 12300113 | Authentication service does not exist. |
+| 12300114 | Authentication service exception. |
**Example**
```js
@@ -4884,17 +4882,17 @@ Authenticates a domain account in a pop-up window.
| ID| Error Message |
| -------- | --------------------------- |
-| 12300001 | system service exception. |
-| 12300002 | invalid localId. |
-| 12300003 | no domain account is bound. |
-| 12300013 | network exception. |
-| 12300101 | authentication failed. |
-| 12300109 | authentication is canceled. |
-| 12300110 | authentication is locked. |
-| 12300111 | authentication timeout. |
-| 12300112 | authentication service is busy. |
-| 12300113 | authentication service does not exist. |
-| 12300114 | authentication service exception. |
+| 12300001 | System service exception. |
+| 12300002 | Invalid localId. |
+| 12300003 | No domain account is bound. |
+| 12300013 | Network exception. |
+| 12300101 | Authentication failed. |
+| 12300109 | Authentication is canceled. |
+| 12300110 | Authentication is locked. |
+| 12300111 | Authentication timeout. |
+| 12300112 | Authentication service is busy. |
+| 12300113 | Authentication service does not exist. |
+| 12300114 | Authentication service exception. |
**Example**
```js
@@ -4933,9 +4931,9 @@ Checks whether a domain account exists.
| ID| Error Message |
| -------- | --------------------------- |
-| 12300001 | system service exception. |
-| 12300002 | invalid domainAccountInfo. |
-| 12300013 | network exception. |
+| 12300001 | System service exception. |
+| 12300002 | Invalid domainAccountInfo. |
+| 12300013 | Network exception. |
**Example**
```js
@@ -4984,9 +4982,9 @@ Checks whether a domain account exists.
| ID| Error Message |
| -------- | --------------------------- |
-| 12300001 | system service exception. |
-| 12300002 | invalid domainAccountInfo. |
-| 12300013 | network exception. |
+| 12300001 | System service exception. |
+| 12300002 | Invalid domainAccountInfo. |
+| 12300013 | Network exception. |
**Example**
```js
@@ -5389,7 +5387,6 @@ Obtains authentication information. This API uses an asynchronous callback to re
| ID| Error Message |
| -------- | --------------------- |
| 12300001 | System service exception. |
-| 12300102 | Credential not found. |
**Example**
```js
@@ -5429,7 +5426,6 @@ Obtains authentication information of the specified type. This API uses an async
| -------- | ------------------- |
| 12300001 | System service exception. |
| 12300002 | Invalid authType. |
-| 12300102 | Credential not found. |
**Example**
```js
@@ -5474,7 +5470,6 @@ Obtains authentication information of the specified type. This API uses a promis
| -------- | ------------------- |
| 12300001 | System service exception. |
| 12300002 | Invalid authType. |
-| 12300102 | Credential not found. |
**Example**
```js
@@ -5513,6 +5508,12 @@ Called to set data in a PIN operation.
| authSubType | [AuthSubType](#authsubtype8) | Yes | Credential subtype. |
| data | Uint8Array | Yes | Data (credential) to set. The data is used for authentication and operations for adding and modifying credentials.|
+**Error codes**
+
+| ID| Error Message |
+| -------- | ------------------- |
+| 12300002 | Invalid pinSubType. |
+
**Example**
```js
let password = new Uint8Array([0, 0, 0, 0, 0, 0]);
@@ -5975,7 +5976,7 @@ Defines the domain account information.
| ----------- | ------ | ---- | ---------- |
| domain | string | Yes | Domain name. |
| accountName | string | Yes | Domain account name.|
-| accountId10+ | string | No | Domain account ID.|
+| accountId10+ | string | No | Domain account ID.
**System API**: This is a system API.|
## Constraints
diff --git a/en/application-dev/reference/apis/js-apis-privacyManager.md b/en/application-dev/reference/apis/js-apis-privacyManager.md
index 37728bb1823311492718e31b44cd3dd4b63fd4e3..403d9a6db944073b19a80d1b086e4adc98d8f4dd 100644
--- a/en/application-dev/reference/apis/js-apis-privacyManager.md
+++ b/en/application-dev/reference/apis/js-apis-privacyManager.md
@@ -47,8 +47,8 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256, or the count value is invalid. |
-| 12100002 | The specified tokenID does not exist or it does not refer to an application process. |
-| 12100003 | The specified permission does not exist or it is not an user_grant permission. |
+| 12100002 | The specified tokenID does not exist or refer to an application process. |
+| 12100003 | The specified permission does not exist or is not an user_grant permission. |
| 12100007 | Service is abnormal. |
| 12100008 | Out of memory. |
@@ -97,8 +97,8 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256, or the count value is invalid. |
-| 12100002 | The specified tokenID does not exist or it does not refer to an application process. |
-| 12100003 | The specified permission does not exist or it is not an user_grant permission. |
+| 12100002 | The specified tokenID does not exist or refer to an application process. |
+| 12100003 | The specified permission does not exist or is not an user_grant permission. |
| 12100007 | Service is abnormal. |
| 12100008 | Out of memory. |
@@ -150,8 +150,8 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. the value of flag in request is invalid. |
-| 12100002 | The specified tokenID does not exist or it does not refer to an application process. |
-| 12100003 | The specified permission does not exist or it is not an user_grant permission. |
+| 12100002 | The specified tokenID does not exist or refer to an application process. |
+| 12100003 | The specified permission does not exist or is not an user_grant permission. |
| 12100007 | Service is abnormal. |
| 12100008 | Out of memory. |
@@ -205,8 +205,8 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. the value of flag in request is invalid. |
-| 12100002 | The specified tokenID does not exist or it does not refer to an application process. |
-| 12100003 | The specified permission does not exist or it is not an user_grant permission. |
+| 12100002 | The specified tokenID does not exist or refer to an application process. |
+| 12100003 | The specified permission does not exist or is not an user_grant permission. |
| 12100007 | Service is abnormal. |
| 12100008 | Out of memory. |
@@ -268,8 +268,8 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. |
-| 12100002 | The specified tokenID does not exist or it does not refer to an application process. |
-| 12100003 | The specified permission does not exist or it is not an user_grant permission. |
+| 12100002 | The specified tokenID does not exist or refer to an application process. |
+| 12100003 | The specified permission does not exist or is not an user_grant permission. |
| 12100004 | The interface is called repeatedly with the same input. It means the application specified by the tokenID has been using the specified permission. |
| 12100007 | Service is abnormal. |
| 12100008 | Out of memory. |
@@ -316,8 +316,8 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. |
-| 12100002 | The specified tokenID does not exist or it does not refer to an application process. |
-| 12100003 | The specified permission does not exist or it is not an user_grant permission. |
+| 12100002 | The specified tokenID does not exist or refer to an application process. |
+| 12100003 | The specified permission does not exist or is not an user_grant permission. |
| 12100004 | The interface is called repeatedly with the same input. It means the application specified by the tokenID has been using the specified permission. |
| 12100007 | Service is abnormal. |
| 12100008 | Out of memory. |
@@ -371,8 +371,8 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. |
-| 12100002 | The specified tokenID does not exist or it does not refer to an application process. |
-| 12100003 | The specified permission does not exist or it is not an user_grant permission. |
+| 12100002 | The specified tokenID does not exist or refer to an application process. |
+| 12100003 | The specified permission does not exist or is not an user_grant permission. |
| 12100004 | The interface is not used with |
| 12100007 | Service is abnormal. |
| 12100008 | Out of memory. |
@@ -419,8 +419,8 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| ID| Error Message|
| -------- | -------- |
| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. |
-| 12100002 | The specified tokenID does not exist or it does not refer to an application process. |
-| 12100003 | The specified permission does not exist or it is not an user_grant permission. |
+| 12100002 | The specified tokenID does not exist or refer to an application process. |
+| 12100003 | The specified permission does not exist or is not an user_grant permission. |
| 12100004 | The interface is not used with |
| 12100007 | Service is abnormal. |
| 12100008 | Out of memory. |
@@ -513,8 +513,8 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
| ID| Error Message|
| -------- | -------- |
-| 12100001 | The parameter is invalid. The permissionName in list is all invalid or the list size is larger than 1024. |
-| 12100004 | The API is not used together with "on()". |
+| 12100001 | The permissionNames in the list are all invalid, or the list size exceeds 1024 bytes. |
+| 12100004 | The interface is not used together with "on()".|
| 12100007 | Service is abnormal. |
| 12100008 | Out of memory. |
diff --git a/en/application-dev/reference/apis/js-apis-useriam-userauth.md b/en/application-dev/reference/apis/js-apis-useriam-userauth.md
index ce3611111a266910c302c779ee5eadc0b1fdc06c..188eeedc48db29468c8abaadf088b9c991305bed 100644
--- a/en/application-dev/reference/apis/js-apis-useriam-userauth.md
+++ b/en/application-dev/reference/apis/js-apis-useriam-userauth.md
@@ -2,7 +2,8 @@
The **userIAM.userAuth** module provides user authentication capabilities in identity authentication scenarios, such as device unlocking, payment, and app login.
-> **NOTE**
+> **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.
@@ -399,44 +400,6 @@ try {
}
```
-## userIAM_userAuth.getVersion9+
-
-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.getAvailableStatus9+
getAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel): void
@@ -535,7 +498,7 @@ getVersion() : number
Obtains the version of this authenticator.
> **NOTE**
-> 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