diff --git a/api/@ohos.userIAM.userAuth.d.ts b/api/@ohos.userIAM.userAuth.d.ts index a2415b366f8d4deaff9ce50b7790027535446cf8..5e13f16b4c96cba9aa3dad14fdb38a22476ee438 100644 --- a/api/@ohos.userIAM.userAuth.d.ts +++ b/api/@ohos.userIAM.userAuth.d.ts @@ -39,7 +39,7 @@ import Context from './application/Context'; * @namespace userAuth * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ declare namespace userAuth { @@ -58,7 +58,7 @@ declare namespace userAuth { * @constant * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since 20 + * @since 22 * @arkts 1.2 */ const MAX_ALLOWABLE_REUSE_DURATION: int = 300000; @@ -695,7 +695,7 @@ declare namespace userAuth { * @enum { int } * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ enum UserAuthType { @@ -710,7 +710,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ PIN = 1, @@ -726,7 +726,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ FACE = 2, @@ -742,7 +742,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ FINGERPRINT = 4, @@ -752,7 +752,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'14','1.2':'20'} + * @since arkts {'1.1':'14','1.2':'22'} * @arkts 1.1&1.2 */ PRIVATE_PIN = 16 @@ -773,7 +773,7 @@ declare namespace userAuth { * @enum { int } * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ enum AuthTrustLevel { @@ -790,7 +790,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ ATL1 = 10000, @@ -808,7 +808,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ ATL2 = 20000, @@ -825,7 +825,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ ATL3 = 30000, @@ -842,7 +842,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ ATL4 = 40000 @@ -1086,7 +1086,7 @@ declare namespace userAuth { * @throws { BusinessError } 12500013 - Operation failed because of PIN expired. * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ function getAvailableStatus(authType: UserAuthType, authTrustLevel: AuthTrustLevel): void; @@ -1097,7 +1097,7 @@ declare namespace userAuth { * @typedef EnrolledState * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ interface EnrolledState { @@ -1107,7 +1107,7 @@ declare namespace userAuth { * @type { int } * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ credentialDigest: int; @@ -1118,7 +1118,7 @@ declare namespace userAuth { * @type { int } * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ credentialCount: int; @@ -1138,7 +1138,7 @@ declare namespace userAuth { * @throws { BusinessError } 12500010 - The type of credential has not been enrolled. * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ function getEnrolledState(authType: UserAuthType): EnrolledState; @@ -1167,7 +1167,7 @@ declare namespace userAuth { * @enum { int } * @syscap SystemCapability.UserIAM.UserAuth.Core * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'10','1.2':'20'} + * @since arkts {'1.1':'10','1.2':'22'} * @arkts 1.1&1.2 */ enum WindowModeType { @@ -1176,7 +1176,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'10','1.2':'20'} + * @since arkts {'1.1':'10','1.2':'22'} * @arkts 1.1&1.2 */ DIALOG_BOX = 1, @@ -1186,7 +1186,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'10','1.2':'20'} + * @since arkts {'1.1':'10','1.2':'22'} * @arkts 1.1&1.2 */ FULLSCREEN = 2 @@ -1198,7 +1198,7 @@ declare namespace userAuth { * @enum { int } * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ enum ReuseMode { @@ -1208,7 +1208,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ AUTH_TYPE_RELEVANT = 1, @@ -1219,7 +1219,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ AUTH_TYPE_IRRELEVANT = 2, @@ -1231,7 +1231,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'14','1.2':'20'} + * @since arkts {'1.1':'14','1.2':'22'} * @arkts 1.1&1.2 */ CALLER_IRRELEVANT_AUTH_TYPE_RELEVANT = 3, @@ -1242,7 +1242,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'14','1.2':'20'} + * @since arkts {'1.1':'14','1.2':'22'} * @arkts 1.1&1.2 */ CALLER_IRRELEVANT_AUTH_TYPE_IRRELEVANT = 4 @@ -1265,7 +1265,7 @@ declare namespace userAuth { * @typedef ReuseUnlockResult * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ interface ReuseUnlockResult { @@ -1275,7 +1275,7 @@ declare namespace userAuth { * @type { ReuseMode } * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ reuseMode: ReuseMode; @@ -1287,7 +1287,7 @@ declare namespace userAuth { * @type { int } * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ reuseDuration: int; @@ -1306,7 +1306,7 @@ declare namespace userAuth { * @typedef AuthParam * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ interface AuthParam { @@ -1324,7 +1324,7 @@ declare namespace userAuth { * @type { Uint8Array } * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ challenge: Uint8Array; @@ -1342,7 +1342,7 @@ declare namespace userAuth { * @type { UserAuthType[] } * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ authType: UserAuthType[]; @@ -1360,7 +1360,7 @@ declare namespace userAuth { * @type { AuthTrustLevel } * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ authTrustLevel: AuthTrustLevel; @@ -1371,7 +1371,7 @@ declare namespace userAuth { * @type { ?ReuseUnlockResult } * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ reuseUnlockResult?: ReuseUnlockResult; @@ -1383,7 +1383,7 @@ declare namespace userAuth { * @default The ID of the current user. The value is a positive integer greater than or equal to 0. * @syscap SystemCapability.UserIAM.UserAuth.Core * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'18','1.2':'20'} + * @since arkts {'1.1':'18','1.2':'22'} * @arkts 1.1&1.2 */ userId?: int; @@ -1402,7 +1402,7 @@ declare namespace userAuth { * @typedef WidgetParam * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ interface WidgetParam { @@ -1419,7 +1419,7 @@ declare namespace userAuth { * @type { string } * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ title: string; @@ -1439,7 +1439,7 @@ declare namespace userAuth { * @type { ?string } * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ navigationButtonText?: string; @@ -1451,7 +1451,7 @@ declare namespace userAuth { * @default WindowModeType.DIALOG_BOX * @syscap SystemCapability.UserIAM.UserAuth.Core * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'10','1.2':'20'} + * @since arkts {'1.1':'10','1.2':'22'} * @arkts 1.1&1.2 */ windowMode?: WindowModeType; @@ -1464,7 +1464,7 @@ declare namespace userAuth { * @type { ?Context } * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'18','1.2':'20'} + * @since arkts {'1.1':'18','1.2':'22'} * @arkts 1.1&1.2 */ uiContext?: Context; @@ -1484,7 +1484,7 @@ declare namespace userAuth { * @typedef UserAuthResult * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ interface UserAuthResult { @@ -1502,7 +1502,7 @@ declare namespace userAuth { * @type { int } * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ result: int; @@ -1520,7 +1520,7 @@ declare namespace userAuth { * @type { ?Uint8Array } * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ token?: Uint8Array; @@ -1538,7 +1538,7 @@ declare namespace userAuth { * @type { ?UserAuthType } * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ authType?: UserAuthType; @@ -1549,12 +1549,25 @@ declare namespace userAuth { * @type { ?EnrolledState } * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ enrolledState?: EnrolledState; } + /** + * Called to return the authentication result. If the authentication is successful, + * UserAuthResult contains the token information. + * + * @typedef { function } AuthCallbackOnResultFunc + * @param { UserAuthResult } result - Authentication result information. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @atomicservice + * @since 22 + * @arkts 1.1&1.2 + */ + type AuthCallbackOnResultFunc = (result: UserAuthResult) => void; + /** * Asynchronous callback of authentication operation. * @@ -1568,7 +1581,7 @@ declare namespace userAuth { * @interface IAuthCallback * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ interface IAuthCallback { @@ -1589,20 +1602,113 @@ declare namespace userAuth { * @atomicservice * @since 12 */ - onResult(result: UserAuthResult): void; /** * Called to return the authentication result. If the authentication is successful, * UserAuthResult contains the token information. * - * @type { function } + * @type { AuthCallbackOnResultFunc } * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since 20 - * @arkts 1.2 + * @since 22 + * @arkts 1.1&1.2 */ - onResult: (result: UserAuthResult) => void; + onResult: AuthCallbackOnResultFunc; } + /** + * Subscribes to the user authentication result. + * + * @typedef { function } UserAuthInstanceOnResultFunc + * @param { 'result' } type - Event type. The value is result, which indicates the authentication result. + * @param { IAuthCallback } callback - Callback used to return the user authentication result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + *
3. Parameter verification failed. + * @throws { BusinessError } 12500002 - General operation error. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @atomicservice + * @since 22 + * @arkts 1.2 + */ + type UserAuthInstanceOnResultFunc = (type: 'result', callback: IAuthCallback) => void; + + /** + * Unsubscribes from the user authentication result. + * + *

NOTE: + *
The UserAuthInstance instance used to invoke this API must be the one used to subscribe to the event. + *

+ * + * @typedef { function } UserAuthInstanceOffResultFunc + * @param { 'result' } type - Event type. The value is result, which indicates the authentication result. + * @param { IAuthCallback } callback - Callback to unregister. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + *
3. Parameter verification failed. + * @throws { BusinessError } 12500002 - General operation error. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @atomicservice + * @since 22 + * @arkts 1.2 + */ + type UserAuthInstanceOffResultFunc = (type: 'result', callback?: IAuthCallback) => void; + + /** + * Starts authentication. + * + *

NOTE: + *
Each UserAuthInstance can be used for authentication only once. + *
Starting from API version 20, only system applications can apply for the + * ohos.permission.USER_AUTH_FROM_BACKGROUND permission. + *

+ * + * @typedef { function } UserAuthInstanceStartFunc + * @permission ohos.permission.ACCESS_BIOMETRIC or ohos.permission.USER_AUTH_FROM_BACKGROUND + * @throws { BusinessError } 201 - Permission denied. Possible causes: + *
1. No permission to access biometric. + *
2. No permission to start authentication from background. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Incorrect parameter types. + * @throws { BusinessError } 12500001 - Authentication failed. + * @throws { BusinessError } 12500002 - General operation error. + * @throws { BusinessError } 12500003 - Authentication canceled. + * @throws { BusinessError } 12500004 - Authentication timeout. + * @throws { BusinessError } 12500005 - The authentication type is not supported. + * @throws { BusinessError } 12500006 - The authentication trust level is not supported. + * @throws { BusinessError } 12500007 - Authentication service is busy. + * @throws { BusinessError } 12500009 - Authentication is locked out. + * @throws { BusinessError } 12500010 - The type of credential has not been enrolled. + * @throws { BusinessError } 12500011 - Switched to the custom authentication process. + * @throws { BusinessError } 12500013 - Operation failed because of PIN expired. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @atomicservice + * @since 22 + * @arkts 1.1&1.2 + */ + type UserAuthInstanceStartFunc = () => void; + + /** + * Cancels this authentication. + * + *

NOTE: + *
UserAuthInstance must be the instance being authenticated. + *

+ * + * @typedef { function } UserAuthInstanceCancelFunc + * @permission ohos.permission.ACCESS_BIOMETRIC + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Incorrect parameter types. + * @throws { BusinessError } 12500002 - General operation error. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @atomicservice + * @since 22 + * @arkts 1.1&1.2 + */ + type UserAuthInstanceCancelFunc = () => void; + /** * User authentication instance, used to initiate a complete authentication. * @@ -1617,7 +1723,7 @@ declare namespace userAuth { * @interface UserAuthInstance * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ interface UserAuthInstance { @@ -1646,11 +1752,21 @@ declare namespace userAuth { * @throws { BusinessError } 12500002 - General operation error. * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'result', callback: IAuthCallback): void; + /** + * Subscribes to the user authentication result. + * + * @type { UserAuthInstanceOnResultFunc } + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @atomicservice + * @since 22 + * @arkts 1.2 + */ + onResult: UserAuthInstanceOnResultFunc; + /** * Turn off widget authentication result event listening. * @@ -1680,17 +1796,27 @@ declare namespace userAuth { * @throws { BusinessError } 12500002 - General operation error. * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ off(type: 'result', callback?: IAuthCallback): void; + /** + * Unsubscribes from the user authentication result. + * + * @type { UserAuthInstanceOffResultFunc } + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @atomicservice + * @since 22 + * @arkts 1.2 + */ + offResult: UserAuthInstanceOffResultFunc; + /** * Start this authentication, an instance can only perform authentication once. * * @permission ohos.permission.ACCESS_BIOMETRIC - * @throws { BusinessError } 201 - Permission verification failed. - * @throws { BusinessError } 401 - Incorrect parameters. Possible causes: + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: *
1. Incorrect parameter types. * @throws { BusinessError } 12500001 - Authentication failed. * @throws { BusinessError } 12500002 - General operation error. @@ -1709,8 +1835,8 @@ declare namespace userAuth { * Start this authentication, an instance can only perform authentication once. * * @permission ohos.permission.ACCESS_BIOMETRIC - * @throws { BusinessError } 201 - Permission verification failed. - * @throws { BusinessError } 401 - Incorrect parameters. Possible causes: + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: *
1. Incorrect parameter types. * @throws { BusinessError } 12500001 - Authentication failed. * @throws { BusinessError } 12500002 - General operation error. @@ -1737,10 +1863,10 @@ declare namespace userAuth { *

* * @permission ohos.permission.ACCESS_BIOMETRIC or ohos.permission.USER_AUTH_FROM_BACKGROUND - * @throws { BusinessError } 201 - Permission verification failed. Possible causes: + * @throws { BusinessError } 201 - Permission denied. Possible causes: *
1. No permission to access biometric. *
2. No permission to start authentication from background. - * @throws { BusinessError } 401 - Incorrect parameters. Possible causes: + * @throws { BusinessError } 401 - Parameter error. Possible causes: *
1. Incorrect parameter types. * @throws { BusinessError } 12500001 - Authentication failed. * @throws { BusinessError } 12500002 - General operation error. @@ -1756,16 +1882,24 @@ declare namespace userAuth { * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice * @since 20 + */ + /** + * Starts authentication. + * + * @type { function } UserAuthInstanceStartFunc + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @atomicservice + * @since 22 * @arkts 1.1&1.2 */ - start(): void; + start: UserAuthInstanceStartFunc; /** * Cancel this authentication. * * @permission ohos.permission.ACCESS_BIOMETRIC - * @throws { BusinessError } 201 - Permission verification failed. - * @throws { BusinessError } 401 - Incorrect parameters. Possible causes: + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: *
1. Incorrect parameter types. * @throws { BusinessError } 12500002 - General operation error. * @syscap SystemCapability.UserIAM.UserAuth.Core @@ -1779,16 +1913,33 @@ declare namespace userAuth { *

* * @permission ohos.permission.ACCESS_BIOMETRIC - * @throws { BusinessError } 201 - Permission verification failed. - * @throws { BusinessError } 401 - Incorrect parameters. Possible causes: + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: *
1. Incorrect parameter types. * @throws { BusinessError } 12500002 - General operation error. * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since 12 + */ + /** + * Cancels this authentication. + * + * @type { function } UserAuthInstanceCancelFunc + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @atomicservice + * @since 22 * @arkts 1.1&1.2 */ - cancel(): void; + cancel: UserAuthInstanceCancelFunc; + + /** + * @arkts 1.2 + */ + overload on { onResult, onTip }; + /** + * @arkts 1.2 + */ + overload off { offResult, offTip }; } /** @@ -1826,7 +1977,7 @@ declare namespace userAuth { * @throws { BusinessError } 12500006 - The authentication trust level is not supported. * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ function getUserAuthInstance(authParam: AuthParam, widgetParam: WidgetParam): UserAuthInstance; @@ -1837,7 +1988,7 @@ declare namespace userAuth { * @enum { int } * @syscap SystemCapability.UserIAM.UserAuth.Core * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'10','1.2':'20'} + * @since arkts {'1.1':'10','1.2':'22'} * @arkts 1.1&1.2 */ enum NoticeType { @@ -1846,7 +1997,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'10','1.2':'20'} + * @since arkts {'1.1':'10','1.2':'22'} * @arkts 1.1&1.2 */ WIDGET_NOTICE = 1 @@ -1867,7 +2018,7 @@ declare namespace userAuth { * @throws { BusinessError } 12500002 - General operation error. * @syscap SystemCapability.UserIAM.UserAuth.Core * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'10','1.2':'20'} + * @since arkts {'1.1':'10','1.2':'22'} * @arkts 1.1&1.2 */ function sendNotice(noticeType: NoticeType, eventData: string): void; @@ -1885,7 +2036,7 @@ declare namespace userAuth { * @enum { int } * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ enum UserAuthResultCode { @@ -1900,7 +2051,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ SUCCESS = 12500000, @@ -1916,7 +2067,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ FAIL = 12500001, @@ -1932,7 +2083,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ GENERAL_ERROR = 12500002, @@ -1948,7 +2099,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ CANCELED = 12500003, @@ -1964,7 +2115,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ TIMEOUT = 12500004, @@ -1980,7 +2131,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ TYPE_NOT_SUPPORT = 12500005, @@ -1996,7 +2147,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ TRUST_LEVEL_NOT_SUPPORT = 12500006, @@ -2012,7 +2163,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ BUSY = 12500007, @@ -2028,7 +2179,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ LOCKED = 12500009, @@ -2044,7 +2195,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ NOT_ENROLLED = 12500010, @@ -2061,7 +2212,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ CANCELED_FROM_WIDGET = 12500011, @@ -2071,7 +2222,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} + * @since arkts {'1.1':'12','1.2':'22'} * @arkts 1.1&1.2 */ PIN_EXPIRED = 12500013, @@ -2081,7 +2232,7 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'18','1.2':'20'} + * @since arkts {'1.1':'18','1.2':'22'} * @arkts 1.1&1.2 */ AUTH_TOKEN_CHECK_FAILED = 12500015, @@ -2092,12 +2243,51 @@ declare namespace userAuth { * * @syscap SystemCapability.UserIAM.UserAuth.Core * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'18','1.2':'20'} + * @since arkts {'1.1':'18','1.2':'22'} * @arkts 1.1&1.2 */ AUTH_TOKEN_EXPIRED = 12500016 } + /** + * Subscribes to commands from the user authentication framework for the user authentication widget. + * + * @typedef { function } UserAuthWidgetMgrOnFunc + * @param { 'command' } type - Event type. The vlaue is command, which indicates the command sent from the user + * authentication framework to the user authentication widget. + * @param { IAuthWidgetCallback } callback - Callback used to return the command from the user authentication + * framework to the user authentication widget. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + *
3. Parameter verification failed. + * @throws { BusinessError } 12500002 - General operation error. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @systemapi Hide this for inner system use. + * @since 22 + * @arkts 1.1&1.2 + */ + type UserAuthWidgetMgrOnFunc = (type: 'command', callback: IAuthWidgetCallback) => void; + + /** + * Unsubscribes from commands sent from the user authentication framework. + * + * @typedef { function } UserAuthWidgetMgrOffFunc + * @param { 'command' } type - Event type. The value is command, which indicates the command sent from the user + * authentication framework to the user authentication widget. + * @param { IAuthWidgetCallback } callback - Callback to unregister. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + *
3. Parameter verification failed. + * @throws { BusinessError } 12500002 - General operation error. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @systemapi Hide this for inner system use. + * @since 22 + * @arkts 1.1&1.2 + */ + type UserAuthWidgetMgrOffFunc = (type: 'command', callback?: IAuthWidgetCallback) => void; + /** * Provides APIs for managing the user authentication widget. You can use the APIs to register the user * authentication widget with UserAuthWidgetMgr for management and scheduling. @@ -2105,7 +2295,7 @@ declare namespace userAuth { * @interface UserAuthWidgetMgr * @syscap SystemCapability.UserIAM.UserAuth.Core * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'10','1.2':'20'} + * @since arkts {'1.1':'10','1.2':'22'} * @arkts 1.1&1.2 */ interface UserAuthWidgetMgr { @@ -2116,17 +2306,25 @@ declare namespace userAuth { * authentication framework to the user authentication widget. * @param { IAuthWidgetCallback } callback - Callback used to return the command from the user authentication * framework to the user authentication widget. - * @throws { BusinessError } 401 - Incorrect parameters. Possible causes: + * @throws { BusinessError } 401 - Parameter error. Possible causes: *
1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. *
3. Parameter verification failed. * @throws { BusinessError } 12500002 - General operation error. * @syscap SystemCapability.UserIAM.UserAuth.Core * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'10','1.2':'20'} + * @since 10 + */ + /** + * Subscribes to commands from the user authentication framework for the user authentication widget. + * + * @type { UserAuthWidgetMgrOnFunc } + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @systemapi Hide this for inner system use. + * @since 22 * @arkts 1.1&1.2 */ - on(type: 'command', callback: IAuthWidgetCallback): void; + on: UserAuthWidgetMgrOnFunc; /** * Unsubscribes from commands sent from the user authentication framework. @@ -2134,17 +2332,25 @@ declare namespace userAuth { * @param { 'command' } type - Event type. The value is command, which indicates the command sent from the user * authentication framework to the user authentication widget. * @param { IAuthWidgetCallback } callback - Callback to unregister. - * @throws { BusinessError } 401 - Incorrect parameters. Possible causes: + * @throws { BusinessError } 401 - Parameter error. Possible causes: *
1. Mandatory parameters are left unspecified. *
2. Incorrect parameter types. *
3. Parameter verification failed. * @throws { BusinessError } 12500002 - General operation error. * @syscap SystemCapability.UserIAM.UserAuth.Core * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'10','1.2':'20'} + * @since 10 + */ + /** + * Unsubscribes from commands sent from the user authentication framework. + * + * @type { UserAuthWidgetMgrOffFunc } + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @systemapi Hide this for inner system use. + * @since 22 * @arkts 1.1&1.2 */ - off(type: 'command', callback?: IAuthWidgetCallback): void; + off: UserAuthWidgetMgrOffFunc; } /** @@ -2165,11 +2371,24 @@ declare namespace userAuth { * @throws { BusinessError } 12500002 - General operation error. * @syscap SystemCapability.UserIAM.UserAuth.Core * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'10','1.2':'20'} + * @since arkts {'1.1':'10','1.2':'22'} * @arkts 1.1&1.2 */ function getUserAuthWidgetMgr(version: int): UserAuthWidgetMgr; + /** + * Called to return the command sent from the user authentication framework to the user authentication widget. + * + * @typedef { function } AuthWidgetCallbackSendCommandFunc + * @param { string } cmdData - Command sent from the user authentication framework to the user + * authentication widget. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @systemapi Hide this for inner system use. + * @since 22 + * @arkts 1.1&1.2 + */ + type AuthWidgetCallbackSendCommandFunc = (cmdData: string) => void; + /** * Provides the callback for returning the commands sent from the user authentication framework * to the user authentication widget. @@ -2177,7 +2396,7 @@ declare namespace userAuth { * @interface IAuthWidgetCallback * @syscap SystemCapability.UserIAM.UserAuth.Core * @systemapi Hide this for inner system use. - * @since arkts {'1.1':'10','1.2':'20'} + * @since arkts {'1.1':'10','1.2':'22'} * @arkts 1.1&1.2 */ interface IAuthWidgetCallback { @@ -2190,17 +2409,16 @@ declare namespace userAuth { * @systemapi Hide this for inner system use. * @since 10 */ - sendCommand(cmdData: string): void; /** * Called to return the command sent from the user authentication framework to the user authentication widget. * - * @type { function } + * @type { AuthWidgetCallbackSendCommandFunc } * @syscap SystemCapability.UserIAM.UserAuth.Core * @systemapi Hide this for inner system use. - * @since 20 - * @arkts 1.2 + * @since 22 + * @arkts 1.1&1.2 */ - sendCommand: (cmdData: string) => void; + sendCommand: AuthWidgetCallbackSendCommandFunc; } /**