• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.account.osAccount (System Account) (System API)
2
3The **osAccount** module provides basic capabilities for managing system (OS) accounts, including adding, deleting, querying, setting, subscribing to, and enabling a system account.
4
5> **NOTE**
6>
7> - The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8> - This topic describes only the system APIs provided by the module. For details about its public APIs, see [ohos.account.osAccount (System Account Management)](js-apis-osAccount.md).
9
10## Modules to Import
11
12```ts
13import { osAccount } from '@kit.BasicServicesKit';
14```
15
16## AccountManager
17
18Provides APIs for managing system accounts.
19
20### activateOsAccount
21
22activateOsAccount(localId: number, callback: AsyncCallback<void>): void
23
24Activates a system account. This API uses an asynchronous callback to return the result.
25
26**System API**: This is a system API.
27
28**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
29
30**System capability**: SystemCapability.Account.OsAccount
31
32**Parameters**
33
34| Name  | Type                      | Mandatory| Description                                               |
35| -------- | ------------------------- | ---- | -------------------------------------------------- |
36| localId  | number                    | Yes  | ID of the target system account.                 |
37| callback | AsyncCallback<void> | Yes  | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
38
39**Error codes**
40
41| ID| Error Message            |
42| -------- | ------------------- |
43| 201 | Permission denied.|
44| 202 | Not system application.|
45| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
46| 12300001 | The system service works abnormally. |
47| 12300002 | Invalid localId.    |
48| 12300003 | Account not found. |
49| 12300008 | Restricted Account. |
50| 12300016 | The number of logged in accounts reaches the upper limit. |
51
52**Example**: Activate system account 100.
53  ```ts
54  import { BusinessError } from '@kit.BasicServicesKit';
55  let localId: number = 100;
56  try {
57    accountManager.activateOsAccount(localId, (err: BusinessError)=>{
58      if (err) {
59        console.error(`activateOsAccount failed, code is ${err.code}, message is ${err.message}`);
60      } else {
61        console.log('activateOsAccount successfully');
62      }
63    });
64  } catch (err) {
65    console.log('activateOsAccount failed, error:' + JSON.stringify(err));
66  }
67  ```
68
69### activateOsAccount
70
71activateOsAccount(localId: number): Promise<void>
72
73Activates a system account. This API uses a promise to return the result.
74
75**System API**: This is a system API.
76
77**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
78
79**System capability**: SystemCapability.Account.OsAccount
80
81**Parameters**
82
83| Name | Type  | Mandatory| Description                |
84| ------- | ------ | ---- | -------------------- |
85| localId | number | Yes  | ID of the target system account.|
86
87**Return value**
88
89| Type               | Description                                 |
90| ------------------- | ------------------------------------ |
91| Promise<void> | Promise that returns no value.|
92
93**Error codes**
94
95| ID| Error Message            |
96| -------- | ------------------- |
97| 201 | Permission denied.|
98| 202 | Not system application.|
99| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
100| 12300001 | The system service works abnormally. |
101| 12300002 | Invalid localId.    |
102| 12300003 | Account not found. |
103| 12300008 | Restricted Account. |
104| 12300016 | The number of logged in accounts reaches the upper limit. |
105
106**Example**: Activate system account 100.
107  ```ts
108  import { BusinessError } from '@kit.BasicServicesKit';
109  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
110  let localId: number = 100;
111  try {
112    accountManager.activateOsAccount(localId).then(() => {
113      console.log('activateOsAccount successfully');
114    }).catch((err: BusinessError) => {
115      console.log('activateOsAccount failed, err:' + JSON.stringify(err));
116    });
117  } catch (e) {
118    console.log('activateOsAccount exception: ' + JSON.stringify(e));
119  }
120  ```
121
122### deactivateOsAccount<sup>12+</sup>
123
124deactivateOsAccount(localId: number): Promise&lt;void&gt;
125
126Deactivates (logs out of) a system account. This API uses a promise to return the result.
127
128**System API**: This is a system API.
129
130**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
131
132**System capability**: SystemCapability.Account.OsAccount
133
134**Parameters**
135
136| Name | Type  | Mandatory| Description                |
137| ------- | ------ | ---- | -------------------- |
138| localId | number | Yes  | ID of the target system account.|
139
140**Return value**
141
142| Type               | Description                                 |
143| ------------------- | ------------------------------------ |
144| Promise&lt;void&gt; | Promise that returns no value.|
145
146**Error codes**
147
148| ID| Error Message            |
149| -------- | ------------------- |
150| 201 | Permission denied.|
151| 202 | Not system application.|
152| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
153| 12300001 | The system service works abnormally. |
154| 12300003 | Account not found. |
155| 12300008 | Restricted Account. |
156
157**Example**: Deactivate system account 100.
158  ```ts
159  import { BusinessError } from '@kit.BasicServicesKit';
160  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
161  let localId: number = 100;
162  try {
163    accountManager.deactivateOsAccount(localId).then(() => {
164      console.log('deactivateOsAccount successfully');
165    }).catch((err: BusinessError) => {
166      console.log('deactivateOsAccount failed, err:' + JSON.stringify(err));
167    });
168  } catch (e) {
169    console.log('deactivateOsAccount exception: ' + JSON.stringify(e));
170  }
171  ```
172
173### isOsAccountActivated<sup>11+</sup>
174
175isOsAccountActivated(localId: number): Promise&lt;boolean&gt;
176
177Checks whether a system account is activated. This API uses a promise to return the result.
178
179**System API**: This is a system API.
180
181**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
182
183**System capability**: SystemCapability.Account.OsAccount
184
185**Parameters**
186
187| Name | Type  | Mandatory| Description                              |
188| ------- | ------ | ---- | --------------------------------- |
189| localId | number | Yes  | ID of the target system account.|
190
191**Return value**
192
193| Type                  | Description                                                      |
194| ---------------------- | ---------------------------------------------------------- |
195| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means the account is activated; the value **false** means the opposite.|
196
197**Error codes**
198
199| ID| Error Message            |
200| -------- | ------------------- |
201| 201 | Permission denied.|
202| 202 | Not system application.|
203| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
204| 12300001 | The system service works abnormally. |
205| 12300003 | Account not found. |
206
207**Example**: Check whether system account 100 is activated.
208
209  ```ts
210  import { BusinessError } from '@kit.BasicServicesKit';
211  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
212  let localId: number = 100;
213  try {
214    accountManager.isOsAccountActivated(localId).then((isActivated: boolean) => {
215      console.log('isOsAccountActivated successfully, isActivated: ' + isActivated);
216    }).catch((err: BusinessError) => {
217      console.log('isOsAccountActivated failed, error: ' + JSON.stringify(err));
218    });
219  } catch (err) {
220    console.log('isOsAccountActivated exception: ' + JSON.stringify(err));
221  }
222  ```
223
224### isOsAccountConstraintEnabled<sup>11+</sup>
225
226isOsAccountConstraintEnabled(localId: number, constraint: string): Promise&lt;boolean&gt;
227
228Checks whether a constraint is enabled for a system account. This API uses a promise to return the result.
229
230**System API**: This is a system API.
231
232**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
233
234**System capability**: SystemCapability.Account.OsAccount
235
236**Parameters**
237
238| Name    | Type  | Mandatory| Description                               |
239| ---------- | ------ | ---- | ---------------------------------- |
240| localId    | number | Yes  | ID of the target system account. |
241| constraint | string | Yes  | [Constraint](js-apis-osAccount.md#constraints) to check.|
242
243**Return value**
244
245| Type                  | Description                                                                 |
246| --------------------- | --------------------------------------------------------------------- |
247| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means the specified constraint is enabled; the value **false** means the opposite.|
248
249**Error codes**
250
251| ID| Error Message            |
252| -------- | ------------------- |
253| 201 | Permission denied.|
254| 202 | Not system application.|
255| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
256| 12300001 | The system service works abnormally. |
257| 12300003 | Account not found. |
258
259**Example**: Check whether system account 100 is forbidden to use Wi-Fi.
260
261  ```ts
262  import { BusinessError } from '@kit.BasicServicesKit';
263  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
264  let localId: number = 100;
265  let constraint: string = 'constraint.wifi';
266  try {
267    accountManager.isOsAccountConstraintEnabled(localId, constraint).then((isEnabled: boolean) => {
268      console.log('isOsAccountConstraintEnabled successfully, isEnabled: ' + isEnabled);
269    }).catch((err: BusinessError) => {
270      console.log('isOsAccountConstraintEnabled failed, error: ' + JSON.stringify(err));
271    });
272  } catch (err) {
273    console.log('isOsAccountConstraintEnabled exception: ' + JSON.stringify(err));
274  }
275  ```
276
277### isOsAccountUnlocked<sup>11+</sup>
278
279isOsAccountUnlocked(localId: number): Promise&lt;boolean&gt;
280
281Checks whether a system account has been verified. This API uses a promise to return the result.
282
283**System API**: This is a system API.
284
285**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
286
287**System capability**: SystemCapability.Account.OsAccount
288
289**Parameters**
290
291| Name | Type  | Mandatory| Description                                                             |
292| ------- | ------ | ---- | --------------------------------------------------------------- |
293| localId | number | Yes  | ID of the target system account. If this parameter is not specified, this API checks whether the current system account has been verified.|
294
295**Return value**
296
297| Type                  | Description                                                              |
298| ---------------------- | ----------------------------------------------------------------- |
299| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means the system account has been verified; the value **false** means the opposite.|
300
301**Error codes**
302
303| ID| Error Message            |
304| -------- | ------------------- |
305| 201 | Permission denied.|
306| 202 | Not system application.|
307| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
308| 12300001 | The system service works abnormally. |
309| 12300003 | Account not found. |
310
311**Example**
312
313  ```ts
314  import { BusinessError } from '@kit.BasicServicesKit';
315  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
316  let localId: number = 100;
317  try {
318    accountManager.isOsAccountUnlocked(localId).then((isVerified: boolean) => {
319      console.log('isOsAccountUnlocked successfully, isVerified: ' + isVerified);
320    }).catch((err: BusinessError) => {
321      console.log('isOsAccountUnlocked failed, error: ' + JSON.stringify(err));
322    });
323  } catch (err) {
324    console.log('isOsAccountUnlocked exception: ' + JSON.stringify(err));
325  }
326  ```
327
328### removeOsAccount
329
330removeOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void
331
332Removes a system account. This API uses an asynchronous callback to return the result.
333
334**System API**: This is a system API.
335
336**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
337
338**System capability**: SystemCapability.Account.OsAccount
339
340**Parameters**
341
342| Name  | Type                     | Mandatory| Description                                                |
343| -------- | ------------------------- | ---- | -------------------------------------------------- |
344| localId  | number                    | Yes  | ID of the target system account.                 |
345| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
346
347**Error codes**
348
349| ID| Error Message            |
350| -------- | ------------------- |
351| 201 | Permission denied.|
352| 202 | Not system application.|
353| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.|
354| 12300001 | The system service works abnormally. |
355| 12300002 | Invalid localId.    |
356| 12300003 | Account not found. |
357| 12300008 | Restricted Account. |
358| 12300010 | Service busy. Possible causes: The target account is being operated. |
359
360**Example**
361
362  ```ts
363  import { BusinessError } from '@kit.BasicServicesKit';
364  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
365  let accountName: string = 'testAccountName';
366  try {
367    accountManager.createOsAccount(accountName, osAccount.OsAccountType.NORMAL,
368      (err: BusinessError, osAccountInfo: osAccount.OsAccountInfo) => {
369        accountManager.removeOsAccount(osAccountInfo.localId, (err: BusinessError)=>{
370          if (err) {
371            console.log('removeOsAccount failed, error: ' + JSON.stringify(err));
372          } else {
373            console.log('removeOsAccount successfully');
374          }
375      });
376    });
377  } catch (err) {
378    console.log('removeOsAccount exception: ' + JSON.stringify(err));
379  }
380  ```
381
382### removeOsAccount
383
384removeOsAccount(localId: number): Promise&lt;void&gt;
385
386Removes a system account. This API uses a promise to return the result.
387
388**System API**: This is a system API.
389
390**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
391
392**System capability**: SystemCapability.Account.OsAccount
393
394**Parameters**
395
396| Name | Type  | Mandatory| Description                              |
397| ------- | ------ | ---- | --------------------------------- |
398| localId | number | Yes  | ID of the target system account.|
399
400**Return value**
401
402| Type               | Description                                 |
403| ------------------- | ------------------------------------ |
404| Promise&lt;void&gt; | Promise that returns no value.|
405
406**Error codes**
407
408| ID| Error Message            |
409| -------- | ------------------- |
410| 201 | Permission denied.|
411| 202 | Not system application.|
412| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.|
413| 12300001 | The system service works abnormally. |
414| 12300002 | Invalid localId.    |
415| 12300003 | Account not found. |
416| 12300008 | Restricted Account. |
417| 12300010 | Service busy. Possible causes: The target account is being operated. |
418
419**Example**
420
421  ```ts
422  import { BusinessError } from '@kit.BasicServicesKit';
423  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
424  let accountName: string = 'testAccountName';
425  try {
426    accountManager.createOsAccount(accountName, osAccount.OsAccountType.NORMAL,
427      (err: BusinessError, osAccountInfo: osAccount.OsAccountInfo)=>{
428        accountManager.removeOsAccount(osAccountInfo.localId).then(() => {
429          console.log('removeOsAccount successfully');
430        }).catch((err: BusinessError) => {
431            console.log('removeOsAccount failed, error: ' + JSON.stringify(err));
432        });
433    });
434  } catch (err) {
435    console.log('removeOsAccount exception: ' + JSON.stringify(err));
436  }
437  ```
438
439### setOsAccountConstraints
440
441setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enable: boolean,callback: AsyncCallback&lt;void&gt;): void
442
443Sets or removes constraints for a system account. This API uses an asynchronous callback to return the result.
444
445**System API**: This is a system API.
446
447**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
448
449**System capability**: SystemCapability.Account.OsAccount
450
451**Parameters**
452
453| Name     | Type                     | Mandatory| Description                                            |
454| ----------- | ------------------------- | ---- | ----------------------------------------------- |
455| localId     | number                    | Yes  | ID of the target system account.              |
456| constraints | Array&lt;string&gt;       | Yes  | [Constraints](js-apis-osAccount.md#constraints) to set or remove.       |
457| enable      | boolean                   | Yes  | Set or remove constraints. The value **true** means to set constraints, and **false** means to remove constraints.                          |
458| callback    | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
459
460**Error codes**
461
462| ID| Error Message            |
463| -------- | ------------------- |
464| 201 | Permission denied.|
465| 202 | Not system application.|
466| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.|
467| 12300001 | The system service works abnormally. |
468| 12300002 | Invalid localId or constraints.    |
469| 12300003 | Account not found. |
470| 12300008 | Restricted Account. |
471
472**Example**: Disable Wi-Fi for system account 100.
473
474  ```ts
475  import { BusinessError } from '@kit.BasicServicesKit';
476  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
477  let localId: number = 100;
478  let constraint: string = 'constraint.wifi';
479  try {
480    accountManager.setOsAccountConstraints(localId, [constraint], true, (err: BusinessError) => {
481      if (err) {
482        console.log('setOsAccountConstraints failed, error: ' + JSON.stringify(err));
483      } else {
484        console.log('setOsAccountConstraints successfully');
485      }
486    });
487  } catch (err) {
488    console.log('setOsAccountConstraints exception: ' + JSON.stringify(err));
489  }
490  ```
491
492### setOsAccountConstraints
493
494setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enable: boolean): Promise&lt;void&gt;
495
496Sets or removes constraints for a system account. This API uses a promise to return the result.
497
498**System API**: This is a system API.
499
500**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
501
502**System capability**: SystemCapability.Account.OsAccount
503
504**Parameters**
505
506| Name     | Type               | Mandatory| Description                                        |
507| ----------- | ------------------- | ---- | -------------------------------------------- |
508| localId     | number              | Yes  | ID of the target system account.          |
509| constraints | Array&lt;string&gt; | Yes  | [Constraints](js-apis-osAccount.md#constraints) to set or remove.   |
510| enable      | boolean             | Yes  | Set or remove constraints. The value **true** means to set constraints, and **false** means to remove constraints.                    |
511
512**Return value**
513
514| Type               | Description                                |
515| :------------------ | :----------------------------------- |
516| Promise&lt;void&gt; | Promise that returns no value.|
517
518**Error codes**
519
520| ID| Error Message            |
521| -------- | ------------------- |
522| 201 | Permission denied.|
523| 202 | Not system application.|
524| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.|
525| 12300001 | The system service works abnormally. |
526| 12300002 | Invalid localId or constraints.    |
527| 12300003 | Account not found. |
528| 12300008 | Restricted Account. |
529
530**Example**: Remove the constraint on the use of Wi-Fi for system account 100.
531
532  ```ts
533  import { BusinessError } from '@kit.BasicServicesKit';
534  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
535  let localId: number = 100;
536  try {
537    accountManager.setOsAccountConstraints(localId, ['constraint.location.set'], false).then(() => {
538      console.log('setOsAccountConstraints succsuccessfully');
539    }).catch((err: BusinessError) => {
540      console.log('setOsAccountConstraints failed, error: ' + JSON.stringify(err));
541    });
542  } catch (err) {
543    console.log('setOsAccountConstraints exception: ' + JSON.stringify(err));
544  }
545  ```
546
547### setOsAccountName
548
549setOsAccountName(localId: number, localName: string, callback: AsyncCallback&lt;void&gt;): void
550
551Sets the name of a system account. This API uses an asynchronous callback to return the result.
552
553**System API**: This is a system API.
554
555**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
556
557**System capability**: SystemCapability.Account.OsAccount
558
559**Parameters**
560
561| Name   | Type                     | Mandatory| Description                                            |
562| :-------- | ------------------------- | ---- | ----------------------------------------------- |
563| localId   | number                    | Yes  | ID of the target system account.              |
564| localName | string                    | Yes  | Account name to set. The value cannot exceed 1024 characters.                         |
565| callback  | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
566
567**Error codes**
568
569| ID| Error Message            |
570| -------- | ------------------- |
571| 201 | Permission denied.|
572| 202 | Not system application.|
573| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.|
574| 12300001 | The system service works abnormally. |
575| 12300002 | Invalid localId or localName. |
576| 12300003 | Account not found. |
577| 12300008 | Restricted Account. |
578
579**Example**: Set the name of system account 100 to **demoName**.
580
581  ```ts
582  import { BusinessError } from '@kit.BasicServicesKit';
583  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
584  let localId: number = 100;
585  let name: string = 'demoName';
586  try {
587    accountManager.setOsAccountName(localId, name, (err: BusinessError) => {
588      if (err) {
589        console.log('setOsAccountName failed, error: ' + JSON.stringify(err));
590      } else {
591        console.log('setOsAccountName successfully');
592      }
593    });
594  } catch (err) {
595    console.log('setOsAccountName exception: ' + JSON.stringify(err));
596  }
597  ```
598
599### setOsAccountName
600
601setOsAccountName(localId: number, localName: string): Promise&lt;void&gt;
602
603Sets the name of a system account. This API uses a promise to return the result.
604
605**System API**: This is a system API.
606
607**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
608
609**System capability**: SystemCapability.Account.OsAccount
610
611**Parameters**
612
613| Name   | Type  | Mandatory| Description                               |
614| --------- | ------ | ---- | --------------------------------- |
615| localId   | number | Yes  | ID of the target system account.|
616| localName | string | Yes  | Account name to set. The value cannot exceed 1024 characters.           |
617
618**Return value**
619
620| Type               | Description                                 |
621| ------------------- | ------------------------------------ |
622| Promise&lt;void&gt; | Promise that returns no value.|
623
624**Error codes**
625
626| ID| Error Message            |
627| -------- | ------------------- |
628| 201 | Permission denied.|
629| 202 | Not system application.|
630| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.|
631| 12300001 | The system service works abnormally. |
632| 12300002 | Invalid localId or localName.    |
633| 12300003 | Account not found. |
634| 12300008 | Restricted Account. |
635
636**Example**: Set the name of system account 100 to **demoName**.
637
638  ```ts
639  import { BusinessError } from '@kit.BasicServicesKit';
640  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
641  let localId: number = 100;
642  let name: string = 'testName';
643  try {
644    accountManager.setOsAccountName(localId, name).then(() => {
645      console.log('setOsAccountName successfully');
646    }).catch((err: BusinessError) => {
647      console.log('setOsAccountName failed, error: ' + JSON.stringify(err));
648    });
649  } catch (err) {
650    console.log('setOsAccountName exception: ' + JSON.stringify(err));
651  }
652  ```
653
654### queryMaxOsAccountNumber
655
656queryMaxOsAccountNumber(callback: AsyncCallback&lt;number&gt;): void
657
658Queries the maximum number of system accounts that can be created. This API uses an asynchronous callback to return the result.
659
660**System API**: This is a system API.
661
662**System capability**: SystemCapability.Account.OsAccount
663
664**Parameters**
665
666| Name  | Type                       | Mandatory| Description                                                                             |
667| -------- | --------------------------- | ---- | -------------------------------------------------------------------------------- |
668| callback | AsyncCallback&lt;number&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the maximum number of system accounts that can be created. Otherwise, **err** is an error object.|
669
670**Error codes**
671
672| ID| Error Message      |
673| -------- | ------------- |
674| 202 | Not system application.|
675| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.|
676| 12300001 | The system service works abnormally. |
677
678**Example**
679
680  ```ts
681  import { BusinessError } from '@kit.BasicServicesKit';
682  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
683  try {
684    accountManager.queryMaxOsAccountNumber((err: BusinessError, maxCnt: number) => {
685      if (err) {
686        console.log('queryMaxOsAccountNumber failed, error:' + JSON.stringify(err));
687      } else {
688        console.log('queryMaxOsAccountNumber successfully, maxCnt:' + maxCnt);
689      }
690    });
691  } catch (err) {
692    console.log('queryMaxOsAccountNumber exception: ' + JSON.stringify(err));
693  }
694  ```
695
696### queryMaxOsAccountNumber
697
698queryMaxOsAccountNumber(): Promise&lt;number&gt;
699
700Queries the maximum number of system accounts that can be created. This API uses a promise to return the result.
701
702**System API**: This is a system API.
703
704**System capability**: SystemCapability.Account.OsAccount
705
706**Return value**
707
708| Type                 | Description                                        |
709| --------------------- | ------------------------------------------- |
710| Promise&lt;number&gt; | Promise used to return the maximum number of system accounts that can be created.|
711
712**Error codes**
713
714| ID| Error Message      |
715| -------- | ------------- |
716| 202 | Not system application.|
717| 12300001 | The system service works abnormally. |
718
719**Example**
720
721  ```ts
722  import { BusinessError } from '@kit.BasicServicesKit';
723  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
724  try {
725    accountManager.queryMaxOsAccountNumber().then((maxCnt: number) => {
726      console.log('queryMaxOsAccountNumber successfully, maxCnt: ' + maxCnt);
727    }).catch((err: BusinessError) => {
728      console.log('queryMaxOsAccountNumber failed, error: ' + JSON.stringify(err));
729    });
730  } catch (err) {
731    console.log('queryMaxOsAccountNumber exception: ' + JSON.stringify(err));
732  }
733  ```
734
735### queryMaxLoggedInOsAccountNumber<sup>12+</sup>
736
737queryMaxLoggedInOsAccountNumber(): Promise&lt;number&gt;
738
739Queries the maximum number of system accounts allowed to log in to the system. This API uses a promise to return the result.
740
741**System API**: This is a system API.
742
743**System capability**: SystemCapability.Account.OsAccount
744
745**Return value**
746
747| Type                 | Description                                        |
748| --------------------- | ------------------------------------------- |
749| Promise&lt;number&gt; | Promise used to return the result.|
750
751**Error codes**
752
753| ID| Error Message      |
754| -------- | ------------- |
755| 202 | Not system application.|
756| 12300001 | The system service works abnormally. |
757
758**Example**
759
760  ```ts
761  import { BusinessError } from '@kit.BasicServicesKit';
762  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
763  try {
764    accountManager.queryMaxLoggedInOsAccountNumber().then((maxNum: number) => {
765      console.log('queryMaxLoggedInOsAccountNumber successfully, maxNum: ' + maxNum);
766    }).catch((err: BusinessError) => {
767      console.log('queryMaxLoggedInOsAccountNumber failed, error: ' + JSON.stringify(err));
768    });
769  } catch (err) {
770    console.log('queryMaxLoggedInOsAccountNumber exception: ' + JSON.stringify(err));
771  }
772  ```
773
774### getEnabledOsAccountConstraints<sup>11+</sup>
775
776getEnabledOsAccountConstraints(localId: number): Promise&lt;Array&lt;string&gt;&gt;
777
778Obtains all the enabled constraints of a system account. This API uses a promise to return the result.
779
780**System API**: This is a system API.
781
782**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
783
784**System capability**: SystemCapability.Account.OsAccount
785
786**Parameters**
787
788| Name | Type  | Mandatory| Description        |
789| ------- | ------ | ---- | ------------ |
790| localId | number | Yes  | ID of the target system account.|
791
792**Return value**
793
794| Type                              | Description                                                      |
795| ---------------------------------- | ---------------------------------------------------------- |
796| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return all the enabled [constraints](js-apis-osAccount.md#constraints) of the system account.|
797
798**Error codes**
799
800| ID| Error Message            |
801| -------- | ------------------- |
802| 201 | Permission denied.|
803| 202 | Not system application.|
804| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.|
805| 12300001 | The system service works abnormally. |
806| 12300003 | Account not found. |
807
808**Example**: Obtain all constraints of system account 100.
809
810  ```ts
811  import { BusinessError } from '@kit.BasicServicesKit';
812  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
813  let localId: number = 100;
814  try {
815    accountManager.getEnabledOsAccountConstraints(localId).then((constraints: string[]) => {
816      console.log('getEnabledOsAccountConstraints, constraints: ' + constraints);
817    }).catch((err: BusinessError) => {
818      console.log('getEnabledOsAccountConstraints err: ' + JSON.stringify(err));
819    });
820  } catch (e) {
821    console.log('getEnabledOsAccountConstraints exception: ' + JSON.stringify(e));
822  }
823  ```
824
825### queryAllCreatedOsAccounts
826
827queryAllCreatedOsAccounts(callback: AsyncCallback&lt;Array&lt;OsAccountInfo&gt;&gt;): void
828
829Queries information about all the system accounts created. This API uses an asynchronous callback to return the result.
830
831**System API**: This is a system API.
832
833**System capability**: SystemCapability.Account.OsAccount
834
835**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
836
837**Parameters**
838
839| Name  | Type                                                        | Mandatory| Description                                              |
840| -------- | ------------------------------------------------------------ | ---- | -------------------------------------------------- |
841| callback | AsyncCallback&lt;Array&lt;[OsAccountInfo](js-apis-osAccount.md#osaccountinfo)&gt;&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is a list of all created system accounts. Otherwise, **data** is an error object.|
842
843**Error codes**
844
845| ID| Error Message      |
846| -------- | ------------- |
847| 201 | Permission denied.|
848| 202 | Not system application.|
849| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types.|
850| 12300001 | The system service works abnormally. |
851
852**Example**
853
854  ```ts
855  import { BusinessError } from '@kit.BasicServicesKit';
856  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
857  try {
858    accountManager.queryAllCreatedOsAccounts((err: BusinessError, accountArr: osAccount.OsAccountInfo[])=>{
859      console.log('queryAllCreatedOsAccounts err:' + JSON.stringify(err));
860      console.log('queryAllCreatedOsAccounts accountArr:' + JSON.stringify(accountArr));
861    });
862  } catch (e) {
863    console.log('queryAllCreatedOsAccounts exception: ' + JSON.stringify(e));
864  }
865  ```
866
867### queryAllCreatedOsAccounts
868
869queryAllCreatedOsAccounts(): Promise&lt;Array&lt;OsAccountInfo&gt;&gt;
870
871Queries information about all the system accounts created. This API uses a promise to return the result.
872
873**System API**: This is a system API.
874
875**System capability**: SystemCapability.Account.OsAccount
876
877**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
878
879**Return value**
880
881| Type                                                       | Description                                          |
882| ----------------------------------------------------------- | --------------------------------------------- |
883| Promise&lt;Array&lt;[OsAccountInfo](js-apis-osAccount.md#osaccountinfo)&gt;&gt; | Promise used to return the information about all the system accounts created.|
884
885**Error codes**
886
887| ID| Error Message      |
888| -------- | ------------- |
889| 201 | Permission denied.|
890| 202 | Not system application.|
891| 12300001 | The system service works abnormally. |
892
893**Example**
894
895  ```ts
896  import { BusinessError } from '@kit.BasicServicesKit';
897  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
898  try {
899    accountManager.queryAllCreatedOsAccounts().then((accountArr: osAccount.OsAccountInfo[]) => {
900      console.log('queryAllCreatedOsAccounts, accountArr: ' + JSON.stringify(accountArr));
901    }).catch((err: BusinessError) => {
902      console.log('queryAllCreatedOsAccounts err: ' + JSON.stringify(err));
903    });
904  } catch (e) {
905    console.log('queryAllCreatedOsAccounts exception: ' + JSON.stringify(e));
906  }
907  ```
908
909### getForegroundOsAccountLocalId<sup>12+</sup>
910
911getForegroundOsAccountLocalId(): Promise&lt;number&gt;;
912
913Obtains the ID of the foreground system account.
914
915**System API**: This is a system API.
916
917**System capability**: SystemCapability.Account.OsAccount
918
919**Return value**
920
921| Name   | Type                                                | Mandatory| Description                                                                        |
922| ---------------------- | ----------------------------------------------------------------- |
923| Promise&lt;number&gt; | Promise used to return the result. |
924
925**Error codes**
926
927| ID| Error Message      |
928| -------- | ------------- |
929| 202 | Not system application.|
930| 12300001 | The system service works abnormally. |
931
932**Example**
933
934  ```ts
935  import { BusinessError } from '@kit.BasicServicesKit';
936  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
937  try {
938    accountManager.getForegroundOsAccountLocalId().then((localId: number) => {
939      console.log('getForegroundOsAccountLocalId, localId: ' + localId);
940    }).catch((err: BusinessError) => {
941      console.log('getForegroundOsAccountLocalId err: ' + JSON.stringify(err));
942    });
943  } catch (e) {
944    console.log('getForegroundOsAccountLocalId exception: ' + JSON.stringify(e));
945  }
946  ```
947
948### createOsAccount
949
950createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback&lt;OsAccountInfo&gt;): void
951
952Creates a system account. This API uses an asynchronous callback to return the result.
953
954**System API**: This is a system API.
955
956**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
957
958**System capability**: SystemCapability.Account.OsAccount
959
960**Parameters**
961
962| Name   | Type                                                | Mandatory| Description                                                                        |
963| :-------- | ---------------------------------------------------- | ---- | --------------------------------------------------------------------------- |
964| localName | string                                               | Yes  | Name of the system account to create.                                                       |
965| type      | [OsAccountType](js-apis-osAccount.md#osaccounttype)                      | Yes  | Type of the system account to create.                                                       |
966| callback  | AsyncCallback&lt;[OsAccountInfo](js-apis-osAccount.md#osaccountinfo)&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the created system account. Otherwise, **err** is an error object.|
967
968**Error codes**
969
970| ID | Error Message                  |
971| -------- | ------------------------- |
972| 201 | Permission denied.|
973| 202 | Not system application.|
974| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
975| 12300001 | The system service works abnormally. |
976| 12300002 | Invalid localName or type. |
977| 12300004 | Local name already exists. |
978| 12300005 | Multi-user not supported. |
979| 12300006 | Unsupported account type. |
980| 12300007 | The number of accounts has reached the upper limit. |
981
982**Example**
983
984  ```ts
985  import { BusinessError } from '@kit.BasicServicesKit';
986  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
987  try {
988    accountManager.createOsAccount('testName', osAccount.OsAccountType.NORMAL,
989      (err: BusinessError, osAccountInfo: osAccount.OsAccountInfo)=>{
990      console.log('createOsAccount err:' + JSON.stringify(err));
991      console.log('createOsAccount osAccountInfo:' + JSON.stringify(osAccountInfo));
992    });
993  } catch (e) {
994    console.log('createOsAccount exception: ' + JSON.stringify(e));
995  }
996  ```
997
998### createOsAccount
999
1000createOsAccount(localName: string, type: OsAccountType, options?: CreateOsAccountOptions): Promise&lt;OsAccountInfo&gt;
1001
1002Creates a system account. This API uses a promise to return the result.
1003
1004**System API**: This is a system API.
1005
1006**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1007
1008**System capability**: SystemCapability.Account.OsAccount
1009
1010**Parameters**
1011
1012| Name   | Type                           | Mandatory| Description                  |
1013| --------- | ------------------------------- | ---- | ---------------------- |
1014| localName | string                          | Yes  | Name of the system account to create.|
1015| type      | [OsAccountType](js-apis-osAccount.md#osaccounttype) | Yes  | Type of the system account to create.|
1016| options      | [CreateOsAccountOptions](js-apis-osAccount-sys.md#createosaccountoptions12) | No  | Options for creating a system account. By default, this parameter is left blank.<br>This parameter is supported since API version 12.|
1017
1018**Return value**
1019
1020| Type                                          | Description                                 |
1021| ---------------------------------------------- | ------------------------------------- |
1022| Promise&lt;[OsAccountInfo](js-apis-osAccount.md#osaccountinfo)&gt; | Promise used to return the information about the created system account.|
1023
1024**Error codes**
1025
1026| ID | Error Message                  |
1027| -------- | ------------------------- |
1028| 201 | Permission denied.|
1029| 202 | Not system application.|
1030| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1031| 12300001 | The system service works abnormally. |
1032| 12300002 | Invalid localName, type or options. |
1033| 12300004 | Local name already exists. |
1034| 12300005 | Multi-user not supported. |
1035| 12300006 | Unsupported account type. |
1036| 12300007 | The number of accounts has reached the upper limit. |
1037| 12300015 | The short name already exists. |
1038
1039**Example**
1040
1041  ```ts
1042  import { BusinessError } from '@kit.BasicServicesKit';
1043  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1044  let options: osAccount.CreateOsAccountOptions = {
1045    shortName: 'myShortName'
1046  }
1047  try {
1048    accountManager.createOsAccount('testAccountName', osAccount.OsAccountType.NORMAL, options).then(
1049      (accountInfo: osAccount.OsAccountInfo) => {
1050      console.log('createOsAccount, accountInfo: ' + JSON.stringify(accountInfo));
1051    }).catch((err: BusinessError) => {
1052      console.log('createOsAccount err: ' + JSON.stringify(err));
1053    });
1054  } catch (e) {
1055    console.log('createOsAccount exception: ' + JSON.stringify(e));
1056  }
1057  ```
1058
1059### createOsAccountForDomain<sup>8+</sup>
1060
1061createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, callback: AsyncCallback&lt;OsAccountInfo&gt;): void
1062
1063Creates a system account and associates it with the specified domain account. This API uses an asynchronous callback to return the result.
1064
1065**System API**: This is a system API.
1066
1067**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1068
1069**System capability**: SystemCapability.Account.OsAccount
1070
1071**Parameters**
1072
1073| Name    | Type                                                | Mandatory| Description                                                                        |
1074| ---------- | ---------------------------------------------------- | ---- | -------------------------------------------------------------------------- |
1075| type       | [OsAccountType](js-apis-osAccount.md#osaccounttype)                      | Yes  | Type of the system account to create.                                                      |
1076| domainInfo | [DomainAccountInfo](#domainaccountinfo8)              | Yes  | Domain account information.                                                              |
1077| callback   | AsyncCallback&lt;[OsAccountInfo](js-apis-osAccount.md#osaccountinfo)&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the created system account. Otherwise, **err** is an error object.|
1078
1079**Error codes**
1080
1081| ID| Error Message                    |
1082| -------- | ------------------- |
1083| 201 | Permission denied.|
1084| 202 | Not system application.|
1085| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1086| 801 | Capability not supported.|
1087| 12300001 | The system service works abnormally. |
1088| 12300002 | Invalid type or domainInfo. |
1089| 12300004 | Account already exists. |
1090| 12300005 | Multi-user not supported. |
1091| 12300006 | Unsupported account type. |
1092| 12300007 | The number of accounts has reached the upper limit. |
1093
1094**Example**
1095
1096  ```ts
1097  import { BusinessError } from '@kit.BasicServicesKit';
1098  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1099  let domainInfo: osAccount.DomainAccountInfo =
1100    {domain: 'testDomain', accountName: 'testAccountName'};
1101  try {
1102    accountManager.createOsAccountForDomain(osAccount.OsAccountType.NORMAL, domainInfo,
1103      (err: BusinessError, osAccountInfo: osAccount.OsAccountInfo)=>{
1104      console.log('createOsAccountForDomain err:' + JSON.stringify(err));
1105      console.log('createOsAccountForDomain osAccountInfo:' + JSON.stringify(osAccountInfo));
1106    });
1107  } catch (e) {
1108    console.log('createOsAccountForDomain exception: ' + JSON.stringify(e));
1109  }
1110  ```
1111
1112### createOsAccountForDomain<sup>8+</sup>
1113
1114createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, options?: CreateOsAccountForDomainOptions): Promise&lt;OsAccountInfo&gt;
1115
1116Creates a system account and associates it with the specified domain account. This API uses a promise to return the result.
1117
1118**System API**: This is a system API.
1119
1120**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1121
1122**System capability**: SystemCapability.Account.OsAccount
1123
1124**Parameters**
1125
1126| Name    | Type                                     | Mandatory| Description                |
1127| ---------- | ---------------------------------------- | ---- | -------------------- |
1128| type       | [OsAccountType](js-apis-osAccount.md#osaccounttype)          | Yes  | Type of the system account to create.|
1129| domainInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes  | Domain account information.         |
1130| options      | [CreateOsAccountForDomainOptions](#createosaccountfordomainoptions12) | No  | Optional parameters for creating the account. By default, this parameter is left blank.<br>This parameter is supported since API version 12.|
1131
1132**Return value**
1133
1134| Type                                          | Description                                   |
1135| ---------------------------------------------- | -------------------------------------- |
1136| Promise&lt;[OsAccountInfo](js-apis-osAccount.md#osaccountinfo)&gt; | Promise used to return the information about the created system account.|
1137
1138**Error codes**
1139
1140| ID| Error Message                    |
1141| -------- | ------------------- |
1142| 201 | Permission denied.|
1143| 202 | Not system application.|
1144| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1145| 801 | Capability not supported.|
1146| 12300001 | The system service works abnormally. |
1147| 12300002 | Invalid type, domainInfo or options. |
1148| 12300004 | Account already exists. |
1149| 12300005 | Multi-user not supported. |
1150| 12300006 | Unsupported account type. |
1151| 12300007 | The number of accounts has reached the upper limit. |
1152| 12300015 | The short name already exists. |
1153
1154**Example**
1155
1156  ```ts
1157  import { BusinessError } from '@kit.BasicServicesKit';
1158  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1159  let domainInfo: osAccount.DomainAccountInfo =
1160    {domain: 'testDomain', accountName: 'testAccountName'};
1161  let options: osAccount.CreateOsAccountForDomainOptions = {
1162    shortName: 'myShortName'
1163  }
1164  try {
1165    accountManager.createOsAccountForDomain(osAccount.OsAccountType.NORMAL, domainInfo, options).then(
1166      (accountInfo: osAccount.OsAccountInfo) => {
1167      console.log('createOsAccountForDomain, account info: ' + JSON.stringify(accountInfo));
1168    }).catch((err: BusinessError) => {
1169      console.log('createOsAccountForDomain err: ' + JSON.stringify(err));
1170    });
1171  } catch (e) {
1172    console.log('createOsAccountForDomain exception: ' + JSON.stringify(e));
1173  }
1174  ```
1175
1176### queryOsAccount<sup>11+</sup>
1177
1178queryOsAccount(): Promise&lt;OsAccountInfo&gt;
1179
1180Obtains information about the system account to which the current process belongs. This API uses a promise to return the result.
1181
1182**System API**: This is a system API.
1183
1184**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.GET_LOCAL_ACCOUNTS
1185
1186**System capability**: SystemCapability.Account.OsAccount
1187
1188**Return value**
1189
1190| Type                                          | Description                                      |
1191| ---------------------------------------------- | ----------------------------------------- |
1192| Promise&lt;[OsAccountInfo](js-apis-osAccount.md#osaccountinfo)&gt; | Promise used to return the system account information obtained.|
1193
1194**Error codes**
1195
1196| ID| Error Message            |
1197| -------- | ------------------- |
1198| 201 | Permission denied.|
1199| 202 | Not system application.|
1200| 12300001 | The system service works abnormally. |
1201
1202**Example**
1203
1204  ```ts
1205  import { BusinessError } from '@kit.BasicServicesKit';
1206  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1207  try {
1208    accountManager.queryOsAccount().then((accountInfo: osAccount.OsAccountInfo) => {
1209      console.log('queryOsAccount, accountInfo: ' + JSON.stringify(accountInfo));
1210    }).catch((err: BusinessError) => {
1211      console.log('queryOsAccount err: ' + JSON.stringify(err));
1212    });
1213  } catch (e) {
1214    console.log('queryOsAccount exception: ' + JSON.stringify(e));
1215  }
1216  ```
1217
1218### queryOsAccountById
1219
1220queryOsAccountById(localId: number, callback: AsyncCallback&lt;OsAccountInfo&gt;): void
1221
1222Queries information about the system account of the given ID. This API uses an asynchronous callback to return the result.
1223
1224**System API**: This is a system API.
1225
1226**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
1227
1228**System capability**: SystemCapability.Account.OsAccount
1229
1230**Parameters**
1231
1232| Name  | Type                                                | Mandatory| Description                                                                      |
1233| -------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------------------ |
1234| localId  | number                                               | Yes  | ID of the target system account.                                                     |
1235| callback | AsyncCallback&lt;[OsAccountInfo](js-apis-osAccount.md#osaccountinfo)&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the system account information obtained. Otherwise, **data** is an error object.|
1236
1237**Error codes**
1238
1239| ID| Error Message            |
1240| -------- | ------------------- |
1241| 201 | Permission denied.|
1242| 202 | Not system application.|
1243| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1244| 12300001 | The system service works abnormally. |
1245| 12300002 | Invalid localId.    |
1246| 12300003 | Account not found. |
1247
1248**Example**: Query information about system account 100.
1249
1250  ```ts
1251  import { BusinessError } from '@kit.BasicServicesKit';
1252  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1253  let localId: number = 100;
1254  try {
1255    accountManager.queryOsAccountById(localId, (err: BusinessError, accountInfo: osAccount.OsAccountInfo)=>{
1256      console.log('queryOsAccountById err:' + JSON.stringify(err));
1257      console.log('queryOsAccountById accountInfo:' + JSON.stringify(accountInfo));
1258    });
1259  } catch (e) {
1260    console.log('queryOsAccountById exception: ' + JSON.stringify(e));
1261  }
1262  ```
1263
1264### queryOsAccountById
1265
1266queryOsAccountById(localId: number): Promise&lt;OsAccountInfo&gt;
1267
1268Queries information about the system account of the given ID. This API uses a promise to return the result.
1269
1270**System API**: This is a system API.
1271
1272**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
1273
1274**System capability**: SystemCapability.Account.OsAccount
1275
1276**Parameters**
1277
1278| Name | Type  | Mandatory| Description                |
1279| ------- | ------ | ---- | -------------------- |
1280| localId | number | Yes  | ID of the target system account.|
1281
1282**Return value**
1283
1284| Type                                          | Description                                |
1285| ---------------------------------------------- | ------------------------------------ |
1286| Promise&lt;[OsAccountInfo](js-apis-osAccount.md#osaccountinfo)&gt; | Promise used to return the system account information obtained.|
1287
1288**Error codes**
1289
1290| ID| Error Message            |
1291| -------- | ------------------- |
1292| 201 | Permission denied.|
1293| 202 | Not system application.|
1294| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1295| 12300001 | The system service works abnormally. |
1296| 12300002 | Invalid localId. |
1297| 12300003 | Account not found. |
1298
1299**Example**: Query information about system account 100.
1300
1301  ```ts
1302  import { BusinessError } from '@kit.BasicServicesKit';
1303  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1304  let localId: number = 100;
1305  try {
1306    accountManager.queryOsAccountById(localId).then((accountInfo: osAccount.OsAccountInfo) => {
1307      console.log('queryOsAccountById, accountInfo: ' + JSON.stringify(accountInfo));
1308    }).catch((err: BusinessError) => {
1309      console.log('queryOsAccountById err: ' + JSON.stringify(err));
1310    });
1311  } catch (e) {
1312    console.log('queryOsAccountById exception: ' + JSON.stringify(e));
1313  }
1314  ```
1315
1316### getOsAccountProfilePhoto
1317
1318getOsAccountProfilePhoto(localId: number, callback: AsyncCallback&lt;string&gt;): void
1319
1320Obtains the profile photo of a system account. This API uses an asynchronous callback to return the result.
1321
1322**System API**: This is a system API.
1323
1324**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1325
1326**System capability**: SystemCapability.Account.OsAccount
1327
1328**Parameters**
1329
1330| Name  | Type                       | Mandatory| Description                                                                        |
1331| -------- | --------------------------- | ---- | -------------------------------------------------------------------------- |
1332| localId  | number                      | Yes  | ID of the target system account.                                                               |
1333| callback | AsyncCallback&lt;string&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the profile photo information obtained. Otherwise, **err** is an error object.|
1334
1335**Error codes**
1336
1337| ID| Error Message            |
1338| -------- | ------------------- |
1339| 201 | Permission denied.|
1340| 202 | Not system application.|
1341| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1342| 12300001 | The system service works abnormally. |
1343| 12300002 | Invalid localId.    |
1344| 12300003 | Account not found. |
1345
1346**Example**: Obtain the profile photo of system account 100.
1347
1348  ```ts
1349  import { BusinessError } from '@kit.BasicServicesKit';
1350  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1351  let localId: number = 100;
1352  try {
1353    accountManager.getOsAccountProfilePhoto(localId, (err: BusinessError, photo: string)=>{
1354      console.log('getOsAccountProfilePhoto err:' + JSON.stringify(err));
1355      console.log('get photo:' + photo + ' by localId: ' + localId);
1356    });
1357  } catch (e) {
1358    console.log('getOsAccountProfilePhoto exception: ' + JSON.stringify(e));
1359  }
1360  ```
1361
1362### getOsAccountProfilePhoto
1363
1364getOsAccountProfilePhoto(localId: number): Promise&lt;string&gt;
1365
1366Obtains the profile photo of a system account. This API uses a promise to return the result.
1367
1368**System API**: This is a system API.
1369
1370**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1371
1372**System capability**: SystemCapability.Account.OsAccount
1373
1374**Parameters**
1375
1376| Name | Type  | Mandatory| Description        |
1377| ------- | ------ | ---- | ------------ |
1378| localId | number | Yes  | ID of the target system account.|
1379
1380**Return value**
1381
1382| Type                 | Description                                   |
1383| --------------------- | -------------------------------------- |
1384| Promise&lt;string&gt; | Promise used to return the profile photo information obtained.|
1385
1386**Error codes**
1387
1388| ID| Error Message            |
1389| -------- | ------------------- |
1390| 201 | Permission denied.|
1391| 202 | Not system application.|
1392| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1393| 12300001 | The system service works abnormally. |
1394| 12300002 | Invalid localId.    |
1395| 12300003 | Account not found. |
1396
1397**Example**: Obtain the profile photo of system account 100.
1398
1399  ```ts
1400  import { BusinessError } from '@kit.BasicServicesKit';
1401  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1402  let localId: number = 100;
1403  try {
1404    accountManager.getOsAccountProfilePhoto(localId).then((photo: string) => {
1405      console.log('getOsAccountProfilePhoto: ' + photo);
1406    }).catch((err: BusinessError) => {
1407      console.log('getOsAccountProfilePhoto err: ' + JSON.stringify(err));
1408    });
1409  } catch (e) {
1410    console.log('getOsAccountProfilePhoto exception: ' + JSON.stringify(e));
1411  }
1412  ```
1413
1414### setOsAccountProfilePhoto
1415
1416setOsAccountProfilePhoto(localId: number, photo: string, callback: AsyncCallback&lt;void&gt;): void
1417
1418Sets a profile photo for a system account. This API uses an asynchronous callback to return the result.
1419
1420**System API**: This is a system API.
1421
1422**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1423
1424**System capability**: SystemCapability.Account.OsAccount
1425
1426**Parameters**
1427
1428| Name  | Type                     | Mandatory| Description        |
1429| -------- | ------------------------- | ---- | ------------ |
1430| localId  | number                    | Yes  | ID of the target system account.|
1431| photo    | string                    | Yes  | Profile photo information.  |
1432| callback | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
1433
1434**Error codes**
1435
1436| ID| Error Message            |
1437| -------- | ------------------- |
1438| 201 | Permission denied.|
1439| 202 | Not system application.|
1440| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1441| 12300001 | The system service works abnormally. |
1442| 12300002 | Invalid localId or photo.    |
1443| 12300003 | Account not found. |
1444| 12300008 | Restricted Account. |
1445
1446**Example**: Set a profile photo for system account 100.
1447
1448  ```ts
1449  import { BusinessError } from '@kit.BasicServicesKit';
1450  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1451  let localId: number = 100;
1452  let photo: string = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPCAYAAAA/I0V3AAAAAXNSR0IArs4c6QAAAARnQU1BAA'+
1453  'Cxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACwSURBVDhPvZLBDYMwDEV/ugsXRjAT0EHCOuFIBwkbdIRewi6unbiAyoGgSn1SFH85+Y'+
1454  'q/4ljARW62X+LHS8uIzjm4dXUYF+utzBikB52Jo5e5iEPKqpACk7R9NM2RvWm5tIkD2czLCUFNKLD6IjdMHFHDzws285MgGrT0xCtp3WOKHo'+
1455  '+7q0mP0DZW9pNmoEFUzrQjp5cCnaen2kSJXLFD8ghbXyZCMQf/8e8Ns1XVAG/XAgqKzVnJFAAAAABJRU5ErkJggg=='
1456  try {
1457    accountManager.setOsAccountProfilePhoto(localId, photo, (err: BusinessError)=>{
1458      console.log('setOsAccountProfilePhoto err:' + JSON.stringify(err));
1459    });
1460  } catch (e) {
1461    console.log('setOsAccountProfilePhoto exception: ' + JSON.stringify(e));
1462  }
1463  ```
1464
1465### setOsAccountProfilePhoto
1466
1467setOsAccountProfilePhoto(localId: number, photo: string): Promise&lt;void&gt;
1468
1469Sets a profile photo for a system account. This API uses a promise to return the result.
1470
1471**System API**: This is a system API.
1472
1473**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1474
1475**System capability**: SystemCapability.Account.OsAccount
1476
1477**Parameters**
1478
1479| Name | Type  | Mandatory| Description        |
1480| ------- | ------ | ---- | ------------ |
1481| localId | number | Yes  | ID of the target system account.|
1482| photo   | string | Yes  | Profile photo information.  |
1483
1484**Return value**
1485
1486| Type               | Description                                |
1487| ------------------- | ------------------------------------ |
1488| Promise&lt;void&gt; | Promise that returns no value.|
1489
1490**Error codes**
1491
1492| ID| Error Message            |
1493| -------- | ------------------- |
1494| 201 | Permission denied.|
1495| 202 | Not system application.|
1496| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1497| 12300001 | The system service works abnormally. |
1498| 12300002 | Invalid localId or photo.    |
1499| 12300003 | Account not found. |
1500| 12300008 | Restricted Account. |
1501
1502**Example**: Set a profile photo for system account 100.
1503
1504  ```ts
1505  import { BusinessError } from '@kit.BasicServicesKit';
1506  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1507  let localId: number = 100;
1508  let photo: string = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPCAYAAAA/I0V3AAAAAXNSR0IArs4c6QAAAARnQU1BAA'+
1509  'Cxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACwSURBVDhPvZLBDYMwDEV/ugsXRjAT0EHCOuFIBwkbdIRewi6unbiAyoGgSn1SFH85+Y'+
1510  'q/4ljARW62X+LHS8uIzjm4dXUYF+utzBikB52Jo5e5iEPKqpACk7R9NM2RvWm5tIkD2czLCUFNKLD6IjdMHFHDzws285MgGrT0xCtp3WOKHo'+
1511  '+7q0mP0DZW9pNmoEFUzrQjp5cCnaen2kSJXLFD8ghbXyZCMQf/8e8Ns1XVAG/XAgqKzVnJFAAAAABJRU5ErkJggg=='
1512  try {
1513    accountManager.setOsAccountProfilePhoto(localId, photo).then(() => {
1514      console.log('setOsAccountProfilePhoto success');
1515    }).catch((err: BusinessError) => {
1516      console.log('setOsAccountProfilePhoto err: ' + JSON.stringify(err));
1517    });
1518  } catch (e) {
1519    console.log('setOsAccountProfilePhoto exception: ' + JSON.stringify(e));
1520  }
1521  ```
1522
1523### on
1524
1525on(type: 'activate' | 'activating', name: string, callback: Callback&lt;number&gt;): void
1526
1527Subscribes to the system account activation states, including the states of the account being activated and the account with activation completed. This API uses an asynchronous callback to return the result.
1528
1529**System API**: This is a system API.
1530
1531**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
1532
1533**System capability**: SystemCapability.Account.OsAccount
1534
1535**Parameters**
1536
1537| Name  | Type                      | Mandatory| Description                                                        |
1538| -------- | -------------------------- | ---- | ------------------------------------------------------------ |
1539| type     | 'activate' \| 'activating' | Yes  | Type of the event to subscribe to. The value **activate** indicates that a system account is activated, and **activating** indicates that a system account is being activated.|
1540| name     | string                     | Yes  | Subscription name, which can be customized. The value cannot be empty or exceed 1024 bytes.          |
1541| callback | Callback&lt;number&gt;     | Yes  | Callback used to return the ID of the system account being activated or activated.   |
1542
1543**Error codes**
1544
1545| ID| Error Message      |
1546| -------- | ------------- |
1547| 201 | Permission denied.|
1548| 202 | Not system application.|
1549| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1550| 12300001 | The system service works abnormally. |
1551| 12300002 | Invalid type or name. |
1552
1553**Example**
1554
1555  ```ts
1556  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1557  function onCallback(receiveLocalId: number){
1558    console.log('receive localId:' + receiveLocalId);
1559  }
1560  try {
1561    accountManager.on('activating', 'osAccountOnOffNameA', onCallback);
1562  } catch (e) {
1563    console.log('receive localId exception: ' + JSON.stringify(e));
1564  }
1565  ```
1566
1567### off
1568
1569off(type: 'activate' | 'activating', name: string, callback?: Callback&lt;number&gt;): void
1570
1571Unsubscribes from the system account activation states, including the states of the account being activated and the account with activation completed. This API uses an asynchronous callback to return the result.
1572
1573**System API**: This is a system API.
1574
1575**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
1576
1577**System capability**: SystemCapability.Account.OsAccount
1578
1579**Parameters**
1580
1581| Name  | Type                      | Mandatory| Description                                                        |
1582| -------- | -------------------------- | ---- | ------------------------------------------------------------ |
1583| type     | 'activate' \| 'activating' | Yes  | Type of the event to unsubscribe from. The value **activate** indicates that a system account is activated, and **activating** indicates that a system account is being activated.|
1584| name     | string                     | Yes  | Subscription name, which can be customized. The value cannot be empty or exceed 1024 bytes, and must be the same as the value passed by **on()**.|
1585| callback | Callback&lt;number&gt;     | No  | Callback to unregister. By default, this parameter is left empty, which unregisters all callbacks for the system account activation states.                     |
1586
1587**Error codes**
1588
1589| ID| Error Message      |
1590| -------- | ------------- |
1591| 201 | Permission denied.|
1592| 202 | Not system application.|
1593| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1594| 12300001 | The system service works abnormally. |
1595| 12300002 | Invalid type or name. |
1596
1597**Example**
1598
1599  ```ts
1600  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1601  function offCallback(){
1602    console.log('off enter')
1603  }
1604  try {
1605    accountManager.off('activating', 'osAccountOnOffNameA', offCallback);
1606  } catch (e) {
1607    console.log('off exception: ' + JSON.stringify(e));
1608  }
1609  ```
1610
1611### on<sup>12+</sup>
1612
1613on(type: 'switching', callback: Callback&lt;OsAccountSwitchEventData&gt;): void
1614
1615Subscribes to the switchover between a foreground system account and a background system account in progress. This API uses an asynchronous callback to return the result.
1616
1617**System API**: This is a system API.
1618
1619**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1620
1621**System capability**: SystemCapability.Account.OsAccount
1622
1623**Parameters**
1624
1625| Name  | Type                      | Mandatory| Description                                                        |
1626| -------- | -------------------------- | ---- | ------------------------------------------------------------ |
1627| type     | 'switching'                 | Yes  | Event type. The value **switching** indicates that the switchover between a foreground system account and a background account is being performed.|
1628| callback | Callback&lt;[OsAccountSwitchEventData](#osaccountswitcheventdata12)&gt;     | Yes  | Callback used to return the system account IDs before and after the switchover.   |
1629
1630**Error codes**
1631
1632| ID| Error Message      |
1633| -------- | ------------- |
1634| 201 | Permission denied.|
1635| 202 | Not system application.|
1636| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1637| 12300001 | The system service works abnormally. |
1638| 12300002 | Invalid type. |
1639
1640**Example**
1641
1642  ```ts
1643  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1644  function onSwitchingCallback(eventData: osAccount.OsAccountSwitchEventData){
1645    console.log('receive eventData:' + JSON.stringify(eventData));
1646  }
1647  try {
1648    accountManager.on('switching', onSwitchingCallback);
1649  } catch (e) {
1650    console.log('receive eventData exception: ' + JSON.stringify(e));
1651  }
1652  ```
1653
1654### off<sup>12+</sup>
1655
1656off(type: 'switching', callback?: Callback&lt;OsAccountSwitchEventData&gt;): void
1657
1658Unsubscribes from the switchover between a foreground system account and a background system account in progress. This API uses an asynchronous callback to return the result.
1659
1660**System API**: This is a system API.
1661
1662**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1663
1664**System capability**: SystemCapability.Account.OsAccount
1665
1666**Parameters**
1667
1668| Name  | Type                      | Mandatory| Description                                                        |
1669| -------- | -------------------------- | ---- | ------------------------------------------------------------ |
1670| type     | 'switching'                 | Yes  | Event type. The value **switching** indicates that the switchover between a foreground system account and a background account is being performed.|
1671| callback | Callback&lt;[OsAccountSwitchEventData](#osaccountswitcheventdata12)&gt;     | No  | Callback to unregister. By default, this parameter is left empty, which unregisters all callbacks for the **switching** event.                     |
1672
1673**Error codes**
1674
1675| ID| Error Message      |
1676| -------- | ------------- |
1677| 201 | Permission denied.|
1678| 202 | Not system application.|
1679| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1680| 12300001 | The system service works abnormally. |
1681| 12300002 | Invalid type. |
1682
1683**Example**
1684
1685  ```ts
1686  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1687  try {
1688    accountManager.off('switching');
1689  } catch (e) {
1690    console.log('off exception: ' + JSON.stringify(e));
1691  }
1692  ```
1693
1694### on<sup>12+</sup>
1695
1696on(type: 'switched', callback: Callback&lt;OsAccountSwitchEventData&gt;): void
1697
1698Subscribes to the end of a switchover between a foreground system account and a background system account. This API uses an asynchronous callback to return the result.
1699
1700**System API**: This is a system API.
1701
1702**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1703
1704**System capability**: SystemCapability.Account.OsAccount
1705
1706**Parameters**
1707
1708| Name  | Type                      | Mandatory| Description                                                        |
1709| -------- | -------------------------- | ---- | ------------------------------------------------------------ |
1710| type     | 'switched'                 | Yes  | Event type. The value **switched** indicates that the switchover between a foreground system account and a background system account is complete.|
1711| callback | Callback&lt;[OsAccountSwitchEventData](#osaccountswitcheventdata12)&gt;     | Yes  | Callback used to return the system account IDs before and after the switchover.   |
1712
1713**Error codes**
1714
1715| ID| Error Message      |
1716| -------- | ------------- |
1717| 201 | Permission denied.|
1718| 202 | Not system application.|
1719| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1720| 12300001 | The system service works abnormally. |
1721| 12300002 | Invalid type. |
1722
1723**Example**
1724
1725  ```ts
1726  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1727  function onSwitchedCallback(eventData: osAccount.OsAccountSwitchEventData){
1728    console.log('receive eventData:' + JSON.stringify(eventData));
1729  }
1730  try {
1731    accountManager.on('switched', onSwitchedCallback);
1732  } catch (e) {
1733    console.log('receive eventData exception: ' + JSON.stringify(e));
1734  }
1735  ```
1736
1737### off<sup>12+</sup>
1738
1739off(type: 'switched', callback?: Callback&lt;OsAccountSwitchEventData&gt;): void
1740
1741Unsubscribes from the end of a switchover between a foreground system account and a background system account. This API uses an asynchronous callback to return the result.
1742
1743**System API**: This is a system API.
1744
1745**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1746
1747**System capability**: SystemCapability.Account.OsAccount
1748
1749**Parameters**
1750
1751| Name  | Type                      | Mandatory| Description                                                        |
1752| -------- | -------------------------- | ---- | ------------------------------------------------------------ |
1753| type     | 'switched'                 | Yes  | Event type. The value **switched** indicates that the switchover between a foreground system account and a background system account is complete.|
1754| callback | Callback&lt;[OsAccountSwitchEventData](#osaccountswitcheventdata12)&gt;     | No  | Callback to unregister. By default, this parameter is left empty, which unregisters all callbacks for the **switched** event.                     |
1755
1756**Error codes**
1757
1758| ID| Error Message      |
1759| -------- | ------------- |
1760| 201 | Permission denied.|
1761| 202 | Not system application.|
1762| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1763| 12300001 | The system service works abnormally. |
1764| 12300002 | Invalid type. |
1765
1766**Example**
1767
1768  ```ts
1769  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1770  try {
1771    accountManager.off('switched');
1772  } catch (e) {
1773    console.log('off exception: ' + JSON.stringify(e));
1774  }
1775  ```
1776
1777### getBundleIdForUid<sup>9+</sup>
1778
1779getBundleIdForUid(uid: number, callback: AsyncCallback&lt;number&gt;): void
1780
1781Obtains the bundle ID based on the UID. This API uses an asynchronous callback to return the result.
1782
1783**System API**: This is a system API.
1784
1785**System capability**: SystemCapability.Account.OsAccount
1786
1787**Parameters**
1788
1789| Name  | Type                      | Mandatory| Description                                                                       |
1790| -------- | --------------------------- | ---- | ------------------------------------------------------------------------ |
1791| uid      | number                      | Yes  | Process UID.                                                                |
1792| callback | AsyncCallback&lt;number&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the bundle ID obtained. Otherwise, **data** is an error object.|
1793
1794**Error codes**
1795
1796| ID| Error Message      |
1797| -------- | ------------- |
1798| 202 | Not system application.|
1799| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1800| 12300001 | The system service works abnormally. |
1801| 12300002 | Invalid uid. |
1802
1803**Example**
1804
1805  ```ts
1806  import { BusinessError } from '@kit.BasicServicesKit';
1807  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1808  let testUid: number = 1000000;
1809  try {
1810    accountManager.getBundleIdForUid(testUid, (err: BusinessError, bundleId: number) => {
1811      console.info('getBundleIdForUid errInfo:' + JSON.stringify(err));
1812      console.info('getBundleIdForUid bundleId:' + JSON.stringify(bundleId));
1813    });
1814  } catch (e) {
1815    console.info('getBundleIdForUid exception: ' + JSON.stringify(e));
1816  }
1817  ```
1818
1819### getBundleIdForUid<sup>9+</sup>
1820
1821getBundleIdForUid(uid: number): Promise&lt;number&gt;
1822
1823Obtains the bundle ID based on the UID. This API uses a promise to return the result.
1824
1825**System API**: This is a system API.
1826
1827**System capability**: SystemCapability.Account.OsAccount
1828
1829**Parameters**
1830
1831| Name | Type  | Mandatory| Description        |
1832| ------- | ------ | ---- | ------------ |
1833| uid     | number | Yes  |  Process UID.|
1834
1835**Return value**
1836
1837| Type                 | Description                                 |
1838| --------------------- | ------------------------------------ |
1839| Promise&lt;number&gt; | Promise used to return the bundle ID obtained.|
1840
1841**Error codes**
1842
1843| ID| Error Message      |
1844| -------- | ------------- |
1845| 202 | Not system application.|
1846| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1847| 12300001 | The system service works abnormally. |
1848| 12300002 | Invalid uid. |
1849
1850**Example**
1851
1852  ```ts
1853  import { BusinessError } from '@kit.BasicServicesKit';
1854  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1855  let testUid: number = 1000000;
1856  try {
1857    accountManager.getBundleIdForUid(testUid).then((result: number) => {
1858      console.info('getBundleIdForUid bundleId:' + JSON.stringify(result));
1859    }).catch((err: BusinessError) => {
1860      console.info('getBundleIdForUid errInfo:' + JSON.stringify(err));
1861    });
1862  } catch (e) {
1863    console.info('getBundleIdForUid exception: ' + JSON.stringify(e));
1864  }
1865  ```
1866
1867### getBundleIdForUidSync<sup>10+</sup>
1868
1869getBundleIdForUidSync(uid: number): number
1870
1871Obtains the bundle ID based on the specified UID. The API returns the result synchronously.
1872
1873**System API**: This is a system API.
1874
1875**System capability**: SystemCapability.Account.OsAccount
1876
1877**Parameters**
1878
1879| Name | Type  | Mandatory| Description        |
1880| ------- | ------ | ---- | ------------ |
1881| uid     | number | Yes  |  Process UID.|
1882
1883**Return value**
1884
1885| Type  | Description                    |
1886| ------ | ------------------------ |
1887| number | Bundle ID obtained.|
1888
1889**Error codes**
1890
1891| ID| Error Message      |
1892| -------- | ------------- |
1893| 202 | Not system application.|
1894| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1895| 12300002 | Invalid uid. |
1896
1897**Example**
1898
1899  ```ts
1900  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1901  let testUid: number = 1000000;
1902  try {
1903    let bundleId : number = accountManager.getBundleIdForUidSync(testUid);
1904    console.info('getBundleIdForUidSync bundleId:' + bundleId);
1905  } catch (e) {
1906    console.info('getBundleIdForUidSync exception: ' + JSON.stringify(e));
1907  }
1908  ```
1909
1910### isMainOsAccount<sup>9+</sup>
1911
1912isMainOsAccount(callback: AsyncCallback&lt;boolean&gt;): void
1913
1914Checks whether the current process belongs to the main system account. This API uses an asynchronous callback to return the result.
1915
1916**System API**: This is a system API.
1917
1918**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1919
1920**System capability**: SystemCapability.Account.OsAccount
1921
1922**Parameters**
1923
1924| Name  | Type                         | Mandatory| Description                                                              |
1925| -------- | ---------------------------- | ---- | ----------------------------------------------------------------- |
1926| callback | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result. If **true** is returned, the current process belongs to the main system account. If **false** is returned, the current process does not belong to the main system account.|
1927
1928**Error codes**
1929
1930| ID| Error Message      |
1931| -------- | ------------- |
1932| 201 | Permission denied.|
1933| 202 | Not system application.|
1934| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
1935| 12300001 | The system service works abnormally. |
1936
1937**Example**
1938
1939  ```ts
1940  import { BusinessError } from '@kit.BasicServicesKit';
1941  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1942  try {
1943    accountManager.isMainOsAccount((err: BusinessError,result: boolean)=>{
1944      console.info('isMainOsAccount errInfo:' + JSON.stringify(err));
1945      console.info('isMainOsAccount result:' + JSON.stringify(result));
1946    });
1947  } catch (e) {
1948    console.info('isMainOsAccount exception: ' + JSON.stringify(e));
1949  }
1950  ```
1951
1952### isMainOsAccount<sup>9+</sup>
1953
1954isMainOsAccount(): Promise&lt;boolean&gt;;
1955
1956Checks whether the current process belongs to the main system account. This API uses a promise to return the result.
1957
1958**System API**: This is a system API.
1959
1960**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
1961
1962**System capability**: SystemCapability.Account.OsAccount
1963
1964**Return value**
1965
1966| Type                  | Description                                                                 |
1967| ---------------------- | --------------------------------------------------------------------- |
1968| Promise&lt;boolean&gt; | Promise used to return the result. If **true** is returned, the current process belongs to the main system account. If **false** is returned, the current process does not belong to the main system account.|
1969
1970**Error codes**
1971
1972| ID| Error Message      |
1973| -------- | ------------- |
1974| 201 | Permission denied.|
1975| 202 | Not system application.|
1976| 12300001 | The system service works abnormally. |
1977
1978**Example**
1979
1980  ```ts
1981  import { BusinessError } from '@kit.BasicServicesKit';
1982  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
1983  try {
1984    accountManager.isMainOsAccount().then((result: boolean) => {
1985      console.info('isMainOsAccount result:' + JSON.stringify(result));
1986    }).catch((err: BusinessError) => {
1987      console.info('isMainOsAccount errInfo:' + JSON.stringify(err));
1988    });
1989  } catch (e) {
1990    console.info('isMainOsAccount exception: ' + JSON.stringify(e));
1991  }
1992  ```
1993
1994### getOsAccountConstraintSourceTypes<sup>9+</sup>
1995
1996getOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback&lt;Array&lt;ConstraintSourceTypeInfo&gt;&gt;): void
1997
1998Obtains the constraint source information of a system account. This API uses an asynchronous callback to return the result.
1999
2000**System API**: This is a system API.
2001
2002**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
2003
2004**System capability**: SystemCapability.Account.OsAccount
2005
2006**Parameters**
2007
2008| Name  | Type                      | Mandatory| Description                                                        |
2009| -------- | -------------------------- | ---- | ------------------------------------------------------------ |
2010| localId     | number | Yes  |  ID of the target system account.|
2011| constraint     | string | Yes  |  [Constraint](js-apis-osAccount.md#constraints) whose source information is to be obtained.|
2012| callback | AsyncCallback&lt;Array&lt;[ConstraintSourceTypeInfo](#constraintsourcetypeinfo9)&gt;&gt;     | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the [constraint](js-apis-osAccount.md#constraints) source information obtained. Otherwise, **err** is an error object.                     |
2013
2014**Error codes**
2015
2016| ID| Error Message      |
2017| -------- | ------------- |
2018| 201 | Permission denied.|
2019| 202 | Not system application.|
2020| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
2021| 12300001 | The system service works abnormally. |
2022| 12300002 | Invalid name or constraint. |
2023| 12300003 | Account not found. |
2024
2025**Example**
2026
2027  ```ts
2028  import { BusinessError } from '@kit.BasicServicesKit';
2029  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2030  try {
2031    accountManager.getOsAccountConstraintSourceTypes(100, 'constraint.wifi',
2032      (err: BusinessError,sourceTypeInfos: osAccount.ConstraintSourceTypeInfo[])=>{
2033      console.info('getOsAccountConstraintSourceTypes errInfo:' + JSON.stringify(err));
2034      console.info('getOsAccountConstraintSourceTypes sourceTypeInfos:' + JSON.stringify(sourceTypeInfos));
2035    });
2036  } catch (e) {
2037    console.info('getOsAccountConstraintSourceTypes exception: ' + JSON.stringify(e));
2038  }
2039  ```
2040
2041### getOsAccountConstraintSourceTypes<sup>9+</sup>
2042
2043getOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise&lt;Array&lt;ConstraintSourceTypeInfo&gt;&gt;;
2044
2045Obtains the constraint source information of a system account. This API uses a promise to return the result.
2046
2047**System API**: This is a system API.
2048
2049**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
2050
2051**System capability**: SystemCapability.Account.OsAccount
2052
2053**Parameters**
2054
2055| Name | Type  | Mandatory| Description        |
2056| ------- | ------ | ---- | ------------ |
2057| localId     | number | Yes  |  ID of the target system account.|
2058| constraint     | string | Yes  |  [Constraint](js-apis-osAccount.md#constraints) whose source information is to be obtained.|
2059
2060**Return value**
2061
2062| Type                 | Description                                                        |
2063| --------------------- | ------------------------------------------------------------ |
2064| Promise&lt;Array&lt;[ConstraintSourceTypeInfo](#constraintsourcetypeinfo9)&gt;&gt; | Promise used to return the source information of the specified [constraint](js-apis-osAccount.md#constraints).|
2065
2066**Error codes**
2067
2068| ID| Error Message      |
2069| -------- | ------------- |
2070| 201 | Permission denied.|
2071| 202 | Not system application.|
2072| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
2073| 12300001 | The system service works abnormally. |
2074| 12300002 | Invalid name or constraint. |
2075| 12300003 | Account not found. |
2076
2077**Example**
2078
2079  ```ts
2080  import { BusinessError } from '@kit.BasicServicesKit';
2081  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2082  try {
2083    accountManager.getOsAccountConstraintSourceTypes(100, 'constraint.wifi').then(
2084      (result: osAccount.ConstraintSourceTypeInfo[]) => {
2085      console.info('getOsAccountConstraintSourceTypes sourceTypeInfos:' + JSON.stringify(result));
2086    }).catch((err: BusinessError) => {
2087      console.info('getOsAccountConstraintSourceTypes errInfo:' + JSON.stringify(err));
2088    });
2089  } catch (e) {
2090    console.info('getOsAccountConstraintSourceTypes exception: ' + JSON.stringify(e));
2091  }
2092  ```
2093
2094### getOsAccountType<sup>12+</sup>
2095
2096getOsAccountType(localId: number): Promise&lt;OsAccountType&gt;;
2097
2098Obtains the type of a system account. This API uses a promise to return the result.
2099
2100**System API**: This is a system API.
2101
2102**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
2103
2104**System capability**: SystemCapability.Account.OsAccount
2105
2106**Parameters**
2107
2108| Name | Type  | Mandatory| Description        |
2109| ------- | ------ | ---- | ------------ |
2110| localId     | number | Yes  |  ID of the target system account.|
2111
2112**Return value**
2113
2114| Type                 | Description                                                        |
2115| --------------------- | ------------------------------------------------------------ |
2116| Promise&lt;[OsAccountType](js-apis-osAccount.md#osaccounttype)&gt; | Promise used to return the type of the system account obtained.|
2117
2118**Error codes**
2119
2120| ID| Error Message      |
2121| -------- | ------------- |
2122| 201 | Permission denied.|
2123| 202 | Not system application.|
2124| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
2125| 12300001 | The system service works abnormally. |
2126| 12300003 | Account not found. |
2127
2128**Example**
2129
2130  ```ts
2131  import { BusinessError } from '@kit.BasicServicesKit';
2132  let accountManager: osAccount.AccountManager = osAccount.getAccountManager();
2133  try {
2134    let localId: number = 100;
2135    accountManager.getOsAccountType(localId).then((type: osAccount.OsAccountType) => {
2136      console.info('getOsAccountType Type:' + type);
2137    }).catch((err: BusinessError) => {
2138      console.info('getOsAccountType errInfo:' + JSON.stringify(err));
2139    });
2140  } catch (e) {
2141    console.info('getOsAccountType exception: ' + JSON.stringify(e));
2142  }
2143  ```
2144
2145## UserAuth<sup>8+</sup>
2146
2147Provides APIs for user authentication.
2148
2149**System API**: This is a system API.
2150
2151### constructor<sup>8+</sup>
2152
2153constructor()
2154
2155A constructor used to create an instance for user authentication.
2156
2157**System API**: This is a system API.
2158
2159**System capability**: SystemCapability.Account.OsAccount
2160
2161**Error codes**
2162
2163| ID| Error Message      |
2164| -------- | ------------- |
2165| 202 | Not system application.|
2166
2167**Example**
2168  ```ts
2169  let userAuth = new osAccount.UserAuth();
2170  ```
2171
2172### getVersion<sup>8+</sup>
2173
2174getVersion(): number;
2175
2176Obtains version information.
2177
2178**System API**: This is a system API.
2179
2180**System capability**: SystemCapability.Account.OsAccount
2181
2182**Return value**
2183
2184| Type  | Description        |
2185| :----- | :----------- |
2186| number | Version information obtained.|
2187
2188**Error codes**
2189
2190| ID| Error Message      |
2191| -------- | ------------- |
2192| 202 | Not system application.|
2193
2194**Example**
2195  ```ts
2196  let userAuth = new osAccount.UserAuth();
2197  let version: number = userAuth.getVersion();
2198  console.log('getVersion version = ' + version);
2199  ```
2200
2201### getAvailableStatus<sup>8+</sup>
2202
2203getAvailableStatus(authType: AuthType, authTrustLevel: AuthTrustLevel): number;
2204
2205Obtains the available status of the authentication capability corresponding to the specified authentication type and trust level.
2206
2207**System API**: This is a system API.
2208
2209**System capability**: SystemCapability.Account.OsAccount
2210
2211**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL
2212
2213**Parameters**
2214
2215| Name          | Type                              | Mandatory| Description                      |
2216| --------------- | -----------------------------------| ---- | ------------------------- |
2217| authType        | [AuthType](#authtype8)             | Yes  | Authentication credential type.    |
2218| authTrustLevel  | [AuthTrustLevel](#authtrustlevel8) | Yes  | Trust level of the authentication.|
2219
2220**Return value**
2221
2222| Type  | Description                          |
2223| ------ | ----------------------------- |
2224| number | Available status of the authentication capability.|
2225
2226**Error codes**
2227
2228| ID| Error Message                    |
2229| -------- | --------------------------- |
2230| 201 | Permission denied.|
2231| 202 | Not system application.|
2232| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
2233| 12300001 | The system service works abnormally. |
2234| 12300002 | Invalid authType or authTrustLevel. |
2235
2236**Example**
2237  ```ts
2238  let userAuth = new osAccount.UserAuth();
2239  let authType: osAccount.AuthType = osAccount.AuthType.PIN;
2240  let authTrustLevel: osAccount.AuthTrustLevel = osAccount.AuthTrustLevel.ATL1;
2241  try {
2242    let status: number = userAuth.getAvailableStatus(authType, authTrustLevel);
2243    console.log('getAvailableStatus status = ' + status);
2244  } catch (e) {
2245    console.log('getAvailableStatus exception = ' + JSON.stringify(e));
2246  }
2247  ```
2248
2249### getProperty<sup>8+</sup>
2250
2251getProperty(request: GetPropertyRequest, callback: AsyncCallback&lt;ExecutorProperty&gt;): void
2252
2253Obtains the executor property based on the request. This API uses an asynchronous callback to return the result.
2254
2255**System API**: This is a system API.
2256
2257**System capability**: SystemCapability.Account.OsAccount
2258
2259**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL
2260
2261**Parameters**
2262
2263| Name   | Type                                                                   | Mandatory| Description                               |
2264| -------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------ |
2265| request  | [GetPropertyRequest](#getpropertyrequest8)                  | Yes  | Request information, including the authentication credential type and property list.|
2266| callback | AsyncCallback&lt;[ExecutorProperty](#executorproperty8)&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the executor property information obtained. Otherwise, **err** is an error object.|
2267
2268**Error codes**
2269
2270| ID| Error Message                    |
2271| -------- | --------------------------- |
2272| 201 | Permission denied.|
2273| 202 | Not system application.|
2274| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
2275| 12300001 | The system service works abnormally. |
2276| 12300002 | Invalid request. |
2277| 12300003 | Account not found. |
2278
2279**Example**
2280  ```ts
2281  import { BusinessError } from '@kit.BasicServicesKit';
2282  let userAuth = new osAccount.UserAuth();
2283  let keys: Array<osAccount.GetPropertyType>  = [
2284    osAccount.GetPropertyType.AUTH_SUB_TYPE,
2285    osAccount.GetPropertyType.REMAIN_TIMES,
2286    osAccount.GetPropertyType.FREEZING_TIME
2287  ];
2288  let request: osAccount.GetPropertyRequest = {
2289    authType: osAccount.AuthType.PIN,
2290    keys: keys
2291  };
2292  try {
2293    userAuth.getProperty(request, (err: BusinessError, result: osAccount.ExecutorProperty) => {
2294      console.log('getProperty err = ' + JSON.stringify(err));
2295      console.log('getProperty result = ' + JSON.stringify(result));
2296    });
2297  } catch (e) {
2298    console.log('getProperty exception = ' + JSON.stringify(e));
2299  }
2300  ```
2301
2302### getProperty<sup>8+</sup>
2303
2304getProperty(request: GetPropertyRequest): Promise&lt;ExecutorProperty&gt;;
2305
2306Obtains the executor property based on the request. This API uses a promise to return the result.
2307
2308**System API**: This is a system API.
2309
2310**System capability**: SystemCapability.Account.OsAccount
2311
2312**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL
2313
2314**Parameters**
2315
2316| Name   | Type                                                  | Mandatory| Description                               |
2317| -------- | ------------------------------------------------------ | ---- | ---------------------------------- |
2318| request  | [GetPropertyRequest](#getpropertyrequest8) | Yes  | Request information, including the authentication credential type and property list.|
2319
2320**Return value**
2321
2322| Type                                                             | Description                                                |
2323| :---------------------------------------------------------------- | :-------------------------------------------------- |
2324| Promise&lt;[ExecutorProperty](#executorproperty8)&gt; | Promise used to return the executor property information obtained.|
2325
2326**Error codes**
2327
2328| ID| Error Message                    |
2329| -------- | --------------------------- |
2330| 201 | Permission denied.|
2331| 202 | Not system application.|
2332| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
2333| 12300001 | The system service works abnormally. |
2334| 12300002 | Invalid request. |
2335| 12300003 | Account not found. |
2336
2337**Example**
2338  ```ts
2339  import { BusinessError } from '@kit.BasicServicesKit';
2340  let userAuth = new osAccount.UserAuth();
2341  let keys: Array<osAccount.GetPropertyType> = [
2342    osAccount.GetPropertyType.AUTH_SUB_TYPE,
2343    osAccount.GetPropertyType.REMAIN_TIMES,
2344    osAccount.GetPropertyType.FREEZING_TIME
2345  ];
2346  let request: osAccount.GetPropertyRequest = {
2347    authType: osAccount.AuthType.PIN,
2348    keys: keys
2349  };
2350  try {
2351    userAuth.getProperty(request).then((result: osAccount.ExecutorProperty) => {
2352      console.log('getProperty result = ' + JSON.stringify(result));
2353    }).catch((err: BusinessError) => {
2354      console.log('getProperty error = ' + JSON.stringify(err));
2355    });
2356  } catch (e) {
2357    console.log('getProperty exception = ' + JSON.stringify(e));
2358  }
2359  ```
2360
2361### getPropertyByCredentialId<sup>14+</sup>
2362
2363getPropertyByCredentialId(credentialId: Uint8Array, keys: Array&lt;GetPropertyType&gt;): Promise&lt;ExecutorProperty&gt;;
2364
2365Obtains the specified property information of the associated executor based on the credential ID. This API uses a promise to return the result.
2366
2367**System API**: This is a system API.
2368
2369**System capability**: SystemCapability.Account.OsAccount
2370
2371**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL
2372
2373**Parameters**
2374
2375| Name   | Type                                                  | Mandatory| Description                               |
2376| -------- | ------------------------------------------------------ | ---- | ---------------------------------- |
2377| credentialId  | Uint8Array | Yes  | Credential ID.|
2378| keys     | Array&lt;[GetPropertyType](#getpropertytype8)&gt; | Yes   | Property type array to be queried.|
2379
2380**Return value**
2381
2382| Type                                                             | Description                                                |
2383| :---------------------------------------------------------------- | :-------------------------------------------------- |
2384| Promise&lt;[ExecutorProperty](#executorproperty8)&gt; | Promise used to return the executor attributes.|
2385
2386**Error codes**
2387
2388| ID| Error Message                    |
2389| -------- | --------------------------- |
2390| 201 | Permission denied.|
2391| 202 | Not system application.|
2392| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
2393| 12300001 | The system service works abnormally. |
2394| 12300002 | Invalid keys. |
2395| 12300102 | The credential does not exist. |
2396
2397**Example**
2398  ```ts
2399  import { BusinessError } from '@kit.BasicServicesKit';
2400  let userIDM = new osAccount.UserIdentityManager();
2401  let credInfo: osAccount.EnrolledCredInfo[] = [];
2402  try {
2403    credInfo = await userIDM.getAuthInfo(osAccount.AuthType.PRIVATE_PIN);
2404  } catch (e) {
2405    console.log('getAuthInfo exception = ' + JSON.stringify(e));
2406    return;
2407  }
2408  if (credInfo.length == 0) {
2409    console.log('no credential infos');
2410    return;
2411  }
2412  let testCredentialId: Uint8Array = credInfo[0].credentialId;
2413  let keys: Array<osAccount.GetPropertyType> = [
2414    osAccount.GetPropertyType.AUTH_SUB_TYPE,
2415    osAccount.GetPropertyType.REMAIN_TIMES,
2416    osAccount.GetPropertyType.FREEZING_TIME
2417  ];
2418  try {
2419    let userAuth = new osAccount.UserAuth();
2420    userAuth.getPropertyByCredentialId(testCredentialId, keys).then((result: osAccount.ExecutorProperty) => {
2421      console.log('getPropertyByCredentialId result = ' + JSON.stringify(result));
2422    }).catch((err: BusinessError) => {
2423      console.log('getPropertyByCredentialId error = ' + JSON.stringify(err));
2424    });
2425  } catch (e) {
2426    console.log('getPropertyByCredentialId exception = ' + JSON.stringify(e));
2427  }
2428  ```
2429
2430### setProperty<sup>8+</sup>
2431
2432setProperty(request: SetPropertyRequest, callback: AsyncCallback&lt;void&gt;): void
2433
2434Sets the property for the initialization algorithm. This API uses an asynchronous callback to return the result.
2435
2436**System API**: This is a system API.
2437
2438**System capability**: SystemCapability.Account.OsAccount
2439
2440**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL
2441
2442**Parameters**
2443
2444| Name   | Type                                                 | Mandatory| Description                                                                   |
2445| -------- | ----------------------------------------------------- | ---- | ---------------------------------------------------------------------- |
2446| request  | [SetPropertyRequest](#setpropertyrequest8)| Yes  | Request information, including the authentication credential type and the key value to set.                                  |
2447| callback | AsyncCallback&lt;void&gt;                           | Yes  | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
2448
2449**Error codes**
2450
2451| ID| Error Message                    |
2452| -------- | --------------------------- |
2453| 201 | Permission denied.|
2454| 202 | Not system application.|
2455| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
2456| 12300001 | The system service works abnormally. |
2457| 12300002 | Invalid request. |
2458
2459**Example**
2460  ```ts
2461  import { BusinessError } from '@kit.BasicServicesKit';
2462  let userAuth = new osAccount.UserAuth();
2463  let request: osAccount.SetPropertyRequest = {
2464    authType: osAccount.AuthType.PIN,
2465    key: osAccount.SetPropertyType.INIT_ALGORITHM,
2466    setInfo: new Uint8Array([0])
2467  };
2468  try {
2469    userAuth.setProperty(request, (err: BusinessError) => {
2470      if (err) {
2471        console.log('setProperty failed, error = ' + JSON.stringify(err));
2472      } else {
2473        console.log('setProperty successfully');
2474      }
2475    });
2476  } catch (e) {
2477    console.log('setProperty exception = ' + JSON.stringify(e));
2478  }
2479  ```
2480
2481### setProperty<sup>8+</sup>
2482
2483setProperty(request: SetPropertyRequest): Promise&lt;void&gt;;
2484
2485Sets the property for the initialization algorithm. This API uses a promise to return the result.
2486
2487**System API**: This is a system API.
2488
2489**System capability**: SystemCapability.Account.OsAccount
2490
2491**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL
2492
2493**Parameters**
2494
2495| Name   | Type                                      | Mandatory| Description                                     |
2496| -------- | ------------------------------------------ | ---- | ---------------------------------------- |
2497| request  | [SetPropertyRequest](#setpropertyrequest8) | Yes  | Request information, including the authentication credential type and the key value to set.|
2498
2499**Return value**
2500
2501| Type                 | Description                                                          |
2502| :-------------------- | :------------------------------------------------------------ |
2503| Promise&lt;void&gt; | Promise that returns no value.|
2504
2505**Error codes**
2506
2507| ID| Error Message                    |
2508| -------- | --------------------------- |
2509| 201 | Permission denied.|
2510| 202 | Not system application.|
2511| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
2512| 12300001 | The system service works abnormally. |
2513| 12300002 | Invalid request. |
2514
2515**Example**
2516  ```ts
2517  import { BusinessError } from '@kit.BasicServicesKit';
2518  let userAuth = new osAccount.UserAuth();
2519  let request: osAccount.SetPropertyRequest = {
2520    authType: osAccount.AuthType.PIN,
2521    key: osAccount.SetPropertyType.INIT_ALGORITHM,
2522    setInfo: new Uint8Array([0])
2523  };
2524  try {
2525    userAuth.setProperty(request).then(() => {
2526      console.log('setProperty successfully');
2527    }).catch((err: BusinessError) => {
2528      console.log('setProperty failed, error = ' + JSON.stringify(err));
2529    });
2530  } catch (e) {
2531    console.log('setProperty exception = ' + JSON.stringify(e));
2532  }
2533  ```
2534
2535### prepareRemoteAuth<sup>12+</sup>
2536
2537prepareRemoteAuth(remoteNetworkId: string): Promise&lt;void&gt;;
2538
2539Prepares for remote authentication. This API uses a promise to return the result.
2540
2541**System API**: This is a system API.
2542
2543**System capability**: SystemCapability.Account.OsAccount
2544
2545**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL
2546
2547**Parameters**
2548
2549| Name           | Type  | Mandatory| Description            |
2550| --------         | ------ | ---- | --------------- |
2551| remoteNetworkId  | string | Yes  | Remote network ID. |
2552
2553**Return value**
2554
2555| Type                 | Description                                                          |
2556| :-------------------- | :------------------------------------------------------------ |
2557| Promise&lt;void&gt; | Promise that returns no value.|
2558
2559**Error codes**
2560
2561| ID| Error Message                    |
2562| -------- | --------------------------- |
2563| 201 | Permission denied.|
2564| 202 | Not system application.|
2565| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
2566| 12300001 | System service exception. |
2567| 12300002 | Invalid remoteNetworkId. |
2568
2569**Example**
2570  ```ts
2571  import { distributedDeviceManager } from '@kit.DistributedServiceKit';
2572  import { BusinessError } from '@kit.BasicServicesKit';
2573
2574  let userAuth = new osAccount.UserAuth();
2575  let distributedDeviceMgr = distributedDeviceManager.createDeviceManager("com.example.bundleName");
2576  distributedDeviceMgr.getAvailableDeviceList().then((data: Array<distributedDeviceManager.DeviceBasicInfo>) => {
2577      try {
2578        if (data.length > 0 && data[0].networkId != null) {
2579          userAuth.prepareRemoteAuth(data[0].networkId).then(() => {
2580            console.log('prepareRemoteAuth successfully');
2581          }).catch((err: BusinessError) => {
2582            console.log('prepareRemoteAuth failed, error = ' + JSON.stringify(err));
2583          });
2584        }
2585      } catch (e) {
2586        console.log('prepareRemoteAuth exception = ' + JSON.stringify(e));
2587      }
2588    }
2589  )
2590  ```
2591
2592### auth<sup>8+</sup>
2593
2594auth(challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array;
2595
2596Performs authentication of the current user. This API uses an asynchronous callback to return the result.
2597
2598**System API**: This is a system API.
2599
2600**System capability**: SystemCapability.Account.OsAccount
2601
2602**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL
2603
2604**Parameters**
2605
2606| Name          | Type                                    | Mandatory| Description                               |
2607| --------------- | ---------------------------------------- | --- | ------------------------------------ |
2608| challenge       | Uint8Array                               | Yes | Challenge value, which is a random number used to improve security.|
2609| authType        | [AuthType](#authtype8)                   | Yes | Authentication credential type.                       |
2610| authTrustLevel  | [AuthTrustLevel](#authtrustlevel8)       | Yes | Trust level of the authentication result.              |
2611| callback        | [IUserAuthCallback](#iuserauthcallback8) | Yes | Callback used to return the authentication result. |
2612
2613**Return value**
2614
2615| Type       | Description              |
2616| ---------- | ------------------ |
2617| Uint8Array | ID of the context for canceling the authentication.|
2618
2619**Error codes**
2620
2621| ID| Error Message         |
2622| -------- | --------------------- |
2623| 201 | Permission denied.|
2624| 202 | Not system application.|
2625| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
2626| 12300001 | The system service works abnormally. |
2627| 12300002 | Invalid challenge, authType or authTrustLevel. |
2628| 12300101 | The credential is incorrect. |
2629| 12300102 | Credential not enrolled. |
2630| 12300105 | The trust level is not supported. |
2631| 12300106 | The authentication type is not supported. |
2632| 12300109 | The authentication, enrollment, or update operation is canceled. |
2633| 12300110 | The authentication is locked. |
2634| 12300111 | The authentication time out. |
2635| 12300112 | The authentication service is busy. |
2636| 12300117 | PIN is expired. |
2637
2638**Example**
2639  ```ts
2640  let userAuth = new osAccount.UserAuth();
2641  let challenge: Uint8Array = new Uint8Array([0]);
2642  let authType: osAccount.AuthType = osAccount.AuthType.PIN;
2643  let authTrustLevel: osAccount.AuthTrustLevel = osAccount.AuthTrustLevel.ATL1;
2644  try {
2645    userAuth.auth(challenge, authType, authTrustLevel, {
2646      onResult: (result: number, extraInfo: osAccount.AuthResult) => {
2647          console.log('auth result = ' + result);
2648          console.log('auth extraInfo = ' + JSON.stringify(extraInfo));
2649      }
2650    });
2651  } catch (e) {
2652    console.log('auth exception = ' + JSON.stringify(e));
2653  }
2654  ```
2655
2656### auth<sup>12+</sup>
2657
2658auth(challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel, options: AuthOptions, callback: IUserAuthCallback): Uint8Array
2659
2660Starts user authentication based on the specified challenge value, authentication type (PIN, facial, or fingerprint authentication), authentication trust level, and optional parameters (such as the account ID and authentication intent). This API uses an asynchronous callback to return the result.
2661
2662**System API**: This is a system API.
2663
2664**System capability**: SystemCapability.Account.OsAccount
2665
2666**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL
2667
2668**Parameters**
2669
2670| Name          | Type                                    | Mandatory| Description                               |
2671| --------------- | ---------------------------------------- | --- | ------------------------------------ |
2672| challenge       | Uint8Array                               | Yes | Challenge value, which is a random number used to prevent replay attacks and improve security.|
2673| authType        | [AuthType](#authtype8)                   | Yes | Authentication credential type.                       |
2674| authTrustLevel  | [AuthTrustLevel](#authtrustlevel8)       | Yes | Trust level of the authentication result.              |
2675| options         | [AuthOptions](#authoptions12) | Yes| Optional parameters for the authentication.|
2676| callback        | [IUserAuthCallback](#iuserauthcallback8) | Yes | Callback used to return the authentication result. |
2677
2678**Return value**
2679
2680| Type       | Description              |
2681| ---------- | ------------------ |
2682| Uint8Array | ID of the context for canceling the authentication.|
2683
2684**Error codes**
2685
2686| ID| Error Message         |
2687| -------- | --------------------- |
2688| 201 | Permission denied.|
2689| 202 | Not system application.|
2690| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
2691| 12300001 | The system service works abnormally. |
2692| 12300002 | Invalid challenge, authType, authTrustLevel or options. |
2693| 12300003 | Account not found. |
2694| 12300101 | The credential is incorrect. |
2695| 12300102 | Credential not enrolled. |
2696| 12300105 | The trust level is not supported. |
2697| 12300106 | The authentication type is not supported. |
2698| 12300109 | The authentication, enrollment, or update operation is canceled. |
2699| 12300110 | The authentication is locked. |
2700| 12300111 | The authentication time out. |
2701| 12300112 | The authentication service is busy. |
2702| 12300117 | PIN is expired. |
2703
2704**Example**
2705  ```ts
2706  let userAuth = new osAccount.UserAuth();
2707  let challenge: Uint8Array = new Uint8Array([0]);
2708  let authType: osAccount.AuthType = osAccount.AuthType.PIN;
2709  let authTrustLevel: osAccount.AuthTrustLevel = osAccount.AuthTrustLevel.ATL1;
2710  let options: osAccount.AuthOptions = {
2711    accountId: 100
2712  };
2713  try {
2714    userAuth.auth(challenge, authType, authTrustLevel, options, {
2715      onResult: (result: number, extraInfo: osAccount.AuthResult) => {
2716          console.log('auth result = ' + result);
2717          console.log('auth extraInfo = ' + JSON.stringify(extraInfo));
2718      }
2719    });
2720  } catch (e) {
2721    console.log('auth exception = ' + JSON.stringify(e));
2722  }
2723  ```
2724
2725### authUser<sup>8+</sup>
2726
2727authUser(userId: number, challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array;
2728
2729Performs authentication of the specified user. This API uses an asynchronous callback to return the result.
2730
2731**System API**: This is a system API.
2732
2733**System capability**: SystemCapability.Account.OsAccount
2734
2735**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL
2736
2737**Parameters**
2738
2739| Name          | Type                                                | Mandatory| Description                               |
2740| --------------- | ---------------------------------------------------- | --- | ------------------------------------ |
2741| userId          | number                                               | Yes | User ID.                       |
2742| challenge       | Uint8Array                                           | Yes | Challenge value, which is a random number used to improve security.                         |
2743| authType        | [AuthType](#authtype8)                   | Yes | Authentication credential type.                       |
2744| authTrustLevel  | [AuthTrustLevel](#authtrustlevel8)       | Yes | Trust level of the authentication result.              |
2745| callback        | [IUserAuthCallback](#iuserauthcallback8) | Yes | Callback used to return the authentication result. |
2746
2747**Return value**
2748
2749| Type       | Description              |
2750| ---------- | ------------------ |
2751| Uint8Array | ID of the context for canceling the authentication.|
2752
2753**Error codes**
2754
2755| ID| Error Message         |
2756| -------- | --------------------- |
2757| 201 | Permission denied.|
2758| 202 | Not system application.|
2759| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
2760| 12300001 | The system service works abnormally. |
2761| 12300002 | Invalid challenge, authType or authTrustLevel. |
2762| 12300101 | The credential is incorrect. |
2763| 12300102 | Credential not enrolled. |
2764| 12300003 | Account not found. |
2765| 12300105 | The trust level is not supported. |
2766| 12300106 | The authentication type is not supported. |
2767| 12300109 | The authentication, enrollment, or update operation is canceled. |
2768| 12300110 | The authentication is locked. |
2769| 12300111 | The authentication time out. |
2770| 12300112 | The authentication service is busy. |
2771| 12300117 | PIN is expired. |
2772
2773**Example**
2774  ```ts
2775  let userAuth = new osAccount.UserAuth();
2776  let userID: number = 100;
2777  let challenge: Uint8Array = new Uint8Array([0]);
2778  let authType: osAccount.AuthType = osAccount.AuthType.PIN;
2779  let authTrustLevel: osAccount.AuthTrustLevel = osAccount.AuthTrustLevel.ATL1;
2780  try {
2781    userAuth.authUser(userID, challenge, authType, authTrustLevel, {
2782      onResult: (result,extraInfo) => {
2783        console.log('authUser result = ' + result);
2784        console.log('authUser extraInfo = ' + JSON.stringify(extraInfo));
2785      }
2786    });
2787  } catch (e) {
2788    console.log('authUser exception = ' + JSON.stringify(e));
2789  }
2790  ```
2791
2792### cancelAuth<sup>8+</sup>
2793
2794cancelAuth(contextID: Uint8Array): void
2795
2796Cancels an authentication.
2797
2798**System API**: This is a system API.
2799
2800**System capability**: SystemCapability.Account.OsAccount
2801
2802**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL
2803
2804**Parameters**
2805
2806| Name   | Type      | Mandatory | Description                                       |
2807| ----------| ---------- | ---- | ------------------------------------------ |
2808| contextId | Uint8Array | Yes  | ID of the authentication context. The context ID is dynamically generated.|
2809
2810**Error codes**
2811
2812| ID| Error Message           |
2813| -------- | ------------------ |
2814| 201 | Permission denied.|
2815| 202 | Not system application.|
2816| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
2817| 12300001 | The system service works abnormally. |
2818| 12300002 | Invalid contextId. |
2819
2820**Example**
2821  ```ts
2822  let userAuth = new osAccount.UserAuth();
2823  let pinAuth: osAccount.PINAuth = new osAccount.PINAuth();
2824  let challenge = new Uint8Array([0]);
2825  let contextId: Uint8Array = userAuth.auth(challenge, osAccount.AuthType.PIN, osAccount.AuthTrustLevel.ATL1, {
2826    onResult: (result: number, extraInfo: osAccount.AuthResult) => {
2827      console.log('auth result = ' + result);
2828      console.log('auth extraInfo = ' + JSON.stringify(extraInfo));
2829    }
2830  });
2831  try {
2832    userAuth.cancelAuth(contextId);
2833  } catch (e) {
2834    console.log('cancelAuth exception = ' + JSON.stringify(e));
2835  }
2836  ```
2837
2838## PINAuth<sup>8+</sup>
2839
2840Provides APIs for PIN authentication.
2841
2842**System API**: This is a system API.
2843
2844### constructor<sup>8+</sup>
2845
2846constructor()
2847
2848Creates a PIN authentication instance.
2849
2850**System API**: This is a system API.
2851
2852**System capability**: SystemCapability.Account.OsAccount
2853
2854**Error codes**
2855
2856| ID| Error Message      |
2857| -------- | ------------- |
2858| 202 | Not system application.|
2859
2860**Example**
2861  ```ts
2862  let pinAuth: osAccount.PINAuth = new osAccount.PINAuth();
2863  ```
2864
2865### registerInputer<sup>8+</sup>
2866
2867registerInputer(inputer: IInputer): void
2868
2869Registers a PIN inputer.
2870
2871**System API**: This is a system API.
2872
2873**System capability**: SystemCapability.Account.OsAccount
2874
2875**Required permissions**: ohos.permission.ACCESS_PIN_AUTH
2876
2877**Parameters**
2878
2879| Name   | Type                    | Mandatory| Description                     |
2880| ----------| ----------------------- | --- | -------------------------- |
2881| inputer   | [IInputer](#iinputer8)  | Yes | PIN inputer, which is used to obtain the PIN.|
2882
2883**Error codes**
2884
2885| ID| Error Message                    |
2886| -------- | --------------------------- |
2887| 201 | Permission denied.|
2888| 202 | Not system application.|
2889| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
2890| 12300001 | The system service works abnormally. |
2891| 12300002 | Invalid inputer. |
2892| 12300103 | The credential inputer already exists. |
2893
2894**Example**
2895  ```ts
2896  let pinAuth: osAccount.PINAuth = new osAccount.PINAuth();
2897  let password = new Uint8Array([0, 0, 0, 0, 0]);
2898  try {
2899    pinAuth.registerInputer({
2900        onGetData: (authSubType: osAccount.AuthSubType, callback: osAccount.IInputData) => {
2901          callback.onSetData(authSubType, password);
2902        }
2903    });
2904    console.log('registerInputer success.');
2905  } catch (e) {
2906    console.log('registerInputer exception = ' + JSON.stringify(e));
2907  }
2908  ```
2909
2910### unregisterInputer<sup>8+</sup>
2911
2912unregisterInputer(): void
2913
2914Unregisters this PIN inputer.
2915
2916**System API**: This is a system API.
2917
2918**System capability**: SystemCapability.Account.OsAccount
2919
2920**Required permissions**: ohos.permission.ACCESS_PIN_AUTH
2921
2922**Error codes**
2923
2924| ID| Error Message                    |
2925| -------- | --------------------------- |
2926| 201 | Permission denied.|
2927| 202 | Not system application.|
2928
2929**Example**
2930  ```ts
2931  let pinAuth: osAccount.PINAuth = new osAccount.PINAuth();
2932  pinAuth.unregisterInputer();
2933  ```
2934
2935## InputerManager <sup>9+</sup>
2936
2937Provides APIs for managing credential inputers.
2938
2939### registerInputer<sup>9+</sup>
2940
2941static registerInputer(authType: AuthType, inputer: IInputer): void
2942
2943Registers a credential inputer.
2944
2945**System API**: This is a system API.
2946
2947**System capability**: SystemCapability.Account.OsAccount
2948
2949**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL or ohos.permission.MANAGE_USER_IDM
2950
2951**Parameters**
2952
2953| Name   | Type                    | Mandatory| Description                     |
2954| ----------| ----------------------- | --- | -------------------------- |
2955| authType   | [AuthType](#authtype8)  | Yes | Authentication credential type.|
2956| inputer   | [IInputer](#iinputer8)  | Yes | Credential inputer to register.|
2957
2958**Error codes**
2959
2960| ID| Error Message                    |
2961| -------- | --------------------------- |
2962| 201 | Permission denied.|
2963| 202 | Not system application.|
2964| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
2965| 12300001 | The system service works abnormally. |
2966| 12300002 | Invalid authType or inputer. |
2967| 12300103 | The credential inputer already exists. |
2968| 12300106 | The authentication type is not supported. |
2969
2970**Example**
2971  ```ts
2972  let authType: osAccount.AuthType = osAccount.AuthType.DOMAIN;
2973  let password: Uint8Array = new Uint8Array([0, 0, 0, 0, 0]);
2974  try {
2975    osAccount.InputerManager.registerInputer(authType, {
2976        onGetData: (authSubType: osAccount.AuthSubType, callback: osAccount.IInputData) => {
2977          callback.onSetData(authSubType, password);
2978        }
2979    });
2980    console.log('registerInputer success.');
2981  } catch (e) {
2982    console.log('registerInputer exception = ' + JSON.stringify(e));
2983  }
2984  ```
2985
2986### unregisterInputer<sup>9+</sup>
2987
2988static unregisterInputer(authType: AuthType): void
2989
2990Unregisters this credential inputer.
2991
2992**System API**: This is a system API.
2993
2994**System capability**: SystemCapability.Account.OsAccount
2995
2996**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL or ohos.permission.MANAGE_USER_IDM
2997
2998**Parameters**
2999
3000| Name   | Type                    | Mandatory| Description                     |
3001| ----------| ----------------------- | --- | -------------------------- |
3002| authType   | [AuthType](#authtype8)  | Yes | Authentication credential type.|
3003
3004**Error codes**
3005
3006| ID| Error Message                    |
3007| -------- | --------------------------- |
3008| 201 | Permission denied.|
3009| 202 | Not system application.|
3010| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
3011| 12300002  | Invalid authType. |
3012
3013**Example**
3014  ```ts
3015  let authType: osAccount.AuthType = osAccount.AuthType.DOMAIN;
3016  try {
3017    osAccount.InputerManager.unregisterInputer(authType);
3018    console.log('unregisterInputer success.');
3019  } catch(err) {
3020    console.log('unregisterInputer err:' + JSON.stringify(err));
3021  }
3022  ```
3023
3024## DomainPlugin<sup>9+</sup>
3025
3026Provides APIs for domain account authentication.
3027
3028**System API**: This is a system API.
3029
3030### auth<sup>9+</sup>
3031
3032auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUserAuthCallback): void
3033
3034Authenticates a domain account.
3035
3036**System API**: This is a system API.
3037
3038**System capability**: SystemCapability.Account.OsAccount
3039
3040**Parameters**
3041
3042| Name     | Type                                   | Mandatory| Description            |
3043| ---------- | --------------------------------------- | ---- | --------------- |
3044| domainAccountInfo   | [DomainAccountInfo](#domainaccountinfo8)  | Yes  | Domain account information.|
3045| credential   | Uint8Array  | Yes  | Credentials of the domain account.|
3046| callback   | [IUserAuthCallback](#iuserauthcallback8)  | Yes  | Callback used to return the authentication result.|
3047
3048**Example**
3049  ```ts
3050  import { AsyncCallback } from '@kit.BasicServicesKit';
3051  let plugin: osAccount.DomainPlugin = {
3052    auth: (domainAccountInfo: osAccount.DomainAccountInfo, credential: Uint8Array,
3053          callback: osAccount.IUserAuthCallback) => {
3054      // mock authentication
3055      // notify authentication result
3056      let result: osAccount.AuthResult = {
3057        token: new Uint8Array([0]),
3058        remainTimes: 5,
3059        freezingTime: 0
3060      };
3061      callback.onResult(0, result);
3062    },
3063    authWithPopup: (domainAccountInfo: osAccount.DomainAccountInfo,
3064                    callback: osAccount.IUserAuthCallback) => {},
3065    authWithToken: (domainAccountInfo: osAccount.DomainAccountInfo, token: Uint8Array,
3066                    callback: osAccount.IUserAuthCallback) => {},
3067    getAccountInfo: (options: osAccount.GetDomainAccountInfoPluginOptions,
3068                    callback: AsyncCallback<osAccount.DomainAccountInfo>) => {},
3069    getAuthStatusInfo: (domainAccountInfo: osAccount.DomainAccountInfo,
3070                      callback: AsyncCallback<osAccount.AuthStatusInfo>) => {},
3071    bindAccount: (domainAccountInfo: osAccount.DomainAccountInfo, localId: number,
3072                  callback: AsyncCallback<void>) => {},
3073    unbindAccount: (domainAccountInfo: osAccount.DomainAccountInfo, callback: AsyncCallback<void>) => {},
3074    isAccountTokenValid: (domainAccountInfo: osAccount.DomainAccountInfo, token: Uint8Array,
3075                          callback: AsyncCallback<boolean>) => {},
3076    getAccessToken: (options: osAccount.GetDomainAccessTokenOptions, callback: AsyncCallback<Uint8Array>) => {}
3077  }
3078  osAccount.DomainAccountManager.registerPlugin(plugin);
3079  let userAuth = new osAccount.UserAuth();
3080  let challenge: Uint8Array = new Uint8Array([0]);
3081  let authType: osAccount.AuthType = osAccount.AuthType.DOMAIN;
3082  let authTrustLevel: osAccount.AuthTrustLevel = osAccount.AuthTrustLevel.ATL1;
3083  try {
3084    userAuth.auth(challenge, authType, authTrustLevel, {
3085      onResult: (resultCode: number, authResult: osAccount.AuthResult) => {
3086          console.log('auth resultCode = ' + resultCode);
3087          console.log('auth authResult = ' + JSON.stringify(authResult));
3088      }
3089    });
3090  } catch (err) {
3091    console.log('auth exception = ' + JSON.stringify(err));
3092  }
3093  ```
3094
3095### authWithPopup<sup>10+</sup>
3096
3097authWithPopup(domainAccountInfo: DomainAccountInfo, callback: IUserAuthCallback): void
3098
3099Authenticates a domain account in a pop-up window.
3100
3101**System API**: This is a system API.
3102
3103**System capability**: SystemCapability.Account.OsAccount
3104
3105**Parameters**
3106
3107| Name     | Type                                   | Mandatory| Description            |
3108| ---------- | --------------------------------------- | ---- | --------------- |
3109| domainAccountInfo   | [DomainAccountInfo](#domainaccountinfo8)  | Yes  | Domain account information.|
3110| callback   | [IUserAuthCallback](#iuserauthcallback8)  | Yes  | Callback used to return the authentication result.|
3111
3112**Example**
3113  ```ts
3114  import { AsyncCallback } from '@kit.BasicServicesKit';
3115  let plugin: osAccount.DomainPlugin = {
3116    auth: (domainAccountInfo: osAccount.DomainAccountInfo, credential: Uint8Array,
3117          callback: osAccount.IUserAuthCallback) => {},
3118    authWithPopup: (domainAccountInfo: osAccount.DomainAccountInfo,
3119                    callback: osAccount.IUserAuthCallback) => {
3120      // mock authentication
3121      // notify authentication result
3122      let result: osAccount.AuthResult = {
3123        token: new Uint8Array([0]),
3124        remainTimes: 5,
3125        freezingTime: 0
3126      };
3127      callback.onResult(0, result);
3128    },
3129    authWithToken: (domainAccountInfo: osAccount.DomainAccountInfo, token: Uint8Array,
3130                    callback: osAccount.IUserAuthCallback) => {},
3131    getAccountInfo: (options: osAccount.GetDomainAccountInfoPluginOptions,
3132                    callback: AsyncCallback<osAccount.DomainAccountInfo>) => {},
3133    getAuthStatusInfo: (domainAccountInfo: osAccount.DomainAccountInfo,
3134                        callback: AsyncCallback<osAccount.AuthStatusInfo>) => {},
3135    bindAccount: (domainAccountInfo: osAccount.DomainAccountInfo, localId: number,
3136                  callback: AsyncCallback<void>) => {},
3137    unbindAccount: (domainAccountInfo: osAccount.DomainAccountInfo, callback: AsyncCallback<void>) => {},
3138    isAccountTokenValid: (domainAccountInfo: osAccount.DomainAccountInfo, token: Uint8Array,
3139                          callback: AsyncCallback<boolean>) => {},
3140    getAccessToken: (options: osAccount.GetDomainAccessTokenOptions, callback: AsyncCallback<Uint8Array>) => {}
3141  }
3142  osAccount.DomainAccountManager.registerPlugin(plugin)
3143  ```
3144
3145### authWithToken<sup>10+</sup>
3146
3147authWithToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, callback: IUserAuthCallback): void
3148
3149Authenticates a domain account by the authorization token.
3150
3151**System API**: This is a system API.
3152
3153**System capability**: SystemCapability.Account.OsAccount
3154
3155**Parameters**
3156
3157| Name     | Type                                   | Mandatory| Description            |
3158| ---------- | --------------------------------------- | ---- | --------------- |
3159| domainAccountInfo   | [DomainAccountInfo](#domainaccountinfo8)  | Yes  | Domain account information.|
3160| token   | Uint8Array  | Yes  | Authorization token generated when the PIN or biometric authentication is successful.|
3161| callback   | [IUserAuthCallback](#iuserauthcallback8)  | Yes  | Callback used to return the authentication result.|
3162
3163**Example**
3164  ```ts
3165  import { AsyncCallback } from '@kit.BasicServicesKit';
3166  let plugin: osAccount.DomainPlugin = {
3167    auth: (domainAccountInfo: osAccount.DomainAccountInfo, credential: Uint8Array,
3168          callback: osAccount.IUserAuthCallback) => {},
3169    authWithPopup: (domainAccountInfo: osAccount.DomainAccountInfo,
3170                    callback: osAccount.IUserAuthCallback) => {},
3171    authWithToken: (domainAccountInfo: osAccount.DomainAccountInfo, token: Uint8Array,
3172                    callback: osAccount.IUserAuthCallback) => {
3173      // mock authentication
3174      // notify authentication result
3175      let result: osAccount.AuthResult = {
3176        token: new Uint8Array([0]),
3177        remainTimes: 5,
3178        freezingTime: 0
3179      };
3180      callback.onResult(0, result);
3181    },
3182    getAccountInfo: (options: osAccount.GetDomainAccountInfoPluginOptions,
3183                    callback: AsyncCallback<osAccount.DomainAccountInfo>) => {},
3184    getAuthStatusInfo: (domainAccountInfo: osAccount.DomainAccountInfo,
3185                        callback: AsyncCallback<osAccount.AuthStatusInfo>) => {},
3186    bindAccount: (domainAccountInfo: osAccount.DomainAccountInfo, localId: number,
3187                  callback: AsyncCallback<void>) => {},
3188    unbindAccount: (domainAccountInfo: osAccount.DomainAccountInfo, callback: AsyncCallback<void>) => {},
3189    isAccountTokenValid: (domainAccountInfo: osAccount.DomainAccountInfo, token: Uint8Array,
3190                          callback: AsyncCallback<boolean>) => {},
3191    getAccessToken: (options: osAccount.GetDomainAccessTokenOptions, callback: AsyncCallback<Uint8Array>) => {}
3192  }
3193  osAccount.DomainAccountManager.registerPlugin(plugin)
3194  ```
3195
3196### getAccountInfo<sup>10+</sup>
3197
3198getAccountInfo(options: GetDomainAccountInfoPluginOptions, callback: AsyncCallback&lt;DomainAccountInfo&gt;): void
3199
3200Obtains information about a domain account.
3201
3202**System API**: This is a system API.
3203
3204**System capability**: SystemCapability.Account.OsAccount
3205
3206**Parameters**
3207
3208| Name     | Type                                   | Mandatory| Description            |
3209| ---------- | --------------------------------------- | ---- | --------------- |
3210| options   | [GetDomainAccountInfoPluginOptions](#getdomainaccountinfopluginoptions10)  | Yes  | Domain account information.|
3211| callback   | AsyncCallback&lt;[DomainAccountInfo](#domainaccountinfo8)&gt; | Yes  | Callback used to return the result.|
3212
3213**Example**
3214  ```ts
3215  import { AsyncCallback, BusinessError } from '@kit.BasicServicesKit';
3216  let plugin: osAccount.DomainPlugin = {
3217    auth: (domainAccountInfo: osAccount.DomainAccountInfo, credential: Uint8Array,
3218          callback: osAccount.IUserAuthCallback) => {},
3219    authWithPopup: (domainAccountInfo: osAccount.DomainAccountInfo,
3220                    callback: osAccount.IUserAuthCallback) => {},
3221    authWithToken: (domainAccountInfo: osAccount.DomainAccountInfo, token: Uint8Array,
3222                    callback: osAccount.IUserAuthCallback) => {},
3223    getAccountInfo: (options: osAccount.GetDomainAccountInfoPluginOptions,
3224                    callback: AsyncCallback<osAccount.DomainAccountInfo>) => {
3225      // mock getting account information
3226      // notify result
3227      let code: BusinessError = {
3228        code: 0,
3229        name: "",
3230        message: ""
3231      };
3232      let accountInfo: osAccount.DomainAccountInfo = {
3233        domain: options.domain ? options.domain : "",
3234        accountName: options.accountName,
3235        accountId: 'xxxx'
3236      };
3237      callback(code, accountInfo);
3238    },
3239    getAuthStatusInfo: (domainAccountInfo: osAccount.DomainAccountInfo,
3240                        callback: AsyncCallback<osAccount.AuthStatusInfo>) => {},
3241    bindAccount: (domainAccountInfo: osAccount.DomainAccountInfo, localId: number,
3242                  callback: AsyncCallback<void>) => {},
3243    unbindAccount: (domainAccountInfo: osAccount.DomainAccountInfo, callback: AsyncCallback<void>) => {},
3244    isAccountTokenValid: (domainAccountInfo: osAccount.DomainAccountInfo, token: Uint8Array,
3245                          callback: AsyncCallback<boolean>) => {},
3246    getAccessToken: (options: osAccount.GetDomainAccessTokenOptions, callback: AsyncCallback<Uint8Array>) => {}
3247  }
3248  osAccount.DomainAccountManager.registerPlugin(plugin)
3249  ```
3250
3251### getAuthStatusInfo<sup>10+</sup>
3252
3253getAuthStatusInfo(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback&lt;AuthStatusInfo&gt;): void
3254
3255Obtains the authentication status of a domain account.
3256
3257**System API**: This is a system API.
3258
3259**System capability**: SystemCapability.Account.OsAccount
3260
3261**Parameters**
3262
3263| Name     | Type                                   | Mandatory| Description            |
3264| ---------- | --------------------------------------- | ---- | --------------- |
3265| domainAccountInfo   | [DomainAccountInfo](#domainaccountinfo8)  | Yes  | Domain account information.|
3266| callback   | AsyncCallback&lt;[AuthStatusInfo](#authstatusinfo10)&gt; | Yes  | Callback used to return the result.|
3267
3268**Example**
3269  ```ts
3270  import { AsyncCallback, BusinessError } from '@kit.BasicServicesKit';
3271  let plugin: osAccount.DomainPlugin = {
3272    auth: (domainAccountInfo: osAccount.DomainAccountInfo, credential: Uint8Array,
3273          callback: osAccount.IUserAuthCallback) => {},
3274    authWithPopup: (domainAccountInfo: osAccount.DomainAccountInfo,
3275                    callback: osAccount.IUserAuthCallback) => {},
3276    authWithToken: (domainAccountInfo: osAccount.DomainAccountInfo, token: Uint8Array,
3277                    callback: osAccount.IUserAuthCallback) => {},
3278    getAccountInfo: (options: osAccount.GetDomainAccountInfoPluginOptions,
3279                    callback: AsyncCallback<osAccount.DomainAccountInfo>) => {},
3280    getAuthStatusInfo: (domainAccountInfo: osAccount.DomainAccountInfo,
3281                        callback: AsyncCallback<osAccount.AuthStatusInfo>) => {
3282      let code: BusinessError = {
3283        code: 0,
3284        name: "",
3285        message: ""
3286      };
3287      let statusInfo: osAccount.AuthStatusInfo = {
3288        remainTimes: 5,
3289        freezingTime: 0
3290      };
3291      callback(code, statusInfo);
3292    },
3293    bindAccount: (domainAccountInfo: osAccount.DomainAccountInfo, localId: number,
3294                  callback: AsyncCallback<void>) => {},
3295    unbindAccount: (domainAccountInfo: osAccount.DomainAccountInfo, callback: AsyncCallback<void>) => {},
3296    isAccountTokenValid: (domainAccountInfo: osAccount.DomainAccountInfo, token: Uint8Array,
3297                          callback: AsyncCallback<boolean>) => {},
3298    getAccessToken: (options: osAccount.GetDomainAccessTokenOptions, callback: AsyncCallback<Uint8Array>) => {}
3299  }
3300  osAccount.DomainAccountManager.registerPlugin(plugin)
3301  ```
3302
3303### bindAccount<sup>10+</sup>
3304
3305bindAccount(domainAccountInfo: DomainAccountInfo, localId: number, callback: AsyncCallback&lt;void&gt;): void
3306
3307Binds a domain account.
3308
3309**System API**: This is a system API.
3310
3311**System capability**: SystemCapability.Account.OsAccount
3312
3313**Parameters**
3314
3315| Name     | Type                                   | Mandatory| Description            |
3316| ---------- | --------------------------------------- | ---- | --------------- |
3317| domainAccountInfo   | [DomainAccountInfo](#domainaccountinfo8)  | Yes  | Domain account information.|
3318| callback   | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
3319
3320**Example**
3321  ```ts
3322  import { AsyncCallback, BusinessError } from '@kit.BasicServicesKit';
3323  let plugin: osAccount.DomainPlugin = {
3324    auth: (domainAccountInfo: osAccount.DomainAccountInfo, credential: Uint8Array,
3325          callback: osAccount.IUserAuthCallback) => {},
3326    authWithPopup: (domainAccountInfo: osAccount.DomainAccountInfo,
3327                    callback: osAccount.IUserAuthCallback) => {},
3328    authWithToken: (domainAccountInfo: osAccount.DomainAccountInfo, token: Uint8Array,
3329                    callback: osAccount.IUserAuthCallback) => {},
3330    getAccountInfo: (options: osAccount.GetDomainAccountInfoPluginOptions,
3331                    callback: AsyncCallback<osAccount.DomainAccountInfo>) => {},
3332    getAuthStatusInfo: (domainAccountInfo: osAccount.DomainAccountInfo,
3333                        callback: AsyncCallback<osAccount.AuthStatusInfo>) => {},
3334    bindAccount: (domainAccountInfo: osAccount.DomainAccountInfo, localId: number,
3335                  callback: AsyncCallback<void>) => {
3336      // mock unbinding operation
3337      // notify binding result
3338      let code: BusinessError = {
3339        code: 0,
3340        name: "",
3341        message: ""
3342      };
3343      callback(code);
3344    },
3345    unbindAccount: (domainAccountInfo: osAccount.DomainAccountInfo, callback: AsyncCallback<void>) => {},
3346    isAccountTokenValid: (domainAccountInfo: osAccount.DomainAccountInfo, token: Uint8Array,
3347                          callback: AsyncCallback<boolean>) => {},
3348    getAccessToken: (options: osAccount.GetDomainAccessTokenOptions, callback: AsyncCallback<Uint8Array>) => {}
3349  }
3350  osAccount.DomainAccountManager.registerPlugin(plugin)
3351  ```
3352
3353### unbindAccount<sup>10+</sup>
3354
3355unbindAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback&lt;void&gt;): void
3356
3357Unbinds a domain account.
3358
3359**System API**: This is a system API.
3360
3361**System capability**: SystemCapability.Account.OsAccount
3362
3363**Parameters**
3364
3365| Name     | Type                                   | Mandatory| Description            |
3366| ---------- | --------------------------------------- | ---- | --------------- |
3367| domainAccountInfo   | [DomainAccountInfo](#domainaccountinfo8)  | Yes  | Domain account information.|
3368| callback   | AsyncCallback&lt;void&gt; | Yes  | Callback used to return the result.|
3369
3370**Example**
3371  ```ts
3372  import { AsyncCallback, BusinessError } from '@kit.BasicServicesKit';
3373  let plugin: osAccount.DomainPlugin = {
3374    auth: (domainAccountInfo: osAccount.DomainAccountInfo, credential: Uint8Array,
3375          callback: osAccount.IUserAuthCallback) => {},
3376    authWithPopup: (domainAccountInfo: osAccount.DomainAccountInfo,
3377                    callback: osAccount.IUserAuthCallback) => {},
3378    authWithToken: (domainAccountInfo: osAccount.DomainAccountInfo, token: Uint8Array,
3379                    callback: osAccount.IUserAuthCallback) => {},
3380    getAccountInfo: (options: osAccount.GetDomainAccountInfoPluginOptions,
3381                    callback: AsyncCallback<osAccount.DomainAccountInfo>) => {},
3382    getAuthStatusInfo: (domainAccountInfo: osAccount.DomainAccountInfo,
3383                        callback: AsyncCallback<osAccount.AuthStatusInfo>) => {},
3384    bindAccount: (domainAccountInfo: osAccount.DomainAccountInfo, localId: number,
3385                  callback: AsyncCallback<void>) => {},
3386    unbindAccount: (domainAccountInfo: osAccount.DomainAccountInfo, callback: AsyncCallback<void>) => {
3387      // mock unbinding operation
3388      // notify unbinding result
3389      let code: BusinessError = {
3390        code: 0,
3391        name: "",
3392        message: ""
3393      };
3394      callback(code);
3395    },
3396    isAccountTokenValid: (domainAccountInfo: osAccount.DomainAccountInfo, token: Uint8Array,
3397                          callback: AsyncCallback<boolean>) => {},
3398    getAccessToken: (options: osAccount.GetDomainAccessTokenOptions, callback: AsyncCallback<Uint8Array>) => {}
3399  }
3400  osAccount.DomainAccountManager.registerPlugin(plugin)
3401  ```
3402
3403### isAccountTokenValid<sup>10+</sup>
3404
3405isAccountTokenValid(domainAccountInfo: DomainAccountInfo, token: Uint8Array, callback: AsyncCallback&lt;boolean&gt;): void
3406
3407Checks whether the specified domain account token is valid.
3408
3409**System API**: This is a system API.
3410
3411**System capability**: SystemCapability.Account.OsAccount
3412
3413**Parameters**
3414
3415| Name     | Type                                   | Mandatory| Description            |
3416| ---------- | --------------------------------------- | ---- | --------------- |
3417| domainAccountInfo   | [DomainAccountInfo](#domainaccountinfo8)  | Yes  | Domain account information.|
3418| token | Uint8Array | Yes| Domain account token to check.|
3419| callback   | AsyncCallback&lt;boolean&gt; | Yes  | Callback used to return the result.|
3420
3421**Example**
3422  ```ts
3423  import { AsyncCallback, BusinessError } from '@kit.BasicServicesKit';
3424  let plugin: osAccount.DomainPlugin = {
3425    auth: (domainAccountInfo: osAccount.DomainAccountInfo, credential: Uint8Array,
3426          callback: osAccount.IUserAuthCallback) => {},
3427    authWithPopup: (domainAccountInfo: osAccount.DomainAccountInfo,
3428                    callback: osAccount.IUserAuthCallback) => {},
3429    authWithToken: (domainAccountInfo: osAccount.DomainAccountInfo, token: Uint8Array,
3430                    callback: osAccount.IUserAuthCallback) => {},
3431    getAccountInfo: (options: osAccount.GetDomainAccountInfoPluginOptions,
3432                    callback: AsyncCallback<osAccount.DomainAccountInfo>) => {},
3433    getAuthStatusInfo: (domainAccountInfo: osAccount.DomainAccountInfo,
3434                        callback: AsyncCallback<osAccount.AuthStatusInfo>) => {},
3435    bindAccount: (domainAccountInfo: osAccount.DomainAccountInfo, localId: number,
3436                  callback: AsyncCallback<void>) => {},
3437    unbindAccount: (domainAccountInfo: osAccount.DomainAccountInfo, callback: AsyncCallback<void>) => {},
3438    isAccountTokenValid: (domainAccountInfo: osAccount.DomainAccountInfo, token: Uint8Array,
3439                          callback: AsyncCallback<boolean>) => {
3440      // mock checking operation
3441      // notify checking result
3442      let code: BusinessError = {
3443        code: 0,
3444        name: "",
3445        message: ""
3446      };
3447      callback(code, true);
3448    },
3449    getAccessToken: (options: osAccount.GetDomainAccessTokenOptions, callback: AsyncCallback<Uint8Array>) => {}
3450  }
3451  osAccount.DomainAccountManager.registerPlugin(plugin)
3452  ```
3453
3454### getAccessToken<sup>10+</sup>
3455
3456getAccessToken(options: GetDomainAccessTokenOptions, callback: AsyncCallback&lt;Uint8Array&gt;): void
3457
3458Obtains the domain access token based on the specified conditions.
3459
3460**System API**: This is a system API.
3461
3462**System capability**: SystemCapability.Account.OsAccount
3463
3464**Parameters**
3465
3466| Name     | Type                                   | Mandatory| Description            |
3467| ---------- | --------------------------------------- | ---- | --------------- |
3468| options | [GetDomainAccessTokenOptions](#getdomainaccesstokenoptions10)  | Yes  | Options specified for obtaining the domain access token.|
3469| callback   | AsyncCallback&lt;Uint8Array&gt; | Yes  | Callback used to return the result.|
3470
3471**Example**
3472  ```ts
3473  import { AsyncCallback, BusinessError } from '@kit.BasicServicesKit';
3474  let plugin: osAccount.DomainPlugin = {
3475    auth: (domainAccountInfo: osAccount.DomainAccountInfo, credential: Uint8Array,
3476          callback: osAccount.IUserAuthCallback) => {},
3477    authWithPopup: (domainAccountInfo: osAccount.DomainAccountInfo,
3478                    callback: osAccount.IUserAuthCallback) => {},
3479    authWithToken: (domainAccountInfo: osAccount.DomainAccountInfo, token: Uint8Array,
3480                    callback: osAccount.IUserAuthCallback) => {},
3481    getAccountInfo: (options: osAccount.GetDomainAccountInfoPluginOptions,
3482                    callback: AsyncCallback<osAccount.DomainAccountInfo>) => {},
3483    getAuthStatusInfo: (domainAccountInfo: osAccount.DomainAccountInfo,
3484                        callback: AsyncCallback<osAccount.AuthStatusInfo>) => {},
3485    bindAccount: (domainAccountInfo: osAccount.DomainAccountInfo, localId: number,
3486                  callback: AsyncCallback<void>) => {},
3487    unbindAccount: (domainAccountInfo: osAccount.DomainAccountInfo, callback: AsyncCallback<void>) => {},
3488    isAccountTokenValid: (domainAccountInfo: osAccount.DomainAccountInfo, token: Uint8Array,
3489                          callback: AsyncCallback<boolean>) => {},
3490    getAccessToken: (options: osAccount.GetDomainAccessTokenOptions, callback: AsyncCallback<Uint8Array>) => {
3491      // mock getting operation
3492      // notify result
3493      let code: BusinessError = {
3494        code: 0,
3495        name: "",
3496        message: ""
3497      };
3498      let token: Uint8Array = new Uint8Array([0]);
3499      callback(code, token);
3500    }
3501  }
3502  osAccount.DomainAccountManager.registerPlugin(plugin)
3503  ```
3504
3505## DomainAccountManager <sup>9+</sup>
3506Provides APIs for domain account management.
3507
3508### registerPlugin<sup>9+</sup>
3509
3510static registerPlugin(plugin: DomainPlugin): void
3511
3512Registers a domain plug-in.
3513
3514**System API**: This is a system API.
3515
3516**System capability**: SystemCapability.Account.OsAccount
3517
3518**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
3519
3520**Parameters**
3521
3522| Name   | Type                    | Mandatory| Description                     |
3523| ----------| ----------------------- | --- | -------------------------- |
3524| plugin   | [DomainPlugin](#domainplugin9)  | Yes | Domain plug-in to register.|
3525
3526**Error codes**
3527
3528| ID| Error Message                    |
3529| -------- | --------------------------- |
3530| 201 | Permission denied.|
3531| 202 | Not system application.|
3532| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
3533| 12300201 | The domain plugin has been registered. |
3534
3535**Example**
3536  ```ts
3537  import { AsyncCallback } from '@kit.BasicServicesKit';
3538  let plugin: osAccount.DomainPlugin = {
3539    auth: (domainAccountInfo: osAccount.DomainAccountInfo, credential: Uint8Array,
3540         callback: osAccount.IUserAuthCallback) => {},
3541    authWithPopup: (domainAccountInfo: osAccount.DomainAccountInfo,
3542                  callback: osAccount.IUserAuthCallback) => {},
3543    authWithToken: (domainAccountInfo: osAccount.DomainAccountInfo, token: Uint8Array,
3544                  callback: osAccount.IUserAuthCallback) => {},
3545    getAccountInfo: (options: osAccount.GetDomainAccountInfoPluginOptions,
3546                   callback: AsyncCallback<osAccount.DomainAccountInfo>) => {},
3547    getAuthStatusInfo: (domainAccountInfo: osAccount.DomainAccountInfo,
3548                        callback: AsyncCallback<osAccount.AuthStatusInfo>) => {},
3549    bindAccount: (domainAccountInfo: osAccount.DomainAccountInfo, localId: number,
3550                  callback: AsyncCallback<void>) => {},
3551    unbindAccount: (domainAccountInfo: osAccount.DomainAccountInfo, callback: AsyncCallback<void>) => {},
3552    isAccountTokenValid: (domainAccountInfo: osAccount.DomainAccountInfo, token: Uint8Array,
3553                        callback: AsyncCallback<boolean>) => {},
3554    getAccessToken: (options: osAccount.GetDomainAccessTokenOptions, callback: AsyncCallback<Uint8Array>) => {}
3555  }
3556  try {
3557    osAccount.DomainAccountManager.registerPlugin(plugin);
3558    console.log('registerPlugin success.');
3559  } catch(err) {
3560    console.log('registerPlugin err:' + JSON.stringify(err));
3561  }
3562  ```
3563
3564### unregisterPlugin<sup>9+</sup>
3565
3566static unregisterPlugin(): void
3567
3568Unregisters this domain plug-in.
3569
3570**System API**: This is a system API.
3571
3572**System capability**: SystemCapability.Account.OsAccount
3573
3574**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
3575
3576**Error codes**
3577
3578| ID| Error Message                    |
3579| -------- | --------------------------- |
3580| 201 | Permission denied.|
3581| 202 | Not system application.|
3582
3583**Example**
3584  ```ts
3585  try {
3586    osAccount.DomainAccountManager.unregisterPlugin();
3587    console.log('unregisterPlugin success.');
3588  } catch(err) {
3589    console.log('unregisterPlugin err:' + JSON.stringify(err));
3590  }
3591  ```
3592
3593### auth<sup>10+</sup>
3594
3595auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUserAuthCallback): void
3596
3597Authenticates a domain account.
3598
3599**System API**: This is a system API.
3600
3601**System capability**: SystemCapability.Account.OsAccount
3602
3603**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL
3604
3605**Parameters**
3606
3607| Name     | Type                                   | Mandatory| Description            |
3608| ---------- | --------------------------------------- | ---- | --------------- |
3609| domainAccountInfo   | [DomainAccountInfo](#domainaccountinfo8)  | Yes  | Domain account information.|
3610| credential   | Uint8Array  | Yes  | Credentials of the domain account.|
3611| callback   | [IUserAuthCallback](#iuserauthcallback8)  | Yes  | Callback used to return the authentication result.|
3612
3613**Error codes**
3614
3615| ID| Error Message                    |
3616| -------- | --------------------------- |
3617| 201 | Permission denied.|
3618| 202 | Not system application.|
3619| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
3620| 801 | Capability not supported.|
3621| 12300001 | The system service works abnormally. |
3622| 12300002 | Invalid domainAccountInfo or credential. |
3623| 12300003 | Domain account does not exist. |
3624| 12300013 | Network exception. |
3625| 12300101 | Authentication failed. |
3626| 12300109 | The authentication, enrollment, or update operation is canceled. |
3627| 12300110 | The authentication is locked. |
3628| 12300111 | The authentication time out. |
3629| 12300112 | The authentication service is busy. |
3630| 12300113 | The account authentication service does not exist. |
3631| 12300114 | The account authentication service works abnormally. |
3632
3633**Example**
3634  ```ts
3635  let domainAccountInfo: osAccount.DomainAccountInfo = {
3636    domain: 'CHINA',
3637    accountName: 'zhangsan'
3638  }
3639  let credential = new Uint8Array([0])
3640  try {
3641    osAccount.DomainAccountManager.auth(domainAccountInfo, credential, {
3642      onResult: (resultCode: number, authResult: osAccount.AuthResult) => {
3643        console.log('auth resultCode = ' + resultCode);
3644        console.log('auth authResult = ' + JSON.stringify(authResult));
3645      }
3646    });
3647  } catch (err) {
3648    console.log('auth exception = ' + JSON.stringify(err));
3649  }
3650  ```
3651
3652### authWithPopup<sup>10+</sup>
3653
3654authWithPopup(callback: IUserAuthCallback): void
3655
3656Authenticates this domain account with a dialog box.
3657
3658**System API**: This is a system API.
3659
3660**System capability**: SystemCapability.Account.OsAccount
3661
3662**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL
3663
3664No permission is required since API version 11. Use the SDK of the latest version.
3665
3666**Parameters**
3667
3668| Name     | Type                                   | Mandatory| Description            |
3669| ---------- | --------------------------------------- | ---- | --------------- |
3670| callback   | [IUserAuthCallback](#iuserauthcallback8)  | Yes  | Callback used to return the authentication result.|
3671
3672**Error codes**
3673
3674| ID| Error Message                    |
3675| -------- | --------------------------- |
3676| 201 | Permission denied.|
3677| 202 | Not system application.|
3678| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
3679| 801 | Capability not supported.|
3680| 12300001 | The system service works abnormally. |
3681| 12300003 | No domain account is bound. |
3682| 12300013 | Network exception. |
3683| 12300101 | Authentication failed. |
3684| 12300109 | The authentication, enrollment, or update operation is canceled. |
3685| 12300110 | The authentication is locked. |
3686| 12300111 | The authentication time out. |
3687| 12300112 | The authentication service is busy. |
3688| 12300113 | The account authentication service does not exist. |
3689| 12300114 | The account authentication service works abnormally. |
3690
3691**Example**
3692  ```ts
3693  try {
3694    osAccount.DomainAccountManager.authWithPopup({
3695      onResult: (resultCode: number, authResult: osAccount.AuthResult) => {
3696        console.log('auth resultCode = ' + resultCode);
3697        console.log('auth authResult = ' + JSON.stringify(authResult));
3698      }
3699    })
3700  } catch (err) {
3701    console.log('auth exception = ' + JSON.stringify(err));
3702  }
3703  ```
3704
3705### authWithPopup<sup>10+</sup>
3706
3707authWithPopup(localId: number, callback: IUserAuthCallback): void
3708
3709Authenticates this domain account with a dialog box.
3710
3711**System API**: This is a system API.
3712
3713**System capability**: SystemCapability.Account.OsAccount
3714
3715**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL
3716
3717No permission is required since API version 11. Use the SDK of the latest version.
3718
3719**Parameters**
3720
3721| Name     | Type                                   | Mandatory| Description            |
3722| ---------- | --------------------------------------- | ---- | --------------- |
3723| localId   | number  | Yes  | Local ID of the system account bound to the domain account.|
3724| callback   | [IUserAuthCallback](#iuserauthcallback8)  | Yes  | Callback used to return the authentication result.|
3725
3726**Error codes**
3727
3728| ID| Error Message                    |
3729| -------- | --------------------------- |
3730| 201 | Permission denied.|
3731| 202 | Not system application.|
3732| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
3733| 801 | Capability not supported.|
3734| 12300001 | The system service works abnormally. |
3735| 12300002 | Invalid localId. |
3736| 12300003 | No domain account is bound. |
3737| 12300013 | Network exception. |
3738| 12300101 | Authentication failed. |
3739| 12300109 | The authentication, enrollment, or update operation is canceled. |
3740| 12300110 | The authentication is locked. |
3741| 12300111 | The authentication time out. |
3742| 12300112 | The authentication service is busy. |
3743| 12300113 | The account authentication service does not exist. |
3744| 12300114 | The account authentication service works abnormally. |
3745
3746**Example**
3747  ```ts
3748  try {
3749    osAccount.DomainAccountManager.authWithPopup(100, {
3750      onResult: (resultCode: number, authResult: osAccount.AuthResult) => {
3751        console.log('authWithPopup resultCode = ' + resultCode);
3752        console.log('authWithPopup authResult = ' + JSON.stringify(authResult));
3753      }
3754    })
3755  } catch (err) {
3756    console.log('authWithPopup exception = ' + JSON.stringify(err));
3757  }
3758  ```
3759
3760### hasAccount<sup>10+</sup>
3761
3762hasAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback&lt;boolean&gt;): void
3763
3764Checks whether a domain account exists.
3765
3766**System API**: This is a system API.
3767
3768**System capability**: SystemCapability.Account.OsAccount
3769
3770**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
3771
3772**Parameters**
3773
3774| Name     | Type                                   | Mandatory| Description            |
3775| ---------- | --------------------------------------- | ---- | --------------- |
3776| domainAccountInfo   | [DomainAccountInfo](#domainaccountinfo8)  | Yes  | Domain account information.|
3777| callback   | AsyncCallback&lt;boolean&gt;  | Yes  | Callback used to return the result.|
3778
3779**Error codes**
3780
3781| ID| Error Message                    |
3782| -------- | --------------------------- |
3783| 201 | Permission denied.|
3784| 202 | Not system application.|
3785| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
3786| 801 | Capability not supported.|
3787| 12300001 | The system service works abnormally. |
3788| 12300002 | Invalid domainAccountInfo. |
3789| 12300013 | Network exception. |
3790| 12300111 | The authentication time out. |
3791
3792**Example**
3793  ```ts
3794  import { BusinessError } from '@kit.BasicServicesKit';
3795  let domainAccountInfo: osAccount.DomainAccountInfo = {
3796    domain: 'CHINA',
3797    accountName: 'zhangsan'
3798  }
3799  try {
3800    osAccount.DomainAccountManager.hasAccount(domainAccountInfo, (err: BusinessError, result: boolean) => {
3801      if (err) {
3802        console.log('call hasAccount failed, error: ' + JSON.stringify(err));
3803      } else {
3804        console.log('hasAccount result: ' + result);
3805      }
3806    });
3807  } catch (err) {
3808    console.log('hasAccount exception = ' + JSON.stringify(err));
3809  }
3810  ```
3811
3812### hasAccount<sup>10+</sup>
3813
3814hasAccount(domainAccountInfo: DomainAccountInfo): Promise&lt;boolean&gt;
3815
3816Checks whether a domain account exists.
3817
3818**System API**: This is a system API.
3819
3820**System capability**: SystemCapability.Account.OsAccount
3821
3822**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
3823
3824**Parameters**
3825
3826| Name     | Type                                   | Mandatory| Description            |
3827| ---------- | --------------------------------------- | ---- | --------------- |
3828| domainAccountInfo   | [DomainAccountInfo](#domainaccountinfo8)  | Yes  | Domain account information.|
3829
3830**Return value**
3831
3832| Type                     | Description                    |
3833| :------------------------ | ----------------------- |
3834| Promise&lt;boolean&gt; | Promise used to return the result.|
3835
3836**Error codes**
3837
3838| ID| Error Message                    |
3839| -------- | --------------------------- |
3840| 201 | Permission denied.|
3841| 202 | Not system application.|
3842| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
3843| 801 | Capability not supported.|
3844| 12300001 | The system service works abnormally. |
3845| 12300002 | Invalid domainAccountInfo. |
3846| 12300013 | Network exception. |
3847| 12300111 | The authentication time out. |
3848
3849**Example**
3850  ```ts
3851  import { BusinessError } from '@kit.BasicServicesKit';
3852  let domainAccountInfo: osAccount.DomainAccountInfo = {
3853    domain: 'CHINA',
3854    accountName: 'zhangsan'
3855  }
3856  try {
3857    osAccount.DomainAccountManager.hasAccount(domainAccountInfo).then((result: boolean) => {
3858      console.log('hasAccount result: ' + result);
3859    }).catch((err: BusinessError) => {
3860        console.log('call hasAccount failed, error: ' + JSON.stringify(err));
3861    });
3862  } catch (err) {
3863    console.log('hasAccount exception = ' + JSON.stringify(err));
3864  }
3865  ```
3866
3867### updateAccountToken<sup>10+</sup>
3868
3869updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, callback: AsyncCallback&lt;void&gt;): void
3870
3871Updates the token of a domain account. An empty token means an invalid token. This API uses an asynchronous callback to return the result.
3872
3873**System API**: This is a system API.
3874
3875**System capability**: SystemCapability.Account.OsAccount
3876
3877**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
3878
3879**Parameters**
3880
3881| Name     | Type                                   | Mandatory| Description            |
3882| ---------- | --------------------------------------- | ---- | --------------- |
3883| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8)  | Yes  | Domain account information.|
3884| token | Uint8Array  | Yes  | New domain account token.|
3885| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the token is successfully updated, **err** is **null**. Otherwise, **err** is an error object.|
3886
3887**Error codes**
3888
3889| ID| Error Message                    |
3890| -------- | --------------------------- |
3891| 201 | Permission denied.|
3892| 202 | Not system application.|
3893| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
3894| 12300001 | The system service works abnormally. |
3895| 12300002 | Invalid token. |
3896| 12300003 | Account not found. |
3897
3898**Example**
3899  ```ts
3900  import { BusinessError } from '@kit.BasicServicesKit';
3901  let domainAccountInfo: osAccount.DomainAccountInfo = {
3902    domain: 'CHINA',
3903    accountName: 'zhangsan',
3904    accountId: '123456'
3905  }
3906  let token = new Uint8Array([0])
3907  try {
3908    osAccount.DomainAccountManager.updateAccountToken(domainAccountInfo, token, (err: BusinessError) => {
3909      if (err != null) {
3910        console.log('updateAccountToken failed, error: ' + JSON.stringify(err));
3911      } else {
3912        console.log('updateAccountToken successfully');
3913      }
3914    })
3915  } catch (err) {
3916    console.log('updateAccountToken exception = ' + JSON.stringify(err));
3917  }
3918  ```
3919
3920### updateAccountToken<sup>10+</sup>
3921
3922updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array): Promise&lt;void&gt;
3923
3924Updates the token of a domain account. An empty token means an invalid token. This API uses a promise to return the result.
3925
3926**System API**: This is a system API.
3927
3928**System capability**: SystemCapability.Account.OsAccount
3929
3930**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
3931
3932**Parameters**
3933
3934| Name     | Type                                   | Mandatory| Description            |
3935| ---------- | --------------------------------------- | ---- | --------------- |
3936| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8)  | Yes  | Domain account information.|
3937| token | Uint8Array  | Yes  | New domain account token.|
3938
3939**Return value**
3940
3941| Type                     | Description                    |
3942| :------------------------ | ----------------------- |
3943| Promise&lt;void&gt; | Promise that returns no value.|
3944
3945**Error codes**
3946
3947| ID| Error Message                    |
3948| -------- | --------------------------- |
3949| 201 | Permission denied.|
3950| 202 | Not system application.|
3951| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
3952| 12300001 | The system service works abnormally. |
3953| 12300002 | Invalid token. |
3954| 12300003 | Account not found. |
3955
3956**Example**
3957  ```ts
3958  import { BusinessError } from '@kit.BasicServicesKit';
3959  let domainAccountInfo: osAccount.DomainAccountInfo = {
3960    domain: 'CHINA',
3961    accountName: 'zhangsan',
3962    accountId: '123456'
3963  }
3964  let token = new Uint8Array([0])
3965  try {
3966    osAccount.DomainAccountManager.updateAccountToken(domainAccountInfo, token).then(() => {
3967      console.log('updateAccountToken successfully');
3968    }).catch((err: BusinessError) => {
3969        console.log('updateAccountToken failed, error: ' + JSON.stringify(err));
3970    });
3971  } catch (err) {
3972    console.log('updateAccountToken exception = ' + JSON.stringify(err));
3973  }
3974  ```
3975
3976### updateAccountInfo<sup>12+</sup>
3977
3978updateAccountInfo(oldAccountInfo: DomainAccountInfo, newAccountInfo: DomainAccountInfo): Promise&lt;void&gt;
3979
3980Updates information of a domain account. This API uses a promise to return the result.
3981
3982**System API**: This is a system API.
3983
3984**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
3985
3986**System capability**: SystemCapability.Account.OsAccount
3987
3988**Parameters**
3989
3990| Name     | Type                                   | Mandatory| Description            |
3991| ---------- | --------------------------------------- | ---- | --------------- |
3992| oldAccountInfo   | [DomainAccountInfo](#domainaccountinfo8)  | Yes  | Domain account information.|
3993| newAccountInfo   | [DomainAccountInfo](#domainaccountinfo8)  | Yes  | New domain account information.|
3994
3995**Error codes**
3996
3997| ID| Error Message                    |
3998| -------- | --------------------------- |
3999| 201 | Permission denied.|
4000| 202 | Not system application.|
4001| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
4002| 801 | Capability not supported.|
4003| 12300001 | The system service works abnormally. |
4004| 12300002 | The new account info is invalid. |
4005| 12300003 | The old account not found. |
4006| 12300004 | The new account already exists. |
4007
4008**Example**
4009  ```ts
4010  import { BusinessError } from '@kit.BasicServicesKit';
4011  let oldDomainInfo: osAccount.DomainAccountInfo =
4012    {domain: 'testDomain', accountName: 'oldtestAccountName'};
4013  let newDomainInfo: osAccount.DomainAccountInfo =
4014    {domain: 'testDomain', accountName: 'newtestAccountName'};
4015  try {
4016    osAccount.DomainAccountManager.updateAccountInfo(oldDomainInfo, newDomainInfo).then(() => {
4017      console.log('updateAccountInfo, success');
4018    }).catch((err: BusinessError) => {
4019      console.log('updateAccountInfo err: ' + err);
4020    });
4021  } catch (e) {
4022    console.log('updateAccountInfo exception: ' + e);
4023  }
4024  ```
4025
4026### getAccountInfo<sup>10+</sup>
4027
4028getAccountInfo(options: GetDomainAccountInfoOptions, callback: AsyncCallback&lt;DomainAccountInfo&gt;): void
4029
4030Obtains information about the specified domain account. This API uses an asynchronous callback to return the result.
4031
4032**System API**: This is a system API.
4033
4034**System capability**: SystemCapability.Account.OsAccount
4035
4036**Required permissions**: ohos.permission.GET_DOMAIN_ACCOUNTS
4037
4038**Parameters**
4039
4040| Name     | Type                                   | Mandatory| Description            |
4041| ---------- | --------------------------------------- | ---- | --------------- |
4042| options   | [GetDomainAccountInfoOptions](#getdomainaccountinfooptions10)  | Yes  | Domain account information.|
4043| callback   | AsyncCallback&lt;DomainAccountInfo&gt;  | Yes  | Callback used to return the result.|
4044
4045**Error codes**
4046
4047| ID| Error Message                    |
4048| -------- | --------------------------- |
4049| 201 | Permission denied.|
4050| 202 | Not system application.|
4051| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
4052| 801 | Capability not supported.|
4053| 12300001 | The system service works abnormally. |
4054| 12300003 | Account not found. |
4055| 12300013 | Network exception. |
4056| 12300111 | The authentication time out. |
4057
4058**Example**
4059  ```ts
4060  import { BusinessError } from '@kit.BasicServicesKit';
4061  let domainAccountInfo: osAccount.GetDomainAccountInfoOptions = {
4062    domain: 'CHINA',
4063    accountName: 'zhangsan'
4064  }
4065  try {
4066    osAccount.DomainAccountManager.getAccountInfo(domainAccountInfo,
4067      (err: BusinessError, result: osAccount.DomainAccountInfo) => {
4068      if (err) {
4069        console.log('call getAccountInfo failed, error: ' + JSON.stringify(err));
4070      } else {
4071        console.log('getAccountInfo result: ' + result);
4072      }
4073    });
4074  } catch (err) {
4075    console.log('getAccountInfo exception = ' + JSON.stringify(err));
4076  }
4077  ```
4078
4079### getAccountInfo<sup>10+</sup>
4080
4081getAccountInfo(options: GetDomainAccountInfoOptions): Promise&lt;DomainAccountInfo&gt;
4082
4083Obtains information about the specified domain account. This API uses a promise to return the result.
4084
4085**System API**: This is a system API.
4086
4087**System capability**: SystemCapability.Account.OsAccount
4088
4089**Required permissions**: ohos.permission.GET_DOMAIN_ACCOUNTS
4090
4091**Parameters**
4092
4093| Name     | Type                                   | Mandatory| Description            |
4094| ---------- | --------------------------------------- | ---- | --------------- |
4095| options   | [GetDomainAccountInfoOptions](#getdomainaccountinfooptions10)  | Yes  | Domain account information.|
4096
4097**Return value**
4098
4099| Type                     | Description                    |
4100| :------------------------ | ----------------------- |
4101| Promise&lt;DomainAccountInfo&gt; | Promise used to return the domain account information obtained.|
4102
4103**Error codes**
4104
4105| ID| Error Message                    |
4106| -------- | --------------------------- |
4107| 201 | Permission denied.|
4108| 202 | Not system application.|
4109| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
4110| 801 | Capability not supported.|
4111| 12300001 | The system service works abnormally. |
4112| 12300003 | Account not found. |
4113| 12300013 | Network exception. |
4114| 12300111 | The authentication time out. |
4115
4116**Example**
4117  ```ts
4118  import { BusinessError } from '@kit.BasicServicesKit';
4119  let domainAccountInfo: osAccount.GetDomainAccountInfoOptions = {
4120    domain: 'CHINA',
4121    accountName: 'zhangsan'
4122  }
4123  try {
4124    osAccount.DomainAccountManager.getAccountInfo(domainAccountInfo)
4125      .then((result: osAccount.DomainAccountInfo) => {
4126      console.log('getAccountInfo result: ' + result);
4127    }).catch((err: BusinessError) => {
4128      console.log('call getAccountInfo failed, error: ' + JSON.stringify(err));
4129    });
4130  } catch (err) {
4131    console.log('getAccountInfo exception = ' + JSON.stringify(err));
4132  }
4133  ```
4134
4135### getAccessToken<sup>11+</sup>
4136
4137getAccessToken(businessParams: Record<string, Object>, callback: AsyncCallback&lt;Uint8Array&gt;): void
4138
4139Obtains the service access token of this domain account. This API uses an asynchronous callback to return the result.
4140
4141**System API**: This is a system API.
4142
4143**System capability**: SystemCapability.Account.OsAccount
4144
4145**Parameters**
4146
4147| Name     | Type                                   | Mandatory| Description            |
4148| ---------- | --------------------------------------- | ---- | --------------- |
4149| businessParams | Record<string, Object>  | Yes  | Service parameters. The specific formats vary depending on the domain plug-in.|
4150| callback | AsyncCallback&lt;Uint8Array&gt;  | Yes  | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, an error object is returned.|
4151
4152**Error codes**
4153
4154| ID| Error Message                    |
4155| -------- | --------------------------- |
4156| 202 | Not system application.|
4157| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
4158| 801 | Capability not supported.|
4159| 12300001 | The system service works abnormally. |
4160| 12300002 | Invalid business parameters. |
4161| 12300003 | Domain account not found. |
4162| 12300013 | Network exception. |
4163| 12300014 | The domain account is not authenticated. |
4164| 12300111 | The authentication time out. |
4165
4166**Example**
4167  ```ts
4168  import { BusinessError } from '@kit.BasicServicesKit';
4169  let businessParams: Record<string, Object> = {
4170    'clientId': 'xxx',
4171    'secretId': 'yyy'
4172  };  // depends on the implementation of the domain plugin
4173  try {
4174    osAccount.DomainAccountManager.getAccessToken(businessParams,
4175      (err: BusinessError, result: Uint8Array) => {
4176      if (err) {
4177        console.log('getAccessToken failed, error: ' + JSON.stringify(err));
4178      } else {
4179        console.log('getAccessToken result: ' + result);
4180      }
4181    });
4182  } catch (err) {
4183    console.log('getAccessToken exception = ' + JSON.stringify(err));
4184  }
4185  ```
4186
4187### getAccessToken<sup>11+</sup>
4188
4189getAccessToken(businessParams: Record<string, Object>): Promise&lt;Uint8Array&gt;
4190
4191Obtains the service access token of this domain account. This API uses a promise to return the result.
4192
4193**System API**: This is a system API.
4194
4195**System capability**: SystemCapability.Account.OsAccount
4196
4197**Parameters**
4198
4199| Name     | Type                                   | Mandatory| Description            |
4200| ---------- | --------------------------------------- | ---- | --------------- |
4201| businessParams | Record<string, Object> | Yes  | Service parameters. The specific formats vary depending on the domain plug-in.|
4202
4203**Return value**
4204
4205| Type                     | Description                    |
4206| :------------------------ | ----------------------- |
4207| Promise&lt;Uint8Array&gt; | Promise used to return the service access token obtained.|
4208
4209**Error codes**
4210
4211| ID| Error Message                    |
4212| -------- | --------------------------- |
4213| 202 | Not system application.|
4214| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
4215| 801 | Capability not supported.|
4216| 12300001 | The system service works abnormally. |
4217| 12300002 | Invalid business parameters. |
4218| 12300003 | Domain account not found. |
4219| 12300013 | Network exception. |
4220| 12300014 | The domain account is not authenticated. |
4221| 12300111 | The authentication time out. |
4222
4223**Example**
4224  ```ts
4225  import { BusinessError } from '@kit.BasicServicesKit';
4226  let businessParams: Record<string, Object> = {
4227    'clientId': 'xxx',
4228    'secretId': 'yyy'
4229  };  // depends on the implementation of the domain plugin
4230  try {
4231    osAccount.DomainAccountManager.getAccessToken(businessParams)
4232      .then((result: Uint8Array) => {
4233      console.log('getAccessToken result: ' + result);
4234    }).catch((err: BusinessError) => {
4235      console.log('getAccessToken failed, error: ' + JSON.stringify(err));
4236    });
4237  } catch (err) {
4238    console.log('getAccessToken exception = ' + JSON.stringify(err));
4239  }
4240  ```
4241
4242### isAuthenticationExpired<sup>12+</sup>
4243
4244isAuthenticationExpired(domainAccountInfo: DomainAccountInfo): Promise&lt;boolean&gt;;
4245
4246Checks whether the authentication of a domain account has expired. This API uses a promise to return the result.
4247
4248**System API**: This is a system API.
4249
4250**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
4251
4252**System capability**: SystemCapability.Account.OsAccount
4253
4254**Parameters**
4255
4256| Name     | Type                                   | Mandatory| Description            |
4257| ---------- | --------------------------------------- | ---- | --------------- |
4258| domainAccountInfo   | [DomainAccountInfo](#domainaccountinfo8)  | Yes  | Domain account information.|
4259
4260**Return value**
4261
4262| Type                     | Description                    |
4263| :------------------------ | ----------------------- |
4264| Promise&lt;boolean&gt; | Promise used to return the result.|
4265
4266**Error codes**
4267
4268| ID| Error Message                    |
4269| -------- | --------------------------- |
4270| 201 | Permission denied.|
4271| 202 | Not system application.|
4272| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
4273| 801 | Capability not supported.|
4274| 12300001 | The system service works abnormally. |
4275| 12300003 | Domain account not found. |
4276
4277**Example**
4278  ```ts
4279  import { BusinessError } from '@kit.BasicServicesKit';
4280  let domainInfo: osAccount.DomainAccountInfo =
4281    {domain: 'testDomain', accountName: 'testAccountName'};
4282  try {
4283    osAccount.DomainAccountManager.isAuthenticationExpired(domainInfo).then((result: boolean) => {
4284      console.log('isAuthenticationExpired, result: ' + result);
4285    }).catch((err: BusinessError) => {
4286      console.log('isAuthenticationExpired err: ' + err);
4287    });
4288  } catch (e) {
4289    console.log('isAuthenticationExpired exception: ' + e);
4290  }
4291  ```
4292
4293## DomainServerConfig<sup>12+</sup>
4294
4295Represents the configuration of a domain server.
4296
4297**System API**: This is a system API.
4298
4299**System capability**: SystemCapability.Account.OsAccount
4300
4301| Name     | Type  | Mandatory| Description      |
4302| ----------- | ------ | ---- | ---------- |
4303| parameters | Record<string, Object> | Yes  | Server configuration parameters.|
4304| id | string | Yes  | Server configuration ID.|
4305| domain | string | Yes| Domain to which the server belongs.|
4306
4307## DomainServerConfigManager<sup>12+</sup>
4308
4309Provides APIs for domain server configuration and management.
4310
4311### addServerConfig<sup>12+</sup>
4312
4313static addServerConfig(parameters: Record&lt;string, Object&gt;): Promise&lt;DomainServerConfig&gt;
4314
4315Adds domain server configuration. This API uses a promise to return the result.
4316
4317**System API**: This is a system API.
4318
4319**System capability**: SystemCapability.Account.OsAccount
4320
4321**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
4322
4323**Parameters**
4324
4325| Name   | Type                    | Mandatory| Description                     |
4326| ----------| ----------------------- | --- | -------------------------- |
4327| parameters   | Record<string, Object>  | Yes | Configuration parameters of the domain server.|
4328
4329**Return value**
4330
4331| Type                     | Description                    |
4332| :------------------------ | ----------------------- |
4333| Promise&lt;[DomainServerConfig](#domainserverconfig12)&gt; | Promise used to return the configuration of the newly added domain server.|
4334
4335**Error codes**
4336
4337| ID| Error Message                    |
4338| -------- | --------------------------- |
4339| 201 | Permission denied.|
4340| 202 | Not system application.|
4341| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
4342| 801 | Capability not supported.|
4343| 12300001 | The system service works abnormally. |
4344| 12300002 | - Invalid server config parameters. |
4345| 12300211 | - Server unreachable. |
4346
4347**Example**
4348  ```ts
4349  import { BusinessError } from '@kit.BasicServicesKit';
4350  let configParams: Record<string, Object> = {
4351    'uri': 'test.example.com',
4352    'port': 100
4353  };
4354  osAccount.DomainServerConfigManager.addServerConfig(configParams).then((
4355    serverConfig: osAccount.DomainServerConfig) => {
4356    console.log('add server configuration successfully, the return config: ' + JSON.stringify(serverConfig));
4357  }).catch((err: BusinessError) => {
4358    console.log('add server configuration failed, error: ' + JSON.stringify(err));
4359  });
4360  ```
4361
4362### removeServerConfig<sup>12+</sup>
4363
4364static removeServerConfig(configId: string): Promise&lt;void&gt;
4365
4366Deletes domain server configuration. This API uses a promise to return the result.
4367
4368**System API**: This is a system API.
4369
4370**System capability**: SystemCapability.Account.OsAccount
4371
4372**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
4373
4374**Parameters**
4375
4376| Name   | Type                    | Mandatory| Description                     |
4377| ----------| ----------------------- | --- | -------------------------- |
4378| configId   | string  | Yes | Server configuration ID.|
4379
4380**Return value**
4381
4382| Type                     | Description                    |
4383| :------------------------ | ----------------------- |
4384| Promise&lt;void&gt; | Promise that returns no value.|
4385
4386**Error codes**
4387
4388| ID| Error Message                    |
4389| -------- | --------------------------- |
4390| 201 | Permission denied.|
4391| 202 | Not system application.|
4392| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
4393| 801 | Capability not supported.|
4394| 12300001 | The system service works abnormally. |
4395| 12300212 | - Server config not found. |
4396
4397**Example**
4398  ```ts
4399  import { BusinessError } from '@kit.BasicServicesKit';
4400  let configParams: Record<string, Object> = {
4401    'uri': 'test.example.com',
4402    'port': 100
4403  };
4404  osAccount.DomainServerConfigManager.addServerConfig(configParams).then((
4405    serverConfig: osAccount.DomainServerConfig) => {
4406    console.log('add domain server configuration successfully, the added config: ' + JSON.stringify(serverConfig));
4407    osAccount.DomainServerConfigManager.removeServerConfig(serverConfig.id);
4408    console.log('remove domain server configuration successfully');
4409  }).catch((err: BusinessError) => {
4410    console.log('add server configuration failed, error: ' + JSON.stringify(err));
4411  });
4412  ```
4413
4414### getAccountServerConfig<sup>12+</sup>
4415
4416static getAccountServerConfig(domainAccountInfo: DomainAccountInfo): Promise&lt;DomainServerConfig&gt;
4417
4418Obtains the server configuration of a domain account. This API uses a promise to return the result.
4419
4420**System API**: This is a system API.
4421
4422**System capability**: SystemCapability.Account.OsAccount
4423
4424**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS
4425
4426**Parameters**
4427
4428| Name   | Type                    | Mandatory| Description                     |
4429| ----------| ----------------------- | --- | -------------------------- |
4430| domainAccountInfo   | [DomainAccountInfo](#domainaccountinfo8)  | Yes | Information of the domain account.|
4431
4432**Return value**
4433
4434| Type                     | Description                    |
4435| :------------------------ | ----------------------- |
4436| Promise&lt;[DomainServerConfig](#domainserverconfig12)&gt; | Promise used to return the domain server configuration of the account.|
4437
4438**Error codes**
4439
4440| ID| Error Message                    |
4441| -------- | --------------------------- |
4442| 201 | Permission denied.|
4443| 202 | Not system application.|
4444| 401 |Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
4445| 801 | Capability not supported.|
4446| 12300001 | The system service works abnormally. |
4447| 12300003 | Domain account not found. |
4448
4449**Example**
4450  ```ts
4451  import { BusinessError } from '@kit.BasicServicesKit';
4452  let accountInfo: osAccount.DomainAccountInfo = {
4453    'accountName': 'demoName',
4454    'accountId': 'demoId',
4455    'domain': 'demoDomain'
4456  };
4457  osAccount.DomainServerConfigManager.getAccountServerConfig(accountInfo).then((
4458    serverConfig: osAccount.DomainServerConfig) => {
4459    console.log('get account server configuration successfully, the return config: ' + JSON.stringify(serverConfig));
4460  }).catch((err: BusinessError) => {
4461    console.log('add server configuration failed, error: ' + JSON.stringify(err));
4462  });
4463  ```
4464
4465## UserIdentityManager<sup>8+</sup>
4466
4467Provides APIs for user IDM.
4468
4469**System API**: This is a system API.
4470
4471### constructor<sup>8+</sup>
4472
4473constructor()
4474
4475A constructor used to create an instance for user IDM.
4476
4477**System API**: This is a system API.
4478
4479**System capability**: SystemCapability.Account.OsAccount
4480
4481**Error codes**
4482
4483| ID| Error Message                    |
4484| -------- | --------------------------- |
4485| 202 | Not system application.|
4486
4487**Example**
4488  ```ts
4489  let userIDM = new osAccount.UserIdentityManager();
4490  ```
4491
4492### openSession<sup>8+</sup>
4493
4494openSession(callback: AsyncCallback&lt;Uint8Array&gt;): void
4495
4496Opens a session to obtain the challenge value. This API uses an asynchronous callback to return the result.
4497
4498**System API**: This is a system API.
4499
4500**System capability**: SystemCapability.Account.OsAccount
4501
4502**Required permissions**: ohos.permission.MANAGE_USER_IDM
4503
4504**Parameters**
4505
4506| Name   | Type                            | Mandatory| Description                                                           |
4507| -------- | -------------------------------- | ---- | -------------------------------------------------------------- |
4508| callback | AsyncCallback&lt;Uint8Array&gt;  | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the challenge value obtained. Otherwise, **err** is an error object.|
4509
4510**Error codes**
4511
4512| ID| Error Message                    |
4513| -------- | --------------------------- |
4514| 201 | Permission denied.|
4515| 202 | Not system application.|
4516| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
4517| 12300001 | The system service works abnormally. |
4518
4519**Example**
4520  ```ts
4521  import { BusinessError } from '@kit.BasicServicesKit';
4522  let userIDM = new osAccount.UserIdentityManager();
4523  try {
4524    userIDM.openSession((err: BusinessError, challenge: Uint8Array) => {
4525        console.log('openSession error = ' + JSON.stringify(err));
4526        console.log('openSession challenge = ' + JSON.stringify(challenge));
4527    });
4528  } catch (e) {
4529    console.log('openSession exception = ' + JSON.stringify(e));
4530  }
4531  ```
4532
4533### openSession<sup>8+</sup>
4534
4535openSession(accountId?: number): Promise&lt;Uint8Array&gt;
4536
4537Opens a session. This API returns a challenge value, which can be used to determine whether the subsequent identity authentication is in this session. This can prevent replay attacks. This API uses a promise to return the result.
4538
4539**System API**: This is a system API.
4540
4541**System capability**: SystemCapability.Account.OsAccount
4542
4543**Required permissions**: ohos.permission.MANAGE_USER_IDM
4544
4545**Parameters**
4546
4547| Name    | Type   | Mandatory| Description       |
4548| --------- | ------- | ---- | ----------- |
4549| accountId<sup>12+</sup> | number  | No  | System account ID, which is left blank by default.|
4550
4551**Return value**
4552
4553| Type                     | Description                    |
4554| :------------------------ | ----------------------- |
4555| Promise&lt;Uint8Array&gt; | Promise used to return the challenge value obtained.|
4556
4557**Error codes**
4558
4559| ID| Error Message                    |
4560| -------- | --------------------------- |
4561| 201 | Permission denied.|
4562| 202 | Not system application.|
4563| 401 | Parameter error. Possible causes: Incorrect parameter types. |
4564| 12300001 | The system service works abnormally. |
4565| 12300003 | Account not found. |
4566| 12300008 | Restricted account. |
4567
4568**Example**
4569  ```ts
4570  import { BusinessError } from '@kit.BasicServicesKit';
4571  let userIDM = new osAccount.UserIdentityManager();
4572  let accountId = 100;
4573  try {
4574    userIDM.openSession(accountId).then((challenge: Uint8Array) => {
4575        console.info('openSession challenge = ' + JSON.stringify(challenge));
4576    }).catch((err: BusinessError) => {
4577        console.info('openSession error = ' + JSON.stringify(err));
4578    });
4579  } catch (e) {
4580    console.log('openSession exception = ' + JSON.stringify(e));
4581  }
4582  ```
4583
4584### addCredential<sup>8+</sup>
4585
4586addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void
4587
4588Adds credential information, including the credential type, subtype, and token (if a non-PIN credential is added).
4589
4590**System API**: This is a system API.
4591
4592**System capability**: SystemCapability.Account.OsAccount
4593
4594**Required permissions**: ohos.permission.MANAGE_USER_IDM
4595
4596**Parameters**
4597
4598| Name          | Type                                | Mandatory| Description                       |
4599| --------------- | ------------------------------------ | --- | ---------------------------- |
4600| credentialInfo  | [CredentialInfo](#credentialinfo8)   | Yes | Credential information to add.               |
4601| callback        | [IIdmCallback](#iidmcallback8)       | Yes | Callback used to return the result. |
4602
4603**Error codes**
4604
4605| ID| Error Message                    |
4606| -------- | ------------------- |
4607| 201 | Permission denied.|
4608| 202 | Not system application.|
4609| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
4610| 12300001 | The system service works abnormally. |
4611| 12300002 | Invalid credentialInfo, i.e. authType or authSubType. |
4612| 12300003 | Account not found. |
4613| 12300008 | Restricted account. |
4614| 12300101 | The token is invalid. |
4615| 12300106 | The authentication type is not supported. |
4616| 12300109 | The authentication, enrollment, or update operation is canceled. |
4617| 12300111 | The authentication time out. |
4618| 12300115 | The number of credentials reaches the upper limit. |
4619| 12300116 | Credential complexity verification failed. |
4620
4621**Example**
4622  ```ts
4623  import { BusinessError } from '@kit.BasicServicesKit';
4624  let password: Uint8Array = new Uint8Array([0, 0, 0, 0, 0, 0]);
4625  let pinAuth: osAccount.PINAuth = new osAccount.PINAuth();
4626  pinAuth.registerInputer({
4627    onGetData: (authSubType: osAccount.AuthSubType, callback: osAccount.IInputData) => {
4628      callback.onSetData(authSubType, password);
4629    }
4630  });
4631  let credentialInfo: osAccount.CredentialInfo = {
4632    credType: osAccount.AuthType.PIN,
4633    credSubType: osAccount.AuthSubType.PIN_SIX,
4634    token: new Uint8Array([]),
4635  };
4636  let userIDM = new osAccount.UserIdentityManager();
4637  userIDM.openSession((err: BusinessError, challenge: Uint8Array) => {
4638    try {
4639    userIDM.addCredential(credentialInfo, {
4640      onResult: (result: number, extraInfo: osAccount.RequestResult) => {
4641        console.log('addCredential result = ' + result);
4642        console.log('addCredential extraInfo = ' + extraInfo);
4643      }
4644    });
4645    } catch (e) {
4646      console.log('addCredential exception = ' + JSON.stringify(e));
4647    }
4648  });
4649  ```
4650
4651### updateCredential<sup>8+</sup>
4652
4653updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void
4654
4655Updates credential information. This API uses an asynchronous callback to return the result.
4656
4657**System API**: This is a system API.
4658
4659**System capability**: SystemCapability.Account.OsAccount
4660
4661**Required permissions**: ohos.permission.MANAGE_USER_IDM
4662
4663**Parameters**
4664
4665| Name          | Type                                 | Mandatory| Description                    |
4666| --------------- | ------------------------------------- | --- | ------------------------- |
4667| credentialInfo  | [CredentialInfo](#credentialinfo8)    | Yes | Credential information to add.            |
4668| callback        | [IIdmCallback](#iidmcallback8)        | Yes | Callback used to return the result.|
4669
4670**Error codes**
4671
4672| ID| Error Message                    |
4673| -------- | ------------------- |
4674| 201 | Permission denied.|
4675| 202 | Not system application.|
4676| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
4677| 12300001 | The system service works abnormally. |
4678| 12300002 | Invalid credentialInfo, i.e. authType or authSubType or token. |
4679| 12300003 | Account not found. |
4680| 12300101 | The token is invalid. |
4681| 12300102 | Credential not enrolled.|
4682| 12300106 | The authentication type is not supported. |
4683| 12300109 | The authentication, enrollment, or update operation is canceled. |
4684| 12300111 | The authentication time out. |
4685| 12300116 | Credential complexity verification failed. |
4686
4687**Example**
4688  ```ts
4689  import { BusinessError } from '@kit.BasicServicesKit';
4690  let userIDM = new osAccount.UserIdentityManager();
4691  let userAuth: osAccount.UserAuth = new osAccount.UserAuth();
4692  let pinAuth: osAccount.PINAuth = new osAccount.PINAuth();
4693  let password: Uint8Array = new Uint8Array([0, 0, 0, 0, 0, 0]);
4694  let credentialInfo: osAccount.CredentialInfo = {
4695    credType: osAccount.AuthType.PIN,
4696    credSubType: osAccount.AuthSubType.PIN_SIX,
4697    token: new Uint8Array([]),
4698  };
4699  pinAuth.registerInputer({
4700    onGetData: (authSubType: osAccount.AuthSubType, callback: osAccount.IInputData) => {
4701      callback.onSetData(authSubType, password);
4702    }
4703  });
4704  userIDM.openSession((err: BusinessError, challenge: Uint8Array) => {
4705    userAuth.auth(challenge, credentialInfo.credType, osAccount.AuthTrustLevel.ATL1, {
4706      onResult: (result: number, extraInfo: osAccount.AuthResult) => {
4707        if (result != osAccount.ResultCode.SUCCESS) {
4708          return;
4709        }
4710        if (extraInfo.token != null) {
4711          credentialInfo.token = extraInfo.token;
4712        }
4713        try {
4714          userIDM.updateCredential(credentialInfo, {
4715            onResult: (result: number, extraInfo: osAccount.RequestResult) => {
4716                console.log('updateCredential result = ' + result);
4717                console.log('updateCredential extraInfo = ' + extraInfo);
4718            }
4719          });
4720        } catch (e) {
4721          console.log('updateCredential exception = ' + JSON.stringify(e));
4722        }
4723      }
4724    });
4725  });
4726  ```
4727
4728### closeSession<sup>8+</sup>
4729
4730closeSession(accountId?: number): void
4731
4732Closes this session to terminate IDM.
4733
4734**System API**: This is a system API.
4735
4736**System capability**: SystemCapability.Account.OsAccount
4737
4738**Required permissions**: ohos.permission.MANAGE_USER_IDM
4739
4740**Parameters**
4741
4742| Name    | Type   | Mandatory| Description       |
4743| --------- | ------- | ---- | ----------- |
4744| accountId<sup>12+</sup> | number  | No  | System account ID, which is left blank by default.|
4745
4746**Error codes**
4747
4748| ID| Error Message                    |
4749| -------- | --------------------------- |
4750| 201 | Permission denied.|
4751| 202 | Not system application.|
4752| 401 | Parameter error. Possible causes: Incorrect parameter types. |
4753| 12300001 | The system service works abnormally. |
4754| 12300003 | Account not found. |
4755| 12300008 | Restricted account. |
4756
4757**Example**
4758  ```ts
4759  let userIDM = new osAccount.UserIdentityManager();
4760  let accountId = 100;
4761  userIDM.closeSession(accountId);
4762  ```
4763
4764### cancel<sup>8+</sup>
4765
4766cancel(challenge: Uint8Array): void
4767
4768Cancels an entry based on the challenge value.
4769
4770**System API**: This is a system API.
4771
4772**System capability**: SystemCapability.Account.OsAccount
4773
4774**Required permissions**: ohos.permission.MANAGE_USER_IDM
4775
4776**Parameters**
4777
4778| Name   | Type       | Mandatory| Description  |
4779| -------- | ----------- | ---- | ----- |
4780| challenge | Uint8Array | Yes  | Challenge value.|
4781
4782**Error codes**
4783
4784| ID| Error Message           |
4785| -------- | ------------------- |
4786| 201 | Permission denied.|
4787| 202 | Not system application.|
4788| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
4789| 12300001 | The system service works abnormally. |
4790| 12300002 | Invalid challenge. |
4791
4792**Example**
4793  ```ts
4794  let userIDM = new osAccount.UserIdentityManager();
4795  let challenge: Uint8Array = new Uint8Array([0]);
4796  try {
4797    userIDM.cancel(challenge);
4798  } catch(err) {
4799    console.log('cancel err:' + JSON.stringify(err));
4800  }
4801  ```
4802
4803### delUser<sup>8+</sup>
4804
4805delUser(token: Uint8Array, callback: IIdmCallback): void
4806
4807Deletes a user based on the authentication token. This API uses a callback to return the result.
4808
4809**System API**: This is a system API.
4810
4811**System capability**: SystemCapability.Account.OsAccount
4812
4813**Required permissions**: ohos.permission.MANAGE_USER_IDM
4814
4815**Parameters**
4816
4817| Name   | Type                          | Mandatory| Description                     |
4818| -------- | ------------------------------ | --- | ------------------------- |
4819| token    | Uint8Array                     | Yes | Authentication token.            |
4820| callback | [IIdmCallback](#iidmcallback8) | Yes | Callback used to return the result.|
4821
4822**Error codes**
4823
4824| ID| Error Message       |
4825| -------- | ------------------- |
4826| 201 | Permission denied.|
4827| 202 | Not system application.|
4828| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
4829| 12300001 | The system service works abnormally. |
4830| 12300101 | The token is invalid. |
4831
4832**Example**
4833  ```ts
4834  let userIDM = new osAccount.UserIdentityManager();
4835  let token: Uint8Array = new Uint8Array([0]);
4836  try {
4837    userIDM.delUser(token, {
4838      onResult: (result: number, extraInfo: osAccount.RequestResult) => {
4839        console.log('delUser result = ' + result);
4840        console.log('delUser extraInfo = ' + JSON.stringify(extraInfo));
4841      }
4842    });
4843  } catch (e) {
4844    console.log('delUser exception = ' + JSON.stringify(e));
4845  }
4846  ```
4847
4848### delCred<sup>8+</sup>
4849
4850delCred(credentialId: Uint8Array, token: Uint8Array, callback: IIdmCallback): void
4851
4852Deletes user credential information.
4853
4854**System API**: This is a system API.
4855
4856**System capability**: SystemCapability.Account.OsAccount
4857
4858**Required permissions**: ohos.permission.MANAGE_USER_IDM
4859
4860**Parameters**
4861
4862| Name          | Type                                           | Mandatory| Description                     |
4863| --------------- | ----------------------------------- | --- | ---------------------------|
4864| credentialId    | Uint8Array                          | Yes | Credential ID.                 |
4865| token           | Uint8Array                          | Yes | Authentication token.              |
4866| callback        | [IIdmCallback](#iidmcallback8)      | Yes | Callback used to return the result.|
4867
4868**Error codes**
4869
4870| ID| Error Message            |
4871| -------- | ------------------- |
4872| 201 | Permission denied.|
4873| 202 | Not system application.|
4874| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
4875| 12300001 | The system service works abnormally. |
4876| 12300002 | Invalid credentialId. |
4877| 12300101 | The token is invalid. |
4878| 12300102 | Credential not enrolled. |
4879
4880**Example**
4881  ```ts
4882  let userIDM = new osAccount.UserIdentityManager();
4883  let credentialId: Uint8Array = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]);
4884  let token: Uint8Array = new Uint8Array([0]);
4885  try {
4886    userIDM.delCred(credentialId, token, {
4887      onResult: (result: number, extraInfo: osAccount.RequestResult) => {
4888          console.log('delCred result = ' + result);
4889          console.log('delCred extraInfo = ' + JSON.stringify(extraInfo));
4890      }
4891    });
4892  } catch (e) {
4893    console.log('delCred exception = ' + JSON.stringify(e));
4894  }
4895  ```
4896
4897### getAuthInfo<sup>8+</sup>
4898
4899getAuthInfo(callback: AsyncCallback&lt;Array&lt;EnrolledCredInfo&gt;&gt;): void
4900
4901Obtains authentication information. This API uses an asynchronous callback to return the result.
4902
4903**System API**: This is a system API.
4904
4905**System capability**: SystemCapability.Account.OsAccount
4906
4907**Required permissions**: ohos.permission.USE_USER_IDM
4908
4909**Parameters**
4910
4911| Name   | Type                                                                    | Mandatory| Description                                                |
4912| -------- | ------------------------------------------------------------------------ | ---- | --------------------------------------------- |
4913| callback | AsyncCallback&lt;Array&lt;[EnrolledCredInfo](#enrolledcredinfo8)&gt;&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is information about all registered credentials of the user. Otherwise, **err** is an error object.|
4914
4915**Error codes**
4916
4917| ID| Error Message              |
4918| -------- | --------------------- |
4919| 201 | Permission denied.|
4920| 202 | Not system application.|
4921| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
4922| 12300001 | The system service works abnormally. |
4923| 12300102 | Credential not enrolled. |
4924
4925**Example**
4926  ```ts
4927  import { BusinessError } from '@kit.BasicServicesKit';
4928  let userIDM = new osAccount.UserIdentityManager();
4929  try {
4930    userIDM.getAuthInfo((err: BusinessError, result: osAccount.EnrolledCredInfo[]) => {
4931      console.log('getAuthInfo err = ' + JSON.stringify(err));
4932      console.log('getAuthInfo result = ' + JSON.stringify(result));
4933    });
4934  } catch (e) {
4935    console.log('getAuthInfo exception = ' + JSON.stringify(e));
4936  }
4937  ```
4938
4939### getAuthInfo<sup>8+</sup>
4940
4941getAuthInfo(authType: AuthType, callback: AsyncCallback&lt;Array&lt;EnrolledCredInfo&gt;&gt;): void
4942
4943Obtains authentication information of the specified type. This API uses an asynchronous callback to return the result.
4944
4945**System API**: This is a system API.
4946
4947**System capability**: SystemCapability.Account.OsAccount
4948
4949**Required permissions**: ohos.permission.USE_USER_IDM
4950
4951**Parameters**
4952
4953| Name   | Type                                              | Mandatory| Description                                               |
4954| -------- | -------------------------------------------------- | ---- | -------------------------------------------------- |
4955| authType | [AuthType](#authtype8) | Yes  | Authentication credential type.                                         |
4956| callback | AsyncCallback&lt;Array&lt;[EnrolledCredInfo](#enrolledcredinfo8)&gt;&gt; | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the information about all enrolled credentials of the specified type. Otherwise, **err** is an error object.|
4957
4958**Error codes**
4959
4960| ID| Error Message              |
4961| -------- | ------------------- |
4962| 201 | Permission denied.|
4963| 202 | Not system application.|
4964| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
4965| 12300001 | The system service works abnormally. |
4966| 12300002 | Invalid authType. |
4967| 12300102 | Credential not enrolled. |
4968
4969**Example**
4970  ```ts
4971  import { BusinessError } from '@kit.BasicServicesKit';
4972  let userIDM = new osAccount.UserIdentityManager();
4973  try {
4974    userIDM.getAuthInfo(osAccount.AuthType.PIN,
4975      (err: BusinessError, result: osAccount.EnrolledCredInfo[]) => {
4976      console.log('getAuthInfo err = ' + JSON.stringify(err));
4977      console.log('getAuthInfo result = ' + JSON.stringify(result));
4978    });
4979  } catch (e) {
4980    console.log('getAuthInfo exception = ' + JSON.stringify(e));
4981  }
4982  ```
4983
4984### getAuthInfo<sup>8+</sup>
4985
4986getAuthInfo(authType?: AuthType): Promise&lt;Array&lt;EnrolledCredInfo&gt;&gt;;
4987
4988Obtains authentication information. This API uses a promise to return the result.
4989
4990**System API**: This is a system API.
4991
4992**System capability**: SystemCapability.Account.OsAccount
4993
4994**Required permissions**: ohos.permission.USE_USER_IDM
4995
4996**Parameters**
4997
4998| Name   | Type                               | Mandatory| Description     |
4999| -------- | ----------------------------------- | ---- | -------- |
5000| authType | [AuthType](#authtype8)              | No  | Authentication type. By default, this parameter is left blank, which means to obtain information about all authentication types.|
5001
5002**Return value**
5003
5004| Type                                        | Description                                                                    |
5005| :------------------------------------------- | :----------------------------------------------------------------------- |
5006| Promise&lt;Array&lt;[EnrolledCredInfo](#enrolledcredinfo8)&gt;&gt; | Promise used to return the information about all the enrolled credentials of the specified type.|
5007
5008**Error codes**
5009
5010| ID| Error Message              |
5011| -------- | ------------------- |
5012| 201 | Permission denied.|
5013| 202 | Not system application.|
5014| 401 | Parameter error. Possible causes: Incorrect parameter types. |
5015| 12300001 | The system service works abnormally. |
5016| 12300002 | Invalid authType. |
5017| 12300102 | Credential not enrolled. |
5018
5019**Example**
5020  ```ts
5021  import { BusinessError } from '@kit.BasicServicesKit';
5022  let userIDM = new osAccount.UserIdentityManager();
5023  try {
5024    userIDM.getAuthInfo(osAccount.AuthType.PIN).then((result: osAccount.EnrolledCredInfo[]) => {
5025      console.log('getAuthInfo result = ' + JSON.stringify(result))
5026    }).catch((err: BusinessError) => {
5027      console.log('getAuthInfo error = ' + JSON.stringify(err));
5028    });
5029  } catch (e) {
5030    console.log('getAuthInfo exception = ' + JSON.stringify(e));
5031  }
5032  ```
5033
5034### getAuthInfo<sup>12+</sup>
5035
5036getAuthInfo(options?: GetAuthInfoOptions): Promise&lt;Array&lt;EnrolledCredInfo&gt;&gt;
5037
5038Obtains authentication information. This API uses a promise to return the result.
5039
5040**System API**: This is a system API.
5041
5042**System capability**: SystemCapability.Account.OsAccount
5043
5044**Required permissions**: ohos.permission.USE_USER_IDM
5045
5046**Parameters**
5047
5048| Name   | Type                               | Mandatory| Description     |
5049| -------- | ----------------------------------- | ---- | -------- |
5050| options | [GetAuthInfoOptions](#getauthinfooptions12)          | No  | Optional parameters for obtaining authentication information.|
5051
5052**Return value**
5053
5054| Type                                        | Description                                                                    |
5055| :------------------------------------------- | :----------------------------------------------------------------------- |
5056| Promise&lt;Array&lt;[EnrolledCredInfo](#enrolledcredinfo8)&gt;&gt; | Promise used to return the information about all the enrolled credentials of the specified type.|
5057
5058**Error codes**
5059
5060| ID| Error Message              |
5061| -------- | ------------------- |
5062| 201 | Permission denied.|
5063| 202 | Not system application.|
5064| 401 | Parameter error. Possible causes: Incorrect parameter types. |
5065| 12300001 | The system service works abnormally. |
5066| 12300002 | Invalid options. |
5067| 12300003 | Account not found. |
5068
5069**Example**
5070  ```ts
5071  import { BusinessError } from '@kit.BasicServicesKit';
5072  let userIDM = new osAccount.UserIdentityManager();
5073  let options: osAccount.GetAuthInfoOptions = {
5074    authType: osAccount.AuthType.PIN,
5075    accountId: 100,
5076  };
5077  try {
5078    userIDM.getAuthInfo(options).then((result: osAccount.EnrolledCredInfo[]) => {
5079      console.log('getAuthInfo result = ' + JSON.stringify(result))
5080    }).catch((err: BusinessError) => {
5081      console.log('getAuthInfo error = ' + JSON.stringify(err));
5082    });
5083  } catch (e) {
5084    console.log('getAuthInfo exception = ' + JSON.stringify(e));
5085  }
5086  ```
5087
5088### getEnrolledId<sup>12+</sup>
5089
5090getEnrolledId(authType: AuthType, accountId?: number): Promise&lt;Uint8Array&gt;
5091
5092Obtains the ID of the enrolled credential based on the credential type and account ID (optional). This API uses a promise to return the result.
5093
5094**System API**: This is a system API.
5095
5096**System capability**: SystemCapability.Account.OsAccount
5097
5098**Required permissions**: ohos.permission.USE_USER_IDM
5099
5100**Parameters**
5101
5102| Name    | Type                  | Mandatory| Description     |
5103| --------  | ---------------------- | ---- | -------- |
5104| authType  | [AuthType](#authtype8) | Yes  | Credential type.|
5105| accountId | number                 | No  | System account ID, which is left blank by default.|
5106
5107**Return value**
5108
5109| Type                      | Description                                                                    |
5110| :------------------------ | :----------------------------------------------------------------------- |
5111| Promise&lt;Uint8Array&gt; | Promise used to return the credential ID obtained.|
5112
5113**Error codes**
5114
5115| ID| Error Message              |
5116| -------- | ------------------- |
5117| 201 | Permission denied.|
5118| 202 | Not system application.|
5119| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. |
5120| 12300001 | The system service works abnormally. |
5121| 12300002 | Invalid authType. |
5122| 12300003 | Account not found. |
5123| 12300102 | Credential not enrolled. |
5124| 12300106 | The authentication type is not supported. |
5125
5126**Example**
5127  ```ts
5128  import { BusinessError } from '@kit.BasicServicesKit';
5129  let userIDM = new osAccount.UserIdentityManager();
5130  let authType: osAccount.AuthType = osAccount.AuthType.PIN;
5131  let accountId = 100;
5132  try {
5133    userIDM.getEnrolledId(authType, accountId).then((enrolledId: Uint8Array) => {
5134        console.info('getEnrolledId enrolledId = ' + JSON.stringify(enrolledId));
5135    }).catch((err: BusinessError) => {
5136        console.info('getEnrolledId error = ' + JSON.stringify(err));
5137    });
5138  } catch (e) {
5139    console.log('getEnrolledId exception = ' + JSON.stringify(e));
5140  }
5141  ```
5142
5143## IInputData<sup>8+</sup>
5144
5145Provides callbacks for PIN operations.
5146
5147**System API**: This is a system API.
5148
5149### onSetData<sup>8+</sup>
5150
5151onSetData: (authSubType: AuthSubType, data: Uint8Array) => void;
5152
5153**System API**: This is a system API.
5154
5155Called to notify the caller the data is set.
5156
5157**System capability**: SystemCapability.Account.OsAccount
5158
5159**Parameters**
5160
5161| Name     | Type                                    | Mandatory| Description                                           |
5162| ---------- | ---------------------------------------- | ---- | ----------------------------------------------- |
5163| authSubType | [AuthSubType](#authsubtype8)             | Yes  | Credential subtype.                           |
5164| data       | Uint8Array                               | Yes  | Data (credential) to set. The data is used for authentication and operations for adding and modifying credentials.|
5165
5166**Error codes**
5167
5168| ID| Error Message              |
5169| -------- | ------------------- |
5170| 202 | Not system application.|
5171| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
5172| 12300002 | Invalid pinSubType. |
5173
5174**Example**
5175  ```ts
5176  let password: Uint8Array = new Uint8Array([0, 0, 0, 0, 0, 0]);
5177  let passwordNumber: Uint8Array = new Uint8Array([1, 2, 3, 4]);
5178  let inputer: osAccount.IInputer = {
5179    onGetData: (authSubType: osAccount.AuthSubType, callback: osAccount.IInputData) => {
5180        if (authSubType == osAccount.AuthSubType.PIN_NUMBER) {
5181          callback.onSetData(authSubType, passwordNumber);
5182        } else {
5183          callback.onSetData(authSubType, password);
5184        }
5185    }
5186  };
5187  ```
5188
5189## IInputer<sup>8+</sup>
5190
5191Provides callbacks for credential inputers.
5192
5193**System API**: This is a system API.
5194
5195### onGetData<sup>8+</sup>
5196
5197onGetData: (authSubType: AuthSubType, callback: IInputData, options: GetInputDataOptions) => void;
5198
5199Called to notify the caller that data is obtained.
5200
5201**System API**: This is a system API.
5202
5203**System capability**: SystemCapability.Account.OsAccount
5204
5205**Parameters**
5206
5207| Name     | Type                                   | Mandatory| Description            |
5208| ---------- | --------------------------------------- | ---- | --------------- |
5209| authSubType | [AuthSubType](#authsubtype8) | Yes| Authentication credential subtype.|
5210| callback   | [IInputData](#iinputdata8)  | Yes  | Callback used to return the PIN data.|
5211| options | [GetInputDataOptions](#getinputdataoptions-12) | Yes| Optional parameters for the callback function.|
5212
5213**Example**
5214  ```ts
5215  let password: Uint8Array = new Uint8Array([0, 0, 0, 0, 0, 0]);
5216  let passwordNumber: Uint8Array = new Uint8Array([1, 2, 3, 4]);
5217  let inputer: osAccount.IInputer = {
5218    onGetData: (authSubType: osAccount.AuthSubType,
5219      callback: osAccount.IInputData, options: osAccount.GetInputDataOptions) => {
5220        if (authSubType == osAccount.AuthSubType.PIN_NUMBER) {
5221          callback.onSetData(authSubType, passwordNumber);
5222        } else {
5223          callback.onSetData(authSubType, password);
5224        }
5225    }
5226  };
5227  let pinAuth: osAccount.PINAuth = new osAccount.PINAuth();
5228  let result = pinAuth.registerInputer(inputer);
5229  console.log('registerInputer result: ' + result);
5230  ```
5231
5232## IUserAuthCallback<sup>8+</sup>
5233
5234Provides callbacks for user authentication.
5235
5236**System API**: This is a system API.
5237
5238### onResult<sup>8+</sup>
5239
5240onResult: (result: number, extraInfo: AuthResult) => void;
5241
5242Called to return the result code and authentication result.
5243
5244**System API**: This is a system API.
5245
5246**System capability**: SystemCapability.Account.OsAccount
5247
5248**Parameters**
5249
5250| Name    | Type                                   | Mandatory| Description                |
5251| --------- | --------------------------------------- | ---- | ------------------- |
5252| result    | number                                   | Yes  | Authentication result code.|
5253| extraInfo | [AuthResult](#authresult8)  | Yes  | Specific authentication result information. If the authentication is successful, the authentication token is returned in **extrainfo**. If the authentication fails, the remaining authentication time is returned. If the authentication executor is locked, the freezing time is returned.|
5254
5255**Example**
5256  ```ts
5257  let authCallback: osAccount.IUserAuthCallback = {
5258    onResult: (result: number, extraInfo: osAccount.AuthResult) => {
5259      console.log('auth result = ' + result);
5260      console.log('auth extraInfo = ' + JSON.stringify(extraInfo));
5261    }
5262  };
5263  ```
5264
5265### onAcquireInfo?<sup>8+</sup>
5266
5267onAcquireInfo?: (module: number, acquire: number, extraInfo: Uint8Array) => void;
5268
5269Called to acquire identity authentication information.
5270
5271**System API**: This is a system API.
5272
5273**System capability**: SystemCapability.Account.OsAccount
5274
5275**Parameters**
5276
5277| Name   | Type    | Mandatory| Description                          |
5278| --------- | ------- | ---- | ----------------------------- |
5279| module    | number  | Yes  | Type of authentication executor.  |
5280| acquire   | number  | Yes  | Tip code of the authentication executor.|
5281| extraInfo | Uint8Array     | Yes  | Reserved.                    |
5282
5283**Example**
5284  ```ts
5285  let authCallback: osAccount.IUserAuthCallback = {
5286    onResult: (result: number, extraInfo: osAccount.AuthResult) => {
5287      console.log('auth result = ' + result)
5288      console.log('auth extraInfo = ' + JSON.stringify(extraInfo));
5289    },
5290    onAcquireInfo: (module: number, acquire: number, extraInfo: Uint8Array) => {
5291      console.log('auth module = ' + module);
5292      console.log('auth acquire = ' + acquire);
5293      console.info('auth extraInfo = ' + JSON.stringify(extraInfo));
5294    }
5295  };
5296  ```
5297
5298## IIdmCallback<sup>8+</sup>
5299
5300Provides callbacks for IDM.
5301
5302**System API**: This is a system API.
5303
5304### onResult<sup>8+</sup>
5305
5306onResult: (result: number, extraInfo: RequestResult) => void;
5307
5308Called to return the result code and request result information.
5309
5310**System API**: This is a system API.
5311
5312**System capability**: SystemCapability.Account.OsAccount
5313
5314**Parameters**
5315
5316| Name    | Type                                   | Mandatory| Description                    |
5317| --------- | --------------------------------------- | ---- | ----------------------- |
5318| result    | number                                  | Yes  | Authentication result code.   |
5319| extraInfo | [RequestResult](#requestresult8)  | Yes  | Specific information to be transferred.|
5320
5321**Example**
5322  ```ts
5323  let idmCallback: osAccount.IIdmCallback = {
5324    onResult: (result: number, extraInfo: osAccount.RequestResult) => {
5325      console.log('callback result = ' + result)
5326      console.info('callback extraInfo = ' + JSON.stringify(extraInfo));
5327    }
5328  };
5329  ```
5330
5331### onAcquireInfo?<sup>8+</sup>
5332
5333onAcquireInfo?: (module: number, acquire: number, extraInfo: Uint8Array) => void;
5334
5335Called to acquire IDM information.
5336
5337**System API**: This is a system API.
5338
5339**System capability**: SystemCapability.Account.OsAccount
5340
5341**Parameters**
5342
5343| Name   | Type    | Mandatory| Description                          |
5344| --------- | ------- | ---- | ----------------------------- |
5345| module    | number  | Yes  | Type of authentication executor.  |
5346| acquire   | number  | Yes  | Tip code of the authentication executor.|
5347| extraInfo | Uint8Array | Yes  | Reserved.                    |
5348
5349**Example**
5350  ```ts
5351  let idmCallback: osAccount.IIdmCallback = {
5352    onResult: (result: number, extraInfo: Object) => {
5353      console.log('callback result = ' + result)
5354      console.log('callback onResult = ' + JSON.stringify(extraInfo));
5355    },
5356    onAcquireInfo: (module: number, acquire: number, extraInfo: Uint8Array) => {
5357      console.log('callback module = ' + module);
5358      console.log('callback acquire = ' + acquire);
5359      console.log('callback onacquireinfo = ' + JSON.stringify(extraInfo));
5360    }
5361  };
5362  ```
5363
5364## GetPropertyRequest<sup>8+</sup>
5365
5366Defines the request for obtaining property information.
5367
5368**System API**: This is a system API.
5369
5370**System capability**: SystemCapability.Account.OsAccount
5371
5372| Name   | Type                                                         | Mandatory  | Description                  |
5373| -------- | ------------------------------------------------------------- | ----- | ----------------------- |
5374| authType | [AuthType](#authtype8)                            | Yes   | Authentication credential type.       |
5375| keys     | Array&lt;[GetPropertyType](#getpropertytype8)&gt; | Yes   | An array of the types of the properties to obtain.|
5376| accountId<sup>12+</sup> | number | No| System account ID, which is **undefined** by default.|
5377
5378## SetPropertyRequest<sup>8+</sup>
5379
5380Defines the request for setting property information.
5381
5382**System API**: This is a system API.
5383
5384**System capability**: SystemCapability.Account.OsAccount
5385
5386| Name   | Type                                            | Mandatory  | Description                |
5387| -------- | ------------------------------------------------ | ----- | -------------------- |
5388| authType | [AuthType](#authtype8)               | Yes   | Authentication credential type.    |
5389| key     | [SetPropertyType](#setpropertytype8) | Yes   | Type of the property to set.|
5390| setInfo  | Uint8Array                                       | Yes   | Information to set.    |
5391
5392## ExecutorProperty<sup>8+</sup>
5393
5394Defines the executor property.
5395
5396**System API**: This is a system API.
5397
5398**System capability**: SystemCapability.Account.OsAccount
5399
5400| Name        | Type                        |  Readable| Writable| Description             |
5401| ------------ | ---------------------------- | ----- | -----|----------------- |
5402| result       | number                       | Yes   | Yes  | Result.        |
5403| authSubType  | [AuthSubType](#authsubtype8) | Yes   | Yes  | Authentication credential subtype.|
5404| remainTimes  | number                       | Yes   | Yes  | Number of remaining authentication times.    |
5405| freezingTime | number                       | Yes   | Yes  | Freezing time.    |
5406| enrollmentProgress<sup>10+</sup> | string   | Yes   | Yes  | Enrollment progress. By default, no value is passed in.|
5407| sensorInfo<sup>10+</sup> | string           | Yes   | Yes  | Sensor information. By default, no value is passed in.|
5408| nextPhaseFreezingTime<sup>12+</sup> | number | Yes   | Yes  | Next freezing time, which is **undefined** by default.|
5409
5410## AuthResult<sup>8+</sup>
5411
5412Defines the authentication result information.
5413
5414**System API**: This is a system API.
5415
5416**System capability**: SystemCapability.Account.OsAccount
5417
5418| Name       | Type       | Mandatory  | Description             |
5419| ------------ | ----------- | ----- | ----------------- |
5420| token        | Uint8Array  | No   | Authentication token. By default, no value is passed in.     |
5421| remainTimes  | number      | No   | Number of remaining authentication times. By default, no value is passed in.     |
5422| freezingTime | number      | No   | Freezing time. By default, no value is passed in.     |
5423| nextPhaseFreezingTime<sup>12+</sup> | number | No   | Next freezing time, which is **undefined** by default.|
5424| credentialId<sup>12+</sup> | Uint8Array  | No   | Credential ID, which is left blank by default.|
5425| accountId<sup>12+</sup>         | number | No   | System account ID, which is **undefined** by default.|
5426| pinValidityPeriod<sup>12+</sup> | number | No   | Authentication validity period, which is **undefined** by default.|
5427
5428## CredentialInfo<sup>8+</sup>
5429
5430Defines the credential information.
5431
5432**System API**: This is a system API.
5433
5434**System capability**: SystemCapability.Account.OsAccount
5435
5436| Name       | Type                                    | Mandatory  | Description             |
5437| ------------ | ---------------------------------------- | ----- | ----------------- |
5438| credType     | [AuthType](#authtype8)       | Yes   | Authentication credential type.    |
5439| credSubType  | [AuthSubType](#authsubtype8) | Yes   | Authentication credential subtype.  |
5440| token        | Uint8Array                           | Yes   | Authentication token.    |
5441| accountId<sup>12+</sup>    | number | No   | System account ID, which is **undefined** by default.|
5442
5443## RequestResult<sup>8+</sup>
5444
5445Defines the request result information.
5446
5447**System API**: This is a system API.
5448
5449**System capability**: SystemCapability.Account.OsAccount
5450
5451| Name       | Type       | Mandatory  | Description             |
5452| ------------ | ----------- | ----- | ----------------- |
5453| credentialId | Uint8Array  | No   | Credential ID. By default, no value is passed in.     |
5454
5455## EnrolledCredInfo<sup>8+</sup>
5456
5457Defines enrolled credential information.
5458
5459**System API**: This is a system API.
5460
5461**System capability**: SystemCapability.Account.OsAccount
5462
5463| Name       | Type                                    | Mandatory  | Description             |
5464| ------------ | ---------------------------------------- | ----- | ------------------- |
5465| credentialId | Uint8Array                               | Yes   | Credential ID.      |
5466| authType     | [AuthType](#authtype8)       | Yes   | Authentication credential type.  |
5467| authSubType  | [AuthSubType](#authsubtype8) | Yes   | Credential subtype.|
5468| templateId   | Uint8Array                               | Yes   | Authentication credential template ID.    |
5469
5470## GetPropertyType<sup>8+</sup>
5471
5472Enumerates the types of properties to obtain.
5473
5474**System API**: This is a system API.
5475
5476**System capability**: SystemCapability.Account.OsAccount
5477
5478| Name          | Value| Description     |
5479| ------------- | ------ | --------- |
5480| AUTH_SUB_TYPE | 1      | Authentication credential subtype.|
5481| REMAIN_TIMES  | 2      | Number of remaining times.  |
5482| FREEZING_TIME | 3      | Freezing time.  |
5483| ENROLLMENT_PROGRESS<sup>10+</sup> | 4      | Enrollment progress.  |
5484| SENSOR_INFO<sup>10+</sup> | 5      | Sensor information.  |
5485| NEXT_PHASE_FREEZING_TIME<sup>12+</sup> | 6 | Next freezing time.|
5486
5487## SetPropertyType<sup>8+</sup>
5488
5489Enumerates the types of properties to set.
5490
5491**System API**: This is a system API.
5492
5493**System capability**: SystemCapability.Account.OsAccount
5494
5495| Name          | Value| Description       |
5496| -------------- | ----- | ----------- |
5497| INIT_ALGORITHM | 1     | Initialization algorithm.|
5498
5499## AuthType<sup>8+</sup>
5500
5501Enumerates the authentication credential types.
5502
5503**System API**: This is a system API.
5504
5505**System capability**: SystemCapability.Account.OsAccount
5506
5507| Name | Value| Description            |
5508| ----- | ----- | ---------------- |
5509| PIN   | 1     | PIN authentication.|
5510| FACE  | 2     | Facial authentication.|
5511| FINGERPRINT<sup>10+</sup>   | 4     | Fingerprint authentication.|
5512| RECOVERY_KEY<sup>12+</sup> | 8 | Key recovery type.|
5513| PRIVATE_PIN<sup>14+</sup> | 16 | Private PIN type.|
5514| DOMAIN<sup>9+</sup>  | 1024     | Domain authentication.|
5515
5516## AuthSubType<sup>8+</sup>
5517
5518Enumerates the authentication credential subtypes.
5519
5520**System API**: This is a system API.
5521
5522**System capability**: SystemCapability.Account.OsAccount
5523
5524| Name      | Value| Description              |
5525| ---------- | ----- | ------------------ |
5526| PIN_SIX    | 10000 | Six-digit PIN.      |
5527| PIN_NUMBER | 10001 | Custom PIN.|
5528| PIN_MIXED  | 10002 | Custom mixed credentials.|
5529| PIN_FOUR<sup>12+</sup>   | 10003 | 4-digit credential.|
5530| PIN_PATTERN<sup>12+</sup>  | 10004 | Pattern credential.|
5531| PIN_QUESTION<sup>14+</sup>  | 10005 | Security question credential.|
5532| FACE_2D    | 20000 | 2D face credential.  |
5533| FACE_3D    | 20001 | 3D face credential.  |
5534| FINGERPRINT_CAPACITIVE<sup>10+</sup>    | 30000 | Capacitive fingerprint.  |
5535| FINGERPRINT_OPTICAL<sup>10+</sup>    | 30001 | Optical fingerprint.  |
5536| FINGERPRINT_ULTRASONIC<sup>10+</sup>    | 30002 | Ultrasonic fingerprint.  |
5537| DOMAIN_MIXED<sup>9+</sup>    | 10240001 | Mixed domain authentication credentials.  |
5538
5539## AuthTrustLevel<sup>8+</sup>
5540
5541Enumerates the trust levels of the authentication result.
5542
5543**System API**: This is a system API.
5544
5545**System capability**: SystemCapability.Account.OsAccount
5546
5547| Name | Value| Description       |
5548| ---- | ------ | ----------- |
5549| ATL1 | 10000  | Trust level 1.|
5550| ATL2 | 20000  | Trust level 2.|
5551| ATL3 | 30000  | Trust level 3.|
5552| ATL4 | 40000  | Trust level 4.|
5553
5554## Module<sup>8+</sup>
5555
5556Enumerates the modules from which information is obtained.
5557
5558**System API**: This is a system API.
5559
5560**System capability**: SystemCapability.Account.OsAccount
5561
5562| Name      | Value| Description                    |
5563| --------- | ------ | ------------------------ |
5564| FACE_AUTH | 1      | Facial authentication module.|
5565
5566## ResultCode<sup>8+</sup>
5567
5568Enumerates the authentication result codes.
5569
5570**System API**: This is a system API.
5571
5572**System capability**: SystemCapability.Account.OsAccount
5573
5574| Name                   | Value| Description                                    |
5575| ----------------------- | ----- | ---------------------------------------- |
5576| SUCCESS                 | 0     | The authentication is successful or the authentication feature is supported.            |
5577| FAIL                    | 1     | The authentication executor failed to identify the user.                  |
5578| GENERAL_ERROR           | 2     | Other errors.                           |
5579| CANCELED                | 3     | The authentication is canceled.                      |
5580| TIMEOUT                 | 4     | The authentication timed out.                      |
5581| TYPE_NOT_SUPPORT        | 5     | The authentication credential type is not supported.                |
5582| TRUST_LEVEL_NOT_SUPPORT | 6     | The authentication trust level is not supported.              |
5583| BUSY                    | 7     | The authentication executor is busy. Try again after a few seconds.|
5584| INVALID_PARAMETERS      | 8     | Incorrect parameters are detected.                         |
5585| LOCKED                  | 9     | The authentication executor is locked.                    |
5586| NOT_ENROLLED            | 10    | The authentication executor is not enrolled.                  |
5587
5588## FaceTipsCode<sup>8+</sup>
5589
5590Enumerates the tip codes for facial authentication.
5591
5592**System API**: This is a system API.
5593
5594**System capability**: SystemCapability.Account.OsAccount
5595
5596| Name                         | Value| Description                                    |
5597| ----------------------------- | ----- | ---------------------------------------- |
5598| FACE_AUTH_TIP_TOO_BRIGHT      | 1     | The obtained face image is too bright.        |
5599| FACE_AUTH_TIP_TOO_DARK        | 2     | The obtained face image is too dark.      |
5600| FACE_AUTH_TIP_TOO_CLOSE       | 3     | The face is too close to the device.                      |
5601| FACE_AUTH_TIP_TOO_FAR         | 4     | The face is too far away from the device.                      |
5602| FACE_AUTH_TIP_TOO_HIGH        | 5     | Only the upper part of the face is captured because the device is angled too high.             |
5603| FACE_AUTH_TIP_TOO_LOW         | 6     | Only the lower part of the face is captured because the device is angled too low.             |
5604| FACE_AUTH_TIP_TOO_RIGHT       | 7     | Only the right part of the face is captured because the device is angled too much to the right.|
5605| FACE_AUTH_TIP_TOO_LEFT        | 8     | Only the left part of the face is captured because the device is angled too much to the left.|
5606| FACE_AUTH_TIP_TOO_MUCH_MOTION | 9     | The face moves too fast during facial information collection.        |
5607| FACE_AUTH_TIP_POOR_GAZE       | 10    | The face is not facing the device.                        |
5608| FACE_AUTH_TIP_NOT_DETECTED    | 11    | No face is detected.                        |
5609
5610## FingerprintTips<sup>8+</sup>
5611
5612Enumerates the tip codes for fingerprint authentication.
5613
5614**System API**: This is a system API.
5615
5616**System capability**: SystemCapability.Account.OsAccount
5617
5618| Name                         | Value| Description                                           |
5619| ----------------------------- | ----- | ----------------------------------------------- |
5620| FINGERPRINT_TIP_GOOD          | 0     | The captured image is clear.                             |
5621| FINGERPRINT_TIP_IMAGER_DIRTY  | 1     | The fingerprint image has big noise due to dirt on the sensor.|
5622| FINGERPRINT_TIP_INSUFFICIENT  | 2     | Failed to process the fingerprint image due to big noise.  |
5623| FINGERPRINT_TIP_PARTIAL       | 3     | Only part of the fingerprint image is detected.                        |
5624| FINGERPRINT_TIP_TOO_FAST      | 4     | The fingerprint image is incomplete due to quick motion.                 |
5625| FINGERPRINT_TIP_TOO_SLOW      | 5     | Failed to read the fingerprint image due to lack of motion.               |
5626| FINGERPRINT_TIP_FINGER_DOWN<sup>10+</sup>   | 6     | Press your finger.                 |
5627| FINGERPRINT_TIP_FINGER_UP<sup>10+</sup>     | 7     | Lift your finger.               |
5628
5629## OsAccountInfo
5630
5631Represents the system account information.
5632
5633**System capability**: SystemCapability.Account.OsAccount
5634
5635| Name     | Type  | Mandatory| Description      |
5636| ----------- | ------ | ---- | ---------- |
5637| shortName<sup>12+</sup> | string | No  | Short name of the system account.<br>**System API**: This is a system API and is left blank by default.|
5638| isLoggedIn<sup>12+</sup> | boolean | No  | Whether the system account is logged in.<br>**System API**: This is a system API. The default value is **false**.|
5639
5640## OsAccountType
5641
5642Enumerates the system account types.
5643
5644**System capability**: SystemCapability.Account.OsAccount
5645
5646| Name  | Value| Description        |
5647| ------ | ------ | ----------- |
5648| PRIVATE<sup>12+</sup> | 1024  | Privacy account. Only one privacy account is allowed.<br>**System API**: This is a system API.  |
5649
5650## DomainAccountInfo<sup>8+</sup>
5651
5652Represents domain account information.
5653
5654**System capability**: SystemCapability.Account.OsAccount
5655
5656| Name     | Type  | Mandatory| Description      |
5657| ----------- | ------ | ---- | ---------- |
5658| accountId<sup>10+</sup> | string | No  | Domain account ID.<br>**System API**: This is a system API and is **undefined** by default.|
5659| isAuthenticated<sup>11+</sup>| boolean | No| Whether the domain account has been authenticated.<br>**System API**: This is a system API. The default value is **false**.|
5660| serverConfigId<sup>12+</sup>| boolean | No| ID of the server to which the domain account belongs.<br>**System API**: This is a system API and is **undefined** by default.|
5661
5662## ConstraintSourceTypeInfo<sup>9+</sup>
5663
5664Defines the constraint source type.
5665
5666**System API**: This is a system API.
5667
5668**System capability**: SystemCapability.Account.OsAccount
5669
5670| Name     | Type  | Mandatory| Description      |
5671| ----------- | ------ | ---- | ---------- |
5672| localId      | number | Yes  | ID of the target system account.    |
5673| type | [ConstraintSourceType](#constraintsourcetype9) | Yes  | Type of the constrain source.|
5674
5675## ConstraintSourceType<sup>9+</sup>
5676
5677Enumerates the constraint sources.
5678
5679**System API**: This is a system API.
5680
5681**System capability**: SystemCapability.Account.OsAccount
5682
5683| Name  | Value| Description        |
5684| ------ | ------ | ------------ |
5685| CONSTRAINT_NOT_EXIST  | 0      | The constraint does not exist.|
5686| CONSTRAINT_TYPE_BASE | 1      | Constraint from system settings.  |
5687| CONSTRAINT_TYPE_DEVICE_OWNER  | 2   | Constraint from the device owners' settings.  |
5688| CONSTRAINT_TYPE_PROFILE_OWNER  | 3  | Constraint from the profile owners' settings.  |
5689
5690## AuthStatusInfo<sup>10+</sup>
5691
5692Presents the authentication status information.
5693
5694**System API**: This is a system API.
5695
5696**System capability**: SystemCapability.Account.OsAccount
5697
5698| Name     | Type  | Mandatory| Description      |
5699| ----------- | ------ | ---- | ---------- |
5700| remainTimes  | number | Yes  | Number of remaining authentication times.  |
5701| freezingTime | number | Yes  | Freezing time.|
5702
5703## GetDomainAccessTokenOptions<sup>10+</sup>
5704
5705Defines the options for obtaining a domain access token.
5706
5707**System API**: This is a system API.
5708
5709**System capability**: SystemCapability.Account.OsAccount
5710
5711| Name     | Type  | Mandatory| Description      |
5712| ----------- | ------ | ---- | ---------- |
5713| domainAccountInfo  | [DomainAccountInfo](#domainaccountinfo8) | Yes  | Domain account information.  |
5714| domainAccountToken | Uint8Array | Yes  | Token of the domain account.|
5715| businessParams | Record<string, Object> | Yes  | Service parameters customized by the service party based on the request protocol.|
5716| callerUid | number | Yes  | Unique identifier of the caller.|
5717
5718## GetDomainAccountInfoOptions<sup>10+</sup>
5719
5720Defines the options for obtaining domain account information.
5721
5722**System API**: This is a system API.
5723
5724**System capability**: SystemCapability.Account.OsAccount
5725
5726| Name     | Type  | Mandatory| Description      |
5727| ----------- | ------ | ---- | ---------- |
5728| accountName | string | Yes  | Domain account name.|
5729| domain      | string | No  | Domain name, which is **undefined** by default.|
5730| serverConfigId<sup>12+</sup>| boolean | No| ID of the server to which the domain account belongs, which is **undefined** by default.|
5731
5732## GetDomainAccountInfoPluginOptions<sup>10+</sup>
5733
5734Defines the options for the domain plug-in to obtain the domain account information. The **GetDomainAccountInfoPluginOptions** class inherits from [**GetDomainAccountInfoOptions**](#getdomainaccountinfooptions10).
5735
5736**System API**: This is a system API.
5737
5738**System capability**: SystemCapability.Account.OsAccount
5739
5740| Name     | Type  | Mandatory| Description      |
5741| ----------- | ------ | ---- | ---------- |
5742| callerUid | number | Yes  | Unique identifier of the caller.|
5743
5744## OsAccountSwitchEventData<sup>12+</sup>
5745
5746Defines the event that indicates the start or end of a foreground-background system account switchover.
5747
5748**System API**: This is a system API.
5749
5750**System capability**: SystemCapability.Account.OsAccount
5751
5752| Name     | Type  | Mandatory| Description      |
5753| ----------- | ------ | ---- | ---------- |
5754| fromAccountId | number | Yes  | System account ID before the switchover.|
5755| toAccountId | number | Yes  | System account ID after the switchover.|
5756
5757## CreateOsAccountOptions<sup>12+</sup>
5758
5759Represents the optional parameter used to create a system account.
5760
5761**System API**: This is a system API.
5762
5763**System capability**: SystemCapability.Account.OsAccount
5764
5765| Name     | Type  | Mandatory| Description      |
5766| ----------- | ------ | ---- | ---------- |
5767| shortName | string | Yes  | Short name of the account (used as the name of the personal folder).<br>**The short name cannot**:<br>Contain any of the following characters: \< \>\| : " * ? / \\<br>Contain any of the following: . or ..<br><br>Exceed 255 characters.|
5768
5769## CreateOsAccountForDomainOptions<sup>12+</sup>
5770
5771Represents a set of optional parameters for creating a system account bound to the specified domain account. It inherits from [CreateOsAccountOptions](#createosaccountoptions12).
5772
5773**System API**: This is a system API.
5774
5775**System capability**: SystemCapability.Account.OsAccount
5776
5777| Name     | Type  | Mandatory| Description      |
5778| ----------- | ------ | ---- | ---------- |
5779| shortName | string | Yes  | Short name of the account (used as the name of the personal folder).<br>**The short name cannot**:<br>Contain any of the following characters: \< \>\| : " * ? / \\<br>Contain any of the following: . or ..<br><br>Exceed 255 characters.|
5780
5781## GetAuthInfoOptions<sup>12+</sup>
5782
5783Represents a set of optional parameters for [GetAuthInfo](#getauthinfo12).
5784
5785**System API**: This is a system API.
5786
5787**System capability**: SystemCapability.Account.OsAccount
5788
5789| Name     | Type                   | Mandatory| Description      |
5790| --------- | ---------------------- | ---- | ---------- |
5791| authType  | [AuthType](#authtype8) | No  | Authentication type, which is **undefined** by default.|
5792| accountId | number                 | No  | System account ID, which is **undefined** by default.|
5793
5794## AuthIntent<sup>12+</sup>
5795
5796Enumerates the authentication intents.
5797
5798**System API**: This is a system API.
5799
5800**System capability**: SystemCapability.Account.OsAccount
5801
5802| Name    | Value  | Description      |
5803| -------- | --- | ---------- |
5804| UNLOCK   | 1   | Unlock.|
5805| SILENT_AUTH<sup>14+</sup>  | 2   | Silent authentication.|
5806| QUESTION_AUTH<sup>14+</sup>   | 3   | Security question authentication.|
5807
5808## RemoteAuthOptions<sup>12+</sup>
5809
5810Represents a set of optional parameters for remote authentication.
5811
5812**System API**: This is a system API.
5813
5814**System capability**: SystemCapability.Account.OsAccount
5815
5816| Name              | Type   | Mandatory| Description      |
5817| ------------------ | ------ | ---- | ---------- |
5818| verifierNetworkId  | string | No  | Network ID of the credential verifier, which is left blank by default.|
5819| collectorNetworkId | string | No  | Network ID of the credential collector, which is left blank by default.|
5820| collectorTokenId   | number | No  | Token ID of the credential collector, which is **undefined** by default.|
5821
5822## AuthOptions<sup>12+</sup>
5823
5824Represents a set of optional parameters for [auth](#auth12).
5825
5826**System API**: This is a system API.
5827
5828**System capability**: SystemCapability.Account.OsAccount
5829
5830| Name              | Type   | Mandatory| Description      |
5831| ------------------ | ------ | ---- | ---------- |
5832| accountId          | number | No  | System account ID, which is **undefined** by default.|
5833| authIntent         | [AuthIntent](#authintent12) | No  | Authentication intent, which is **undefined** by default.|
5834| remoteAuthOptions  | [RemoteAuthOptions](#remoteauthoptions12) | No  | Remote authentication options, which is **undefined** by default.|
5835
5836## GetInputDataOptions <sup>12+</sup>
5837
5838Represents a set of optional parameters for [onGetData](#ongetdata8).
5839
5840**System API**: This is a system API.
5841
5842**System capability**: SystemCapability.Account.OsAccount
5843
5844| Name              | Type   | Mandatory| Description      |
5845| ------------------ | ------ | ---- | ---------- |
5846| challenge          | Uint8Array | No  | Challenge value, which is **undefined** by default.|
5847