;
/**
* Obtains the distributed virtual device ID (DVID).
*
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs.
* The same application running on different devices obtains the same DVID, whereas different applications
* obtain different DVIDs.
*
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { AsyncCallback } callback - Returns the DVID if obtained; returns an empty string if no OHOS account has logged in.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#queryDistributedVirtualDeviceId
*/
getDistributedVirtualDeviceId(callback: AsyncCallback): void;
/**
* Obtains the distributed virtual device ID (DVID).
*
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs.
* The same application running on different devices obtains the same DVID, whereas different applications
* obtain different DVIDs.
*
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @returns { Promise } Returns the DVID if obtained; returns an empty string if no OHOS account has logged in.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#queryDistributedVirtualDeviceId
*/
getDistributedVirtualDeviceId(): Promise;
/**
* Queries the distributed virtual device ID (DVID).
*
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs.
* The same application running on different devices obtains the same DVID, whereas different applications
* obtain different DVIDs.
*
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { AsyncCallback } callback - Returns the DVID if obtained; returns an empty string if no OHOS account has logged in.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
queryDistributedVirtualDeviceId(callback: AsyncCallback): void;
/**
* Queries the distributed virtual device ID (DVID).
*
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs.
* The same application running on different devices obtains the same DVID, whereas different applications
* obtain different DVIDs.
*
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @returns { Promise } Returns the DVID if obtained; returns an empty string if no OHOS account has logged in.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
queryDistributedVirtualDeviceId(): Promise;
/**
* Obtains the profile photo of an OS account based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } 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 } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
getOsAccountProfilePhoto(localId: number, callback: AsyncCallback): void;
/**
* Obtains the profile photo of an OS account based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } 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 } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
getOsAccountProfilePhoto(localId: number): Promise;
/**
* Sets the profile photo for an OS account based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { string } photo - Indicates the profile photo to set for the OS account.
* @param { AsyncCallback } callback - Asynchronous callback interface.
* @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 - System service exception.
* @throws { BusinessError } 12300002 - Invalid localId or photo.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300008 - Restricted Account.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
setOsAccountProfilePhoto(localId: number, photo: string, callback: AsyncCallback): void;
/**
* Sets the profile photo for an OS account based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { string } photo - Indicates the profile photo to set for the OS account.
* @returns { Promise } The promise returned by the function.
* @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 - System service exception.
* @throws { BusinessError } 12300002 - Invalid localId or photo.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300008 - Restricted Account.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
setOsAccountProfilePhoto(localId: number, photo: string): Promise;
/**
* Obtain localId according to serial number
*
* @param { number } serialNumber - Indicates serial number.
* @param { AsyncCallback } callback - Returns localId.
* @syscap SystemCapability.Account.OsAccount
* @since 8
* @deprecated since 9
* @useinstead osAccount.AccountManager#getOsAccountLocalIdForSerialNumber
*/
getOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback): void;
/**
* Obtain localId according to serial number
*
* @param { number } serialNumber - Indicates serial number.
* @returns { Promise } Returns localId.
* @syscap SystemCapability.Account.OsAccount
* @since 8
* @deprecated since 9
* @useinstead osAccount.AccountManager#getOsAccountLocalIdForSerialNumber
*/
getOsAccountLocalIdBySerialNumber(serialNumber: number): Promise;
/**
* Gets the local ID of the OS account associated with the serial number.
*
* @param { number } serialNumber - Indicates serial number.
* @param { AsyncCallback } callback - Indicates the callback for getting the local ID of the OS account associated with the serial number.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid serialNumber.
* @throws { BusinessError } 12300003 - The account indicated by serialNumber dose not exist.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback): void;
/**
* Gets the local ID of the OS account associated with the serial number.
*
* @param { number } serialNumber - Indicates serial number.
* @returns { Promise } Returns the local ID of the OS account associated with the serial number.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid serialNumber.
* @throws { BusinessError } 12300003 - The account indicated by serialNumber dose not exist.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise;
/**
* Obtain serial number according to localId.
*
* @param { number } localId - Indicates the local ID of the OS account.
* @param { AsyncCallback } callback - Returns serial number.
* @syscap SystemCapability.Account.OsAccount
* @since 8
* @deprecated since 9
* @useinstead osAccount.AccountManager#getSerialNumberForOsAccountLocalId
*/
getSerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback): void;
/**
* Obtain serial number according to localId.
*
* @param { number } localId - Indicates the local ID of the OS account.
* @returns { Promise } Returns serial number.
* @syscap SystemCapability.Account.OsAccount
* @since 8
* @deprecated since 9
* @useinstead osAccount.AccountManager#getSerialNumberForOsAccountLocalId
*/
getSerialNumberByOsAccountLocalId(localId: number): Promise;
/**
* Gets the serial number for the specified os account local id.
*
* @param { number } localId - Indicates the local ID of the OS account.
* @param { AsyncCallback } callback - Indicates the callback for getting the serial number for the specified os account local id.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback): void;
/**
* Gets the serial number for the specified os account local id.
*
* @param { number } localId - Indicates the local ID of the OS account.
* @returns { Promise } Returns the serial number according to local ID.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
getSerialNumberForOsAccountLocalId(localId: number): Promise;
/**
* 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 } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid type or name.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
on(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 } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid type or name.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
off(type: 'activate' | 'activating', name: string, 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 } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid type.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
on(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 } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid type.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
off(type: 'switching', 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 } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid type.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
on(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 } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid type.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
off(type: 'switched', callback?: Callback): void;
/**
* Gets the bundle ID associated with the specified UID.
*
* @param { number } uid - Indicates the target uid.
* @param { AsyncCallback } callback - Indicates the callback for getting the bundle ID associated with the specified UID.
* @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 - System service exception.
* @throws { BusinessError } 12300002 - Invalid uid.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
getBundleIdForUid(uid: number, callback: AsyncCallback): void;
/**
* Gets the bundle ID associated with the specified UID.
*
* @param { number } uid - Indicates the target uid.
* @returns { Promise } Returns the bundle ID associated with the specified UID.
* @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 - System service exception.
* @throws { BusinessError } 12300002 - Invalid uid.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
getBundleIdForUid(uid: number): Promise;
/**
* Gets the bundle ID associated with the specified UID synchronously.
*
* @param { number } uid - Indicates the target uid.
* @returns { number } Returns the bundle ID associated with the specified UID.
* @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 } 12300002 - Invalid uid.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
getBundleIdForUidSync(uid: number): number;
/**
* 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 } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
isMainOsAccount(callback: AsyncCallback): void;
/**
* 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 } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
isMainOsAccount(): Promise;
/**
* Gets a list of constraint source types for the specified os account.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { string } constraint - Indicates the constraint to query the source type.
* @param { AsyncCallback> } callback - Indicates the callback for
* getting a list of constraint source types for the specified os account.
* @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 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or constraint.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
getOsAccountConstraintSourceTypes(
localId: number,
constraint: string,
callback: AsyncCallback>
): void;
/**
* Gets a list of constraint source types for the specified os account.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { string } constraint - Indicates the constraint to query the source type.
* @returns { Promise> } Returns a list of constraint source types for the specified os account.
* @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 - System service exception.
* @throws { BusinessError } 12300002 - Invalid name or constraint.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
getOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise>;
}
/**
* Provides information about OS accounts, including the local ID, local name, and type of an OS account.
*
* @interface OsAccountInfo
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
interface OsAccountInfo {
/**
* The local ID of an OS account.
*
* @type { number }
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
localId: number;
/**
* The local name of an OS account.
*
* @type { string }
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
localName: string;
/**
* The short name of an OS account.
*
* @type { ?string }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
shortName?: string;
/**
* Include: ADMIN, Normal, GUEST.
*
* @type { OsAccountType }
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
type: OsAccountType;
/**
* Account constraints information.
*
* @type { Array }
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
constraints: Array;
/**
* The account is verified or not.
*
* @type { boolean }
* @syscap SystemCapability.Account.OsAccount
* @since 8
* @deprecated since 11
* @useinstead osAccount.OsAccountInfo#isUnlocked
*/
isVerified: boolean;
/**
* The OS account is unlocked or not.
*
* @type { boolean }
* @syscap SystemCapability.Account.OsAccount
* @since 11
*/
isUnlocked: boolean;
/**
* OS account photo.
*
* @type { string }
* @syscap SystemCapability.Account.OsAccount
* @since 8
*/
photo: string;
/**
* Os account create time.
*
* @type { number }
* @syscap SystemCapability.Account.OsAccount
* @since 8
*/
createTime: number;
/**
* The last time to log in.
*
* @type { number }
* @syscap SystemCapability.Account.OsAccount
* @since 8
*/
lastLoginTime: number;
/**
* Os account serial number.
*
* @type { number }
* @syscap SystemCapability.Account.OsAccount
* @since 8
*/
serialNumber: number;
/**
* Os account is activated or not.
*
* @type { boolean }
* @syscap SystemCapability.Account.OsAccount
* @since 8
* @deprecated since 11
* @useinstead osAccount.OsAccountInfo#isActivated
*/
isActived: boolean;
/**
* The OS account is activated or not.
*
* @type { boolean }
* @syscap SystemCapability.Account.OsAccount
* @since 11
*/
isActivated: boolean;
/**
* Indicates whether the OS account is logged in.
*
* @type { ?boolean }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
isLoggedIn?: boolean;
/**
* Os account create completed or not.
*
* @type { boolean }
* @syscap SystemCapability.Account.OsAccount
* @since 8
*/
isCreateCompleted: boolean;
/**
* Distributed account info.
*
* @type { distributedAccount.DistributedInfo }
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
distributedInfo: distributedAccount.DistributedInfo;
/**
* Domain account info.
*
* @type { DomainAccountInfo }
* @syscap SystemCapability.Account.OsAccount
* @since 8
*/
domainInfo: DomainAccountInfo;
}
/**
* Defines the switching/switched event data structure for the OS account.
*
* @typedef OsAccountSwitchEventData
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
interface OsAccountSwitchEventData {
/**
* Indicates which OS account to switch from.
*
* @type { number }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
fromAccountId: number;
/**
* Indicates which OS account to switch to.
*
* @type { number }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
toAccountId: number;
}
/**
* Options for creating an OS account.
*
* @interface CreateOsAccountOptions
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
interface CreateOsAccountOptions {
/**
* Indicates the short name of the OS account.
*
* @type { string }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
shortName: string;
}
/**
* Options to create an OS account for domain.
*
* @interface CreateOsAccountForDomainOptions
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
interface CreateOsAccountForDomainOptions extends CreateOsAccountOptions {}
/**
* Provides information about domain accounts.
*
* @interface DomainAccountInfo
* @syscap SystemCapability.Account.OsAccount
* @since 8
*/
interface DomainAccountInfo {
/**
* The domain name
*
* @type { string }
* @syscap SystemCapability.Account.OsAccount
* @since 8
*/
domain: string;
/**
* The account name in the domain
*
* @type { string }
* @syscap SystemCapability.Account.OsAccount
* @since 8
*/
accountName: string;
/**
* The account identifier in the domain.
*
* @type { ?string }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
accountId?: string;
/**
* Indicates whether the account is authenticated.
*
* @type { ?boolean }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 11
*/
isAuthenticated?: boolean;
/**
* Indicates the server config identifier for the domain to which the account belongs.
*
* @type { ?string }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
serverConfigId?: string;
}
/**
* Enumerates OS account types.
*
* @enum { number } OsAccountType
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
enum OsAccountType {
/**
* Indicates the administrator account, which has the permission to manage other OS accounts.
*
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
ADMIN = 0,
/**
* Indicates a normal account, which has access to common functions of OS accounts.
*
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
NORMAL,
/**
* Indicates a guest account, which is used to temporarily access the device and may be deleted at any time.
*
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
GUEST,
/**
* Indicates a private account.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
PRIVATE = 1024
}
/**
* Provides the abilities for user authentication.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
* @name UserAuth
*/
class UserAuth {
/**
* Constructor to get the UserAuth class instance.
*
* @throws { BusinessError } 202 - Not system application.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
constructor();
/**
* Gets version information.
*
* @returns { number } Returns the version information.
* @throws { BusinessError } 202 - Not system application.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
getVersion(): number;
/**
* Checks whether the authentication capability is available.
*
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
* @param { AuthType } authType - Indicates the credential type for authentication.
* @param { AuthTrustLevel } authTrustLevel - Indicates the trust level of authentication result.
* @returns { number } Returns a status result.
* @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 - System service exception.
* @throws { BusinessError } 12300002 - Invalid authType or authTrustLevel.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
getAvailableStatus(authType: AuthType, authTrustLevel: AuthTrustLevel): number;
/**
* 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 } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid request.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
/**
* 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 } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid request.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @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.
* @returns { Promise } Returns an executor property.
* @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 - System service exception.
* @throws { BusinessError } 12300002 - Invalid request.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
/**
* 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 } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*
2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid request.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
getProperty(request: GetPropertyRequest): 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.
* @param { AsyncCallback } callback - Asynchronous callback interface.
* @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 - System service exception.
* @throws { BusinessError } 12300002 - Invalid request.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @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.
* @returns { Promise } The promise returned by the function.
* @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 - System service exception.
* @throws { BusinessError } 12300002 - Invalid request.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
setProperty(request: SetPropertyRequest): Promise;
/**
* 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 } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
*