1# Account Subsystem ChangeLog 2 3## cl.account_os_account.1 Change in Error Information Return Method of Account System APIs 4 5Certain system APIs of the account subsystem 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: 6 7Asynchronous API: An error message is returned via **AsyncCallback** or the **error** object of **Promise**. 8 9Synchronous API: An error message is returned via an exception. 10 11**Change Impacts** 12 13The application developed based on earlier versions needs to adapt the new APIs and their method for returning API error information. Otherwise, the original service logic will be affected. 14 15**Key API/Component Changes** 16 17Before change: 18 - class UserAuth 19 - setProperty(request: SetPropertyRequest, callback: AsyncCallback<number>): void; 20 - setProperty(request: SetPropertyRequest): Promise<number>; 21 - cancelAuth(contextID: Uint8Array): number; 22 - class PINAuth 23 - registerInputer(inputer: Inputer): boolean; 24 - UserIdentityManager 25 - cancel(challenge: Uint8Array): number; 26 27After change: 28 - class UserAuth 29 - setProperty(request: SetPropertyRequest, callback: AsyncCallback<void>): void; 30 - setProperty(request: SetPropertyRequest): Promise<void>; 31 - cancelAuth(contextID: Uint8Array): void; 32 - class PINAuth 33 - registerInputer(inputer: Inputer): void; 34 - UserIdentityManager 35 - cancel(challenge: Uint8Array): void; 36 37**Adaptation Guide** 38 39The following uses **setProperty** as an example for asynchronous APIs: 40 41``` 42import account_osAccount from "@ohos.account.osAccount" 43userAuth.setProperty({ 44 authType: account_osAccount.AuthType.PIN, 45 key: account_osAccount.SetPropertyType.INIT_ALGORITHM, 46 setInfo: new Uint8Array([0]) 47}, (err) => { 48 if (err) { 49 console.log("setProperty failed, error: " + JSON.stringify(err)); 50 } else { 51 console.log("setProperty successfully"); 52 } 53}); 54 55userAuth.setProperty({ 56 authType: account_osAccount.AuthType.PIN, 57 key: account_osAccount.SetPropertyType.INIT_ALGORITHM, 58 setInfo: new Uint8Array([0]) 59}).catch((err) => { 60 if (err) { 61 console.log("setProperty failed, error: " + JSON.stringify(err)); 62 } else { 63 console.log("setProperty successfully"); 64 } 65}); 66``` 67 68The following uses **registerInputer** as an example for synchronous APIs: 69 70``` 71import account_osAccount from "@ohos.account.osAccount" 72let pinAuth = new account_osAccount.PINAuth() 73let inputer = { 74 onGetData: (authType, passwordRecipient) => { 75 let password = new Uint8Array([0]); 76 passwordRecipient.onSetData(authType, password); 77 } 78} 79try { 80 pinAuth.registerInputer(inputer); 81} catch (err) { 82 console.log("registerInputer failed, error: " + JSON.stringify(err)); 83} 84``` 85 86## cl.account_os_account.2 ACTION Definition Change for the Application Account Authentication Service 87 88**Change Impacts** 89 90For the application developed based on an earlier version, you need to modify **ACTION** in the application configuration file (**config.json** for the FA model and **module.json5** for the Stage model) to normally provide the application authentication service. 91 92**Key API/Component Changes** 93 94Involved constant: 95 96@ohos.ability.wantConstant.ACTION_APP_ACCOUNT_AUTH 97 98Before change: 99 100ACTION_APP_ACCOUNT_AUTH = "account.appAccount.action.auth" 101 102After change: 103 104ACTION_APP_ACCOUNT_AUTH = "ohos.appAccount.action.auth" 105 106**Adaptation Guide** 107 108For a third-party application providing the account authentication service, adapt the changed application account authentication **ACTION** in the **ServiceAbility** configuration file (**config.json** for the FA module or **module.json5** for the Stage module). 109``` 110"abilities": [ 111 { 112 "name": "ServiceAbility", 113 "srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts", 114 ... 115 "visible": true, 116 "skills": { 117 { 118 "actions": [ 119 "ohos.appAccount.action.auth" 120 ] 121 } 122 } 123 }] 124} 125