• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import distributedAccount from './@ohos.account.distributedAccount'
17import { AsyncCallback, Callback } from './basic';
18
19/**
20 * This module provides the capability to manage os accounts.
21 * @syscap SystemCapability.Account.OsAccount
22 * @since 7
23 */
24declare namespace osAccount {
25    /**
26     * Obtains the AccountManager instance.
27     * @returns Returns the instance of the AccountManager.
28     * @syscap SystemCapability.Account.OsAccount
29     * @since 7
30     */
31    function getAccountManager(): AccountManager;
32
33    /**
34     * Provides abilities for you to manage and perform operations on your OS accounts.
35     * @name AccountManager
36     * @syscap SystemCapability.Account.OsAccount
37     * @since 7
38     */
39    interface AccountManager {
40        /**
41         * Activates a specified OS account.
42         * <p>
43         * If multiple OS accounts are available, you can call this method to enable a specific OS account
44         * to run in the foreground. Then, the OS account originally running in the foreground will be
45         * switched to the background.
46         * </p>
47         * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
48         * @param localId Indicates the local ID of the OS account.
49         * @returns void.
50         * @throws {BusinessError} 201 - permission denied.
51         * @throws {BusinessError} 401 - the parameter check failed.
52         * @throws {BusinessError} 12300001 - system service exception.
53         * @throws {BusinessError} 12300002 - invalid localId.
54         * @throws {BusinessError} 12300003 - the account indicated by localId dose not exist.
55         * @throws {BusinessError} 12300008 - the localId indicates restricted account.
56         * @throws {BusinessError} 12300009 - the account indicated by localId has been activated.
57         * @systemapi Hide this for inner system use.
58         * @since 7
59         */
60        activateOsAccount(localId: number, callback: AsyncCallback<void>): void;
61        activateOsAccount(localId: number): Promise<void>;
62
63        /**
64         * Checks whether the function of supporting multiple OS accounts is enabled.
65         * @returns Returns {@code true} if this function is enabled; returns {@code false} otherwise.
66         * @since 7
67         * @deprecated since 9
68         * @useinstead osAccount.AccountManager#checkMultiOsAccountEnabled
69         */
70        isMultiOsAccountEnable(callback: AsyncCallback<boolean>): void;
71        isMultiOsAccountEnable(): Promise<boolean>;
72
73        /**
74         * Checks whether the function of supporting multiple OS accounts is enabled.
75         * @returns void
76         * @throws {BusinessError} 401 - the parameter check failed.
77         * @throws {BusinessError} 12300001 - system service exception.
78         * @since 9
79         */
80        checkMultiOsAccountEnabled(callback: AsyncCallback<boolean>): void;
81        checkMultiOsAccountEnabled(): Promise<boolean>;
82
83        /**
84         * Checks whether an OS account is activated based on its local ID.
85         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
86         * @param localId Indicates the local ID of the OS account.
87         * @returns Returns {@code true} if the OS account is activated; returns {@code false} otherwise.
88         * @since 7
89         * @deprecated since 9
90         * @useinstead osAccount.AccountManager#checkOsAccountActivated
91         */
92        isOsAccountActived(localId: number, callback: AsyncCallback<boolean>): void;
93        isOsAccountActived(localId: number): Promise<boolean>;
94
95        /**
96         * Checks whether an OS account is activated based on its local ID.
97         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
98         * @param localId Indicates the local ID of the OS account.
99         * @returns void
100         * @throws {BusinessError} 201 - permission denied.
101         * @throws {BusinessError} 401 - the parameter check failed.
102         * @throws {BusinessError} 12300001 - system service exception.
103         * @throws {BusinessError} 12300002 - invalid localId.
104         * @throws {BusinessError} 12300003 - the account indicated by localId dose not exist.
105         * @since 9
106         */
107        checkOsAccountActivated(localId: number, callback: AsyncCallback<boolean>): void;
108        checkOsAccountActivated(localId: number): Promise<boolean>;
109
110        /**
111         * Checks whether a constraint has been enabled for an OS account based on its local ID.
112         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
113         * @param localId Indicates the local ID of the OS account.
114         * @param constraint Indicates the constraint to check. The value can be:
115         *        <ul>
116         *        <li>{@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point.
117         *        </li>
118         *        <li>{@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages.
119         *        </li>
120         *        <li>{@code constraint.calls.outgoing} - Indicates the constraint on making calls.</li>
121         *        <li>{@code constraint.unknown.sources.install} - Indicates the constraint on installing applications
122         *        from unknown sources.</li>
123         *        </ul>
124         * @returns Returns {@code true} if the constraint has been enabled for the OS account;
125         *         returns {@code false} otherwise.
126         * @since 7
127         * @deprecated since 9
128         * @useinstead osAccount.AccountManager#checkConstraintEnabled
129         */
130        isOsAccountConstraintEnable(localId: number, constraint: string, callback: AsyncCallback<boolean>): void;
131        isOsAccountConstraintEnable(localId: number, constraint: string): Promise<boolean>;
132
133        /**
134         * Checks whether the given constraint is enabled for the specified OS account.
135         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
136         * @param { number } localId - Indicates the local ID of the OS account.
137         * @param { string } constraint - Indicates the constraint to check. For example: the value can be:
138         *        <ul>
139         *        <li>{@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point.
140         *        </li>
141         *        <li>{@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages.
142         *        </li>
143         *        <li>{@code constraint.calls.outgoing} - Indicates the constraint on making calls.</li>
144         *        <li>{@code constraint.unknown.sources.install} - Indicates the constraint on installing applications
145         *        from unknown sources.</li>
146         *        </ul>
147         * @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether the constraint is enabled for the specified OS account.
148         * @throws { BusinessError } 201 - permission denied.
149         * @throws { BusinessError } 401 - the parameter check failed.
150         * @throws { BusinessError } 12300001 - system service exception.
151         * @throws { BusinessError } 12300002 - invalid localId or constraint.
152         * @throws { BusinessError } 12300003 - the account indicated by localId dose not exist.
153         * @since 9
154         */
155        checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback<boolean>): void;
156
157        /**
158         * Checks whether the given constraint is enabled for the specified OS account.
159         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
160         * @param { number } localId - Indicates the local ID of the OS account.
161         * @param { string } constraint - Indicates the constraint to check. For example: the value can be:
162         *        <ul>
163         *        <li>{@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point.
164         *        </li>
165         *        <li>{@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages.
166         *        </li>
167         *        <li>{@code constraint.calls.outgoing} - Indicates the constraint on making calls.</li>
168         *        <li>{@code constraint.unknown.sources.install} - Indicates the constraint on installing applications
169         *        from unknown sources.</li>
170         *        </ul>
171         * @returns { Promise<boolean> } Returns whether the given constraint is enabled for the specified OS account.
172         * @throws { BusinessError } 201 - permission denied.
173         * @throws { BusinessError } 401 - the parameter check failed.
174         * @throws { BusinessError } 12300001 - system service exception.
175         * @throws { BusinessError } 12300002 - invalid localId or constraint.
176         * @throws { BusinessError } 12300003 - the account indicated by localId dose not exist.
177         * @since 9
178         */
179        checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise<boolean>;
180
181        /**
182         * Checks whether this OS account is a test OS account.
183         * @returns Returns {@code true} if this OS account is a test OS account; returns {@code false} otherwise.
184         * @since 7
185         * @deprecated since 9
186         * @useinstead osAccount.AccountManager#checkOsAccountTestable
187         */
188        isTestOsAccount(callback: AsyncCallback<boolean>): void;
189        isTestOsAccount(): Promise<boolean>;
190
191        /**
192         * Checks whether current OS account is testable.
193         * @returns Returns {@code true} if this account is testable; returns {@code false} otherwise.
194         * @throws {BusinessError} 401 - the parameter check failed.
195         * @throws {BusinessError} 12300001 - system service exception.
196         * @since 9
197         */
198        checkOsAccountTestable(callback: AsyncCallback<boolean>): void;
199        checkOsAccountTestable(): Promise<boolean>;
200
201        /**
202         * Checks whether an OS account has been verified based on its local ID.
203         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
204         * @param localId Indicates the local ID of the OS account.
205         * @returns Returns {@code true} if the OS account has been verified successfully;
206         *          returns {@code false} otherwise.
207         * @since 7
208         * @deprecated since 9
209         * @useinstead osAccount.AccountManager#checkOsAccountVerified
210         *
211         */
212        isOsAccountVerified(callback: AsyncCallback<boolean>): void;
213        isOsAccountVerified(localId: number, callback: AsyncCallback<boolean>): void;
214        isOsAccountVerified(localId?: number): Promise<boolean>;
215
216        /**
217         * Checks whether the current OS account is verified.
218         * @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether the current OS account is verified.
219         * @throws { BusinessError } 12300001 - system service exception.
220         * @since 9
221         */
222        checkOsAccountVerified(callback: AsyncCallback<boolean>): void;
223
224        /**
225         * Checks whether the current OS account is verified.
226         * @returns { Promise<boolean> } Returns whether the current OS account is verified.
227         * @throws { BusinessError } 12300001 - system service exception.
228         * @since 9
229         */
230        checkOsAccountVerified(): Promise<boolean>;
231
232        /**
233         * Checks whether the specified OS account is verified.
234         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
235         * @param { number } localId - Indicates the local ID of the OS account.
236         * @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether the specified OS account is verified.
237         * @throws { BusinessError } 201 - permission denied.
238         * @throws { BusinessError } 401 - the parameter check failed.
239         * @throws { BusinessError } 12300001 - system service exception.
240         * @throws { BusinessError } 12300002 - invalid localId.
241         * @throws { BusinessError } 12300003 - the account indicated by localId dose not exist.
242         * @since 9
243         */
244        checkOsAccountVerified(localId: number, callback: AsyncCallback<boolean>): void;
245
246        /**
247         * Checks whether the specified OS account is verified.
248         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
249         * @param { number } localId - Indicates the local ID of the OS account.
250         * @returns { Promise<boolean> } Returns whether the specified OS account is verified.
251         * @throws { BusinessError } 201 - permission denied.
252         * @throws { BusinessError } 401 - the parameter check failed.
253         * @throws { BusinessError } 12300001 - system service exception.
254         * @throws { BusinessError } 12300002 - invalid localId.
255         * @throws { BusinessError } 12300003 - the account indicated by localId dose not exist.
256         * @since 9
257         */
258        checkOsAccountVerified(localId: number): Promise<boolean>;
259
260        /**
261         * Removes an OS account based on its local ID.
262         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
263         * @param localId Indicates the local ID of the OS account.
264         * @returns void.
265         * @throws {BusinessError} 201 - permission denied.
266         * @throws {BusinessError} 401 - the parameter check failed.
267         * @throws {BusinessError} 12300001 - system service exception.
268         * @throws {BusinessError} 12300002 - invalid localId.
269         * @throws {BusinessError} 12300003 - the account indicated by localId dose not exist.
270         * @throws {BusinessError} 12300008 - the localId indicates restricted account.
271         * @systemapi Hide this for inner system use.
272         * @since 7
273         */
274        removeOsAccount(localId: number, callback: AsyncCallback<void>): void;
275        removeOsAccount(localId: number): Promise<void>;
276
277        /**
278         * Sets constraints for an OS account based on its local ID.
279         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
280         * @param localId Indicates the local ID of the OS account.
281         * @param constraints Indicates the constraints to set for the OS account. The value can be:
282         *        <ul>
283         *        <li>{@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point.
284         *        </li>
285         *        <li>{@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages.
286         *        </li>
287         *        <li>{@code constraint.calls.outgoing} - Indicates the constraint on making calls.</li>
288         *        <li>{@code constraint.unknown.sources.install} - Indicates the constraint on installing applications
289         *        from unknown sources.</li>
290         *        </ul>
291         * @param enable Specifies whether to enable the constraint.
292         * @returns void.
293         * @throws {BusinessError} 201 - permission denied.
294         * @throws {BusinessError} 401 - the parameter check failed.
295         * @throws {BusinessError} 12300001 - system service exception.
296         * @throws {BusinessError} 12300002 - invalid localId or constraints.
297         * @throws {BusinessError} 12300003 - the account indicated by localId dose not exist.
298         * @throws {BusinessError} 12300008 - the localId indicates restricted account.
299         * @systemapi Hide this for inner system use.
300         * @since 7
301         */
302        setOsAccountConstraints(localId: number, constraints: Array<string>, enable: boolean,
303                                callback: AsyncCallback<void>): void;
304        setOsAccountConstraints(localId: number, constraints: Array<string>, enable: boolean): Promise<void>;
305
306        /**
307         * Sets the local name for an OS account based on its local ID.
308         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
309         * @param localId Indicates the local ID of the OS account.
310         * @param localName Indicates the local name to set for the OS account.
311         * @returns void.
312         * @throws {BusinessError} 201 - permission denied.
313         * @throws {BusinessError} 401 - the parameter check failed.
314         * @throws {BusinessError} 12300001 - system service exception.
315         * @throws {BusinessError} 12300002 - invalid localId or localName.
316         * @throws {BusinessError} 12300003 - the account indicated by localId dose not exist.
317         * @throws {BusinessError} 12300008 - the localId indicates restricted account.
318         * @systemapi Hide this for inner system use.
319         * @since 7
320         */
321        setOsAccountName(localId: number, localName: string, callback: AsyncCallback<void>): void;
322        setOsAccountName(localId: number, localName: string): Promise<void>;
323
324        /**
325         * Obtains the number of all OS accounts created on a device.
326         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
327         * @returns Returns the number of created OS accounts.
328         * @since 7
329         * @deprecated since 9
330         * @useinstead osAccount.AccountManager#getOsAccountCount
331         */
332        getCreatedOsAccountsCount(callback: AsyncCallback<number>): void;
333        getCreatedOsAccountsCount(): Promise<number>;
334
335        /**
336         * Obtains the number of all OS accounts created on a device.
337         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
338         * @returns Returns the number of created OS accounts.
339         * @throws {BusinessError} 201 - permission denied.
340         * @throws {BusinessError} 401 - the parameter check failed.
341         * @throws {BusinessError} 12300001 - system service exception.
342         * @since 9
343         */
344        getOsAccountCount(callback: AsyncCallback<number>): void;
345        getOsAccountCount(): Promise<number>;
346
347        /**
348         * Obtains the local ID of an OS account from the current process UID.
349         * @returns Returns the local ID of the OS account.
350         * @since 7
351         * @deprecated since 9
352         * @useinstead osAccount.AccountManager#getOsAccountLocalId
353         */
354        getOsAccountLocalIdFromProcess(callback: AsyncCallback<number>): void;
355        getOsAccountLocalIdFromProcess(): Promise<number>;
356
357        /**
358         * Gets the local ID of the current OS account.
359         * @param { AsyncCallback<number> } callback - Indicates the callback for getting the local ID of the current OS account.
360         * @throws { BusinessError } 401 - the parameter check failed.
361         * @throws { BusinessError } 12300001 - system service exception.
362         * @since 9
363         */
364        getOsAccountLocalId(callback: AsyncCallback<number>): void;
365
366        /**
367         * Get the local ID of the current OS account.
368         * @returns { Promise<number> } Returns the local ID of the current account.
369         * @throws { BusinessError } 401 - the parameter check failed.
370         * @throws { BusinessError } 12300001 - system service exception.
371         * @since 9
372         */
373        getOsAccountLocalId(): Promise<number>;
374
375        /**
376         * Gets the local ID of an OS account from the process UID
377         * @param uid Indicates the process UID.
378         * @returns Returns the local ID of the OS account.
379         * @since 7
380         * @deprecated since 9
381         * @useinstead osAccount.AccountManager#getOsAccountLocalIdForUid
382         */
383        getOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback<number>): void;
384        getOsAccountLocalIdFromUid(uid: number): Promise<number>;
385
386        /**
387         * Gets the local ID of the OS account associated with the specified UID.
388         * @param { number } uid - Indicates the process UID.
389         * @param { AsyncCallback<number> } callback - Indicates the callback for getting the local ID of the OS account associated with the specified UID.
390         * @throws {BusinessError} 401 - the parameter check failed.
391         * @throws {BusinessError} 12300001 - system service exception.
392         * @throws {BusinessError} 12300002 - invalid uid.
393         * @since 9
394         */
395        getOsAccountLocalIdForUid(uid: number, callback: AsyncCallback<number>): void;
396
397        /**
398         * Get the local ID of the OS account associated with the specified UID.
399         * @param { number } uid - Indicates the process UID.
400         * @returns { Promise<number> } Returns the local ID of the OS account associated with the specified UID.
401         * @throws { BusinessError } 401 - the parameter check failed.
402         * @throws { BusinessError } 12300001 - system service exception.
403         * @throws { BusinessError } 12300002 - invalid uid.
404         * @since 9
405         */
406        getOsAccountLocalIdForUid(uid: number): Promise<number>;
407
408        /**
409         * Queries the local ID of an OS account which is bound to the specified domain account.
410         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
411         * @param domainInfo Indicates the domain account info.
412         * @returns Returns the local ID of the OS account.
413         * @since 8
414         * @deprecated since 9
415         * @useinstead osAccount.AccountManager#getOsAccountLocalIdForDomain
416         */
417        getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback<number>): void;
418        getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise<number>;
419
420        /**
421         * Gets the local ID of the OS account associated with the specified domain account.
422         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
423         * @param { DomainAccountInfo } domainInfo - Indicates the domain account info.
424         * @param { AsyncCallback<number> } callback - Indicates the callback for getting the local ID of the OS account associated with the specified domain account.
425         * @throws { BusinessError } 201 - permission denied.
426         * @throws { BusinessError } 401 - the parameter check failed.
427         * @throws { BusinessError } 12300001 - system service exception.
428         * @throws { BusinessError } 12300002 - invalid domainInfo.
429         * @since 9
430         */
431        getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback<number>): void;
432
433        /**
434         * Gets the local ID of the OS account associated with the specified domain account.
435         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
436         * @param { DomainAccountInfo } domainInfo - Indicates the domain account info.
437         * @returns { Promise<number> } Returns the local ID of the OS account associated with the specified domain account.
438         * @throws { BusinessError } 201 - permission denied.
439         * @throws { BusinessError } 401 - the parameter check failed.
440         * @throws { BusinessError } 12300001 - system service exception.
441         * @throws { BusinessError } 12300002 - invalid domainInfo.
442         * @since 9
443         */
444        getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise<number>;
445
446        /**
447         * Queries the maximum number of OS accounts that can be created on a device.
448         * @returns Returns the maximum number of OS accounts that can be created.
449         * @throws {BusinessError} 401 - the parameter check failed.
450         * @throws {BusinessError} 12300001 - system service exception.
451         * @systemapi Hide this for inner system use.
452         * @since 7
453         */
454        queryMaxOsAccountNumber(callback: AsyncCallback<number>): void;
455        queryMaxOsAccountNumber(): Promise<number>;
456
457        /**
458         * Obtains all constraints of an OS account based on its local ID.
459         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
460         * @param localId Indicates the local ID of the OS account.
461         * @returns Returns a list of constraints.
462         * @since 7
463         * @deprecated since 9
464         * @useinstead osAccount.AccountManager#getOsAccountConstraints
465         */
466        getOsAccountAllConstraints(localId: number, callback: AsyncCallback<Array<string>>): void;
467        getOsAccountAllConstraints(localId: number): Promise<Array<string>>;
468
469        /**
470         * Obtains all constraints of an account based on its ID.
471         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
472         * @param localId Indicates the local ID of the OS account.
473         * @returns Returns a list of constraints.
474         * @throws {BusinessError} 201 - permission denied.
475         * @throws {BusinessError} 401 - the parameter check failed.
476         * @throws {BusinessError} 12300001 - system service exception.
477         * @throws {BusinessError} 12300002 - invalid localId.
478         * @throws {BusinessError} 12300003 - the account indicated by localId dose not exist.
479         * @since 9
480         */
481        getOsAccountConstraints(localId: number, callback: AsyncCallback<Array<string>>): void;
482        getOsAccountConstraints(localId: number): Promise<Array<string>>;
483
484        /**
485         * Queries the list of all the OS accounts that have been created in the system.
486         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
487         * @returns Returns a list of OS accounts.
488         * @throws {BusinessError} 201 - permission denied.
489         * @throws {BusinessError} 401 - the parameter check failed.
490         * @throws {BusinessError} 12300001 - system service exception.
491         * @systemapi Hide this for inner system use.
492         * @since 7
493         */
494        queryAllCreatedOsAccounts(callback: AsyncCallback<Array<OsAccountInfo>>): void;
495        queryAllCreatedOsAccounts(): Promise<Array<OsAccountInfo>>;
496
497        /**
498         * Queries the id list of all activated OS accounts.
499         * @returns Returns a id list of OS accounts.
500         * @since 8
501         * @deprecated since 9
502         * @useinstead osAccount.AccountManager#getActivatedOsAccountLocalIds
503         */
504        queryActivatedOsAccountIds(callback: AsyncCallback<Array<number>>): void;
505        queryActivatedOsAccountIds(): Promise<Array<number>>;
506
507        /**
508         * Gets the local IDs of all activated OS accounts.
509         * @param { AsyncCallback<Array<number>> } callback - Indicates the callback for getting the local IDs of all activated OS accounts.
510         * @throws { BusinessError } 401 - the parameter check failed.
511         * @throws { BusinessError } 12300001 - system service exception.
512         * @since 9
513         */
514        getActivatedOsAccountLocalIds(callback: AsyncCallback<Array<number>>): void;
515
516        /**
517         * Gets the local IDs of all activated OS accounts.
518         * @returns { Promise<Array<number>> } Returns all activated accounts.
519         * @throws { BusinessError } 401 - the parameter check failed.
520         * @throws { BusinessError } 12300001 - system service exception.
521         * @since 9
522         */
523        getActivatedOsAccountLocalIds(): Promise<Array<number>>;
524
525        /**
526         * Creates an OS account using the local name and account type.
527         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
528         * @param localName Indicates the local name of the OS account to create.
529         * @param type Indicates the type of the OS account to create.
530         *        {@link OsAccountType} specifies the account types available in the system.
531         * @returns Returns information about the created OS account; returns {@code null} if the creation fails.
532         * @throws {BusinessError} 201 - permission denied.
533         * @throws {BusinessError} 401 - the parameter check failed.
534         * @throws {BusinessError} 12300001 - system service exception.
535         * @throws {BusinessError} 12300002 - invalid localName.
536         * @throws {BusinessError} 12300005 - multi-user not supported.
537         * @throws {BusinessError} 12300006 - unsupported account type.
538         * @throws {BusinessError} 12300007 - the number of account reaches the upper limit.
539         * @systemapi Hide this for inner system use.
540         * @since 7
541         */
542        createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback<OsAccountInfo>): void;
543        createOsAccount(localName: string, type: OsAccountType): Promise<OsAccountInfo>;
544
545        /**
546         * Creates an OS account using the account type and domain account info.
547         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
548         * @param type Indicates the type of the OS account to create.
549         *        {@link OsAccountType} specifies the account types available in the system.
550         * @param domainInfo Indicates the domain account info.
551         * @returns Returns information about the created OS account; returns {@code null} if the creation fails.
552         * @throws {BusinessError} 201 - permission denied.
553         * @throws {BusinessError} 401 - the parameter check failed.
554         * @throws {BusinessError} 12300001 - system service exception.
555         * @throws {BusinessError} 12300002 - invalid type or domainInfo.
556         * @throws {BusinessError} 12300005 - multi-user not supported.
557         * @throws {BusinessError} 12300006 - unsupported account type.
558         * @throws {BusinessError} 12300007 - the number of account reaches the upper limit.
559         * @systemapi Hide this for inner system use.
560         * @since 8
561         */
562        createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, callback: AsyncCallback<OsAccountInfo>): void;
563        createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Promise<OsAccountInfo>;
564
565        /**
566         * Queries information about the current OS account.
567         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
568         * @returns Returns information about the current OS account; returns {@code null} if the query fails.
569         * @since 7
570         * @deprecated since 9
571         * @useinstead osAccount.AccountManager#getCurrentOsAccount
572         */
573        queryCurrentOsAccount(callback: AsyncCallback<OsAccountInfo>): void;
574        queryCurrentOsAccount(): Promise<OsAccountInfo>;
575
576        /**
577         * Gets information about the current OS account.
578         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
579         * @returns Returns information about the current OS account; returns {@code null} if the query fails.
580         * @throws {BusinessError} 201 - permission denied.
581         * @throws {BusinessError} 401 - the parameter check failed.
582         * @throws {BusinessError} 12300001 - system service exception.
583         * @since 9
584         */
585        getCurrentOsAccount(callback: AsyncCallback<OsAccountInfo>): void;
586        getCurrentOsAccount(): Promise<OsAccountInfo>;
587
588        /**
589         * Queries OS account information based on the local ID.
590         *
591         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
592         * @param localId Indicates the local ID of the OS account.
593         * @returns Returns the OS account information; returns {@code null} if the query fails.
594         * @throws {BusinessError} 201 - permission denied.
595         * @throws {BusinessError} 401 - the parameter check failed.
596         * @throws {BusinessError} 12300001 - system service exception.
597         * @throws {BusinessError} 12300002 - invalid localId.
598         * @throws {BusinessError} 12300003 - the account indicated by localId dose not exist.
599         * @systemapi Hide this for inner system use.
600         * @since 7
601         */
602        queryOsAccountById(localId: number, callback: AsyncCallback<OsAccountInfo>): void;
603        queryOsAccountById(localId: number): Promise<OsAccountInfo>;
604
605        /**
606         * Obtains the type of this OS account from the current process.
607         * @returns Returns the OS account type. The value can be {@link OsAccountType#ADMIN},
608         *         {@link OsAccountType#NORMAL}, and {@link OsAccountType#GUEST}.
609         * @since 7
610         * @deprecated since 9
611         * @useinstead osAccount.AccountManager#getOsAccountType
612         */
613        getOsAccountTypeFromProcess(callback: AsyncCallback<OsAccountType>): void;
614        getOsAccountTypeFromProcess(): Promise<OsAccountType>;
615
616        /**
617         * Obtains the type of this OS account from the current process.
618         * @returns Returns the OS account type. The value can be {@link OsAccountType#ADMIN},
619         *         {@link OsAccountType#NORMAL}, and {@link OsAccountType#GUEST}.
620         * @throws {BusinessError} 401 - the parameter check failed.
621         * @throws {BusinessError} 12300001 - system service exception.
622         * @since 9
623         */
624        getOsAccountType(callback: AsyncCallback<OsAccountType>): void;
625        getOsAccountType(): Promise<OsAccountType>;
626
627        /**
628         * Obtains the distributed virtual device ID (DVID).
629         * <p>
630         * If the same OHOS account has logged in to multiple devices, these devices constitute a super device
631         * through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs.
632         * The same application running on different devices obtains the same DVID, whereas different applications
633         * obtain different DVIDs.
634         * <p>
635         * @permission ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS
636         * @returns Returns the DVID if obtained; returns an empty string if no OHOS account has logged in.
637         * @since 7
638         * @deprecated since 9
639         * @useinstead osAccount.AccountManager#queryDistributedVirtualDeviceId
640         */
641        getDistributedVirtualDeviceId(callback: AsyncCallback<string>): void;
642        getDistributedVirtualDeviceId(): Promise<string>;
643
644        /**
645         * Queries the distributed virtual device ID (DVID).
646         * <p>
647         * If the same OHOS account has logged in to multiple devices, these devices constitute a super device
648         * through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs.
649         * The same application running on different devices obtains the same DVID, whereas different applications
650         * obtain different DVIDs.
651         * <p>
652         * @permission ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS
653         * @returns Returns the DVID if obtained; returns an empty string if no OHOS account has logged in.
654         * @throws {BusinessError} 201 - permission denied.
655         * @throws {BusinessError} 401 - the parameter check failed.
656         * @throws {BusinessError} 12300001 - system service exception.
657         * @since 9
658         */
659        queryDistributedVirtualDeviceId(callback: AsyncCallback<string>): void;
660        queryDistributedVirtualDeviceId(): Promise<string>;
661
662        /**
663         * Obtains the profile photo of an OS account based on its local ID.
664         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
665         * @param localId Indicates the local ID of the OS account.
666         * @returns Returns the profile photo if obtained;
667         *         returns {@code null} if the profile photo fails to be obtained.
668         * @throws {BusinessError} 201 - permission denied.
669         * @throws {BusinessError} 401 - the parameter check failed.
670         * @throws {BusinessError} 12300001 - system service exception.
671         * @throws {BusinessError} 12300002 - invalid localId.
672         * @throws {BusinessError} 12300003 - the account indicated by localId dose not exist.
673         * @systemapi Hide this for inner system use.
674         * @since 7
675         */
676        getOsAccountProfilePhoto(localId: number, callback: AsyncCallback<string>): void;
677        getOsAccountProfilePhoto(localId: number): Promise<string>;
678
679        /**
680         * Sets the profile photo for an OS account based on its local ID.
681         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
682         * @param localId Indicates the local ID of the OS account.
683         * @param photo Indicates the profile photo to set for the OS account.
684         * @returns void.
685         * @throws {BusinessError} 201 - permission denied.
686         * @throws {BusinessError} 401 - the parameter check failed.
687         * @throws {BusinessError} 12300001 - system service exception.
688         * @throws {BusinessError} 12300002 - invalid localId or photo.
689         * @throws {BusinessError} 12300003 - the account indicated by localId dose not exist.
690         * @throws {BusinessError} 12300008 - the localId indicates restricted account.
691         * @systemapi Hide this for inner system use.
692         * @since 7
693         */
694        setOsAccountProfilePhoto(localId: number, photo: string, callback: AsyncCallback<void>): void;
695        setOsAccountProfilePhoto(localId: number, photo: string): Promise<void>;
696
697        /**
698         * Obtain localId according to serial number
699         * @param serialNumber Indicates serial number.
700         * @returns localId.
701         * @since 8
702         * @deprecated since 9
703         * @useinstead osAccount.AccountManager#getOsAccountLocalIdForSerialNumber
704         */
705        getOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback<number>): void;
706        getOsAccountLocalIdBySerialNumber(serialNumber: number): Promise<number>;
707
708        /**
709         * Gets the local ID of the OS account associated with the serial number.
710         * @param { number } serialNumber - Indicates serial number.
711         * @param { AsyncCallback<number> } callback - Indicates the callback for getting the local ID of the OS account associated with the serial number.
712         * @throws { BusinessError } 401 - the parameter check failed.
713         * @throws { BusinessError } 12300001 - system service exception.
714         * @throws { BusinessError } 12300002 - invalid serialNumber.
715         * @throws { BusinessError } 12300003 - the account indicated by serialNumber dose not exist.
716         * @since 9
717         */
718        getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback<number>): void;
719
720        /**
721         * Gets the local ID of the OS account associated with the serial number.
722         * @param { number } serialNumber - Indicates serial number.
723         * @returns { Promise<number> } Returns the local ID of the OS account associated with the serial number.
724         * @throws { BusinessError } 401 - the parameter check failed.
725         * @throws { BusinessError } 12300001 - system service exception.
726         * @throws { BusinessError } 12300002 - invalid serialNumber.
727         * @throws { BusinessError } 12300003 - the account indicated by serialNumber dose not exist.
728         * @since 9
729         */
730        getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise<number>;
731
732        /**
733         * Obtain serial number according to localId.
734         * @param localId Indicates the local ID of the OS account.
735         * @returns serial number.
736         * @since 8
737         * @deprecated since 9
738         * @useinstead osAccount.AccountManager#getSerialNumberForOsAccountLocalId
739         */
740        getSerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback<number>): void;
741        getSerialNumberByOsAccountLocalId(localId: number): Promise<number>;
742
743        /**
744         * Gets the serial number for the specified os account local id.
745         * @param { number } localId - Indicates the local ID of the OS account.
746         * @param { AsyncCallback<number> } callback - Indicates the callback for getting the serial number for the specified os account local id.
747         * @throws { BusinessError } 401 - the parameter check failed.
748         * @throws { BusinessError } 12300001 - system service exception.
749         * @throws { BusinessError } 12300002 - invalid localId.
750         * @throws { BusinessError } 12300003 - the account indicated by localId dose not exist.
751         * @since 9
752         */
753        getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback<number>): void;
754
755        /**
756         * Gets the serial number for the specified os account local id.
757         * @param { number } localId - Indicates the local ID of the OS account.
758         * @returns { Promise<number> } Returns the serial number according to local ID.
759         * @throws { BusinessError } 401 - the parameter check failed.
760         * @throws { BusinessError } 12300001 - system service exception.
761         * @throws { BusinessError } 12300002 - invalid localId.
762         * @throws { BusinessError } 12300003 - the account indicated by localId dose not exist.
763         * @since 9
764         */
765        getSerialNumberForOsAccountLocalId(localId: number): Promise<number>;
766
767        /**
768         * Subscribes to the change events of accounts.
769         * <p>
770         * When user change the account, the subscriber will receive a notification
771         * about the account change event.
772         * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
773         * @param type Event type.
774         * @param name Indicates the name of subscriber.
775         * @returns void.
776         * @throws {BusinessError} 201 - permission denied.
777         * @throws {BusinessError} 401 - the parameter check failed.
778         * @throws {BusinessError} 12300001 - system service exception.
779         * @throws {BusinessError} 12300002 - invalid type or name.
780         * @throws {BusinessError} 12300011 - the callback has been registered.
781         * @systemapi Hide this for inner system use.
782         * @since 7
783         */
784        on(type: 'activate' | 'activating', name: string, callback: Callback<number>): void;
785
786        /**
787         * Unsubscribes from account events.
788         * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
789         * @param type Event type.
790         * @param name Indicates the name of subscriber.
791         * @returns void.
792         * @throws {BusinessError} 201 - permission denied.
793         * @throws {BusinessError} 401 - the parameter check failed.
794         * @throws {BusinessError} 12300001 - system service exception.
795         * @throws {BusinessError} 12300002 - invalid type or name.
796         * @throws {BusinessError} 12300012 - the callback has not been registered.
797         * @systemapi Hide this for inner system use.
798         * @since 7
799         */
800        off(type: 'activate' | 'activating', name: string, callback?: Callback<number>): void;
801
802        /**
803         * Gets the bundle ID associated with the specified UID.
804         * @param { number } uid - Indicates the target uid.
805         * @param { AsyncCallback<number> } callback - Indicates the callback for getting the bundle ID associated with the specified UID.
806         * @throws { BusinessError } 202 - not system application.
807         * @throws { BusinessError } 401 - the parameter check failed.
808         * @throws { BusinessError } 12300001 - system service exception.
809         * @throws { BusinessError } 12300002 - invalid uid.
810         * @systemapi Hide this for inner system use.
811         * @since 9
812         */
813        getBundleIdForUid(uid: number, callback: AsyncCallback<number>): void;
814
815        /**
816         * Gets the bundle ID associated with the specified UID.
817         * @param { number } uid - Indicates the target uid.
818         * @returns { Promise<number> } Returns the bundle ID associated with the specified UID.
819         * @throws { BusinessError } 202 - not system application.
820         * @throws { BusinessError } 401 - the parameter check failed.
821         * @throws { BusinessError } 12300001 - system service exception.
822         * @throws { BusinessError } 12300002 - invalid uid.
823         * @systemapi Hide this for inner system use.
824         * @since 9
825         */
826        getBundleIdForUid(uid: number): Promise<number>;
827
828        /**
829         * Check whether current process belongs to the main account.
830         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
831         * @returns Returns {@code true} if current process belongs to the main os account;
832         *         returns {@code false} otherwise.
833         * @throws {BusinessError} 201 - permission denied.
834         * @throws {BusinessError} 401 - the parameter check failed.
835         * @throws {BusinessError} 12300001 - system service exception.
836         * @systemapi Hide this for inner system use.
837         * @since 9
838         */
839        isMainOsAccount(callback: AsyncCallback<boolean>): void;
840        isMainOsAccount(): Promise<boolean>;
841
842        /**
843         * Gets a list of constraint source types for the specified os account.
844         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
845         * @param { number } localId - Indicates the local ID of the OS account.
846         * @param { string } constraint - Indicates the constraint to query the source type.
847         * @param { AsyncCallback<Array<ConstraintSourceTypeInfo>> } callback - Indicates the callback for getting a list of constraint source types for the specified os account.
848         * @throws { BusinessError } 201 - permission denied.
849         * @throws { BusinessError } 202 - not system application.
850         * @throws { BusinessError } 401 - the parameter check failed.
851         * @throws { BusinessError } 12300001 - system service exception.
852         * @throws { BusinessError } 12300002 - invalid name or constraint.
853         * @throws { BusinessError } 12300003 - the account indicated by localId dose not exist.
854         * @systemapi Hide this for inner system use.
855         * @since 9
856         */
857        getOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback<Array<ConstraintSourceTypeInfo>>): void;
858
859        /**
860         * Gets a list of constraint source types for the specified os account.
861         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
862         * @param { number } localId - Indicates the local ID of the OS account.
863         * @param { string } constraint - Indicates the constraint to query the source type.
864         * @returns { Promise<Array<ConstraintSourceTypeInfo>> } Returns a list of constraint source types for the specified os account.
865         * @throws { BusinessError } 201 - permission denied.
866         * @throws { BusinessError } 202 - not system application.
867         * @throws { BusinessError } 401 - the parameter check failed.
868         * @throws { BusinessError } 12300001 - system service exception.
869         * @throws { BusinessError } 12300002 - invalid name or constraint.
870         * @throws { BusinessError } 12300003 - the account indicated by localId dose not exist.
871         * @systemapi Hide this for inner system use.
872         * @since 9
873         */
874        getOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise<Array<ConstraintSourceTypeInfo>>;
875    }
876
877    /**
878     * Provides information about OS accounts, including the local ID, local name, and type of an OS account.
879     * @name OsAccountInfo
880     * @syscap SystemCapability.Account.OsAccount
881     * @since 7
882     */
883    interface OsAccountInfo {
884        /**
885         * The local ID of an OS account.
886         * @since 7
887         */
888        localId: number;
889
890        /**
891         * The local name of an OS account.
892         * @since 7
893         */
894        localName: string;
895
896        /**
897         * Include: ADMIN, Normal, GUEST.
898         * @since 7
899         */
900        type: OsAccountType;
901
902        /**
903         * Account constraints information.
904         * @since 7
905         */
906        constraints: Array<string>;
907
908        /**
909         * The account is verified or not.
910         * @since 8
911         */
912        isVerified: boolean;
913
914        /**
915         * OS account photo.
916         * @since 8
917         */
918        photo: string;
919
920        /**
921         * Os account create time.
922         * @since 8
923         */
924        createTime: number;
925
926        /**
927         * The last time to log in.
928         * @since 8
929         */
930        lastLoginTime: number;
931
932        /**
933         * Os account serial number.
934         * @since 8
935         */
936        serialNumber: number;
937
938        /**
939         * Os account is activated or not.
940         * @since 8
941         */
942        isActived: boolean;
943
944        /**
945         * Os account create completed or not.
946         * @since 8
947         */
948        isCreateCompleted: boolean;
949
950        /**
951         * Distributed account info.
952         * @since 7
953         */
954        distributedInfo: distributedAccount.DistributedInfo;
955
956         /**
957          * Domain account info.
958          * @since 8
959          */
960        domainInfo: DomainAccountInfo;
961    }
962
963    interface DomainAccountInfo {
964        /**
965        * The domain name
966        * @since 8
967        */
968        domain: string;
969
970        /**
971        * The account name in the domain
972        * @since 8
973        */
974        accountName: string;
975    }
976
977    /**
978     * Enumerates OS account types.
979     * @name OsAccountType
980     * @syscap SystemCapability.Account.OsAccount
981     * @since 7
982     */
983    enum OsAccountType {
984        /**
985         * Indicates the administrator account, which has the permission to manage other OS accounts.
986         */
987        ADMIN = 0,
988
989        /**
990         * Indicates a normal account, which has access to common functions of OS accounts.
991         */
992        NORMAL,
993
994        /**
995         * Indicates a guest account, which is used to temporarily access the device and may be deleted at any time.
996         */
997        GUEST
998    }
999
1000    /**
1001     * Provides the abilities for user authentication.
1002     * @name UserAuth
1003     * @syscap SystemCapability.Account.OsAccount
1004     * @since 8
1005     */
1006    class UserAuth {
1007        /**
1008         * Constructor to get the UserAuth class instance.
1009         * @returns Returns the UserAuth class instance.
1010         * @systemapi Hide this for inner system use.
1011         * @since 8
1012         */
1013        constructor();
1014
1015        /**
1016         * Gets version information.
1017         * @returns Returns the version information.
1018         * @systemapi Hide this for inner system use.
1019         * @since 8
1020         */
1021        getVersion(): number;
1022
1023        /**
1024         * Checks whether the authentication capability is available.
1025         * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
1026         * @param authType Indicates the credential type for authentication.
1027         * @param authTrustLevel Indicates the trust level of authentication result.
1028         * @returns Returns a status result.
1029         * @throws {BusinessError} 201 - permission denied.
1030         * @throws {BusinessError} 401 - the parameter check failed.
1031         * @throws {BusinessError} 12300001 - system service exception.
1032         * @throws {BusinessError} 12300002 - invalid authType or authTrustLevel.
1033         * @systemapi Hide this for inner system use.
1034         * @since 8
1035         */
1036        getAvailableStatus(authType: AuthType, authTrustLevel: AuthTrustLevel): number;
1037
1038        /**
1039         * Gets the property based on the specified request information.
1040         * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
1041         * @param request Indicates the request information, including authentication type, and property type list.
1042         * @returns Returns an executor property.
1043         * @throws {BusinessError} 201 - permission denied.
1044         * @throws {BusinessError} 401 - the parameter check failed.
1045         * @throws {BusinessError} 12300001 - system service exception.
1046         * @throws {BusinessError} 12300002 - invalid request.
1047         * @systemapi Hide this for inner system use.
1048         * @since 8
1049         */
1050        getProperty(request: GetPropertyRequest, callback: AsyncCallback<ExecutorProperty>): void;
1051        getProperty(request: GetPropertyRequest): Promise<ExecutorProperty>;
1052
1053        /**
1054         * Sets property that can be used to initialize algorithms.
1055         * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
1056         * @param request Indicates the request information, including authentication type and the key-value to be set.
1057         * @throws {BusinessError} 201 - permission denied.
1058         * @throws {BusinessError} 401 - the parameter check failed.
1059         * @throws {BusinessError} 12300001 - system service exception.
1060         * @throws {BusinessError} 12300002 - invalid request.
1061         * @systemapi Hide this for inner system use.
1062         * @since 8
1063         */
1064        setProperty(request: SetPropertyRequest, callback: AsyncCallback<void>): void;
1065        setProperty(request: SetPropertyRequest): Promise<void>;
1066
1067        /**
1068         * Executes authentication.
1069         * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
1070         * @param challenge Indicates the challenge value.
1071         * @param authType Indicates the authentication type.
1072         * @param authTrustLevel Indicates the trust level of authentication result.
1073         * @param callback Indicates the callback to get result and acquireInfo.
1074         * @returns Returns a context ID for cancellation.
1075         * @throws {BusinessError} 201 - permission denied.
1076         * @throws {BusinessError} 401 - the parameter check failed.
1077         * @throws {BusinessError} 12300001 - system service exception.
1078         * @throws {BusinessError} 12300002 - invalid challenge, authType or authTrustLevel.
1079         * @throws {BusinessError} 12300101 - credential is incorrect.
1080         * @throws {BusinessError} 12300105 - unsupported authTrustLevel.
1081         * @throws {BusinessError} 12300106 - unsupported authType.
1082         * @throws {BusinessError} 12300110 - authentication is locked.
1083         * @throws {BusinessError} 12300111 - authentication timeout.
1084         * @throws {BusinessError} 12300112 - authentication service is busy.
1085         * @systemapi Hide this for inner system use.
1086         * @since 8
1087         */
1088        auth(challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array;
1089
1090        /**
1091         * Executes user authentication.
1092         * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
1093         * @param userId Indicates the user identification.
1094         * @param challenge Indicates the challenge value.
1095         * @param authType Indicates the authentication type.
1096         * @param authTrustLevel Indicates the trust level of authentication result.
1097         * @param callback Indicates the callback to get result and acquireInfo.
1098         * @returns Returns a context ID for cancellation.
1099         * @throws {BusinessError} 201 - permission denied.
1100         * @throws {BusinessError} 401 - the parameter check failed.
1101         * @throws {BusinessError} 12300001 - system service exception.
1102         * @throws {BusinessError} 12300002 - invalid userId, challenge, authType or authTrustLevel.
1103         * @throws {BusinessError} 12300101 - credential is incorrect.
1104         * @throws {BusinessError} 12300105 - unsupported authTrustLevel.
1105         * @throws {BusinessError} 12300106 - unsupported authType.
1106         * @throws {BusinessError} 12300110 - authentication is locked.
1107         * @throws {BusinessError} 12300111 - authentication timeout.
1108         * @throws {BusinessError} 12300112 - authentication service is busy.
1109         * @systemapi Hide this for inner system use.
1110         * @since 8
1111         */
1112        authUser(userId: number, challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array;
1113
1114        /**
1115         * Cancels authentication with context ID.
1116         * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
1117         * @param contextID Indicates the authentication context ID.
1118         * @throws {BusinessError} 201 - permission denied.
1119         * @throws {BusinessError} 401 - the parameter check failed.
1120         * @throws {BusinessError} 12300001 - system service exception.
1121         * @throws {BusinessError} 12300002 - invalid contextId.
1122         * @systemapi Hide this for inner system use.
1123         * @since 8
1124         */
1125        cancelAuth(contextID: Uint8Array): void;
1126    }
1127
1128    /**
1129     * Provides the abilities for Pin code authentication.
1130     * @name PINAuth
1131     * @syscap SystemCapability.Account.OsAccount
1132     * @since 8
1133     */
1134    class PINAuth {
1135        /**
1136         * Constructor to get the PINAuth class instance.
1137         * @returns Returns the PINAuth class instance.
1138         * @systemapi Hide this for inner system use.
1139         * @since 8
1140         */
1141        constructor();
1142
1143        /**
1144         * Register inputer.
1145         * @permission ohos.permission.ACCESS_PIN_AUTH
1146         * @param inputer Indicates the password input box callback
1147         * @throws {BusinessError} 201 - permission denied.
1148         * @throws {BusinessError} 401 - the parameter check failed.
1149         * @throws {BusinessError} 12300001 - system service exception.
1150         * @throws {BusinessError} 12300002 - invalid inputer.
1151         * @throws {BusinessError} 12300103 - the credential inputer has been registered.
1152         * @systemapi Hide this for inner system use.
1153         * @since 8
1154         */
1155        registerInputer(inputer: IInputer): void;
1156
1157        /**
1158         * Unregister inputer.
1159         * @permission ohos.permission.ACCESS_PIN_AUTH
1160         * @systemapi Hide this for inner system use.
1161         * @throws {BusinessError} 201 - permission denied.
1162         * @since 8
1163         */
1164        unregisterInputer(): void;
1165    }
1166
1167    /**
1168     * Provides the management of credential inputers.
1169     * @name InputerManager
1170     * @syscap SystemCapability.Account.OsAccount
1171     * @since 9
1172     */
1173    class InputerManager {
1174        /**
1175         * Register credential inputer by authentication type.
1176         * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL or ohos.permission.MANAGE_USER_IDM
1177         * @static
1178         * @param authType Indicates the authentication type.
1179         * @param inputer Indicates the credential input box callback.
1180         * @throws {BusinessError} 201 - permission denied.
1181         * @throws {BusinessError} 202 - not system application.
1182         * @throws {BusinessError} 401 - the parameter check failed.
1183         * @throws {BusinessError} 12300001 - system service exception.
1184         * @throws {BusinessError} 12300002 - invalid authType or inputer.
1185         * @throws {BusinessError} 12300103 - the credential inputer has been registered.
1186         * @throws {BusinessError} 12300106 - unsupported authType.
1187         * @systemapi Hide this for inner system use.
1188         * @since 9
1189         */
1190        static registerInputer(authType: AuthType, inputer: IInputer): void;
1191
1192        /**
1193         * Unregister credential inputer by authentication type.
1194         * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL or ohos.permission.MANAGE_USER_IDM
1195         * @static
1196         * @param authType Indicates the authentication type.
1197         * @throws {BusinessError} 201 - permission denied.
1198         * @throws {BusinessError} 202 - not system application.
1199         * @throws {BusinessError} 401 - the parameter check failed.
1200         * @throws {BusinessError} 12300002 - invalid authType.
1201         * @systemapi Hide this for inner system use.
1202         * @since 9
1203         */
1204        static unregisterInputer(authType: AuthType): void;
1205    }
1206
1207    /**
1208     * Provides the definition of domain plugin.
1209     * @interface DomainPlugin
1210     * @syscap SystemCapability.Account.OsAccount
1211     * @since 9
1212     */
1213    interface DomainPlugin {
1214        /**
1215         * Authenticates the specified domain account.
1216         * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information for authentication.
1217         * @param { Uint8Array } credential - Indicates the credential for authentication.
1218         * @param { IUserAuthCallback } callback - Indicates the authentication callback.
1219         * @systemapi Hide this for inner system use.
1220         * @since 9
1221         */
1222        auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUserAuthCallback): void;
1223    }
1224
1225    /**
1226     * Provides abilities for the management of domain account.
1227     * @syscap SystemCapability.Account.OsAccount
1228     * @since 9
1229     */
1230    class DomainAccountManager {
1231        /**
1232         * Registers the domain plugin, which provides the capabilities for domain authentication.
1233         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
1234         * @static
1235         * @param { DomainPlugin } plugin - Indicates the domain plugin.
1236         * @throws { BusinessError } 201 - permission denied.
1237         * @throws { BusinessError } 202 - not system application.
1238         * @throws { BusinessError } 401 - the parameter check failed.
1239         * @throws { BusinessError } 12300201 - the domain plugin has been registered.
1240         * @systemapi Hide this for inner system use.
1241         * @since 9
1242         */
1243        static registerPlugin(plugin: DomainPlugin): void;
1244
1245        /**
1246         * Unregisters domain plugin.
1247         * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
1248         * @static
1249         * @throws { BusinessError } 201 - permission denied.
1250         * @throws { BusinessError } 202 - not system application.
1251         * @systemapi Hide this for inner system use.
1252         * @since 9
1253         */
1254        static unregisterPlugin(): void;
1255    }
1256
1257    /**
1258     * Provides the abilities for managing user identity.
1259     * @name UserIdentityManager
1260     * @syscap SystemCapability.Account.OsAccount
1261     * @since 8
1262     */
1263    class UserIdentityManager {
1264        /**
1265         * Constructor to get the UserIdentityManager class instance.
1266         * @returns Returns the UserIdentityManager class instance.
1267         * @systemapi Hide this for inner system use.
1268         * @since 8
1269         */
1270        constructor();
1271
1272        /**
1273         * Opens session.
1274         * <p>
1275         * Start an IDM operation to obtain challenge value.
1276         * A challenge value of 0 indicates that opensession failed.
1277         * @permission ohos.permission.MANAGE_USER_IDM
1278         * @returns Returns a challenge value.
1279         * @throws {BusinessError} 201 - permission denied.
1280         * @throws {BusinessError} 401 - the parameter check failed.
1281         * @throws {BusinessError} 12300001 - system service exception.
1282         * @systemapi Hide this for inner system use.
1283         * @since 8
1284         */
1285        openSession(callback: AsyncCallback<Uint8Array>): void;
1286        openSession(): Promise<Uint8Array>;
1287
1288        /**
1289         * Adds credential.
1290         * <p>
1291         * Add user credential information, pass in credential addition method and credential information
1292         * (credential type, subclass, if adding user's non password credentials, pass in password authentication token),
1293         * and get the result / acquireInfo callback.
1294         * @permission ohos.permission.MANAGE_USER_IDM
1295         * @param credentialInfo Indicates the credential information.
1296         * @param callback Indicates the callback to get results and acquireInfo.
1297         * @throws {BusinessError} 201 - permission denied.
1298         * @throws {BusinessError} 401 - the parameter check failed.
1299         * @throws {BusinessError} 12300001 - system service exception.
1300         * @throws {BusinessError} 12300002 - invalid credentialInfo.
1301         * @throws {BusinessError} 12300101 - token is invalid.
1302         * @throws {BusinessError} 12300106 - unsupported authType.
1303         * @systemapi Hide this for inner system use.
1304         * @since 8
1305         */
1306        addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
1307
1308        /**
1309         * Updates credential.
1310         * @permission ohos.permission.MANAGE_USER_IDM
1311         * @param credentialInfo Indicates the credential information.
1312         * @param callback Indicates the callback to get results and acquireInfo.
1313         * @throws {BusinessError} 201 - permission denied.
1314         * @throws {BusinessError} 401 - the parameter check failed.
1315         * @throws {BusinessError} 12300001 - system service exception.
1316         * @throws {BusinessError} 12300002 - invalid credentialInfo.
1317         * @throws {BusinessError} 12300101 - token is invalid.
1318         * @throws {BusinessError} 12300106 - unsupported authType.
1319         * @systemapi Hide this for inner system use.
1320         * @since 8
1321         */
1322        updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
1323
1324        /**
1325         * Closes session.
1326         * <p>
1327         * End an IDM operation.
1328         * @permission ohos.permission.MANAGE_USER_IDM
1329         * @throws {BusinessError} 201 - permission denied.
1330         * @systemapi Hide this for inner system use.
1331         * @since 8
1332         */
1333        closeSession(): void;
1334
1335        /**
1336         * Cancels entry with a challenge value.
1337         * @permission ohos.permission.MANAGE_USER_IDM
1338         * @param challenge Indicates the challenge value.
1339         * @throws {BusinessError} 201 - permission denied.
1340         * @throws {BusinessError} 401 - the parameter check failed.
1341         * @throws {BusinessError} 12300001 - system service exception.
1342         * @throws {BusinessError} 12300002 - invalid challenge.
1343         * @systemapi Hide this for inner system use.
1344         * @since 8
1345         */
1346        cancel(challenge: Uint8Array): void;
1347
1348        /**
1349         * Deletes the user with the authentication token.
1350         * @permission ohos.permission.MANAGE_USER_IDM
1351         * @param token Indicates the authentication token.
1352         * @param callback Indicates the callback to get the deletion result.
1353         * @throws {BusinessError} 201 - permission denied.
1354         * @throws {BusinessError} 401 - the parameter check failed.
1355         * @throws {BusinessError} 12300001 - system service exception.
1356         * @throws {BusinessError} 12300101 - token is invalid.
1357         * @systemapi Hide this for inner system use.
1358         * @since 8
1359         */
1360        delUser(token: Uint8Array, callback: IIdmCallback): void;
1361
1362        /**
1363         * Deletes the user credential information.
1364         * @permission ohos.permission.MANAGE_USER_IDM
1365         * @param credentialId Indicates the credential index.
1366         * @param token Indicates the authentication token.
1367         * @param callback Indicates the callback to get the deletion result.
1368         * @throws {BusinessError} 201 - permission denied.
1369         * @throws {BusinessError} 401 - the parameter check failed.
1370         * @throws {BusinessError} 12300001 - system service exception.
1371         * @throws {BusinessError} 12300002 - invalid credentialId.
1372         * @throws {BusinessError} 12300101 - token is invalid.
1373         * @throws {BusinessError} 12300102 - credential not found.
1374         * @systemapi Hide this for inner system use.
1375         * @since 8
1376         */
1377        delCred(credentialId: Uint8Array, token: Uint8Array, callback: IIdmCallback): void;
1378
1379        /**
1380         * Gets authentication information.
1381         * @permission ohos.permission.USE_USER_IDM
1382         * @param authType Indicates the authentication type.
1383         * @param callback Indicates the callback to get all registered credential information of
1384         * the specified type for the current user.
1385         * @throws {BusinessError} 201 - permission denied.
1386         * @throws {BusinessError} 401 - the parameter check failed.
1387         * @throws {BusinessError} 12300001 - system service exception.
1388         * @throws {BusinessError} 12300002 - invalid authType.
1389         * @throws {BusinessError} 12300102 - credential not found.
1390         * @systemapi Hide this for inner system use.
1391         * @since 8
1392         */
1393        getAuthInfo(callback: AsyncCallback<Array<EnrolledCredInfo>>): void;
1394        getAuthInfo(authType: AuthType, callback: AsyncCallback<Array<EnrolledCredInfo>>): void;
1395        getAuthInfo(authType?: AuthType): Promise<Array<EnrolledCredInfo>>;
1396    }
1397
1398    /**
1399     * Password data callback.
1400     *
1401     * @name IInputData
1402     * @syscap SystemCapability.Account.OsAccount
1403     * @systemapi Hide this for inner system use.
1404     * @since 8
1405     */
1406    interface IInputData {
1407        /**
1408         * Notifies to set data.
1409         * @param authSubType Indicates the credential subtype for authentication.
1410         * @param data Indicates the data to set.
1411         * @throws {BusinessError} 401 - the parameter check failed.
1412         * @throws {BusinessError} 12300002 - invalid pinSubType.
1413         * @systemapi Hide this for inner system use.
1414         * @since 8
1415         */
1416        onSetData: (authSubType: AuthSubType, data: Uint8Array) => void;
1417    }
1418
1419    /**
1420     * Password input box callback.
1421     * @name IInputer
1422     * @syscap SystemCapability.Account.OsAccount
1423     * @systemapi Hide this for inner system use.
1424     * @since 8
1425     */
1426    interface IInputer {
1427        /**
1428         * Notifies to get data.
1429         * @param authSubType Indicates the credential subtype for authentication.
1430         * @param callback Indicates the password data callback.
1431         * @systemapi Hide this for inner system use.
1432         * @since 8
1433         */
1434        onGetData: (authSubType: AuthSubType, callback: IInputData) => void;
1435    }
1436
1437    /**
1438     * User authentication callback.
1439     * @name IUserAuthCallback
1440     * @syscap SystemCapability.Account.OsAccount
1441     * @systemapi Hide this for inner system use.
1442     * @since 8
1443     */
1444    interface IUserAuthCallback {
1445        /**
1446         * The authentication result code is returned through the callback.
1447         * @param result Indicates the authentication result code.
1448         * @param extraInfo Indicates the specific information for different situation.
1449         * If the authentication is passed, the authentication token is returned in extraInfo,
1450         * If the authentication fails, the remaining authentication times are returned in extraInfo,
1451         * If the authentication executor is locked, the freezing time is returned in extraInfo.
1452         * @systemapi Hide this for inner system use.
1453         * @since 8
1454         */
1455        onResult: (result: number, extraInfo: AuthResult) => void;
1456
1457        /**
1458         * During an authentication, the TipsCode is returned through the callback.
1459         * @param module Indicates the executor type for authentication.
1460         * @param acquire Indicates the tip code for different authentication executor.
1461         * @param extraInfo reserved parameter.
1462         * @systemapi Hide this for inner system use.
1463         * @since 8
1464         */
1465        onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void;
1466    }
1467
1468    /**
1469     * Identity manager callback.
1470     * @name IIdmCallback
1471     * @syscap SystemCapability.Account.OsAccount
1472     * @systemapi Hide this for inner system use.
1473     * @since 8
1474     */
1475    interface IIdmCallback {
1476        /**
1477         * The authentication result code is returned through the callback.
1478         * @param result Indicates the authentication result code.
1479         * @param extraInfo pass the specific information for different situation.
1480         * @systemapi Hide this for inner system use.
1481         * @since 8
1482         */
1483        onResult: (result: number, extraInfo: RequestResult) => void;
1484
1485        /**
1486         * During an authentication, the TipsCode is returned through the callback.
1487         * @param module Indicates the executor type for authentication.
1488         * @param acquire Indicates the tip code for different authentication executor.
1489         * @param extraInfo reserved parameter.
1490         * @systemapi Hide this for inner system use.
1491         * @since 8
1492         */
1493        onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void;
1494    }
1495
1496    /**
1497     * Provides the information of the get property request.
1498     *
1499     * @name GetPropertyRequest
1500     * @syscap SystemCapability.Account.OsAccount
1501     * @systemapi Hide this for inner system use.
1502     * @since 8
1503     */
1504    interface GetPropertyRequest {
1505        /**
1506         * Indicates the authentication credential type.
1507         */
1508        authType: AuthType;
1509
1510        /**
1511         * Indicates the array of property types to get.
1512         */
1513        keys: Array<GetPropertyType>;
1514    }
1515
1516    /**
1517     * Provides the information of the set property request.
1518     * @name SetPropertyRequest
1519     * @syscap SystemCapability.Account.OsAccount
1520     * @systemapi Hide this for inner system use.
1521     * @since 8
1522     */
1523    interface SetPropertyRequest {
1524        /**
1525         * Indicates the authentication credential type.
1526         */
1527        authType: AuthType;
1528
1529        /**
1530         * Indicates the property type to set.
1531         */
1532        key: SetPropertyType;
1533
1534        /**
1535         * Indicates the information to set.
1536         */
1537        setInfo: Uint8Array;
1538    }
1539
1540    /**
1541     * Provides the property of executor.
1542     * @name ExecutorProperty
1543     * @syscap SystemCapability.Account.OsAccount
1544     * @systemapi Hide this for inner system use.
1545     * @since 8
1546     */
1547    interface ExecutorProperty {
1548        /**
1549         * Indicates the result.
1550         */
1551        result: number;
1552
1553        /**
1554         * Indicates the authentication credential subtype.
1555         */
1556        authSubType: AuthSubType;
1557
1558        /**
1559         * Indicates the remaining times.
1560         */
1561        remainTimes?: number;
1562
1563        /**
1564         * Indicates the freezing times.
1565         */
1566        freezingTime?: number;
1567    }
1568
1569    /**
1570     * Indicates the information of authentication result.
1571     * @name AuthResult
1572     * @syscap SystemCapability.Account.OsAccount
1573     * @systemapi Hide this for inner system use.
1574     * @since 8
1575     */
1576    interface AuthResult {
1577        /**
1578         * Indicates the authentication token.
1579         */
1580        token?: Uint8Array;
1581
1582        /**
1583         * Indicates the remaining times.
1584         */
1585        remainTimes?: number;
1586
1587        /**
1588         * Indicates the freezing times.
1589         */
1590        freezingTime?: number;
1591    }
1592
1593    /**
1594     * Indicates the information of credential.
1595     * @name CredentialInfo
1596     * @syscap SystemCapability.Account.OsAccount
1597     * @systemapi Hide this for inner system use.
1598     * @since 8
1599     */
1600    interface CredentialInfo {
1601        /**
1602         * Indicates the credential type.
1603         */
1604        credType: AuthType;
1605
1606        /**
1607         * Indicates the credential subtype.
1608         */
1609        credSubType: AuthSubType;
1610
1611        /**
1612         * Indicates the authentication token.
1613         */
1614        token: Uint8Array;
1615    }
1616
1617    /**
1618     * Indicates the information of request result.
1619     * @name RequestResult
1620     * @syscap SystemCapability.Account.OsAccount
1621     * @systemapi Hide this for inner system use.
1622     * @since 8
1623     */
1624    interface RequestResult {
1625        /**
1626         * Indicates the credential index.
1627         */
1628        credentialId?: Uint8Array;
1629    }
1630
1631    /**
1632     * Indicates the information of enrolled credential.
1633     * @name EnrolledCredInfo
1634     * @syscap SystemCapability.Account.OsAccount
1635     * @systemapi Hide this for inner system use.
1636     * @since 8
1637     */
1638    interface EnrolledCredInfo {
1639        /**
1640         * Indicates the credential index.
1641         */
1642        credentialId: Uint8Array;
1643
1644        /**
1645         * Indicates the authentication credential type.
1646         */
1647        authType: AuthType;
1648
1649        /**
1650         * Indicates the authentication credential subtype.
1651         */
1652        authSubType: AuthSubType;
1653
1654        /**
1655         * Indicates the credential template ID.
1656         */
1657        templateId: Uint8Array;
1658    }
1659
1660    /**
1661     * Indicates the property type to get.
1662     * @name GetPropertyType
1663     * @syscap SystemCapability.Account.OsAccount
1664     * @systemapi Hide this for inner system use.
1665     * @since 8
1666     */
1667    enum GetPropertyType {
1668        /**
1669         * Indicates the authentication subtype.
1670         */
1671        AUTH_SUB_TYPE = 1,
1672
1673        /**
1674         * Indicates the remain times.
1675         */
1676        REMAIN_TIMES = 2,
1677
1678        /**
1679         * Indicates the freezing time.
1680         */
1681        FREEZING_TIME = 3
1682    }
1683
1684    /**
1685     * Indicates the property type to set.
1686     *
1687     * @name SetPropertyType
1688     * @syscap SystemCapability.Account.OsAccount
1689     * @systemapi Hide this for inner system use.
1690     * @since 8
1691     */
1692    enum SetPropertyType {
1693        /**
1694         * Indicates the init algorithm.
1695         */
1696        INIT_ALGORITHM = 1,
1697    }
1698
1699    /**
1700     * Indicates the credential type for authentication.
1701     * @name AuthType
1702     * @syscap SystemCapability.Account.OsAccount
1703     * @systemapi Hide this for inner system use.
1704     * @since 8
1705     */
1706    enum AuthType {
1707        /**
1708         * Indicates the PIN authentication type.
1709         */
1710        PIN = 1,
1711
1712        /**
1713         * Indicates the FACE authentication type.
1714         */
1715        FACE = 2,
1716
1717        /**
1718         * Indicates the DOMAIN authentication type.
1719         * @since 9
1720         */
1721        DOMAIN = 1024
1722    }
1723
1724    /**
1725     * Indicates the credential subtype for authentication.
1726     * @name AuthSubType
1727     * @syscap SystemCapability.Account.OsAccount
1728     * @systemapi Hide this for inner system use.
1729     * @since 8
1730     */
1731    enum AuthSubType {
1732        /**
1733         * Indicates the 6-digit credential.
1734         */
1735        PIN_SIX = 10000,
1736
1737        /**
1738         * Indicates the self-defined digital credential.
1739         */
1740        PIN_NUMBER = 10001,
1741
1742        /**
1743         * Indicates the self-defined mixed credential.
1744         */
1745        PIN_MIXED = 10002,
1746
1747        /**
1748         * Indicates the 2D face credential.
1749         */
1750        FACE_2D = 20000,
1751
1752        /**
1753         * Indicates the 3D face credential.
1754         */
1755        FACE_3D = 20001,
1756
1757        /**
1758         * Indicates the mixed domain credential.
1759         * @since 9
1760         */
1761        DOMAIN_MIXED = 10240001
1762    }
1763
1764    /**
1765     * Indicates the trusted level of authentication results.
1766     * @name AuthTrustLevel
1767     * @syscap SystemCapability.Account.OsAccount
1768     * @systemapi Hide this for inner system use.
1769     * @since 8
1770     */
1771    enum AuthTrustLevel {
1772        /**
1773         * Indicates the trusted level 1.
1774         */
1775        ATL1 = 10000,
1776
1777        /**
1778         * Indicates the trusted level 2.
1779         */
1780        ATL2 = 20000,
1781
1782        /**
1783         * Indicates the trusted level 3.
1784         */
1785        ATL3 = 30000,
1786
1787        /**
1788         * Indicates the trusted level 4.
1789         */
1790        ATL4 = 40000
1791    }
1792
1793    /**
1794     * Indicates the module of acquired information.
1795     * @name Module
1796     * @syscap SystemCapability.Account.OsAccount
1797     * @systemapi Hide this for inner system use.
1798     * @since 8
1799     */
1800    enum Module {
1801        /**
1802         * Indicates the information acquired from FaceAuth.
1803         */
1804        FACE_AUTH = 1
1805    }
1806
1807    /**
1808     * Indicates the enumeration of authentication result code.
1809     * @name ResultCode
1810     * @syscap SystemCapability.Account.OsAccount
1811     * @systemapi Hide this for inner system use.
1812     * @since 8
1813     */
1814    enum ResultCode {
1815        /**
1816         * Indicates that authentication is success or ability is supported.
1817         */
1818        SUCCESS = 0,
1819
1820        /**
1821         * Indicates the authenticator fails to identify user.
1822         */
1823        FAIL = 1,
1824
1825        /**
1826         * Indicates other errors.
1827         */
1828        GENERAL_ERROR = 2,
1829
1830        /**
1831         * Indicates that authentication has been canceled.
1832         */
1833        CANCELED = 3,
1834
1835        /**
1836         * Indicates that authentication has timed out.
1837         */
1838        TIMEOUT = 4,
1839
1840        /**
1841         * Indicates that this authentication type is not supported.
1842         */
1843        TYPE_NOT_SUPPORT = 5,
1844
1845        /**
1846         * Indicates that the authentication trust level is not supported.
1847         */
1848        TRUST_LEVEL_NOT_SUPPORT = 6,
1849
1850        /**
1851         * Indicates that the authentication task is busy. Wait for a few seconds and try again.
1852         */
1853        BUSY = 7,
1854
1855        /**
1856         * Indicates incorrect parameters.
1857         */
1858        INVALID_PARAMETERS = 8,
1859
1860        /**
1861         * Indicates that the authenticator is locked.
1862         */
1863        LOCKED = 9,
1864
1865        /**
1866         * Indicates that the user has not enrolled the authenticator.
1867         */
1868        NOT_ENROLLED = 10
1869    }
1870
1871    /**
1872     * Indicates the enumeration of prompt codes in the process of face authentication.
1873     * @name FaceTipsCode
1874     * @syscap SystemCapability.Account.OsAccount
1875     * @systemapi Hide this for inner system use.
1876     * @since 8
1877     */
1878    enum FaceTipsCode {
1879        /**
1880         * Indicates that the obtained facial image is too bright due to high illumination.
1881         */
1882        FACE_AUTH_TIP_TOO_BRIGHT = 1,
1883
1884        /**
1885         * Indicates that the obtained facial image is too dark due to low illumination.
1886         */
1887        FACE_AUTH_TIP_TOO_DARK = 2,
1888
1889        /**
1890         * Indicates that the face is too close to the device.
1891         */
1892        FACE_AUTH_TIP_TOO_CLOSE = 3,
1893
1894        /**
1895         * Indicates that the face is too far away from the device.
1896         */
1897        FACE_AUTH_TIP_TOO_FAR = 4,
1898
1899        /**
1900         * Indicates that the device is too high, and that only the upper part of the face is captured.
1901         */
1902        FACE_AUTH_TIP_TOO_HIGH = 5,
1903
1904        /**
1905         * Indicates that the device is too low, and that only the lower part of the face is captured.
1906         */
1907        FACE_AUTH_TIP_TOO_LOW = 6,
1908
1909        /**
1910         * Indicates that the device is deviated to the right, and that only the right part of the face is captured.
1911         */
1912        FACE_AUTH_TIP_TOO_RIGHT = 7,
1913
1914        /**
1915         * Indicates that the device is deviated to the left, and that only the left part of the face is captured.
1916         */
1917        FACE_AUTH_TIP_TOO_LEFT = 8,
1918
1919        /**
1920         * Indicates that the face moves too fast during facial information collection.
1921         */
1922        FACE_AUTH_TIP_TOO_MUCH_MOTION = 9,
1923
1924        /**
1925         * Indicates that the face is not facing the device.
1926         */
1927        FACE_AUTH_TIP_POOR_GAZE = 10,
1928
1929        /**
1930         * Indicates that no face is detected.
1931         */
1932        FACE_AUTH_TIP_NOT_DETECTED = 11,
1933    }
1934
1935    /**
1936     * Indicates the enumeration of prompt codes in the process of fingerprint authentication.
1937     * @name FingerprintTips
1938     * @syscap SystemCapability.Account.OsAccount
1939     * @systemapi Hide this for inner system use.
1940     * @since 8
1941     */
1942    enum FingerprintTips {
1943        /**
1944         * Indicates that the image acquired is good.
1945         */
1946        FINGERPRINT_TIP_GOOD = 0,
1947
1948        /**
1949         * Indicates that the fingerprint image is too noisy due to suspected or detected dirt on the sensor.
1950         */
1951        FINGERPRINT_TIP_IMAGER_DIRTY = 1,
1952
1953        /**
1954         * Indicates that the fingerprint image is too noisy to process due to a detected condition.
1955         */
1956        FINGERPRINT_TIP_INSUFFICIENT = 2,
1957
1958        /**
1959         * Indicates that only a partial fingerprint image is detected.
1960         */
1961        FINGERPRINT_TIP_PARTIAL = 3,
1962
1963        /**
1964         * Indicates that the fingerprint image is incomplete due to quick motion.
1965         */
1966        FINGERPRINT_TIP_TOO_FAST = 4,
1967
1968        /**
1969         * Indicates that the fingerprint image is unreadable due to lack of motion.
1970         */
1971        FINGERPRINT_TIP_TOO_SLOW = 5
1972    }
1973
1974    /**
1975     * Enumerates for constraint source types.
1976     * @name ConstraintSourceType
1977     * @syscap SystemCapability.Account.OsAccount
1978     * @systemapi Hide this for inner system use.
1979     * @since 9
1980     */
1981    enum ConstraintSourceType {
1982        /**
1983         * No constraints are set
1984         * @since 9
1985         */
1986        CONSTRAINT_NOT_EXIST = 0,
1987
1988        /**
1989         * Constraint is set by setOsAccountConstraints
1990         * @since 9
1991         */
1992        CONSTRAINT_TYPE_BASE = 1,
1993
1994        /**
1995         * Constraint is set by device owner
1996         * @since 9
1997         */
1998        CONSTRAINT_TYPE_DEVICE_OWNER = 2,
1999
2000        /**
2001         * Constraint is set by profile owner
2002         * @since 9
2003         */
2004        CONSTRAINT_TYPE_PROFILE_OWNER = 3
2005    }
2006
2007    /**
2008     * Provides information about the constraint source type info of an os account.
2009     * @name ConstraintSourceTypeInfo
2010     * @syscap SystemCapability.Account.OsAccount
2011     * @systemapi Hide this for inner system use.
2012     * @since 9
2013     */
2014    interface ConstraintSourceTypeInfo {
2015        /**
2016         * Indicates the id of an os account who set the constraint.
2017         * When type is CONSTRAINT_NOT_EXIST or CONSTRAINT_TYPE_BASE, localId will be -1.
2018         * @since 9
2019         */
2020        localId: number;
2021
2022        /**
2023         * Indicates the source type of the constraint.
2024         * @since 9
2025         */
2026        type: ConstraintSourceType;
2027    }
2028}
2029
2030export default osAccount;