diff --git a/en/application-dev/reference/apis/js-apis-appAccount.md b/en/application-dev/reference/apis/js-apis-appAccount.md index ddf515f985c2f34bad319ddceb564307f73f1b95..30fbc107e9a490bdb139da859a45cb343db63308 100644 --- a/en/application-dev/reference/apis/js-apis-appAccount.md +++ b/en/application-dev/reference/apis/js-apis-appAccount.md @@ -1470,7 +1470,7 @@ Obtains the authorization token of the specified authentication type for an app | ID| Error Message| | ------- | -------| | 12300001 | System service exception. | -| 12300002 | Invalid name, owner or authType. | +| 12300002 | Invalid name, owner, or authType. | | 12300003 | Account not found. | | 12300107 | AuthType not found. | @@ -1559,7 +1559,7 @@ Sets an authorization token of the specific authentication type for an app accou | 12300001 | System service exception. | | 12300002 | Invalid name, authType, or token. | | 12300003 | Account not found. | -| 12400004 | The number of token reaches the upper limit. | +| 12400004 | The number of tokens reaches the upper limit. | **Example** @@ -1606,7 +1606,7 @@ Sets an authorization token of the specific authentication type for an app accou | 12300001 | System service exception. | | 12300002 | Invalid name, authType, or token. | | 12300003 | Account not found. | -| 12400004 | The number of token reaches the upper limit. | +| 12400004 | The number of tokens reaches the upper limit. | **Example** @@ -1637,7 +1637,7 @@ Deletes the authorization token of the specified authentication type for an app | name | string | Yes | Name of the target app account. | | owner | string | Yes | Owner of the app account. The value is the bundle name of the app. | | authType | string | Yes | Authentication type. | -| token | string | Yes | Token to delete.| +| token | string | Yes | Authorization token to delete.| | callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. | **Error codes** @@ -4982,298 +4982,3 @@ Obtains the remote object of an authenticator. This API cannot be overloaded. } } ``` - -## AccountCapabilityType10+ - -Enumerates the account capability types. - -**System capability**: SystemCapability.Account.AppAccount - -| Name | Value | Description | -| ---------------- | ----- | ----------------------- | -| AUTHORIZATION | 1 | Authorization capability. | - -## AccountCapabilityProvider10+ - -Represents the **AccountCapabilityProvider** class. - -### Attributes - -**System capability**: SystemCapability.Account.AppAccount - -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| capabilityType | [AccountCapabilityType](#accountcapabilitytype10) | Yes| No| Capability type of the account.| - -### constructor10+ - -constructor(capabilityType: AccountCapabilityType) - -A constructor used to create an **AccountCapabilityProvider** instance. - -**System capability**: SystemCapability.Account.AppAccount - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------------------- | -| capabilityType | [AccountCapabilityType](#accountcapabilitytype10) | Yes | Capability type of the account. | - -**Example** - -```ts -class MyAuthorizationProvider extends account_appAccount.AccountCapabilityProvider { - constructor() { - super(account_appAccount.AccountCapabilityType.AUTHORIZATION); - } -} - -try { - let provider = new MyAuthorizationProvider(); - if (provider instanceof account_appAccount.AccountCapabilityProvider) { - console.log("the provider is an instance of AccountCapabilityProvider"); - } -} catch (err) { - console.error('catch error: ' + JSON.stringify(err)); -} -``` - -## AccountCapabilityRequest10+ - -Represents the **AccountCapabilityRequest** class. - -### constructor10+ - -constructor(provider: AccountCapabilityProvider) - -A constructor used to create an **AccountCapabilityRequest** instance. - -**System capability**: SystemCapability.Account.AppAccount - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------------------- | -| provider | [AccountCapabilityProvider](#accountcapabilityprovider10) | Yes | Provider of the account capability. | - -**Example** - -```ts -class MyAuthorizationProvider extends account_appAccount.AccountCapabilityProvider { - constructor() { - super(account_appAccount.AccountCapabilityType.AUTHORIZATION); - } -} - -class MyAuthorizationRequest extends account_appAccount.AccountCapabilityRequest { - constructor() { - let provider = new MyAuthorizationProvider(); - super(provider); - } -} - -try { - let request = new MyAuthorizationRequest(); - if (request instanceof account_appAccount.AccountCapabilityRequest) { - console.log("the request is an instance of AccountCapabilityRequest"); - } -} catch (err) { - console.error('catch error: ' + JSON.stringify(err)); -} -``` - -## AccountCapabilityResponse10+ - -Represents the **AccountCapabilityResponse** class. - -### Attributes - -**System capability**: SystemCapability.Account.AppAccount - -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| request | [AccountCapabilityRequest](#accountcapabilityrequest10) | Yes| No| Account capability request corresponding to the response.| - -### constructor10+ - -constructor(request: AccountCapabilityRequest) - -A constructor used to create an **AccountCapabilityResponse** instance. - -**System capability**: SystemCapability.Account.AppAccount - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------------------- | -| request | [AccountCapabilityRequest](#accountcapabilityrequest10) | Yes | Account capability request corresponding to the response.| - -**Example** - -```ts -class MyAuthorizationProvider extends account_appAccount.AccountCapabilityProvider { - constructor() { - super(account_appAccount.AccountCapabilityType.AUTHORIZATION); - } -} - -class MyAuthorizationRequest extends account_appAccount.AccountCapabilityRequest { - constructor() { - let provider = new MyAuthorizationProvider(); - super(provider); - } -} - -class MyAuthorizationResponse extends account_appAccount.AccountCapabilityResponse { - constructor(request) { - super(request) - } -} - -try { - let request = new MyAuthorizationRequest(); - let response = new MyAuthorizationResponse(request); - if (response instanceof account_appAccount.AccountCapabilityResponse) { - console.log("the response is an instance of AccountCapabilityResponse"); - } -} catch (err) { - console.error('catch error: ' + JSON.stringify(err)); -} -``` - -## AuthorizationProviderInfo10+ - -Defines information about the authorization provider. - -**System capability**: SystemCapability.Account.AppAccount - -| Name | Type | Readable| Writable| Description | -| ------- | ------ | ---- | --- | ---------- | -| bundleName | string | Yes| No| Bundle name of the authorization provider.| -| abilityName | string | Yes| No| Ability name of the authorization provider.| - -## AuthorizationProvider10+ - -Represents the **AuthorizationProvider** class. - -### constructor10+ - -constructor(info: AuthorizationProviderInfo) - -A constructor used to create an **AuthorizationProvider** instance. - -**System capability**: SystemCapability.Account.AppAccount - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------------------- | -| info | [AuthorizationProviderInfo](#authorizationproviderinfo10) | Yes | Information about the authorization provider.| - -**Example** - -```ts -class MyAuthorizationProvider extends account_appAccount.AuthorizationProvider { - constructor() { - super({bundleName: 'xxx', abilityName: 'xxx'}); - } -} - -try { - let provider = new MyAuthorizationProvider(); - if (provider instanceof account_appAccount.AuthorizationProvider) { - console.log("the provider is an instance of AuthorizationProvider"); - } -} catch (err) { - console.error("catch error: " + JSON.stringify(err)); -} -``` - -## AccountCapabilityScheduler10+ - -Represents the **AccountCapabilityScheduler** class. - -### executeRequest10+ - -executeRequest(request: AccountCapabilityRequest, callback: AsyncCallback<AccountCapabilityResponse, { [key: string]: object }>): void - -Executes an account capability request. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Account.AppAccount - -**Parameters** - -| Name | Type | Mandatory | Description | -| ---------- | ------------------------- | ---- | ------------------------- | -| request | [AccountCapabilityRequest](#accountcapabilityrequest10) | Yes | Account capability request to execute. | -| callback | AsyncCallback<[AccountCapabilityResponse](#accountcapabilityresponse10), { [key: string]: object }> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. | - -**Error codes** - -| ID| Error Message| -| ------- | ------- | -| 12300001 | System service exception. | -| 12300002 | Invalid request. | - -**Example** - -```ts -let scheduler = new account_appAccount.AccountCapabilityScheduler(); -let provider = new account_appAccount.AuthorizationProvider({ bundleName: 'xxx', abilityName: 'xxx' }); -let request = new account_appAccount.AccountCapabilityRequest(provider); -try { - scheduler.executeRequest(request, (err, response) => { - if (err != null) { - console.log('executeRequest failed, error: ' + JSON.stringify(err)); - } else { - console.log('executeRequest response: ' + JSON.stringify(response)); - } - }); -} catch (err) { - console.log('executeRequest exception: ' + JSON.stringify(err)); -} -``` - -### executeRequest10+ - -executeRequest(request: AccountCapabilityRequest): Promise<AccountCapabilityResponse> - -Executes an account capability request. This API uses a promise to return the result. - -**System capability**: SystemCapability.Account.AppAccount - -**Parameters** - -| Name | Type | Mandatory | Description | -| ---------- | ------- | ---- | ------------ | -| request | [AccountCapabilityRequest](#accountcapabilityrequest10) | Yes | Account capability request to execute.| - -**Return value** - -| Type | Description | -| ------------------- | --------------------- | -| Promise<[AccountCapabilityResponse](#accountcapabilityresponse10)> | Promise used to return the result. | - -**Error codes** - -| ID| Error Message| -| ------- | ------- | -| 12300001 | System service exception. | -| 12300002 | Invalid request. | - -**Example** - -```ts -let scheduler = new account_appAccount.AccountCapabilityScheduler(); -let provider = new account_appAccount.AuthorizationProvider({ bundleName: 'xxx', abilityName: 'xxx' }); -let request = new account_appAccount.AccountCapabilityRequest(provider); -try { - scheduler.executeRequest(request).then((response) => { - console.log('executeRequest response: ' + JSON.stringify(response)); - }).catch((err) => { - console.log('executeRequest failed, error: ' + JSON.stringify(err)); - }); -} catch (err) { - console.log('executeRequest exception: ' + JSON.stringify(err)); -} -``` diff --git a/en/application-dev/reference/apis/js-apis-osAccount.md b/en/application-dev/reference/apis/js-apis-osAccount.md index c5575525ae030c63abda09464bb309b70dab3f6f..a3aa13b74e274359295edb15006bd1bcd0541995 100644 --- a/en/application-dev/reference/apis/js-apis-osAccount.md +++ b/en/application-dev/reference/apis/js-apis-osAccount.md @@ -481,7 +481,7 @@ Checks whether this OS account has been verified. This API uses an asynchronous | Name | Type | Mandatory| Description | | -------- | ---------------------------- | ---- | ------------------------------------------------------------- | -| callback | AsyncCallback<boolean> | Yes | Callback invoked to return the result. If true is returned, the current account has been verified. If false is returned, the current account has not been verified.| +| callback | AsyncCallback<boolean> | Yes | Callback invoked to return the result. The value **true** means the OS account has been verified; the value **false** means the opposite.| **Error codes** @@ -508,6 +508,41 @@ Checks whether this OS account has been verified. This API uses an asynchronous ### checkOsAccountVerified9+ +checkOsAccountVerified(): Promise<boolean> + +Checks whether this OS account has been verified. This API uses a promise to return the result. + +**System capability**: SystemCapability.Account.OsAccount + +**Return value** + +| Type | Description | +| ---------------------- | ------------------------------------------------------------------------ | +| Promise<boolean> | Promise used to return the result. The value **true** means the OS account has been verified; the value **false** means the opposite.| + +**Error codes** + +| ID| Error Message | +| -------- | ------------------- | +| 12300001 | System service exception. | + +**Example** + + ```js + let accountManager = account_osAccount.getAccountManager(); + try { + accountManager.checkOsAccountVerified().then((isVerified) => { + console.log('checkOsAccountVerified successfully, isVerified: ' + isVerified); + }).catch((err) => { + console.log('checkOsAccountVerified failed, error: ' + JSON.stringify(err)); + }); + } catch (err) { + console.log('checkOsAccountVerified exception: ' + JSON.stringify(err)); + } + ``` + +### checkOsAccountVerified9+ + checkOsAccountVerified(localId: number, callback: AsyncCallback<boolean>): void Checks whether an OS account has been verified. This API uses an asynchronous callback to return the result. @@ -595,6 +630,41 @@ Checks whether an OS account has been verified. This API uses a promise to retur } ``` +### checkOsAccountVerified9+ + +checkOsAccountVerified(): Promise<boolean> + +Checks whether this OS account has been verified. This API uses a promise to return the result. + +**System capability**: SystemCapability.Account.OsAccount + +**Return value** + +| Type | Description | +| ---------------------- | ----------------------------------------------------------------- | +| Promise<boolean> | Promise used to return the result. The value **true** means the OS account has been verified; the value **false** means the opposite.| + +**Error codes** + +| ID| Error Message | +| -------- | ------------------- | +| 12300001 | System service exception. | + +**Example** + + ```js + let accountManager = account_osAccount.getAccountManager(); + try { + accountManager.checkOsAccountVerified().then((isVerified) => { + console.log('checkOsAccountVerified successfully, isVerified: ' + isVerified); + }).catch((err) => { + console.log('checkOsAccountVerified failed, error: ' + JSON.stringify(err)); + }); + } catch (err) { + console.log('checkOsAccountVerified exception: ' + JSON.stringify(err)); + } + ``` + ### removeOsAccount removeOsAccount(localId: number, callback: AsyncCallback<void>): void @@ -1552,7 +1622,7 @@ Creates an OS account. This API uses an asynchronous callback to return the resu | 12300002 | Invalid localName or type. | | 12300005 | Multi-user not supported. | | 12300006 | Unsupported account type. | -| 12300007 | The number of account reaches the upper limit. | +| 12300007 | The number of accounts reaches the upper limit. | **Example** @@ -1601,7 +1671,7 @@ Creates an OS account. This API uses a promise to return the result. | 12300002 | Invalid localName or type. | | 12300005 | Multi-user not supported. | | 12300006 | Unsupported account type. | -| 12300007 | The number of account reaches the upper limit. | +| 12300007 | The number of accounts reaches the upper limit. | **Example** @@ -1646,7 +1716,7 @@ Creates an OS account and associates it with the specified domain account. This | 12300002 | Invalid type or domainInfo. | | 12300005 | Multi-user not supported. | | 12300006 | Unsupported account type. | -| 12300007 | The number of account reaches the upper limit. | +| 12300007 | The number of accounts reaches the upper limit. | **Example** @@ -1696,7 +1766,7 @@ Creates an OS account and associates it with the specified domain account. This | 12300002 | Invalid type or domainInfo. | | 12300005 | Multi-user not supported. | | 12300006 | Unsupported account type. | -| 12300007 | The number of account reaches the upper limit. | +| 12300007 | The number of accounts reaches the upper limit. | **Example** @@ -1720,7 +1790,7 @@ getCurrentOsAccount(callback: AsyncCallback<OsAccountInfo>): void Obtains information about the OS account to which the current process belongs. This API uses an asynchronous callback to return the result. -**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS +**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.GET_LOCAL_ACCOUNTS10+ **System capability**: SystemCapability.Account.OsAccount @@ -1756,7 +1826,7 @@ getCurrentOsAccount(): Promise<OsAccountInfo> Obtains information about the OS account to which the current process belongs. This API uses a promise to return the result. -**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS +**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.GET_LOCAL_ACCOUNTS10+ **System capability**: SystemCapability.Account.OsAccount @@ -4109,8 +4179,10 @@ Performs authentication of the current user. This API uses an asynchronous callb | 12300001 | System service exception. | | 12300002 | Invalid challenge, authType, or authTrustLevel. | | 12300101 | Credential is incorrect. | +| 12300102 | Credential not enrolled. | | 12300105 | Unsupported authTrustLevel. | | 12300106 | Unsupported authType. | +| 12300109 | Authentication is canceled. | | 12300110 | Authentication is locked. | | 12300111 | Authentication timeout. | | 12300112 | Authentication service is busy. | @@ -4168,8 +4240,10 @@ Performs authentication of the specified user. This API uses an asynchronous cal | 12300001 | System service exception. | | 12300002 | Invalid userId, challenge, authType, or authTrustLevel. | | 12300101 | Credential is incorrect. | +| 12300102 | Credential not enrolled. | | 12300105 | Unsupported authTrustLevel. | | 12300106 | Unsupported authType. | +| 12300109 | Authentication is canceled. | | 12300110 | Authentication is locked. | | 12300111 | Authentication timeout. | | 12300112 | Authentication service is busy. | @@ -5319,6 +5393,9 @@ Adds credential information, including the credential type, subtype, and token ( | 12300002 | Invalid credentialInfo, i.e. authType or authSubType. | | 12300101 | Token is invalid. | | 12300106 | Unsupported authType. | +| 12300109 | Operation is canceled. | +| 12300111 | Operation timeout. | +| 12300115 | The number of credentials reaches the upper limit. | **Example** ```js @@ -5375,7 +5452,10 @@ Updates credential information. This API uses a callback to return the result. | 12300001 | System service exception. | | 12300002 | Invalid credentialInfo, i.e. authType or authSubType or token. | | 12300101 | Token is invalid. | +| 12300102 | Credential not enrolled.| | 12300106 | Unsupported authType. | +| 12300109 | Operation is canceled. | +| 12300111 | Operation timeout. | **Example** ```js @@ -5538,7 +5618,7 @@ Deletes user credential information. | 12300001 | System service exception. | | 12300002 | Invalid credentialId. | | 12300101 | Token is invalid. | -| 12300102 | Credential not found. | +| 12300102 | Credential not enrolled. | **Example** ```js @@ -5580,6 +5660,7 @@ Obtains authentication information. This API uses an asynchronous callback to re | ID| Error Message | | -------- | --------------------- | | 12300001 | System service exception. | +| 12300102 | Credential not enrolled. | **Example** ```js @@ -5619,6 +5700,7 @@ Obtains authentication information of the specified type. This API uses an async | -------- | ------------------- | | 12300001 | System service exception. | | 12300002 | Invalid authType. | +| 12300102 | Credential not enrolled. | **Example** ```js @@ -5663,6 +5745,7 @@ Obtains authentication information of the specified type. This API uses a promis | -------- | ------------------- | | 12300001 | System service exception. | | 12300002 | Invalid authType. | +| 12300102 | Credential not enrolled. | **Example** ```js