From 5e75dfd1d0848e2467b849d5531c39a1e741416c Mon Sep 17 00:00:00 2001 From: tongdiaoZS <1904807608@qq.com> Date: Tue, 22 Jul 2025 11:40:58 +0800 Subject: [PATCH] taihe: modify account related statements according to the new overload Issue: https://gitee.com/openharmony/interface_sdk-js/issues/ICNXMI Signed-off-by: tongdiaoZS <1904807608@qq.com> --- api/@ohos.account.distributedAccount.d.ts | 38 +- api/@ohos.account.osAccount.d.ts | 1007 +++++++++++++++++++-- 2 files changed, 956 insertions(+), 89 deletions(-) diff --git a/api/@ohos.account.distributedAccount.d.ts b/api/@ohos.account.distributedAccount.d.ts index 330a3bd341..fee8bb3c51 100644 --- a/api/@ohos.account.distributedAccount.d.ts +++ b/api/@ohos.account.distributedAccount.d.ts @@ -82,11 +82,23 @@ declare namespace distributedAccount { *
2. Incorrect parameter types. * @throws { BusinessError } 12300001 - System service exception. * @syscap SystemCapability.Account.OsAccount - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ getOsAccountDistributedInfo(callback: AsyncCallback): void; + /** + * Gets the distributed information of the current OS account. + * + * @permission ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS or ohos.permission.GET_DISTRIBUTED_ACCOUNTS or ohos.permission.DISTRIBUTED_DATASYNC + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 20 + * @arkts 1.2 + */ + getOsAccountDistributedInfoWithCallback(callback: AsyncCallback): void; + /** * Gets the distributed information of the current OS account. * @@ -95,11 +107,29 @@ declare namespace distributedAccount { * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 12300001 - System service exception. * @syscap SystemCapability.Account.OsAccount - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ getOsAccountDistributedInfo(): Promise; + /** + * Gets the distributed information of the current OS account. + * + * @permission ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS or ohos.permission.GET_DISTRIBUTED_ACCOUNTS or ohos.permission.DISTRIBUTED_DATASYNC + * @returns { Promise } The distributed information of the current OS account. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 20 + * @arkts 1.2 + */ + getOsAccountDistributedInfoReturnsPromise(): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getOsAccountDistributedInfo { getOsAccountDistributedInfoWithCallback, getOsAccountDistributedInfoReturnsPromise }; + /** * Gets the distributed information of the specified OS account. * diff --git a/api/@ohos.account.osAccount.d.ts b/api/@ohos.account.osAccount.d.ts index 625fa93a13..77527084e1 100644 --- a/api/@ohos.account.osAccount.d.ts +++ b/api/@ohos.account.osAccount.d.ts @@ -96,11 +96,36 @@ declare namespace osAccount { * @throws { BusinessError } 12300016 - The number of logged in accounts reaches the upper limit. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ activateOsAccount(localId: int, callback: AsyncCallback): void; + /** + * Activates a specified OS account. + *

+ * If multiple OS accounts are available, you can call this method to enable a specific OS account + * to run in the foreground. Then, the OS account originally running in the foreground will be + * switched to the background. + *

+ * + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION + * @param { int } localId - Indicates the local ID of the OS account. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid localId. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300008 - Restricted Account. + * @throws { BusinessError } 12300010 - Service busy. Possible causes: The target account is being operated. + * @throws { BusinessError } 12300016 - The number of logged in accounts reaches the upper limit. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + activateOsAccountWithCallback(localId: int, callback: AsyncCallback): void; + /** * Activates a specified OS account. *

@@ -148,11 +173,42 @@ declare namespace osAccount { * @throws { BusinessError } 12300016 - The number of logged in accounts reaches the upper limit. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ activateOsAccount(localId: int): Promise; + /** + * Activates a specified OS account. + *

+ * If multiple OS accounts are available, you can call this method to enable a specific OS account + * to run in the foreground. Then, the OS account originally running in the foreground will be + * switched to the background. + *

+ * + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION + * @param { int } localId - Indicates the local ID of the OS account. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid localId. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300008 - Restricted Account. + * @throws { BusinessError } 12300010 - Service busy. Possible causes: The target account is being operated. + * @throws { BusinessError } 12300016 - The number of logged in accounts reaches the upper limit. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + activateOsAccountReturnsPromise(localId: int): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload activateOsAccount { activateOsAccountWithCallback, activateOsAccountReturnsPromise }; + /** * Deactivates a specified OS account. * @@ -585,11 +641,21 @@ declare namespace osAccount { * @returns { Promise } Returns whether the current OS account is unlocked. * @throws { BusinessError } 12300001 - The system service works abnormally. * @syscap SystemCapability.Account.OsAccount - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ isOsAccountUnlocked(): Promise; + /** + * Checks whether the current OS account is unlocked. + * + * @returns { Promise } Returns whether the current OS account is unlocked. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @syscap SystemCapability.Account.OsAccount + * @since 20 + * @arkts 1.2 + */ + isOsAccountUnlockedReturnsPromise(): Promise; + /** * Checks whether the specified OS account is unlocked. * @@ -604,11 +670,36 @@ declare namespace osAccount { * @throws { BusinessError } 12300003 - Account not found. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ isOsAccountUnlocked(localId: int): Promise; + /** + * Checks whether the specified OS account is unlocked. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { int } localId - Indicates the local ID of the OS account. + * @returns { Promise } Returns whether the specified OS account is unlocked. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + isOsAccountUnlockedWithLocalIdReturnsPromise(localId: int): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload isOsAccountUnlocked { + isOsAccountUnlockedReturnsPromise, + isOsAccountUnlockedWithLocalIdReturnsPromise + }; + /** * Removes an OS account based on its local ID. * @@ -849,22 +940,48 @@ declare namespace osAccount { *
2. Incorrect parameter types. * @throws { BusinessError } 12300001 - The system service works abnormally. * @syscap SystemCapability.Account.OsAccount - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ getOsAccountLocalId(callback: AsyncCallback): void; + /** + * Gets the local ID of the current OS account. + * + * @param { AsyncCallback } callback - Indicates the callback for getting the local ID of the current OS account. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @syscap SystemCapability.Account.OsAccount + * @since 20 + * @arkts 1.2 + */ + getOsAccountLocalIdWithCallback(callback: AsyncCallback): void; + /** * Get the local ID of the current OS account. * * @returns { Promise } Returns the local ID of the current account. * @throws { BusinessError } 12300001 - The system service works abnormally. * @syscap SystemCapability.Account.OsAccount - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ getOsAccountLocalId(): Promise; + /** + * Get the local ID of the current OS account. + * + * @returns { Promise } Returns the local ID of the current account. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @syscap SystemCapability.Account.OsAccount + * @since 20 + * @arkts 1.2 + */ + getOsAccountLocalIdReturnsPromise(): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getOsAccountLocalId { getOsAccountLocalIdWithCallback, getOsAccountLocalIdReturnsPromise }; + /** * Gets the local ID of an OS account from the process UID * @@ -899,11 +1016,23 @@ declare namespace osAccount { * @throws { BusinessError } 12300001 - The system service works abnormally. * @throws { BusinessError } 12300002 - Invalid uid. * @syscap SystemCapability.Account.OsAccount - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ getOsAccountLocalIdForUid(uid: int, callback: AsyncCallback): void; + /** + * Gets the local ID of the OS account associated with the specified UID. + * + * @param { int } uid - Indicates the process UID. + * @param { AsyncCallback } callback - Indicates the callback for getting the local ID of the OS account associated with the specified UID. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid uid. + * @syscap SystemCapability.Account.OsAccount + * @since 20 + * @arkts 1.2 + */ + getOsAccountLocalIdForUidWithCallback(uid: int, callback: AsyncCallback): void; + /** * Get the local ID of the OS account associated with the specified UID. * @@ -914,11 +1043,32 @@ declare namespace osAccount { * @throws { BusinessError } 12300001 - The system service works abnormally. * @throws { BusinessError } 12300002 - Invalid uid. * @syscap SystemCapability.Account.OsAccount - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ getOsAccountLocalIdForUid(uid: int): Promise; + /** + * Get the local ID of the OS account associated with the specified UID. + * + * @param { int } uid - Indicates the process UID. + * @returns { Promise } - Returns the local ID of the OS account associated with the specified UID. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid uid. + * @syscap SystemCapability.Account.OsAccount + * @since 20 + * @arkts 1.2 + */ + getOsAccountLocalIdForUidReturnsPromise(uid: int): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getOsAccountLocalIdForUid { + getOsAccountLocalIdForUidWithCallback, + getOsAccountLocalIdForUidReturnsPromise + }; + /** * Gets the local ID of the OS account associated with the specified UID synchronously. * @@ -1130,11 +1280,25 @@ declare namespace osAccount { * @throws { BusinessError } 12300001 - The system service works abnormally. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'7', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 7 */ queryAllCreatedOsAccounts(callback: AsyncCallback>): void; + /** + * Queries the list of all the OS accounts that have been created in the system. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { AsyncCallback> } callback - Returns a list of OS accounts. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + queryAllCreatedOsAccountsWithCallback(callback: AsyncCallback>): void; + /** * Queries the list of all the OS accounts that have been created in the system. * @@ -1145,11 +1309,34 @@ declare namespace osAccount { * @throws { BusinessError } 12300001 - The system service works abnormally. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'7', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 7 */ queryAllCreatedOsAccounts(): Promise>; + /** + * Queries the list of all the OS accounts that have been created in the system. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @returns { Promise> } Returns a list of OS accounts. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + queryAllCreatedOsAccountsReturnsPromise(): Promise>; + + /** + * @since 20 + * @arkts 1.2 + */ + overload queryAllCreatedOsAccounts { + queryAllCreatedOsAccountsWithCallback, + queryAllCreatedOsAccountsReturnsPromise + }; + /** * Queries the id list of all activated OS accounts. * @@ -1180,22 +1367,51 @@ declare namespace osAccount { *
2. Incorrect parameter types. * @throws { BusinessError } 12300001 - The system service works abnormally. * @syscap SystemCapability.Account.OsAccount - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ getActivatedOsAccountLocalIds(callback: AsyncCallback>): void; + /** + * Gets the local IDs of all activated OS accounts. + * + * @param { AsyncCallback> } callback - Indicates the callback for getting the local IDs of all activated OS accounts. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @syscap SystemCapability.Account.OsAccount + * @since 20 + * @arkts 1.2 + */ + getActivatedOsAccountLocalIdsWithCallback(callback: AsyncCallback>): void; + /** * Gets the local IDs of all activated OS accounts. * * @returns { Promise> } Returns all activated accounts. * @throws { BusinessError } 12300001 - The system service works abnormally. * @syscap SystemCapability.Account.OsAccount - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ getActivatedOsAccountLocalIds(): Promise>; + /** + * Gets the local IDs of all activated OS accounts. + * + * @returns { Promise> } Returns all activated accounts. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @syscap SystemCapability.Account.OsAccount + * @since 20 + * @arkts 1.2 + */ + getActivatedOsAccountLocalIdsReturnsPromise(): Promise>; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getActivatedOsAccountLocalIds { + getActivatedOsAccountLocalIdsWithCallback, + getActivatedOsAccountLocalIdsReturnsPromise + }; + /** * Gets the local ID of the foreground OS account. * @@ -1248,11 +1464,33 @@ declare namespace osAccount { * @throws { BusinessError } 12300007 - The number of accounts has reached the upper limit. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback): void; + /** + * Creates an OS account with the specified local name and type. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { string } localName - Indicates the local name of the OS account to create. + * @param { OsAccountType } type - Indicates the type of the OS account to create. + * {@link OsAccountType} specifies the account types available in the system. + * @param { AsyncCallback } callback - Returns information about the created OS account; returns {@code null} if the creation fails. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid localName or type. + * @throws { BusinessError } 12300004 - Local name already exists. + * @throws { BusinessError } 12300005 - Multi-user not supported. + * @throws { BusinessError } 12300006 - Unsupported account type. + * @throws { BusinessError } 12300007 - The number of accounts has reached the upper limit. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + createOsAccountWithCallback(localName: string, type: OsAccountType, callback: AsyncCallback): void; + /** * Creates an OS account using the local name and account type. * @@ -1296,33 +1534,41 @@ declare namespace osAccount { * @throws { BusinessError } 12300015 - The short name already exists. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ createOsAccount(localName: string, type: OsAccountType, options?: CreateOsAccountOptions): Promise; /** - * Creates an OS account using the account type and domain account info. + * Creates an OS account with the specified local name, type and options. * * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { string } localName - Indicates the local name of the OS account to create. * @param { OsAccountType } type - Indicates the type of the OS account to create. * {@link OsAccountType} specifies the account types available in the system. - * @param { DomainAccountInfo } domainInfo - Indicates the domain account info. - * @param { AsyncCallback } callback - Returns information about the created OS account; returns {@code null} if the creation fails. + * @param { CreateOsAccountOptions } [options] - Indicates the options for creating an OS account. + * @returns { Promise } Returns information about the created OS account; returns {@code null} if the creation fails. * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 202 - Not system application. - * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. * @throws { BusinessError } 12300001 - The system service works abnormally. - * @throws { BusinessError } 12300002 - Invalid type or domainInfo. - * @throws { BusinessError } 12300004 - Account already exists. + * @throws { BusinessError } 12300002 - Invalid localName, type or options. + * @throws { BusinessError } 12300004 - Local name already exists. * @throws { BusinessError } 12300005 - Multi-user not supported. * @throws { BusinessError } 12300006 - Unsupported account type. * @throws { BusinessError } 12300007 - The number of accounts has reached the upper limit. + * @throws { BusinessError } 12300015 - The short name already exists. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since 8 + * @since 20 + * @arkts 1.2 + */ + createOsAccountReturnsPromise(localName: string, type: OsAccountType, options?: CreateOsAccountOptions): Promise; + + /** + * @since 20 + * @arkts 1.2 */ + overload createOsAccount { createOsAccountWithCallback, createOsAccountReturnsPromise }; + /** * Creates an OS account using the account type and domain account info. * @@ -1335,6 +1581,26 @@ declare namespace osAccount { * @throws { BusinessError } 202 - Not system application. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid type or domainInfo. + * @throws { BusinessError } 12300004 - Account already exists. + * @throws { BusinessError } 12300005 - Multi-user not supported. + * @throws { BusinessError } 12300006 - Unsupported account type. + * @throws { BusinessError } 12300007 - The number of accounts has reached the upper limit. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 8 + */ + /** + * Creates an OS account using the account type and domain account info. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { OsAccountType } type - Indicates the type of the OS account to create. + * {@link OsAccountType} specifies the account types available in the system. + * @param { DomainAccountInfo } domainInfo - Indicates the domain account info. + * @param { AsyncCallback } callback - Returns information about the created OS account; returns {@code null} if the creation fails. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. * @throws { BusinessError } 801 - Capability not supported. * @throws { BusinessError } 12300001 - The system service works abnormally. * @throws { BusinessError } 12300002 - Invalid type or domainInfo. @@ -1509,11 +1775,28 @@ declare namespace osAccount { * @throws { BusinessError } 12300003 - Account not found. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'7', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 7 */ queryOsAccountById(localId: int, callback: AsyncCallback): void; + /** + * Queries OS account information based on the local ID. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION + * @param { int } localId - Indicates the local ID of the OS account. + * @param { AsyncCallback } callback - Returns the OS account information; returns {@code null} if the query fails. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid localId. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + queryOsAccountByIdWithCallback(localId: int, callback: AsyncCallback): void; + /** * Queries OS account information based on the local ID. * @@ -1529,11 +1812,34 @@ declare namespace osAccount { * @throws { BusinessError } 12300003 - Account not found. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'7', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 7 */ queryOsAccountById(localId: int): Promise; + /** + * Queries OS account information based on the local ID. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION + * @param { int } localId - Indicates the local ID of the OS account. + * @returns { Promise } Returns the OS account information; returns {@code null} if the query fails. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid localId. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + queryOsAccountByIdReturnsPromise(localId: int): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload queryOsAccountById { queryOsAccountByIdWithCallback, queryOsAccountByIdReturnsPromise }; + /** * Gets the domain account information associated with the specified OS account. * @@ -1584,11 +1890,22 @@ declare namespace osAccount { *
2. Incorrect parameter types. * @throws { BusinessError } 12300001 - The system service works abnormally. * @syscap SystemCapability.Account.OsAccount - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ getOsAccountType(callback: AsyncCallback): void; + /** + * Obtains the type of this OS account from the current process. + * + * @param { AsyncCallback } callback - Returns the OS account type. The value can be {@link OsAccountType#ADMIN}, + * {@link OsAccountType#NORMAL}, and {@link OsAccountType#GUEST}. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @syscap SystemCapability.Account.OsAccount + * @since 20 + * @arkts 1.2 + */ + getOsAccountTypeWithCallback(callback: AsyncCallback): void; + /** * Obtains the type of this OS account from the current process. * @@ -1596,11 +1913,22 @@ declare namespace osAccount { * {@link OsAccountType#NORMAL}, and {@link OsAccountType#GUEST}. * @throws { BusinessError } 12300001 - The system service works abnormally. * @syscap SystemCapability.Account.OsAccount - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ getOsAccountType(): Promise; + /** + * Obtains the type of this OS account from the current process. + * + * @returns { Promise } Returns the OS account type. The value can be {@link OsAccountType#ADMIN}, + * {@link OsAccountType#NORMAL}, and {@link OsAccountType#GUEST}. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @syscap SystemCapability.Account.OsAccount + * @since 20 + * @arkts 1.2 + */ + getOsAccountTypeReturnsPromise(): Promise; + /** * Gets the type of the specified OS account. * @@ -1615,11 +1943,37 @@ declare namespace osAccount { * @throws { BusinessError } 12300003 - Account not found. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ getOsAccountType(localId: int): Promise; + /** + * Gets the type of the specified OS account. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { int } localId - Indicates the local ID of the OS account. + * @returns { Promise } Returns the OS account type. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + getOsAccountTypeWithLocalIdReturnsPromise(localId: int): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getOsAccountType { + getOsAccountTypeWithCallback, + getOsAccountTypeReturnsPromise, + getOsAccountTypeWithLocalIdReturnsPromise + }; + /** * Obtains the distributed virtual device ID (DVID). *

@@ -1712,11 +2066,29 @@ declare namespace osAccount { * @throws { BusinessError } 12300003 - Account not found. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'7', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 7 */ getOsAccountProfilePhoto(localId: int, callback: AsyncCallback): void; + /** + * Obtains the profile photo of an OS account based on its local ID. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { int } localId - Indicates the local ID of the OS account. + * @param { AsyncCallback } callback - Returns the profile photo if obtained; + * returns {@code null} if the profile photo fails to be obtained. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid localId. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + getOsAccountProfilePhotoWithCallback(localId: int, callback: AsyncCallback): void; + /** * Obtains the profile photo of an OS account based on its local ID. * @@ -1733,11 +2105,38 @@ declare namespace osAccount { * @throws { BusinessError } 12300003 - Account not found. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'7', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 7 */ getOsAccountProfilePhoto(localId: int): Promise; + /** + * Obtains the profile photo of an OS account based on its local ID. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { int } localId - Indicates the local ID of the OS account. + * @returns { Promise } Returns the profile photo if obtained; + * returns {@code null} if the profile photo fails to be obtained. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid localId. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + getOsAccountProfilePhotoReturnsPromise(localId: int): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getOsAccountProfilePhoto { + getOsAccountProfilePhotoWithCallback, + getOsAccountProfilePhotoReturnsPromise + }; + /** * Sets the profile photo for an OS account based on its local ID. * @@ -1912,11 +2311,31 @@ declare namespace osAccount { * @throws { BusinessError } 12300002 - Invalid type or name. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'7', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 7 */ on(type: 'activate' | 'activating', name: string, callback: Callback): void; + /** + * Subscribes to the change events of accounts. + *

+ * When user change the account, the subscriber will receive a notification + * about the account change event. + * + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION + * @param { 'activate' | 'activating' } type - Event type. + * @param { string } name - Indicates the name of subscriber. + * @param { Callback } callback - Asynchronous callback interface. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid type or name. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + onActivate(type: 'activate' | 'activating', name: string, callback: Callback): void; + /** * Unsubscribes from account events. * @@ -1932,11 +2351,28 @@ declare namespace osAccount { * @throws { BusinessError } 12300002 - Invalid type or name. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'7', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 7 */ off(type: 'activate' | 'activating', name: string, callback?: Callback): void; + /** + * Unsubscribes from account events. + * + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION + * @param { 'activate' | 'activating' } type - Event type. + * @param { string } name - Indicates the name of subscriber. + * @param { Callback } callback - Asynchronous callback interface. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid type or name. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + offActivate(type: 'activate' | 'activating', name: string, callback?: Callback): void; + /** * Subscribes to the OS account switching event. * @@ -1951,11 +2387,27 @@ declare namespace osAccount { * @throws { BusinessError } 12300002 - Invalid type. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'switching', callback: Callback): void; + /** + * Subscribes to the OS account switching event. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { 'switching' } type - Indicates the event type. + * @param { Callback } callback - Indicates the callback for getting the event data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid type. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + onSwitching(type: 'switching', callback: Callback): void; + /** * Unsubscribes from the OS account switching event. * @@ -1970,11 +2422,27 @@ declare namespace osAccount { * @throws { BusinessError } 12300002 - Invalid type. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ off(type: 'switching', callback?: Callback): void; + /** + * Unsubscribes from the OS account switching event. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { 'switching' } type - Indicates the event type. + * @param { Callback } [callback] - Indicates the callback for getting the event data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid type. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + offSwitching(type: 'switching', callback?: Callback): void; + /** * Subscribes to the OS account switched event. * @@ -1989,11 +2457,27 @@ declare namespace osAccount { * @throws { BusinessError } 12300002 - Invalid type. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'switched', callback: Callback): void; + /** + * Subscribes to the OS account switched event. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { 'switched' } type - Indicates the event type. + * @param { Callback } callback - Indicates the callback for getting the event data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid type. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + onSwitched(type: 'switched', callback: Callback): void; + /** * Unsubscribes from the OS account switched event. * @@ -2008,11 +2492,39 @@ declare namespace osAccount { * @throws { BusinessError } 12300002 - Invalid type. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ off(type: 'switched', callback?: Callback): void; + /** + * Unsubscribes from the OS account switched event. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { 'switched' } type - Indicates the event type. + * @param { Callback } [callback] - Indicates the callback for getting the event data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid type. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + offSwitched(type: 'switched', callback?: Callback): void; + + /** + * @since 20 + * @arkts 1.2 + */ + overload on { onActivate, onSwitching, onSwitched }; + + /** + * @since 20 + * @arkts 1.2 + */ + overload off { offActivate, offSwitching, offSwitched }; + /** * Gets the bundle ID associated with the specified UID. * @@ -2076,11 +2588,26 @@ declare namespace osAccount { * @throws { BusinessError } 12300001 - The system service works abnormally. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ isMainOsAccount(callback: AsyncCallback): void; + /** + * Check whether current process belongs to the main account. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { AsyncCallback } callback - Returns {@code true} if current process belongs to the main os account; + * returns {@code false} otherwise. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + isMainOsAccountWithCallback(callback: AsyncCallback): void; + /** * Check whether current process belongs to the main account. * @@ -2092,11 +2619,32 @@ declare namespace osAccount { * @throws { BusinessError } 12300001 - The system service works abnormally. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ isMainOsAccount(): Promise; + /** + * Check whether current process belongs to the main account. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @returns { Promise } Returns {@code true} if current process belongs to the main os account; + * returns {@code false} otherwise. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + isMainOsAccountReturnsPromise(): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload isMainOsAccount { isMainOsAccountWithCallback, isMainOsAccountReturnsPromise }; + /** * Gets a list of constraint source types for the specified os account. * @@ -2629,11 +3177,28 @@ declare namespace osAccount { * @throws { BusinessError } 12300003 - Account not found. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ getProperty(request: GetPropertyRequest, callback: AsyncCallback): void; + /** + * Gets the property based on the specified request information. + * + * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL + * @param { GetPropertyRequest } request - Indicates the request information, including authentication type, and property type list. + * @param { AsyncCallback } callback - Returns an executor property. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid request. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + getPropertyWithCallback(request: GetPropertyRequest, callback: AsyncCallback): void; + /** * Gets the property based on the specified request information. * @@ -2665,10 +3230,33 @@ declare namespace osAccount { * @throws { BusinessError } 12300003 - Account not found. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + */ + getProperty(request: GetPropertyRequest): Promise; + + /** + * Gets the property based on the specified request information. + * + * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL + * @param { GetPropertyRequest } request - Indicates the request information, including authentication type, and property type list. + * @returns { Promise } Returns an executor property. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid request. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 */ - getProperty(request: GetPropertyRequest): Promise; + getPropertyReturnsPromise(request: GetPropertyRequest): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getProperty { getPropertyWithCallback, getPropertyReturnsPromise }; /** * Gets the executor property associated with the specified credential. @@ -2705,11 +3293,27 @@ declare namespace osAccount { * @throws { BusinessError } 12300002 - Invalid request. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'8', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 8 */ setProperty(request: SetPropertyRequest, callback: AsyncCallback): void; + /** + * Sets property that can be used to initialize algorithms. + * + * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL + * @param { SetPropertyRequest } request - Indicates the request information, including authentication type and the key-value to be set. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid request. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + setPropertyWithCallback(request: SetPropertyRequest, callback: AsyncCallback): void; + /** * Sets property that can be used to initialize algorithms. * @@ -2724,11 +3328,33 @@ declare namespace osAccount { * @throws { BusinessError } 12300002 - Invalid request. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'8', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 8 */ setProperty(request: SetPropertyRequest): Promise; + /** + * Sets property that can be used to initialize algorithms. + * + * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL + * @param { SetPropertyRequest } request - Indicates the request information, including authentication type and the key-value to be set. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid request. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + setPropertyReturnsPromise(request: SetPropertyRequest): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload setProperty { setPropertyWithCallback, setPropertyReturnsPromise }; + /** * Prepares remote authentication. * @@ -2856,7 +3482,6 @@ declare namespace osAccount { * @syscap SystemCapability.Account.OsAccount * @systemapi * @since 20 - * @arkts 1.1&1.2 */ auth( challenge: Uint8Array, @@ -2865,6 +3490,48 @@ declare namespace osAccount { callback: IUserAuthCallback ): Uint8Array; + /** + * Executes authentication. + * + * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL + * @param { Uint8Array } challenge - Indicates the challenge value. + * @param { AuthType } authType - Indicates the authentication type. + * @param { AuthTrustLevel } authTrustLevel - Indicates the trust level of authentication result. + * @param { IUserAuthCallback } callback - Indicates the callback to get result and acquireInfo. + * @returns { Uint8Array } Returns a context ID for cancellation. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid challenge, authType or authTrustLevel. + * @throws { BusinessError } 12300013 - Network exception. + * @throws { BusinessError } 12300020 - Device hardware abnormal. + * @throws { BusinessError } 12300090 - Cross-device capability not supported. + * @throws { BusinessError } 12300091 - Cross-device communication failed. + * @throws { BusinessError } 12300101 - The credential is incorrect. + * @throws { BusinessError } 12300102 - The credential does not exist. + * @throws { BusinessError } 12300105 - The trust level is not supported. + * @throws { BusinessError } 12300106 - The authentication type is not supported. + * @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled. + * @throws { BusinessError } 12300110 - The authentication is locked. + * @throws { BusinessError } 12300111 - The authentication timeout. + * @throws { BusinessError } 12300112 - The authentication service is busy. + * @throws { BusinessError } 12300113 - The authentication service does not exist. + * @throws { BusinessError } 12300114 - The authentication service works abnormally. + * @throws { BusinessError } 12300117 - PIN is expired. + * @throws { BusinessError } 12300119 - Multi-factor authentication failed. + * @throws { BusinessError } 12300211 - Server unreachable. + * @syscap SystemCapability.Account.OsAccount + * @systemapi + * @since 20 + * @arkts 1.2 + */ + authWithCallback( + challenge: Uint8Array, + authType: AuthType, + authTrustLevel: AuthTrustLevel, + callback: IUserAuthCallback + ): Uint8Array; + /** * Executes authentication. * @@ -2934,7 +3601,6 @@ declare namespace osAccount { * @syscap SystemCapability.Account.OsAccount * @systemapi * @since 20 - * @arkts 1.1&1.2 */ auth( challenge: Uint8Array, @@ -2944,6 +3610,57 @@ declare namespace osAccount { callback: IUserAuthCallback ): Uint8Array; + /** + * Executes authentication. + * + * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL + * @param { Uint8Array } challenge - Indicates the challenge value. + * @param { AuthType } authType - Indicates the authentication type. + * @param { AuthTrustLevel } authTrustLevel - Indicates the trust level of authentication result. + * @param { AuthOptions } options - Indicates authentication options. + * @param { IUserAuthCallback } callback - Indicates the callback to get result and acquireInfo. + * @returns { Uint8Array } Returns a context ID for cancellation. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid challenge, authType, authTrustLevel or options. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300013 - Network exception. + * @throws { BusinessError } 12300020 - Device hardware abnormal. + * @throws { BusinessError } 12300090 - Cross-device capability not supported. + * @throws { BusinessError } 12300091 - Cross-device communication failed. + * @throws { BusinessError } 12300101 - The credential is incorrect. + * @throws { BusinessError } 12300102 - The credential does not exist. + * @throws { BusinessError } 12300105 - The trust level is not supported. + * @throws { BusinessError } 12300106 - The authentication type is not supported. + * @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled. + * @throws { BusinessError } 12300110 - The authentication is locked. + * @throws { BusinessError } 12300111 - The authentication timeout. + * @throws { BusinessError } 12300112 - The authentication service is busy. + * @throws { BusinessError } 12300113 - The authentication service does not exist. + * @throws { BusinessError } 12300114 - The authentication service works abnormally. + * @throws { BusinessError } 12300117 - PIN is expired. + * @throws { BusinessError } 12300119 - Multi-factor authentication failed. + * @throws { BusinessError } 12300211 - Server unreachable. + * @syscap SystemCapability.Account.OsAccount + * @systemapi + * @since 20 + * @arkts 1.2 + */ + authReturnsPromise( + challenge: Uint8Array, + authType: AuthType, + authTrustLevel: AuthTrustLevel, + options: AuthOptions, + callback: IUserAuthCallback + ): Uint8Array; + + /** + * @since 20 + * @arkts 1.2 + */ + overload auth { authWithCallback, authReturnsPromise }; + /** * Executes user authentication. * @@ -4106,11 +4823,28 @@ declare namespace osAccount { * @throws { BusinessError } 12300001 - The system service works abnormally. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'8', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 8 */ openSession(callback: AsyncCallback): void; + /** + * Opens session. + *

+ * Start an IDM operation to obtain challenge value. + * A challenge value of 0 indicates that opensession failed. + * + * @permission ohos.permission.MANAGE_USER_IDM + * @param { AsyncCallback } callback - Returns a challenge value. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + openSessionWithCallback(callback: AsyncCallback): void; + /** * Opens session. *

@@ -4143,11 +4877,36 @@ declare namespace osAccount { * @throws { BusinessError } 12300008 - Restricted account. * @syscap SystemCapability.Account.OsAccount * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ openSession(accountId?: int): Promise; + /** + * Opens a session. + *

+ * Start an IDM operation to obtain challenge value. + * + * @permission ohos.permission.MANAGE_USER_IDM + * @param { int } [accountId] - Indicates the local ID of the OS account. + * @returns { Promise } Returns a challenge value. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300008 - Restricted account. + * @syscap SystemCapability.Account.OsAccount + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + openSessionReturnsPromise(accountId?: int): Promise; + + /** + * @since 20 + * @arkts 1.2 + */ + overload openSession { openSessionWithCallback, openSessionReturnsPromise }; + /** * Adds credential. *

@@ -4370,10 +5129,26 @@ declare namespace osAccount { * @syscap SystemCapability.Account.OsAccount * @systemapi * @since 20 - * @arkts 1.1&1.2 */ getAuthInfo(callback: AsyncCallback>): void; + /** + * Gets authentication information. + * + * @permission ohos.permission.USE_USER_IDM + * @param { AsyncCallback> } callback - Indicates the callback to get all registered credential information of + * the specified type for the current user. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300020 - Device hardware abnormal. + * @syscap SystemCapability.Account.OsAccount + * @systemapi + * @since 20 + * @arkts 1.2 + */ + getAuthInfoWithCallback(callback: AsyncCallback>): void; + /** * Gets authentication information. * @@ -4406,10 +5181,28 @@ declare namespace osAccount { * @syscap SystemCapability.Account.OsAccount * @systemapi * @since 20 - * @arkts 1.1&1.2 */ getAuthInfo(authType: AuthType, callback: AsyncCallback>): void; + /** + * Gets authentication information. + * + * @permission ohos.permission.USE_USER_IDM + * @param { AuthType } authType - Indicates the authentication type. + * @param { AsyncCallback> } callback - Indicates the callback to get all registered credential information of + * the specified type for the current user. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid authType. + * @throws { BusinessError } 12300020 - Device hardware abnormal. + * @syscap SystemCapability.Account.OsAccount + * @systemapi + * @since 20 + * @arkts 1.2 + */ + getAuthInfoWithAuthTypeCallback(authType: AuthType, callback: AsyncCallback>): void; + /** * Gets authentication information. * @@ -4441,10 +5234,28 @@ declare namespace osAccount { * @syscap SystemCapability.Account.OsAccount * @systemapi * @since 20 - * @arkts 1.1&1.2 */ getAuthInfo(authType: AuthType): Promise>; + /** + * Gets authentication information. + * + * @permission ohos.permission.USE_USER_IDM + * @param { AuthType } authType - Indicates the authentication type. + * @returns { Promise> } Returns all registered credential information of + * the specified type for the current user. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid authType. + * @throws { BusinessError } 12300020 - Device hardware abnormal. + * @syscap SystemCapability.Account.OsAccount + * @systemapi + * @since 20 + * @arkts 1.2 + */ + getAuthInfoReturnsPromise(authType: AuthType): Promise>; + /** * Gets authentication information. * @@ -4478,10 +5289,36 @@ declare namespace osAccount { * @syscap SystemCapability.Account.OsAccount * @systemapi * @since 20 - * @arkts 1.1&1.2 */ getAuthInfo(options?: GetAuthInfoOptions): Promise>; + /** + * Gets authentication information. + * + * @permission ohos.permission.USE_USER_IDM + * @param { GetAuthInfoOptions } [options] - Indicates the options for getting the authentication information. + * @returns { Promise> } Returns all enrolled credential information + * according to the options. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 12300001 - The system service works abnormally. + * @throws { BusinessError } 12300002 - Invalid options. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300020 - Device hardware abnormal. + * @syscap SystemCapability.Account.OsAccount + * @systemapi + * @since 20 + * @arkts 1.2 + */ + getAuthInfoWithOptionsReturnsPromise(options?: GetAuthInfoOptions): Promise>; + + /** + * @since 20 + * @arkts 1.2 + */ + overload getAuthInfo { getAuthInfoWithCallback, getAuthInfoWithAuthTypeCallback, + getAuthInfoReturnsPromise, getAuthInfoWithOptionsReturnsPromise }; + /** * Gets the credential enrolled identifier of the specified authentication type. * -- Gitee