1e41f4b71Sopenharmony_ci# User IAM Subsystem ChangeLog 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci## cl.useriam.1 API Exception Handling Method Change 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ciCertain APIs of user IAM use service logic return values to indicate error information, which does not comply with the API error code specifications of OpenHarmony. The following changes are made in API version 9 and later: 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ciAn error message is returned via an exception. 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci**Change Impacts** 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ciApplications developed based on earlier versions are not affected. If your application uses API version 9 or later, you need to adapt the change in the way for APIs to return the error information. Otherwise, service logic will be affected. 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ci**Key API/Component Changes** 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ciFor adaptation to the unified API exception handling mode, certain APIs of user IAM are deprecated (original APIs in the following table) and corresponding new APIs in the following table are added. The newly added APIs support unified error code handling specifications and function the same as the original APIs. 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci| Module | Class | Method/Attribute/Enumeration/Constant | Change Type | 18e41f4b71Sopenharmony_ci| ---------------------- | ------------------- | ------------------------- | ------------------------ | 19e41f4b71Sopenharmony_ci| ohos.userIAM.userAuth | UserAuth | constructor() | Deprecated| 20e41f4b71Sopenharmony_ci| ohos.userIAM.userAuth | UserAuth | getVersion() : number | Deprecated| 21e41f4b71Sopenharmony_ci| ohos.userIAM.userAuth | UserAuth | getAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel) : number | Deprecated| 22e41f4b71Sopenharmony_ci| ohos.userIAM.userAuth | UserAuth | auth(challenge: Uint8Array, authType: UserAuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array | Deprecated| 23e41f4b71Sopenharmony_ci| ohos.userIAM.userAuth | UserAuth | cancelAuth(contextID : Uint8Array) : number | Deprecated| 24e41f4b71Sopenharmony_ci| ohos.userIAM.userAuth | IUserAuthCallback | onResult: (result : number, extraInfo : AuthResult) => void | Deprecated| 25e41f4b71Sopenharmony_ci| ohos.userIAM.userAuth | IUserAuthCallback | onAcquireInfo ?: (module : number, acquire : number, extraInfo : any) => void | Deprecated| 26e41f4b71Sopenharmony_ci| ohos.userIAM.userAuth | AuthResult | AuthResult {<br>token ?: Uint8Array; <br>remainTimes ?: number; <br>freezingTime ?: number;} | Deprecated| 27e41f4b71Sopenharmony_ci| ohos.userIAM.userAuth | Enumeration| ResultCode {<br>SUCCESS = 0, <br>FAIL = 1, <br>GENERAL_ERROR = 2, <br>CANCELED = 3, <br>TIMEOUT = 4, <br>TYPE_NOT_SUPPORT = 5, <br>TRUST_LEVEL_NOT_SUPPORT = 6, <br>BUSY = 7, <br>INVALID_PARAMETERS = 8, <br>LOCKED = 9, <br>NOT_ENROLLED = 10,} | Deprecated| 28e41f4b71Sopenharmony_ci| ohos.userIAM.userAuth | type | AuthEventKey = "result" | Added| 29e41f4b71Sopenharmony_ci| ohos.userIAM.userAuth | type | EventInfo = AuthResultInfo | Added| 30e41f4b71Sopenharmony_ci| ohos.userIAM.userAuth | AuthResultInfo | AuthResultInfo {<br>result : number; <br>token ?: Uint8Array; <br>remainAttempts ?: number; <br>lockoutDuration ?: number;} | Added| 31e41f4b71Sopenharmony_ci| ohos.userIAM.userAuth | TipInfo | TipInfo {<br>module : number; <br>tip : number;} | Added| 32e41f4b71Sopenharmony_ci| ohos.userIAM.userAuth | AuthInstance | AuthInstance {<br>on: (name: AuthEventKey, callback: AuthEvent) => void; <br>off: (name: AuthEventKey) => void; <br>start: () => void; <br>cancel: () => void;} | Added| 33e41f4b71Sopenharmony_ci| ohos.userIAM.userAuth | Enumeration| ResultCodeV9 {<br>SUCCESS = 12500000, <br>FAIL = 12500001, <br>GENERAL_ERROR = 12500002, <br>CANCELED = 12500003, <br>TIMEOUT = 12500004, <br>TYPE_NOT_SUPPORT = 12500005, <br>TRUST_LEVEL_NOT_SUPPORT = 12500006, <br>BUSY = 12500007, <br>LOCKED = 12500009, <br>NOT_ENROLLED = 12500010,} | Added| 34e41f4b71Sopenharmony_ci| ohos.userIAM.userAuth | function | getAuthInstance(challenge : Uint8Array, authType : UserAuthType, authTrustLevel : AuthTrustLevel) : AuthInstance | Added| 35e41f4b71Sopenharmony_ci| ohos.userIAM.userAuth | function | getVersion() : number | Added| 36e41f4b71Sopenharmony_ci| ohos.userIAM.userAuth | function | getAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel) : void | Added| 37e41f4b71Sopenharmony_ci| ohos.userIAM.faceAuth | FaceAuthManager | setSurfaceId(surfaceId : string) : ResultCode | Deleted| 38e41f4b71Sopenharmony_ci| ohos.userIAM.faceAuth | Enumeration| ResultCode {<br>SUCCESS = 0, <br>FAIL = 1,} | Deleted| 39e41f4b71Sopenharmony_ci| ohos.userIAM.faceAuth | FaceAuthManager | setSurfaceId(surfaceId: string) : void | Added| 40e41f4b71Sopenharmony_ci 41e41f4b71Sopenharmony_ci**Adaptation Guide** 42e41f4b71Sopenharmony_ci 43e41f4b71Sopenharmony_ciThe following uses **getVersion** as an example: 44e41f4b71Sopenharmony_ci 45e41f4b71Sopenharmony_ci```js 46e41f4b71Sopenharmony_ciimport userIAM_userAuth from '@ohos.userIAM.userAuth'; 47e41f4b71Sopenharmony_ci 48e41f4b71Sopenharmony_citry { 49e41f4b71Sopenharmony_ci let version = userIAM_userAuth.getVersion(); 50e41f4b71Sopenharmony_ci console.info("auth version = " + version); 51e41f4b71Sopenharmony_ci} catch (error) { 52e41f4b71Sopenharmony_ci console.info("get version failed, error = " + error); 53e41f4b71Sopenharmony_ci} 54e41f4b71Sopenharmony_ci``` 55e41f4b71Sopenharmony_ci 56e41f4b71Sopenharmony_ciFor sample code of more APIs, see the [user authentication API reference](../../../application-dev/reference/apis/js-apis-useriam-userauth.md) and [face authentication API reference](../../../application-dev/reference/apis/js-apis-useriam-faceauth.md). 57e41f4b71Sopenharmony_ci 58e41f4b71Sopenharmony_ci## cl.useriam.2 API Call Permission Change 59e41f4b71Sopenharmony_ci 60e41f4b71Sopenharmony_ciSome APIs of user IAM can only be called by system applications, and system application runtime authentication is required. The following changes are made in API version 9 and later: 61e41f4b71Sopenharmony_ci 62e41f4b71Sopenharmony_ciThe service logic for checking whether an application is a system application is added for the **setSurfaceId** API of the face authentication module. Non-system applications cannot call this API. 63e41f4b71Sopenharmony_ci 64e41f4b71Sopenharmony_ci**Change Impacts** 65e41f4b71Sopenharmony_ci 66e41f4b71Sopenharmony_ciApplications developed based on earlier versions are not affected. If your application uses API version 9 or later and wants to call this API, your application must be a system application. 67e41f4b71Sopenharmony_ci 68e41f4b71Sopenharmony_ci**Key API/Component Changes** 69e41f4b71Sopenharmony_ci 70e41f4b71Sopenharmony_ciThe service logic for checking whether an application is a system application is added for the **setSurfaceId** API. Error code **202** will be returned if the API is called by a non-system application. 71e41f4b71Sopenharmony_ci 72e41f4b71Sopenharmony_ci**Adaptation Guide** 73e41f4b71Sopenharmony_ci 74e41f4b71Sopenharmony_ciModify the **UnsgnedReleasedProfileTemplate.json** file related to [app signing](https://gitee.com/openharmony/developtools_hapsigner/tree/master/dist) to change the **app-feature** field to **hos_system_app**, so that the signed application is a system application. 75