;
/**
* 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 Returns the DVID if obtained; returns an empty string if no OHOS account has logged in.
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#queryDistributedVirtualDeviceId
*/
getDistributedVirtualDeviceId(callback: AsyncCallback): void;
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
* @returns Returns the DVID if obtained; returns an empty string if no OHOS account has logged in.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 401 - the parameter check failed.
* @throws {BusinessError} 12300001 - system service exception.
* @since 9
*/
queryDistributedVirtualDeviceId(callback: AsyncCallback): void;
queryDistributedVirtualDeviceId(): Promise;
/**
* Obtains the profile photo of an OS account based on its local ID.
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param localId Indicates the local ID of the OS account.
* @returns Returns the profile photo if obtained;
* returns {@code null} if the profile photo fails to be obtained.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 401 - the parameter check failed.
* @throws {BusinessError} 12300001 - system service exception.
* @throws {BusinessError} 12300002 - invalid localId.
* @throws {BusinessError} 12300003 - the account indicated by localId dose not exist.
* @systemapi Hide this for inner system use.
* @since 7
*/
getOsAccountProfilePhoto(localId: number, callback: AsyncCallback): void;
getOsAccountProfilePhoto(localId: number): Promise;
/**
* Sets the profile photo for an OS account based on its local ID.
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param localId Indicates the local ID of the OS account.
* @param photo Indicates the profile photo to set for the OS account.
* @returns void.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 401 - the parameter check failed.
* @throws {BusinessError} 12300001 - system service exception.
* @throws {BusinessError} 12300002 - invalid localId or photo.
* @throws {BusinessError} 12300003 - the account indicated by localId dose not exist.
* @throws {BusinessError} 12300008 - the localId indicates restricted account.
* @systemapi Hide this for inner system use.
* @since 7
*/
setOsAccountProfilePhoto(localId: number, photo: string, callback: AsyncCallback): void;
setOsAccountProfilePhoto(localId: number, photo: string): Promise;
/**
* Obtain localId according to serial number
* @param serialNumber Indicates serial number.
* @returns localId.
* @since 8
* @deprecated since 9
* @useinstead osAccount.AccountManager#getOsAccountLocalIdForSerialNumber
*/
getOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback): void;
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 - the parameter check failed.
* @throws { BusinessError } 12300001 - system service exception.
* @throws { BusinessError } 12300002 - invalid serialNumber.
* @throws { BusinessError } 12300003 - the account indicated by serialNumber dose not exist.
* @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 - the parameter check failed.
* @throws { BusinessError } 12300001 - system service exception.
* @throws { BusinessError } 12300002 - invalid serialNumber.
* @throws { BusinessError } 12300003 - the account indicated by serialNumber dose not exist.
* @since 9
*/
getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise;
/**
* Obtain serial number according to localId.
* @param localId Indicates the local ID of the OS account.
* @returns serial number.
* @since 8
* @deprecated since 9
* @useinstead osAccount.AccountManager#getSerialNumberForOsAccountLocalId
*/
getSerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback): void;
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 - the parameter check failed.
* @throws { BusinessError } 12300001 - system service exception.
* @throws { BusinessError } 12300002 - invalid localId.
* @throws { BusinessError } 12300003 - the account indicated by localId dose not exist.
* @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 - the parameter check failed.
* @throws { BusinessError } 12300001 - system service exception.
* @throws { BusinessError } 12300002 - invalid localId.
* @throws { BusinessError } 12300003 - the account indicated by localId dose not exist.
* @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 type Event type.
* @param name Indicates the name of subscriber.
* @returns void.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 401 - the parameter check failed.
* @throws {BusinessError} 12300001 - system service exception.
* @throws {BusinessError} 12300002 - invalid type or name.
* @throws {BusinessError} 12300011 - the callback has been registered.
* @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 type Event type.
* @param name Indicates the name of subscriber.
* @returns void.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 401 - the parameter check failed.
* @throws {BusinessError} 12300001 - system service exception.
* @throws {BusinessError} 12300002 - invalid type or name.
* @throws {BusinessError} 12300012 - the callback has not been registered.
* @systemapi Hide this for inner system use.
* @since 7
*/
off(type: 'activate' | 'activating', name: string, 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 - the parameter check failed.
* @throws { BusinessError } 12300001 - system service exception.
* @throws { BusinessError } 12300002 - invalid uid.
* @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 - the parameter check failed.
* @throws { BusinessError } 12300001 - system service exception.
* @throws { BusinessError } 12300002 - invalid uid.
* @systemapi Hide this for inner system use.
* @since 9
*/
getBundleIdForUid(uid: number): Promise;
/**
* Check whether current process belongs to the main account.
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @returns Returns {@code true} if current process belongs to the main os account;
* returns {@code false} otherwise.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 401 - the parameter check failed.
* @throws {BusinessError} 12300001 - system service exception.
* @systemapi Hide this for inner system use.
* @since 9
*/
isMainOsAccount(callback: AsyncCallback): void;
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 - the parameter check failed.
* @throws { BusinessError } 12300001 - system service exception.
* @throws { BusinessError } 12300002 - invalid name or constraint.
* @throws { BusinessError } 12300003 - the account indicated by localId dose not exist.
* @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 - the parameter check failed.
* @throws { BusinessError } 12300001 - system service exception.
* @throws { BusinessError } 12300002 - invalid name or constraint.
* @throws { BusinessError } 12300003 - the account indicated by localId dose not exist.
* @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.
* @name OsAccountInfo
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
interface OsAccountInfo {
/**
* The local ID of an OS account.
* @since 7
*/
localId: number;
/**
* The local name of an OS account.
* @since 7
*/
localName: string;
/**
* Include: ADMIN, Normal, GUEST.
* @since 7
*/
type: OsAccountType;
/**
* Account constraints information.
* @since 7
*/
constraints: Array;
/**
* The account is verified or not.
* @since 8
*/
isVerified: boolean;
/**
* OS account photo.
* @since 8
*/
photo: string;
/**
* Os account create time.
* @since 8
*/
createTime: number;
/**
* The last time to log in.
* @since 8
*/
lastLoginTime: number;
/**
* Os account serial number.
* @since 8
*/
serialNumber: number;
/**
* Os account is activated or not.
* @since 8
*/
isActived: boolean;
/**
* Os account create completed or not.
* @since 8
*/
isCreateCompleted: boolean;
/**
* Distributed account info.
* @since 7
*/
distributedInfo: distributedAccount.DistributedInfo;
/**
* Domain account info.
* @since 8
*/
domainInfo: DomainAccountInfo;
}
interface DomainAccountInfo {
/**
* The domain name
* @since 8
*/
domain: string;
/**
* The account name in the domain
* @since 8
*/
accountName: string;
}
/**
* Enumerates OS account types.
* @name OsAccountType
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
enum OsAccountType {
/**
* Indicates the administrator account, which has the permission to manage other OS accounts.
*/
ADMIN = 0,
/**
* Indicates a normal account, which has access to common functions of OS accounts.
*/
NORMAL,
/**
* Indicates a guest account, which is used to temporarily access the device and may be deleted at any time.
*/
GUEST
}
/**
* Provides the abilities for user authentication.
* @name UserAuth
* @syscap SystemCapability.Account.OsAccount
* @since 8
*/
class UserAuth {
/**
* Constructor to get the UserAuth class instance.
* @returns Returns the UserAuth class instance.
* @systemapi Hide this for inner system use.
* @since 8
*/
constructor();
/**
* Gets version information.
* @returns Returns the version information.
* @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 Indicates the credential type for authentication.
* @param authTrustLevel Indicates the trust level of authentication result.
* @returns Returns a status result.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 401 - the parameter check failed.
* @throws {BusinessError} 12300001 - system service exception.
* @throws {BusinessError} 12300002 - invalid authType or authTrustLevel.
* @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 request Indicates the request information, including authentication type, and property type list.
* @returns Returns an executor property.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 401 - the parameter check failed.
* @throws {BusinessError} 12300001 - system service exception.
* @throws {BusinessError} 12300002 - invalid request.
* @systemapi Hide this for inner system use.
* @since 8
*/
getProperty(request: GetPropertyRequest, callback: AsyncCallback): void;
getProperty(request: GetPropertyRequest): Promise;
/**
* Sets property that can be used to initialize algorithms.
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
* @param request Indicates the request information, including authentication type and the key-value to be set.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 401 - the parameter check failed.
* @throws {BusinessError} 12300001 - system service exception.
* @throws {BusinessError} 12300002 - invalid request.
* @systemapi Hide this for inner system use.
* @since 8
*/
setProperty(request: SetPropertyRequest, callback: AsyncCallback): void;
setProperty(request: SetPropertyRequest): Promise;
/**
* Executes authentication.
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
* @param challenge Indicates the challenge value.
* @param authType Indicates the authentication type.
* @param authTrustLevel Indicates the trust level of authentication result.
* @param callback Indicates the callback to get result and acquireInfo.
* @returns Returns a context ID for cancellation.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 401 - the parameter check failed.
* @throws {BusinessError} 12300001 - system service exception.
* @throws {BusinessError} 12300002 - invalid challenge, authType or authTrustLevel.
* @throws {BusinessError} 12300101 - credential is incorrect.
* @throws {BusinessError} 12300105 - unsupported authTrustLevel.
* @throws {BusinessError} 12300106 - unsupported authType.
* @throws {BusinessError} 12300110 - authentication is locked.
* @throws {BusinessError} 12300111 - authentication timeout.
* @throws {BusinessError} 12300112 - authentication service is busy.
* @systemapi Hide this for inner system use.
* @since 8
*/
auth(challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array;
/**
* Executes user authentication.
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
* @param userId Indicates the user identification.
* @param challenge Indicates the challenge value.
* @param authType Indicates the authentication type.
* @param authTrustLevel Indicates the trust level of authentication result.
* @param callback Indicates the callback to get result and acquireInfo.
* @returns Returns a context ID for cancellation.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 401 - the parameter check failed.
* @throws {BusinessError} 12300001 - system service exception.
* @throws {BusinessError} 12300002 - invalid userId, challenge, authType or authTrustLevel.
* @throws {BusinessError} 12300101 - credential is incorrect.
* @throws {BusinessError} 12300105 - unsupported authTrustLevel.
* @throws {BusinessError} 12300106 - unsupported authType.
* @throws {BusinessError} 12300110 - authentication is locked.
* @throws {BusinessError} 12300111 - authentication timeout.
* @throws {BusinessError} 12300112 - authentication service is busy.
* @systemapi Hide this for inner system use.
* @since 8
*/
authUser(userId: number, challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array;
/**
* Cancels authentication with context ID.
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
* @param contextID Indicates the authentication context ID.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 401 - the parameter check failed.
* @throws {BusinessError} 12300001 - system service exception.
* @throws {BusinessError} 12300002 - invalid contextId.
* @systemapi Hide this for inner system use.
* @since 8
*/
cancelAuth(contextID: Uint8Array): void;
}
/**
* Provides the abilities for Pin code authentication.
* @name PINAuth
* @syscap SystemCapability.Account.OsAccount
* @since 8
*/
class PINAuth {
/**
* Constructor to get the PINAuth class instance.
* @returns Returns the PINAuth class instance.
* @systemapi Hide this for inner system use.
* @since 8
*/
constructor();
/**
* Register inputer.
* @permission ohos.permission.ACCESS_PIN_AUTH
* @param inputer Indicates the password input box callback
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 401 - the parameter check failed.
* @throws {BusinessError} 12300001 - system service exception.
* @throws {BusinessError} 12300002 - invalid inputer.
* @throws {BusinessError} 12300103 - the credential inputer has been registered.
* @systemapi Hide this for inner system use.
* @since 8
*/
registerInputer(inputer: IInputer): void;
/**
* Unregister inputer.
* @permission ohos.permission.ACCESS_PIN_AUTH
* @systemapi Hide this for inner system use.
* @throws {BusinessError} 201 - permission denied.
* @since 8
*/
unregisterInputer(): void;
}
/**
* Provides the management of credential inputers.
* @name InputerManager
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
class InputerManager {
/**
* Register credential inputer by authentication type.
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL or ohos.permission.MANAGE_USER_IDM
* @static
* @param authType Indicates the authentication type.
* @param inputer Indicates the credential input box callback.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 202 - not system application.
* @throws {BusinessError} 401 - the parameter check failed.
* @throws {BusinessError} 12300001 - system service exception.
* @throws {BusinessError} 12300002 - invalid authType or inputer.
* @throws {BusinessError} 12300103 - the credential inputer has been registered.
* @throws {BusinessError} 12300106 - unsupported authType.
* @systemapi Hide this for inner system use.
* @since 9
*/
static registerInputer(authType: AuthType, inputer: IInputer): void;
/**
* Unregister credential inputer by authentication type.
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL or ohos.permission.MANAGE_USER_IDM
* @static
* @param authType Indicates the authentication type.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 202 - not system application.
* @throws {BusinessError} 401 - the parameter check failed.
* @throws {BusinessError} 12300002 - invalid authType.
* @systemapi Hide this for inner system use.
* @since 9
*/
static unregisterInputer(authType: AuthType): void;
}
/**
* Provides the definition of domain plugin.
* @interface DomainPlugin
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
interface DomainPlugin {
/**
* Authenticates the specified domain account.
* @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information for authentication.
* @param { Uint8Array } credential - Indicates the credential for authentication.
* @param { IUserAuthCallback } callback - Indicates the authentication callback.
* @systemapi Hide this for inner system use.
* @since 9
*/
auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUserAuthCallback): void;
}
/**
* Provides abilities for the management of domain account.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
class DomainAccountManager {
/**
* Registers the domain plugin, which provides the capabilities for domain authentication.
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @static
* @param { DomainPlugin } plugin - Indicates the domain plugin.
* @throws { BusinessError } 201 - permission denied.
* @throws { BusinessError } 202 - not system application.
* @throws { BusinessError } 401 - the parameter check failed.
* @throws { BusinessError } 12300201 - the domain plugin has been registered.
* @systemapi Hide this for inner system use.
* @since 9
*/
static registerPlugin(plugin: DomainPlugin): void;
/**
* Unregisters domain plugin.
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @static
* @throws { BusinessError } 201 - permission denied.
* @throws { BusinessError } 202 - not system application.
* @systemapi Hide this for inner system use.
* @since 9
*/
static unregisterPlugin(): void;
}
/**
* Provides the abilities for managing user identity.
* @name UserIdentityManager
* @syscap SystemCapability.Account.OsAccount
* @since 8
*/
class UserIdentityManager {
/**
* Constructor to get the UserIdentityManager class instance.
* @returns Returns the UserIdentityManager class instance.
* @systemapi Hide this for inner system use.
* @since 8
*/
constructor();
/**
* 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
* @returns Returns a challenge value.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 401 - the parameter check failed.
* @throws {BusinessError} 12300001 - system service exception.
* @systemapi Hide this for inner system use.
* @since 8
*/
openSession(callback: AsyncCallback): void;
openSession(): Promise;
/**
* Adds credential.
*
* Add user credential information, pass in credential addition method and credential information
* (credential type, subclass, if adding user's non password credentials, pass in password authentication token),
* and get the result / acquireInfo callback.
* @permission ohos.permission.MANAGE_USER_IDM
* @param credentialInfo Indicates the credential information.
* @param callback Indicates the callback to get results and acquireInfo.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 401 - the parameter check failed.
* @throws {BusinessError} 12300001 - system service exception.
* @throws {BusinessError} 12300002 - invalid credentialInfo.
* @throws {BusinessError} 12300101 - token is invalid.
* @throws {BusinessError} 12300106 - unsupported authType.
* @systemapi Hide this for inner system use.
* @since 8
*/
addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
/**
* Updates credential.
* @permission ohos.permission.MANAGE_USER_IDM
* @param credentialInfo Indicates the credential information.
* @param callback Indicates the callback to get results and acquireInfo.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 401 - the parameter check failed.
* @throws {BusinessError} 12300001 - system service exception.
* @throws {BusinessError} 12300002 - invalid credentialInfo.
* @throws {BusinessError} 12300101 - token is invalid.
* @throws {BusinessError} 12300106 - unsupported authType.
* @systemapi Hide this for inner system use.
* @since 8
*/
updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
/**
* Closes session.
*
* End an IDM operation.
* @permission ohos.permission.MANAGE_USER_IDM
* @throws {BusinessError} 201 - permission denied.
* @systemapi Hide this for inner system use.
* @since 8
*/
closeSession(): void;
/**
* Cancels entry with a challenge value.
* @permission ohos.permission.MANAGE_USER_IDM
* @param challenge Indicates the challenge value.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 401 - the parameter check failed.
* @throws {BusinessError} 12300001 - system service exception.
* @throws {BusinessError} 12300002 - invalid challenge.
* @systemapi Hide this for inner system use.
* @since 8
*/
cancel(challenge: Uint8Array): void;
/**
* Deletes the user with the authentication token.
* @permission ohos.permission.MANAGE_USER_IDM
* @param token Indicates the authentication token.
* @param callback Indicates the callback to get the deletion result.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 401 - the parameter check failed.
* @throws {BusinessError} 12300001 - system service exception.
* @throws {BusinessError} 12300101 - token is invalid.
* @systemapi Hide this for inner system use.
* @since 8
*/
delUser(token: Uint8Array, callback: IIdmCallback): void;
/**
* Deletes the user credential information.
* @permission ohos.permission.MANAGE_USER_IDM
* @param credentialId Indicates the credential index.
* @param token Indicates the authentication token.
* @param callback Indicates the callback to get the deletion result.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 401 - the parameter check failed.
* @throws {BusinessError} 12300001 - system service exception.
* @throws {BusinessError} 12300002 - invalid credentialId.
* @throws {BusinessError} 12300101 - token is invalid.
* @throws {BusinessError} 12300102 - credential not found.
* @systemapi Hide this for inner system use.
* @since 8
*/
delCred(credentialId: Uint8Array, token: Uint8Array, callback: IIdmCallback): void;
/**
* Gets authentication information.
* @permission ohos.permission.USE_USER_IDM
* @param authType Indicates the authentication type.
* @param 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} 401 - the parameter check failed.
* @throws {BusinessError} 12300001 - system service exception.
* @throws {BusinessError} 12300002 - invalid authType.
* @throws {BusinessError} 12300102 - credential not found.
* @systemapi Hide this for inner system use.
* @since 8
*/
getAuthInfo(callback: AsyncCallback>): void;
getAuthInfo(authType: AuthType, callback: AsyncCallback>): void;
getAuthInfo(authType?: AuthType): Promise>;
}
/**
* Password data callback.
*
* @name IInputData
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
interface IInputData {
/**
* Notifies to set data.
* @param authSubType Indicates the credential subtype for authentication.
* @param data Indicates the data to set.
* @throws {BusinessError} 401 - the parameter check failed.
* @throws {BusinessError} 12300002 - invalid pinSubType.
* @systemapi Hide this for inner system use.
* @since 8
*/
onSetData: (authSubType: AuthSubType, data: Uint8Array) => void;
}
/**
* Password input box callback.
* @name IInputer
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
interface IInputer {
/**
* Notifies to get data.
* @param authSubType Indicates the credential subtype for authentication.
* @param callback Indicates the password data callback.
* @systemapi Hide this for inner system use.
* @since 8
*/
onGetData: (authSubType: AuthSubType, callback: IInputData) => void;
}
/**
* User authentication callback.
* @name IUserAuthCallback
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
interface IUserAuthCallback {
/**
* The authentication result code is returned through the callback.
* @param result Indicates the authentication result code.
* @param extraInfo Indicates the specific information for different situation.
* If the authentication is passed, the authentication token is returned in extraInfo,
* If the authentication fails, the remaining authentication times are returned in extraInfo,
* If the authentication executor is locked, the freezing time is returned in extraInfo.
* @systemapi Hide this for inner system use.
* @since 8
*/
onResult: (result: number, extraInfo: AuthResult) => void;
/**
* During an authentication, the TipsCode is returned through the callback.
* @param module Indicates the executor type for authentication.
* @param acquire Indicates the tip code for different authentication executor.
* @param extraInfo reserved parameter.
* @systemapi Hide this for inner system use.
* @since 8
*/
onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void;
}
/**
* Identity manager callback.
* @name IIdmCallback
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
interface IIdmCallback {
/**
* The authentication result code is returned through the callback.
* @param result Indicates the authentication result code.
* @param extraInfo pass the specific information for different situation.
* @systemapi Hide this for inner system use.
* @since 8
*/
onResult: (result: number, extraInfo: RequestResult) => void;
/**
* During an authentication, the TipsCode is returned through the callback.
* @param module Indicates the executor type for authentication.
* @param acquire Indicates the tip code for different authentication executor.
* @param extraInfo reserved parameter.
* @systemapi Hide this for inner system use.
* @since 8
*/
onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void;
}
/**
* Provides the information of the get property request.
*
* @name GetPropertyRequest
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
interface GetPropertyRequest {
/**
* Indicates the authentication credential type.
*/
authType: AuthType;
/**
* Indicates the array of property types to get.
*/
keys: Array;
}
/**
* Provides the information of the set property request.
* @name SetPropertyRequest
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
interface SetPropertyRequest {
/**
* Indicates the authentication credential type.
*/
authType: AuthType;
/**
* Indicates the property type to set.
*/
key: SetPropertyType;
/**
* Indicates the information to set.
*/
setInfo: Uint8Array;
}
/**
* Provides the property of executor.
* @name ExecutorProperty
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
interface ExecutorProperty {
/**
* Indicates the result.
*/
result: number;
/**
* Indicates the authentication credential subtype.
*/
authSubType: AuthSubType;
/**
* Indicates the remaining times.
*/
remainTimes?: number;
/**
* Indicates the freezing times.
*/
freezingTime?: number;
}
/**
* Indicates the information of authentication result.
* @name AuthResult
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
interface AuthResult {
/**
* Indicates the authentication token.
*/
token?: Uint8Array;
/**
* Indicates the remaining times.
*/
remainTimes?: number;
/**
* Indicates the freezing times.
*/
freezingTime?: number;
}
/**
* Indicates the information of credential.
* @name CredentialInfo
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
interface CredentialInfo {
/**
* Indicates the credential type.
*/
credType: AuthType;
/**
* Indicates the credential subtype.
*/
credSubType: AuthSubType;
/**
* Indicates the authentication token.
*/
token: Uint8Array;
}
/**
* Indicates the information of request result.
* @name RequestResult
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
interface RequestResult {
/**
* Indicates the credential index.
*/
credentialId?: Uint8Array;
}
/**
* Indicates the information of enrolled credential.
* @name EnrolledCredInfo
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
interface EnrolledCredInfo {
/**
* Indicates the credential index.
*/
credentialId: Uint8Array;
/**
* Indicates the authentication credential type.
*/
authType: AuthType;
/**
* Indicates the authentication credential subtype.
*/
authSubType: AuthSubType;
/**
* Indicates the credential template ID.
*/
templateId: Uint8Array;
}
/**
* Indicates the property type to get.
* @name GetPropertyType
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
enum GetPropertyType {
/**
* Indicates the authentication subtype.
*/
AUTH_SUB_TYPE = 1,
/**
* Indicates the remain times.
*/
REMAIN_TIMES = 2,
/**
* Indicates the freezing time.
*/
FREEZING_TIME = 3
}
/**
* Indicates the property type to set.
*
* @name SetPropertyType
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
enum SetPropertyType {
/**
* Indicates the init algorithm.
*/
INIT_ALGORITHM = 1,
}
/**
* Indicates the credential type for authentication.
* @name AuthType
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
enum AuthType {
/**
* Indicates the PIN authentication type.
*/
PIN = 1,
/**
* Indicates the FACE authentication type.
*/
FACE = 2,
/**
* Indicates the DOMAIN authentication type.
* @since 9
*/
DOMAIN = 1024
}
/**
* Indicates the credential subtype for authentication.
* @name AuthSubType
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
enum AuthSubType {
/**
* Indicates the 6-digit credential.
*/
PIN_SIX = 10000,
/**
* Indicates the self-defined digital credential.
*/
PIN_NUMBER = 10001,
/**
* Indicates the self-defined mixed credential.
*/
PIN_MIXED = 10002,
/**
* Indicates the 2D face credential.
*/
FACE_2D = 20000,
/**
* Indicates the 3D face credential.
*/
FACE_3D = 20001,
/**
* Indicates the mixed domain credential.
* @since 9
*/
DOMAIN_MIXED = 10240001
}
/**
* Indicates the trusted level of authentication results.
* @name AuthTrustLevel
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
enum AuthTrustLevel {
/**
* Indicates the trusted level 1.
*/
ATL1 = 10000,
/**
* Indicates the trusted level 2.
*/
ATL2 = 20000,
/**
* Indicates the trusted level 3.
*/
ATL3 = 30000,
/**
* Indicates the trusted level 4.
*/
ATL4 = 40000
}
/**
* Indicates the module of acquired information.
* @name Module
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
enum Module {
/**
* Indicates the information acquired from FaceAuth.
*/
FACE_AUTH = 1
}
/**
* Indicates the enumeration of authentication result code.
* @name ResultCode
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
enum ResultCode {
/**
* Indicates that authentication is success or ability is supported.
*/
SUCCESS = 0,
/**
* Indicates the authenticator fails to identify user.
*/
FAIL = 1,
/**
* Indicates other errors.
*/
GENERAL_ERROR = 2,
/**
* Indicates that authentication has been canceled.
*/
CANCELED = 3,
/**
* Indicates that authentication has timed out.
*/
TIMEOUT = 4,
/**
* Indicates that this authentication type is not supported.
*/
TYPE_NOT_SUPPORT = 5,
/**
* Indicates that the authentication trust level is not supported.
*/
TRUST_LEVEL_NOT_SUPPORT = 6,
/**
* Indicates that the authentication task is busy. Wait for a few seconds and try again.
*/
BUSY = 7,
/**
* Indicates incorrect parameters.
*/
INVALID_PARAMETERS = 8,
/**
* Indicates that the authenticator is locked.
*/
LOCKED = 9,
/**
* Indicates that the user has not enrolled the authenticator.
*/
NOT_ENROLLED = 10
}
/**
* Indicates the enumeration of prompt codes in the process of face authentication.
* @name FaceTipsCode
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
enum FaceTipsCode {
/**
* Indicates that the obtained facial image is too bright due to high illumination.
*/
FACE_AUTH_TIP_TOO_BRIGHT = 1,
/**
* Indicates that the obtained facial image is too dark due to low illumination.
*/
FACE_AUTH_TIP_TOO_DARK = 2,
/**
* Indicates that the face is too close to the device.
*/
FACE_AUTH_TIP_TOO_CLOSE = 3,
/**
* Indicates that the face is too far away from the device.
*/
FACE_AUTH_TIP_TOO_FAR = 4,
/**
* Indicates that the device is too high, and that only the upper part of the face is captured.
*/
FACE_AUTH_TIP_TOO_HIGH = 5,
/**
* Indicates that the device is too low, and that only the lower part of the face is captured.
*/
FACE_AUTH_TIP_TOO_LOW = 6,
/**
* Indicates that the device is deviated to the right, and that only the right part of the face is captured.
*/
FACE_AUTH_TIP_TOO_RIGHT = 7,
/**
* Indicates that the device is deviated to the left, and that only the left part of the face is captured.
*/
FACE_AUTH_TIP_TOO_LEFT = 8,
/**
* Indicates that the face moves too fast during facial information collection.
*/
FACE_AUTH_TIP_TOO_MUCH_MOTION = 9,
/**
* Indicates that the face is not facing the device.
*/
FACE_AUTH_TIP_POOR_GAZE = 10,
/**
* Indicates that no face is detected.
*/
FACE_AUTH_TIP_NOT_DETECTED = 11,
}
/**
* Indicates the enumeration of prompt codes in the process of fingerprint authentication.
* @name FingerprintTips
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
enum FingerprintTips {
/**
* Indicates that the image acquired is good.
*/
FINGERPRINT_TIP_GOOD = 0,
/**
* Indicates that the fingerprint image is too noisy due to suspected or detected dirt on the sensor.
*/
FINGERPRINT_TIP_IMAGER_DIRTY = 1,
/**
* Indicates that the fingerprint image is too noisy to process due to a detected condition.
*/
FINGERPRINT_TIP_INSUFFICIENT = 2,
/**
* Indicates that only a partial fingerprint image is detected.
*/
FINGERPRINT_TIP_PARTIAL = 3,
/**
* Indicates that the fingerprint image is incomplete due to quick motion.
*/
FINGERPRINT_TIP_TOO_FAST = 4,
/**
* Indicates that the fingerprint image is unreadable due to lack of motion.
*/
FINGERPRINT_TIP_TOO_SLOW = 5
}
/**
* Enumerates for constraint source types.
* @name ConstraintSourceType
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
enum ConstraintSourceType {
/**
* No constraints are set
* @since 9
*/
CONSTRAINT_NOT_EXIST = 0,
/**
* Constraint is set by setOsAccountConstraints
* @since 9
*/
CONSTRAINT_TYPE_BASE = 1,
/**
* Constraint is set by device owner
* @since 9
*/
CONSTRAINT_TYPE_DEVICE_OWNER = 2,
/**
* Constraint is set by profile owner
* @since 9
*/
CONSTRAINT_TYPE_PROFILE_OWNER = 3
}
/**
* Provides information about the constraint source type info of an os account.
* @name ConstraintSourceTypeInfo
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
interface ConstraintSourceTypeInfo {
/**
* Indicates the id of an os account who set the constraint.
* When type is CONSTRAINT_NOT_EXIST or CONSTRAINT_TYPE_BASE, localId will be -1.
* @since 9
*/
localId: number;
/**
* Indicates the source type of the constraint.
* @since 9
*/
type: ConstraintSourceType;
}
}
export default osAccount;