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