• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2023 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
16/**
17 * @file
18 * @kit BasicServicesKit
19 */
20
21import type { AsyncCallback, Callback } from './@ohos.base';
22import type Want from './@ohos.app.ability.Want';
23import type rpc from './@ohos.rpc';
24
25/**
26 * This module provides the capability to manage application accounts.
27 *
28 * @namespace appAccount
29 * @syscap SystemCapability.Account.AppAccount
30 * @since 7
31 */
32declare namespace appAccount {
33  /**
34   * Obtains the AppAccountManager instance.
35   *
36   * @returns { AppAccountManager } Returns the instance of the AppAccountManager.
37   * @syscap SystemCapability.Account.AppAccount
38   * @since 7
39   */
40  function createAppAccountManager(): AppAccountManager;
41
42  /**
43   * Provides methods for managing application accounts.
44   *
45   * @interface AppAccountManager
46   * @syscap SystemCapability.Account.AppAccount
47   * @since 7
48   */
49  interface AppAccountManager {
50    /**
51     * Adds the account name and extra information of this application to the account management service.
52     * <p>
53     * Only the owner of the application account has the permission to call this method.
54     *
55     * @param { string } name - Indicates the name of the application account to add.
56     * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
57     * @syscap SystemCapability.Account.AppAccount
58     * @since 7
59     * @deprecated since 9
60     * @useinstead appAccount.AppAccountManager#createAccount
61     */
62    addAccount(name: string, callback: AsyncCallback<void>): void;
63
64    /**
65     * Adds the account name and extra information of this application to the account management service.
66     * <p>
67     * Only the owner of the application account has the permission to call this method.
68     *
69     * @param { string } name - Indicates the name of the application account to add.
70     * @param { string } extraInfo - Indicates the extra information of the application account to add.
71     *        The extra information cannot be sensitive information of the application account.
72     * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
73     * @syscap SystemCapability.Account.AppAccount
74     * @since 7
75     * @deprecated since 9
76     * @useinstead appAccount.AppAccountManager#createAccount
77     */
78    addAccount(name: string, extraInfo: string, callback: AsyncCallback<void>): void;
79
80    /**
81     * Adds the account name and extra information of this application to the account management service.
82     * <p>
83     * Only the owner of the application account has the permission to call this method.
84     *
85     * @param { string } name - Indicates the name of the application account to add.
86     * @param { string } [extraInfo] - Indicates the extra information of the application account to add.
87     *        The extra information cannot be sensitive information of the application account.
88     * @returns { Promise<void> } The promise returned by the function.
89     * @syscap SystemCapability.Account.AppAccount
90     * @since 7
91     * @deprecated since 9
92     * @useinstead appAccount.AppAccountManager#createAccount
93     */
94    addAccount(name: string, extraInfo?: string): Promise<void>;
95
96    /**
97     * Creates the account name and extra information of this application to the account management service.
98     * <p>
99     * Only the owner of the application account has the permission to call this method.
100     *
101     * @param { string } name - Indicates the name of the application account to add.
102     * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
103     * @throws { BusinessError } 401 - The parameter check failed.
104     * @throws { BusinessError } 12300001 - System service exception.
105     * @throws { BusinessError } 12300002 - Invalid name.
106     * @throws { BusinessError } 12300004 - Account already exists.
107     * @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit.
108     * @syscap SystemCapability.Account.AppAccount
109     * @since 9
110     */
111    createAccount(name: string, callback: AsyncCallback<void>): void;
112
113    /**
114     * Creates the account name and extra information of this application to the account management service.
115     * <p>
116     * Only the owner of the application account has the permission to call this method.
117     *
118     * @param { string } name - Indicates the name of the application account to add.
119     * @param { CreateAccountOptions } options - Indicates the extra information of the application account to add.
120     *        The extra information cannot be sensitive information of the application account.
121     * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
122     * @throws { BusinessError } 401 - The parameter check failed.
123     * @throws { BusinessError } 12300001 - System service exception.
124     * @throws { BusinessError } 12300002 - Invalid name or options.
125     * @throws { BusinessError } 12300004 - Account already exists.
126     * @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit.
127     * @syscap SystemCapability.Account.AppAccount
128     * @since 9
129     */
130    createAccount(name: string, options: CreateAccountOptions, callback: AsyncCallback<void>): void;
131
132    /**
133     * Creates the account name and extra information of this application to the account management service.
134     * <p>
135     * Only the owner of the application account has the permission to call this method.
136     *
137     * @param { string } name - Indicates the name of the application account to add.
138     * @param { CreateAccountOptions } [options] - Indicates the extra information of the application account to add.
139     *        The extra information cannot be sensitive information of the application account.
140     * @returns { Promise<void> } The promise returned by the function.
141     * @throws { BusinessError } 401 - The parameter check failed.
142     * @throws { BusinessError } 12300001 - System service exception.
143     * @throws { BusinessError } 12300002 - Invalid name or options.
144     * @throws { BusinessError } 12300004 - Account already exists.
145     * @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit.
146     * @syscap SystemCapability.Account.AppAccount
147     * @since 9
148     */
149    createAccount(name: string, options?: CreateAccountOptions): Promise<void>;
150
151    /**
152     * Adds an application account of a specified owner implicitly.
153     *
154     * @param { string } owner - Indicates the account owner of your application or third-party applications.
155     * @param { string } authType - Indicates the authentication type.
156     * @param { object } options - Indicates the authenticator-specific options for the request.
157     * @param { AuthenticatorCallback } callback - Indicates the authenticator callback.
158     * @syscap SystemCapability.Account.AppAccount
159     * @since 8
160     * @deprecated since 9
161     * @useinstead appAccount.AppAccountManager#createAccountImplicitly
162     */
163    addAccountImplicitly(
164      owner: string,
165      authType: string,
166      options: { [key: string]: any },
167      callback: AuthenticatorCallback
168    ): void;
169
170    /**
171     * Creates an application account of a specified owner implicitly.
172     *
173     * @param { string } owner - Indicates the account owner of your application or third-party applications.
174     * @param { AuthCallback } callback - Indicates the authenticator callback.
175     * @throws { BusinessError } 401 - The parameter check failed.
176     * @throws { BusinessError } 12300001 - System service exception.
177     * @throws { BusinessError } 12300002 - Invalid owner.
178     * @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit.
179     * @throws { BusinessError } 12300010 - Account service busy.
180     * @throws { BusinessError } 12300113 - Authenticator service not found.
181     * @throws { BusinessError } 12300114 - Authenticator service exception.
182     * @syscap SystemCapability.Account.AppAccount
183     * @since 9
184     */
185    createAccountImplicitly(owner: string, callback: AuthCallback): void;
186
187    /**
188     * Creates an application account of a specified owner implicitly.
189     *
190     * @param { string } owner - Indicates the account owner of your application or third-party applications.
191     * @param { CreateAccountImplicitlyOptions } options - Indicates the authenticator-specific options for the request.
192     * @param { AuthCallback } callback - Indicates the authenticator callback.
193     * @throws { BusinessError } 401 - The parameter check failed.
194     * @throws { BusinessError } 12300001 - System service exception.
195     * @throws { BusinessError } 12300002 - Invalid owner or options.
196     * @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit.
197     * @throws { BusinessError } 12300010 - Account service busy.
198     * @throws { BusinessError } 12300113 - Authenticator service not found.
199     * @throws { BusinessError } 12300114 - Authenticator service exception.
200     * @syscap SystemCapability.Account.AppAccount
201     * @since 9
202     */
203    createAccountImplicitly(owner: string, options: CreateAccountImplicitlyOptions, callback: AuthCallback): void;
204
205    /**
206     * Deletes an application account from the account management service.
207     * <p>
208     * Only the owner of the application account has the permission to call this method.
209     *
210     * @param { string } name - Indicates the name of the application account to delete.
211     * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
212     * @syscap SystemCapability.Account.AppAccount
213     * @since 7
214     * @deprecated since 9
215     * @useinstead appAccount.AppAccountManager#removeAccount
216     */
217    deleteAccount(name: string, callback: AsyncCallback<void>): void;
218
219    /**
220     * Deletes an application account from the account management service.
221     * <p>
222     * Only the owner of the application account has the permission to call this method.
223     *
224     * @param { string } name - Indicates the name of the application account to delete.
225     * @returns { Promise<void> } The promise returned by the function.
226     * @syscap SystemCapability.Account.AppAccount
227     * @since 7
228     * @deprecated since 9
229     * @useinstead appAccount.AppAccountManager#removeAccount
230     */
231    deleteAccount(name: string): Promise<void>;
232
233    /**
234     * Removes an application account from the account management service.
235     * <p>
236     * Only the owner of the application account has the permission to call this method.
237     *
238     * @param { string } name - Indicates the name of the application account to delete.
239     * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
240     * @throws { BusinessError } 401 - The parameter check failed.
241     * @throws { BusinessError } 12300001 - System service exception.
242     * @throws { BusinessError } 12300002 - Invalid name.
243     * @throws { BusinessError } 12300003 - Account not found.
244     * @syscap SystemCapability.Account.AppAccount
245     * @since 9
246     */
247    removeAccount(name: string, callback: AsyncCallback<void>): void;
248
249    /**
250     * Removes an application account from the account management service.
251     * <p>
252     * Only the owner of the application account has the permission to call this method.
253     *
254     * @param { string } name - Indicates the name of the application account to delete.
255     * @returns { Promise<void> } The promise returned by the function.
256     * @throws { BusinessError } 401 - The parameter check failed.
257     * @throws { BusinessError } 12300001 - System service exception.
258     * @throws { BusinessError } 12300002 - Invalid name.
259     * @throws { BusinessError } 12300003 - Account not found.
260     * @syscap SystemCapability.Account.AppAccount
261     * @since 9
262     */
263    removeAccount(name: string): Promise<void>;
264
265    /**
266     * Disables a third-party application with the specified bundle name from
267     * accessing the given application account.
268     *
269     * @param { string } name - Indicates the name of the application account to disable access from
270     *        the third-party application.
271     * @param { string } bundleName - Indicates the bundle name of the third-party application.
272     * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
273     * @syscap SystemCapability.Account.AppAccount
274     * @since 7
275     * @deprecated since 9
276     * @useinstead appAccount.AppAccountManager#setAppAccess
277     */
278    disableAppAccess(name: string, bundleName: string, callback: AsyncCallback<void>): void;
279
280    /**
281     * Disables a third-party application with the specified bundle name from
282     * accessing the given application account.
283     *
284     * @param { string } name - Indicates the name of the application account to disable access from
285     *        the third-party application.
286     * @param { string } bundleName - Indicates the bundle name of the third-party application.
287     * @returns { Promise<void> } The promise returned by the function.
288     * @syscap SystemCapability.Account.AppAccount
289     * @since 7
290     * @deprecated since 9
291     * @useinstead appAccount.AppAccountManager#setAppAccess
292     */
293    disableAppAccess(name: string, bundleName: string): Promise<void>;
294
295    /**
296     * Enables a third-party application with the specified bundle name to access the given application
297     * account for data query and listening.
298     *
299     * @param { string } name - Indicates the name of the application account.
300     * @param { string } bundleName - Indicates the bundle name of the third-party application.
301     * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
302     * @syscap SystemCapability.Account.AppAccount
303     * @since 7
304     * @deprecated since 9
305     * @useinstead appAccount.AppAccountManager#setAppAccess
306     */
307    enableAppAccess(name: string, bundleName: string, callback: AsyncCallback<void>): void;
308
309    /**
310     * Enables a third-party application with the specified bundle name to access the given application
311     * account for data query and listening.
312     *
313     * @param { string } name - Indicates the name of the application account.
314     * @param { string } bundleName - Indicates the bundle name of the third-party application.
315     * @returns { Promise<void> } The promise returned by the function.
316     * @syscap SystemCapability.Account.AppAccount
317     * @since 7
318     * @deprecated since 9
319     * @useinstead appAccount.AppAccountManager#setAppAccess
320     */
321    enableAppAccess(name: string, bundleName: string): Promise<void>;
322
323    /**
324     * Sets a third-party application with the specified bundle name to access the given application
325     * account for data query and listening.
326     *
327     * @param { string } name - Indicates the name of the application account.
328     * @param { string } bundleName - Indicates the bundle name of the third-party application.
329     * @param { boolean } isAccessible - Indicates the accessibility flag, true for accessible, false for inaccessible.
330     * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
331     * @throws { BusinessError } 401 - The parameter check failed.
332     * @throws { BusinessError } 12300001 - System service exception.
333     * @throws { BusinessError } 12300002 - Invalid name or bundleName.
334     * @throws { BusinessError } 12300003 - Account not found.
335     * @throws { BusinessError } 12400001 - Application not found.
336     * @syscap SystemCapability.Account.AppAccount
337     * @since 9
338     */
339    setAppAccess(name: string, bundleName: string, isAccessible: boolean, callback: AsyncCallback<void>): void;
340
341    /**
342     * Sets a third-party application with the specified bundle name to access the given application
343     * account for data query and listening.
344     *
345     * @param { string } name - Indicates the name of the application account.
346     * @param { string } bundleName - Indicates the bundle name of the third-party application.
347     * @param { boolean } isAccessible - Indicates the accessibility flag, true for accessible, false for inaccessible.
348     * @returns { Promise<void> } The promise returned by the function.
349     * @throws { BusinessError } 401 - The parameter check failed.
350     * @throws { BusinessError } 12300001 - System service exception.
351     * @throws { BusinessError } 12300002 - Invalid name or bundleName.
352     * @throws { BusinessError } 12300003 - Account not found.
353     * @throws { BusinessError } 12400001 - Application not found.
354     * @syscap SystemCapability.Account.AppAccount
355     * @since 9
356     */
357    setAppAccess(name: string, bundleName: string, isAccessible: boolean): Promise<void>;
358
359    /**
360     * Checks whether a third-party application with the specified bundle name is allowed to access
361     * the given application account for data query and listening.
362     *
363     * @param { string } name - Indicates the name of the application account.
364     * @param { string } bundleName - Indicates the bundle name of the third-party application.
365     * @param { AsyncCallback<boolean> } callback - Asynchronous callback interface.
366     * @throws { BusinessError } 401 - The parameter check failed.
367     * @throws { BusinessError } 12300001 - System service exception.
368     * @throws { BusinessError } 12300002 - Invalid name or bundleName.
369     * @throws { BusinessError } 12300003 - Account not found.
370     * @syscap SystemCapability.Account.AppAccount
371     * @since 9
372     */
373    checkAppAccess(name: string, bundleName: string, callback: AsyncCallback<boolean>): void;
374
375    /**
376     * Checks whether a third-party application with the specified bundle name is allowed to access
377     * the given application account for data query and listening.
378     *
379     * @param { string } name - Indicates the name of the application account.
380     * @param { string } bundleName - Indicates the bundle name of the third-party application.
381     * @returns { Promise<boolean> } The promise returned by the function.
382     * @throws { BusinessError } 401 - The parameter check failed.
383     * @throws { BusinessError } 12300001 - System service exception.
384     * @throws { BusinessError } 12300002 - Invalid name or bundleName.
385     * @throws { BusinessError } 12300003 - Account not found.
386     * @syscap SystemCapability.Account.AppAccount
387     * @since 9
388     */
389    checkAppAccess(name: string, bundleName: string): Promise<boolean>;
390
391    /**
392     * Checks whether a specified application account allows application data synchronization.
393     * <p>
394     * If the same OHOS account has logged in to multiple devices, these devices constitute a super device
395     * through the distributed networking. On the connected devices, you can call this method to check
396     * whether application data can be synchronized.
397     * <p>
398     *
399     * @permission ohos.permission.DISTRIBUTED_DATASYNC
400     * @param { string } name - Indicates the name of the application account.
401     * @param { AsyncCallback<boolean> } callback - Asynchronous callback interface.
402     * @syscap SystemCapability.Account.AppAccount
403     * @since 7
404     * @deprecated since 9
405     * @useinstead appAccount.AppAccountManager#checkDataSyncEnabled
406     */
407    checkAppAccountSyncEnable(name: string, callback: AsyncCallback<boolean>): void;
408
409    /**
410     * Checks whether a specified application account allows application data synchronization.
411     * <p>
412     * If the same OHOS account has logged in to multiple devices, these devices constitute a super device
413     * through the distributed networking. On the connected devices, you can call this method to check
414     * whether application data can be synchronized.
415     * <p>
416     *
417     * @permission ohos.permission.DISTRIBUTED_DATASYNC
418     * @param { string } name - Indicates the name of the application account.
419     * @returns { Promise<boolean> } Returns {@code true} if application data synchronization is allowed; returns {@code false} otherwise.
420     * @syscap SystemCapability.Account.AppAccount
421     * @since 7
422     * @deprecated since 9
423     * @useinstead appAccount.AppAccountManager#checkDataSyncEnabled
424     */
425    checkAppAccountSyncEnable(name: string): Promise<boolean>;
426
427    /**
428     * Checks whether application data synchronization is enabled for the specified account.
429     * <p>
430     * If the same OHOS account has logged in to multiple devices, these devices constitute a super device
431     * through the distributed networking. On the connected devices, you can call this method to check
432     * whether application data can be synchronized.
433     * <p>
434     *
435     * @permission ohos.permission.DISTRIBUTED_DATASYNC
436     * @param { string } name - Indicates the name of the application account.
437     * @param { AsyncCallback<boolean> } callback - Asynchronous callback interface.
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 name.
442     * @throws { BusinessError } 12300003 - Account not found.
443     * @syscap SystemCapability.Account.AppAccount
444     * @since 9
445     */
446    checkDataSyncEnabled(name: string, callback: AsyncCallback<boolean>): void;
447
448    /**
449     * Checks whether application data synchronization is enabled for the specified account.
450     * <p>
451     * If the same OHOS account has logged in to multiple devices, these devices constitute a super device
452     * through the distributed networking. On the connected devices, you can call this method to check
453     * whether application data can be synchronized.
454     * <p>
455     *
456     * @permission ohos.permission.DISTRIBUTED_DATASYNC
457     * @param { string } name - Indicates the name of the application account.
458     * @returns { Promise<boolean> } Returns {@code true} if application data synchronization is allowed; returns {@code false} otherwise.
459     * @throws { BusinessError } 201 - Permission denied.
460     * @throws { BusinessError } 401 - The parameter check failed.
461     * @throws { BusinessError } 12300001 - System service exception.
462     * @throws { BusinessError } 12300002 - Invalid name.
463     * @throws { BusinessError } 12300003 - Account not found.
464     * @syscap SystemCapability.Account.AppAccount
465     * @since 9
466     */
467    checkDataSyncEnabled(name: string): Promise<boolean>;
468
469    /**
470     * Sets the credential for this application account.
471     *
472     * @param { string } name - Indicates the name of the application account.
473     * @param { string } credentialType - Indicates the type of the credential to set.
474     * @param { string } credential - Indicates the credential to set.
475     * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
476     * @syscap SystemCapability.Account.AppAccount
477     * @since 7
478     * @deprecated since 9
479     * @useinstead appAccount.AppAccountManager#setCredential
480     */
481    setAccountCredential(name: string, credentialType: string, credential: string, callback: AsyncCallback<void>): void;
482
483    /**
484     * Sets the credential for this application account.
485     *
486     * @param { string } name - Indicates the name of the application account.
487     * @param { string } credentialType - Indicates the type of the credential to set.
488     * @param { string } credential - Indicates the credential to set.
489     * @returns { Promise<void> } The promise returned by the function.
490     * @syscap SystemCapability.Account.AppAccount
491     * @since 7
492     * @deprecated since 9
493     * @useinstead appAccount.AppAccountManager#setCredential
494     */
495    setAccountCredential(name: string, credentialType: string, credential: string): Promise<void>;
496
497    /**
498     * Sets the credential for this application account.
499     *
500     * @param { string } name - Indicates the name of the application account.
501     * @param { string } credentialType - Indicates the type of the credential to set.
502     * @param { string } credential - Indicates the credential to set.
503     * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
504     * @throws { BusinessError } 401 - The parameter check failed.
505     * @throws { BusinessError } 12300001 - System service exception.
506     * @throws { BusinessError } 12300002 - Invalid name, credentialType or credential.
507     * @throws { BusinessError } 12300003 - Account not found.
508     * @syscap SystemCapability.Account.AppAccount
509     * @since 9
510     */
511    setCredential(name: string, credentialType: string, credential: string, callback: AsyncCallback<void>): void;
512
513    /**
514     * Sets the credential for this application account.
515     *
516     * @param { string } name - Indicates the name of the application account.
517     * @param { string } credentialType - Indicates the type of the credential to set.
518     * @param { string } credential - Indicates the credential to set.
519     * @returns { Promise<void> } The promise returned by the function.
520     * @throws { BusinessError } 401 - The parameter check failed.
521     * @throws { BusinessError } 12300001 - System service exception.
522     * @throws { BusinessError } 12300002 - Invalid name, credentialType or credential.
523     * @throws { BusinessError } 12300003 - Account not found.
524     * @syscap SystemCapability.Account.AppAccount
525     * @since 9
526     */
527    setCredential(name: string, credentialType: string, credential: string): Promise<void>;
528
529    /**
530     * Sets extra information for this application account.
531     * <p>
532     * You can call this method when you forget the extra information of your application account or
533     * need to modify the extra information.
534     *
535     * @param { string } name - Indicates the name of the application account.
536     * @param { string } extraInfo - Indicates the extra information to set.
537     * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
538     * @syscap SystemCapability.Account.AppAccount
539     * @since 7
540     * @deprecated since 9
541     * @useinstead appAccount.AppAccountManager#setCustomData
542     */
543    setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback<void>): void;
544
545    /**
546     * Sets extra information for this application account.
547     * <p>
548     * You can call this method when you forget the extra information of your application account or
549     * need to modify the extra information.
550     *
551     * @param { string } name - Indicates the name of the application account.
552     * @param { string } extraInfo - Indicates the extra information to set.
553     * @returns { Promise<void> } The promise returned by the function.
554     * @syscap SystemCapability.Account.AppAccount
555     * @since 7
556     * @deprecated since 9
557     * @useinstead appAccount.AppAccountManager#setCustomData
558     */
559    setAccountExtraInfo(name: string, extraInfo: string): Promise<void>;
560
561    /**
562     * Sets whether a specified application account allows application data synchronization.
563     * <p>
564     * If the same OHOS account has logged in to multiple devices, these devices constitute a super device
565     * through the distributed networking. On the connected devices, you can call this method to set whether to
566     * allow cross-device data synchronization. If synchronization is allowed, application data can be synchronized
567     * among these devices in the event of any changes related to the application account.
568     * If synchronization is not allowed, the application data is stored only on the local device.
569     * <p>
570     * <b>Application account-related changes</b>: adding or deleting an application account, setting extra
571     * information (such as updating a token), and setting data associated with this application account
572     * <p>
573     * <b>Application data that can be synchronized</b>: application account name, token,
574     * and data associated with this application account
575     * <p>
576     *
577     * @permission ohos.permission.DISTRIBUTED_DATASYNC
578     * @param { string } name - Indicates the name of the application account.
579     * @param { boolean } isEnable - Specifies whether to allow application data synchronization.
580     * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
581     * @syscap SystemCapability.Account.AppAccount
582     * @since 7
583     * @deprecated since 9
584     * @useinstead appAccount.AppAccountManager#setDataSyncEnabled
585     */
586    setAppAccountSyncEnable(name: string, isEnable: boolean, callback: AsyncCallback<void>): void;
587
588    /**
589     * Sets whether a specified application account allows application data synchronization.
590     * <p>
591     * If the same OHOS account has logged in to multiple devices, these devices constitute a super device
592     * through the distributed networking. On the connected devices, you can call this method to set whether to
593     * allow cross-device data synchronization. If synchronization is allowed, application data can be synchronized
594     * among these devices in the event of any changes related to the application account.
595     * If synchronization is not allowed, the application data is stored only on the local device.
596     * <p>
597     * <b>Application account-related changes</b>: adding or deleting an application account, setting extra
598     * information (such as updating a token), and setting data associated with this application account
599     * <p>
600     * <b>Application data that can be synchronized</b>: application account name, token,
601     * and data associated with this application account
602     * <p>
603     *
604     * @permission ohos.permission.DISTRIBUTED_DATASYNC
605     * @param { string } name - Indicates the name of the application account.
606     * @param { boolean } isEnable - Specifies whether to allow application data synchronization.
607     * @returns { Promise<void> } The promise returned by the function.
608     * @syscap SystemCapability.Account.AppAccount
609     * @since 7
610     * @deprecated since 9
611     * @useinstead appAccount.AppAccountManager#setDataSyncEnabled
612     */
613    setAppAccountSyncEnable(name: string, isEnable: boolean): Promise<void>;
614
615    /**
616     * Sets whether a specified application account enables application data synchronization.
617     * <p>
618     * If the same OHOS account has logged in to multiple devices, these devices constitute a super device
619     * through the distributed networking. On the connected devices, you can call this method to set whether to
620     * enable cross-device data synchronization. If synchronization is enabled, application data can be synchronized
621     * among these devices in the event of any changes related to the application account.
622     * If synchronization is not enabled, the application data is stored only on the local device.
623     * <p>
624     * <b>Application account-related changes</b>: adding or deleting an application account, setting extra
625     * information (such as updating a token), and setting data associated with this application account
626     * <p>
627     * <b>Application data that can be synchronized</b>: application account name, token,
628     * and data associated with this application account
629     * <p>
630     *
631     * @permission ohos.permission.DISTRIBUTED_DATASYNC
632     * @param { string } name - Indicates the name of the application account.
633     * @param { boolean } isEnabled - Specifies whether to enable application data synchronization.
634     * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
635     * @throws { BusinessError } 201 - Permission denied.
636     * @throws { BusinessError } 401 - The parameter check failed.
637     * @throws { BusinessError } 12300001 - System service exception.
638     * @throws { BusinessError } 12300002 - Invalid name.
639     * @throws { BusinessError } 12300003 - Account not found.
640     * @syscap SystemCapability.Account.AppAccount
641     * @since 9
642     */
643    setDataSyncEnabled(name: string, isEnabled: boolean, callback: AsyncCallback<void>): void;
644
645    /**
646     * Sets whether a specified application account enables application data synchronization.
647     * <p>
648     * If the same OHOS account has logged in to multiple devices, these devices constitute a super device
649     * through the distributed networking. On the connected devices, you can call this method to set whether to
650     * enable cross-device data synchronization. If synchronization is enabled, application data can be synchronized
651     * among these devices in the event of any changes related to the application account.
652     * If synchronization is not enabled, the application data is stored only on the local device.
653     * <p>
654     * <b>Application account-related changes</b>: adding or deleting an application account, setting extra
655     * information (such as updating a token), and setting data associated with this application account
656     * <p>
657     * <b>Application data that can be synchronized</b>: application account name, token,
658     * and data associated with this application account
659     * <p>
660     *
661     * @permission ohos.permission.DISTRIBUTED_DATASYNC
662     * @param { string } name - Indicates the name of the application account.
663     * @param { boolean } isEnabled - Specifies whether to enable application data synchronization.
664     * @returns { Promise<void> } The promise returned by the function.
665     * @throws { BusinessError } 201 - Permission denied.
666     * @throws { BusinessError } 401 - The parameter check failed.
667     * @throws { BusinessError } 12300001 - System service exception.
668     * @throws { BusinessError } 12300002 - Invalid name.
669     * @throws { BusinessError } 12300003 - Account not found.
670     * @syscap SystemCapability.Account.AppAccount
671     * @since 9
672     */
673    setDataSyncEnabled(name: string, isEnabled: boolean): Promise<void>;
674
675    /**
676     * Sets data associated with this application account.
677     *
678     * @param { string } name - Indicates the name of the application account.
679     * @param { string } key - Indicates the key of the data to set. The key can be customized.
680     * @param { string } value - Indicates the value of the data to set.
681     * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
682     * @syscap SystemCapability.Account.AppAccount
683     * @since 7
684     * @deprecated since 9
685     * @useinstead appAccount.AppAccountManager#setCustomData
686     */
687    setAssociatedData(name: string, key: string, value: string, callback: AsyncCallback<void>): void;
688
689    /**
690     * Sets data associated with this application account.
691     *
692     * @param { string } name - Indicates the name of the application account.
693     * @param { string } key - Indicates the key of the data to set. The key can be customized.
694     * @param { string } value - Indicates the value of the data to set.
695     * @returns { Promise<void> } The promise returned by the function.
696     * @syscap SystemCapability.Account.AppAccount
697     * @since 7
698     * @deprecated since 9
699     * @useinstead appAccount.AppAccountManager#setCustomData
700     */
701    setAssociatedData(name: string, key: string, value: string): Promise<void>;
702
703    /**
704     * Sets data associated with this application account.
705     *
706     * @param { string } name - Indicates the name of the application account.
707     * @param { string } key - Indicates the key of the data to set. The key can be customized.
708     * @param { string } value - Indicates the value of the data to set.
709     * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
710     * @throws { BusinessError } 401 - The parameter check failed.
711     * @throws { BusinessError } 12300001 - System service exception.
712     * @throws { BusinessError } 12300002 - Invalid name, key or value.
713     * @throws { BusinessError } 12300003 - Account not found.
714     * @throws { BusinessError } 12400003 - The number of custom data reaches the upper limit.
715     * @syscap SystemCapability.Account.AppAccount
716     * @since 9
717     */
718    setCustomData(name: string, key: string, value: string, callback: AsyncCallback<void>): void;
719
720    /**
721     * Sets data associated with this application account.
722     *
723     * @param { string } name - Indicates the name of the application account.
724     * @param { string } key - Indicates the key of the data to set. The key can be customized.
725     * @param { string } value - Indicates the value of the data to set.
726     * @returns { Promise<void> } The promise returned by the function.
727     * @throws { BusinessError } 401 - The parameter check failed.
728     * @throws { BusinessError } 12300001 - System service exception.
729     * @throws { BusinessError } 12300002 - Invalid name, key or value.
730     * @throws { BusinessError } 12300003 - Account not found.
731     * @throws { BusinessError } 12400003 - The number of custom data reaches the upper limit.
732     * @syscap SystemCapability.Account.AppAccount
733     * @since 9
734     */
735    setCustomData(name: string, key: string, value: string): Promise<void>;
736
737    /**
738     * Obtains information about all accessible accounts.
739     * <p>
740     * This method applies to the following accounts:
741     * <ul>
742     * <li>Accounts of this application.</li>
743     * <li>Accounts of third-party applications. To obtain such information,
744     * your application must have gained authorization from the third-party applications.</li>
745     * </ul>
746     *
747     * @permission ohos.permission.GET_ALL_APP_ACCOUNTS
748     * @param { AsyncCallback<Array<AppAccountInfo>> } callback - Asynchronous callback interface.
749     * @syscap SystemCapability.Account.AppAccount
750     * @since 7
751     * @deprecated since 9
752     * @useinstead appAccount.AppAccountManager#getAllAccounts
753     */
754    getAllAccessibleAccounts(callback: AsyncCallback<Array<AppAccountInfo>>): void;
755
756    /**
757     * Obtains information about all accessible accounts.
758     * <p>
759     * This method applies to the following accounts:
760     * <ul>
761     * <li>Accounts of this application.</li>
762     * <li>Accounts of third-party applications. To obtain such information,
763     * your application must have gained authorization from the third-party applications.</li>
764     * </ul>
765     *
766     * @permission ohos.permission.GET_ALL_APP_ACCOUNTS
767     * @returns { Promise<Array<AppAccountInfo>> } Returns a list of application accounts.
768     * @syscap SystemCapability.Account.AppAccount
769     * @since 7
770     * @deprecated since 9
771     * @useinstead appAccount.AppAccountManager#getAllAccounts
772     */
773    getAllAccessibleAccounts(): Promise<Array<AppAccountInfo>>;
774
775    /**
776     * Obtains information about all accessible accounts.
777     * <p>
778     * This method applies to the following accounts:
779     * <ul>
780     * <li>Accounts of this application.</li>
781     * <li>Accounts of third-party applications. To obtain such information,
782     * your application must have gained authorization from the third-party applications or
783     * have gained the ohos.permission.GET_ALL_APP_ACCOUNTS permission.</li>
784     * </ul>
785     *
786     * @param { AsyncCallback<Array<AppAccountInfo>> } callback - Asynchronous callback interface. Returns a list of application accounts.
787     * @throws { BusinessError } 401 - The parameter check failed.
788     * @throws { BusinessError } 12300001 - System service exception.
789     * @syscap SystemCapability.Account.AppAccount
790     * @since 9
791     */
792    getAllAccounts(callback: AsyncCallback<Array<AppAccountInfo>>): void;
793
794    /**
795     * Obtains information about all accessible accounts.
796     * <p>
797     * This method applies to the following accounts:
798     * <ul>
799     * <li>Accounts of this application.</li>
800     * <li>Accounts of third-party applications. To obtain such information,
801     * your application must have gained authorization from the third-party applications or
802     * have gained the ohos.permission.GET_ALL_APP_ACCOUNTS permission.</li>
803     * </ul>
804     *
805     * @returns { Promise<Array<AppAccountInfo>> } Returns a list of application accounts.
806     * @throws { BusinessError } 401 - The parameter check failed.
807     * @throws { BusinessError } 12300001 - System service exception.
808     * @syscap SystemCapability.Account.AppAccount
809     * @since 9
810     */
811    getAllAccounts(): Promise<Array<AppAccountInfo>>;
812
813    /**
814     * Obtains information about all accounts of a specified account owner.
815     * <p>
816     * This method applies to the following accounts:
817     * <ul>
818     * <li>Accounts of this application.</li>
819     * <li>Accounts of third-party applications. To obtain such information,
820     * your application must have gained authorization from the third-party applications.</li>
821     * </ul>
822     *
823     * @permission ohos.permission.GET_ALL_APP_ACCOUNTS
824     * @param { string } owner - Indicates the account owner of your application or third-party applications.
825     * @param { AsyncCallback<Array<AppAccountInfo>> } callback - Asynchronous callback interface. Returns a list of application accounts.
826     * @syscap SystemCapability.Account.AppAccount
827     * @since 7
828     * @deprecated since 9
829     * @useinstead appAccount.AppAccountManager#getAccountsByOwner
830     */
831    getAllAccounts(owner: string, callback: AsyncCallback<Array<AppAccountInfo>>): void;
832
833    /**
834     * Obtains information about all accounts of a specified account owner.
835     * <p>
836     * This method applies to the following accounts:
837     * <ul>
838     * <li>Accounts of this application.</li>
839     * <li>Accounts of third-party applications. To obtain such information,
840     * your application must have gained authorization from the third-party applications.</li>
841     * </ul>
842     *
843     * @permission ohos.permission.GET_ALL_APP_ACCOUNTS
844     * @param { string } owner - Indicates the account owner of your application or third-party applications.
845     * @returns { Promise<Array<AppAccountInfo>> } Returns a list of application accounts.
846     * @syscap SystemCapability.Account.AppAccount
847     * @since 7
848     * @deprecated since 9
849     * @useinstead appAccount.AppAccountManager#getAccountsByOwner
850     */
851    getAllAccounts(owner: string): Promise<Array<AppAccountInfo>>;
852
853    /**
854     * Gets information about all accounts of a specified account owner.
855     * <p>
856     * This method applies to the following accounts:
857     * <ul>
858     * <li>Accounts of this application.</li>
859     * <li>Accounts of third-party applications. To obtain such information,
860     * your application must have gained authorization from the third-party applications or
861     * have gained the ohos.permission.GET_ALL_APP_ACCOUNTS permission.</li>
862     * </ul>
863     *
864     * @param { string } owner - Indicates the account owner of your application or third-party applications.
865     * @param { AsyncCallback<Array<AppAccountInfo>> } callback - Asynchronous callback interface. Returns a list of application accounts.
866     * @throws { BusinessError } 401 - The parameter check failed.
867     * @throws { BusinessError } 12300001 - System service exception.
868     * @throws { BusinessError } 12300002 - Invalid owner.
869     * @throws { BusinessError } 12400001 - Application not found.
870     * @syscap SystemCapability.Account.AppAccount
871     * @since 9
872     */
873    getAccountsByOwner(owner: string, callback: AsyncCallback<Array<AppAccountInfo>>): void;
874
875    /**
876     * Gets information about all accounts of a specified account owner.
877     * <p>
878     * This method applies to the following accounts:
879     * <ul>
880     * <li>Accounts of this application.</li>
881     * <li>Accounts of third-party applications. To obtain such information,
882     * your application must have gained authorization from the third-party applications or
883     * have gained the ohos.permission.GET_ALL_APP_ACCOUNTS permission.</li>
884     * </ul>
885     *
886     * @param { string } owner - Indicates the account owner of your application or third-party applications.
887     * @returns { Promise<Array<AppAccountInfo>> } Returns a list of application accounts.
888     * @throws { BusinessError } 401 - The parameter check failed.
889     * @throws { BusinessError } 12300001 - System service exception.
890     * @throws { BusinessError } 12300002 - Invalid owner.
891     * @throws { BusinessError } 12400001 - Application not found.
892     * @syscap SystemCapability.Account.AppAccount
893     * @since 9
894     */
895    getAccountsByOwner(owner: string): Promise<Array<AppAccountInfo>>;
896
897    /**
898     * Obtains the credential of this application account.
899     *
900     * @param { string } name - Indicates the name of the application account.
901     * @param { string } credentialType - Indicates the type of the credential to obtain.
902     * @param { AsyncCallback<string> } callback - Asynchronous callback interface. Returns the credential of the application account.
903     * @syscap SystemCapability.Account.AppAccount
904     * @since 7
905     * @deprecated since 9
906     * @useinstead appAccount.AppAccountManager#getCredential
907     */
908    getAccountCredential(name: string, credentialType: string, callback: AsyncCallback<string>): void;
909
910    /**
911     * Obtains the credential of this application account.
912     *
913     * @param { string } name - Indicates the name of the application account.
914     * @param { string } credentialType - Indicates the type of the credential to obtain.
915     * @returns { Promise<string> } Returns the credential of the application account.
916     * @syscap SystemCapability.Account.AppAccount
917     * @since 7
918     * @deprecated since 9
919     * @useinstead appAccount.AppAccountManager#getCredential
920     */
921    getAccountCredential(name: string, credentialType: string): Promise<string>;
922
923    /**
924     * Obtains the credential of this application account.
925     *
926     * @param { string } name - Indicates the name of the application account.
927     * @param { string } credentialType - Indicates the type of the credential to obtain.
928     * @param { AsyncCallback<string> } callback - Asynchronous callback interface. Returns the credential of the application account.
929     * @throws { BusinessError } 401 - The parameter check failed.
930     * @throws { BusinessError } 12300001 - System service exception.
931     * @throws { BusinessError } 12300002 - Invalid name or credentialType.
932     * @throws { BusinessError } 12300003 - Account not found.
933     * @throws { BusinessError } 12300102 - Credential not found.
934     * @syscap SystemCapability.Account.AppAccount
935     * @since 9
936     */
937    getCredential(name: string, credentialType: string, callback: AsyncCallback<string>): void;
938
939    /**
940     * Obtains the credential of this application account.
941     *
942     * @param { string } name - Indicates the name of the application account.
943     * @param { string } credentialType - Indicates the type of the credential to obtain.
944     * @returns { Promise<string> } Returns the credential of the application account.
945     * @throws { BusinessError } 401 - The parameter check failed.
946     * @throws { BusinessError } 12300001 - System service exception.
947     * @throws { BusinessError } 12300002 - Invalid name or credentialType.
948     * @throws { BusinessError } 12300003 - Account not found.
949     * @throws { BusinessError } 12300102 - Credential not found.
950     * @syscap SystemCapability.Account.AppAccount
951     * @since 9
952     */
953    getCredential(name: string, credentialType: string): Promise<string>;
954
955    /**
956     * Obtains extra information of this application account.
957     *
958     * @param { string } name - Indicates the name of the application account.
959     * @param { AsyncCallback<string> } callback - Asynchronous callback interface.
960     *   Returns the extra information of the account; returns {@code null} in other scenarios,
961     *   for example, if the account does not exist.
962     * @syscap SystemCapability.Account.AppAccount
963     * @since 7
964     * @deprecated since 9
965     * @useinstead appAccount.AppAccountManager#getCustomData
966     */
967    getAccountExtraInfo(name: string, callback: AsyncCallback<string>): void;
968
969    /**
970     * Obtains extra information of this application account.
971     *
972     * @param { string } name - Indicates the name of the application account.
973     * @returns { Promise<string> } Returns the extra information of the account; returns {@code null} in other scenarios,
974     *         for example, if the account does not exist.
975     * @syscap SystemCapability.Account.AppAccount
976     * @since 7
977     * @deprecated since 9
978     * @useinstead appAccount.AppAccountManager#getCustomData
979     */
980    getAccountExtraInfo(name: string): Promise<string>;
981
982    /**
983     * Obtains data associated with this application account.
984     *
985     * @param { string } name - Indicates the name of the application account.
986     * @param { string } key - Indicates the key of the data to obtain.
987     * @param { AsyncCallback<string> } callback - Asynchronous callback interface. Returns the associated data of the application account.
988     * @syscap SystemCapability.Account.AppAccount
989     * @since 7
990     * @deprecated since 9
991     * @useinstead appAccount.AppAccountManager#getCustomData
992     */
993    getAssociatedData(name: string, key: string, callback: AsyncCallback<string>): void;
994
995    /**
996     * Obtains data associated with this application account.
997     *
998     * @param { string } name - Indicates the name of the application account.
999     * @param { string } key - Indicates the key of the data to obtain.
1000     * @returns { Promise<string> } Returns the associated data of the application account.
1001     * @syscap SystemCapability.Account.AppAccount
1002     * @since 7
1003     * @deprecated since 9
1004     * @useinstead appAccount.AppAccountManager#getCustomData
1005     */
1006    getAssociatedData(name: string, key: string): Promise<string>;
1007
1008    /**
1009     * Obtains data associated with this application account.
1010     *
1011     * @param { string } name - Indicates the name of the application account.
1012     * @param { string } key - Indicates the key of the data to obtain.
1013     * @param { AsyncCallback<string> } callback - Asynchronous callback interface. Returns the associated data of the application account.
1014     * @throws { BusinessError } 401 - The parameter check failed.
1015     * @throws { BusinessError } 12300001 - System service exception.
1016     * @throws { BusinessError } 12300002 - Invalid name or key.
1017     * @throws { BusinessError } 12300003 - Account not found.
1018     * @throws { BusinessError } 12400002 - Custom data not found.
1019     * @syscap SystemCapability.Account.AppAccount
1020     * @since 9
1021     */
1022    getCustomData(name: string, key: string, callback: AsyncCallback<string>): void;
1023
1024    /**
1025     * Obtains data associated with this application account.
1026     *
1027     * @param { string } name - Indicates the name of the application account.
1028     * @param { string } key - Indicates the key of the data to obtain.
1029     * @returns { Promise<string> } Returns the associated data of the application account.
1030     * @throws { BusinessError } 401 - The parameter check failed.
1031     * @throws { BusinessError } 12300001 - System service exception.
1032     * @throws { BusinessError } 12300002 - Invalid name or key.
1033     * @throws { BusinessError } 12300003 - Account not found.
1034     * @throws { BusinessError } 12400002 - Custom data not found
1035     * @syscap SystemCapability.Account.AppAccount
1036     * @since 9
1037     */
1038    getCustomData(name: string, key: string): Promise<string>;
1039
1040    /**
1041     * Obtains data associated with the specified account synchronously.
1042     *
1043     * @param { string } name - Indicates the name of the application account.
1044     * @param { string } key - Indicates the key of the data to obtain.
1045     * @returns { string } Returns the associated data of the application account.
1046     * @throws { BusinessError } 401 - The parameter check failed.
1047     * @throws { BusinessError } 12300001 - System service exception.
1048     * @throws { BusinessError } 12300002 - Invalid name or key.
1049     * @throws { BusinessError } 12300003 - Account not found.
1050     * @throws { BusinessError } 12400002 - Custom data not found.
1051     * @syscap SystemCapability.Account.AppAccount
1052     * @since 9
1053     */
1054    getCustomDataSync(name: string, key: string): string;
1055
1056    /**
1057     * Subscribes to the change events of accounts of the specified owners.
1058     * <p>
1059     * When the account owner updates the account, the subscriber will receive a notification
1060     * about the account change event.
1061     *
1062     * @param { 'change' } type - Event type.
1063     * @param { Array<string> } owners - Indicates the account owners, which are specified
1064     *        by {@link AppAccount#AppAccount(String name, String owner)}.
1065     * @param { Callback<Array<AppAccountInfo>> } callback - Asynchronous callback interface.
1066     * @syscap SystemCapability.Account.AppAccount
1067     * @since 7
1068     * @deprecated since 9
1069     * @useinstead appAccount.AppAccountManager#on
1070     */
1071    on(type: 'change', owners: Array<string>, callback: Callback<Array<AppAccountInfo>>): void;
1072
1073    /**
1074     * Subscribes to the change events of accounts of the specified owners.
1075     * <p>
1076     * When the account owner updates the account, the subscriber will receive a notification
1077     * about the account change event.
1078     *
1079     * @param { 'accountChange' } type - Event type.
1080     * @param { Array<string> } owners - Indicates the account owners, which are specified
1081     *        by {@link AppAccount#AppAccount(String name, String owner)}.
1082     * @param { Callback<Array<AppAccountInfo>> } callback - Asynchronous callback interface.
1083     * @throws { BusinessError } 401 - The parameter check failed.
1084     * @throws { BusinessError } 12300001 - System service exception.
1085     * @throws { BusinessError } 12300002 - Invalid type or owners.
1086     * @throws { BusinessError } 12400001 - Application not found.
1087     * @syscap SystemCapability.Account.AppAccount
1088     * @since 9
1089     */
1090    on(type: 'accountChange', owners: Array<string>, callback: Callback<Array<AppAccountInfo>>): void;
1091
1092    /**
1093     * Unsubscribes from account events.
1094     *
1095     * @param { 'change' } type - Event type.
1096     * @param { Callback<Array<AppAccountInfo>> } [callback] - Asynchronous callback interface.
1097     * @syscap SystemCapability.Account.AppAccount
1098     * @since 7
1099     * @deprecated since 9
1100     * @useinstead appAccount.AppAccountManager#off
1101     */
1102    off(type: 'change', callback?: Callback<Array<AppAccountInfo>>): void;
1103
1104    /**
1105     * Unsubscribes from account events.
1106     *
1107     * @param { 'accountChange' } type - Event type.
1108     * @param { Callback<Array<AppAccountInfo>> } [callback] - Asynchronous callback interface.
1109     * @throws { BusinessError } 401 - The parameter check failed.
1110     * @throws { BusinessError } 12300001 - System service exception.
1111     * @throws { BusinessError } 12300002 - Invalid type.
1112     * @syscap SystemCapability.Account.AppAccount
1113     * @since 9
1114     */
1115    off(type: 'accountChange', callback?: Callback<Array<AppAccountInfo>>): void;
1116
1117    /**
1118     * Authenticates an application account to get an oauth token.
1119     *
1120     * @param { string } name - Indicates the account name of your application or third-party applications.
1121     * @param { string } owner - Indicates the account owner of your application or third-party applications.
1122     * @param { string } authType - Indicates the authentication type.
1123     * @param { object } options - Indicates the authenticator-specific options for the request.
1124     * @param { AuthenticatorCallback } callback - Indicates the authenticator callback.
1125     * @syscap SystemCapability.Account.AppAccount
1126     * @since 8
1127     * @deprecated since 9
1128     * @useinstead appAccount.AppAccountManager#auth
1129     */
1130    authenticate(
1131      name: string,
1132      owner: string,
1133      authType: string,
1134      options: { [key: string]: any },
1135      callback: AuthenticatorCallback
1136    ): void;
1137
1138    /**
1139     * Authenticates an application account to get an auth token.
1140     *
1141     * @param { string } name - Indicates the account name of your application or third-party applications.
1142     * @param { string } owner - Indicates the account owner of your application or third-party applications.
1143     * @param { string } authType - Indicates the authentication type.
1144     * @param { AuthCallback } callback - Indicates the authenticator callback.
1145     * @throws { BusinessError } 401 - The parameter check failed.
1146     * @throws { BusinessError } 12300001 - System service exception.
1147     * @throws { BusinessError } 12300002 - Invalid name, owner or authType.
1148     * @throws { BusinessError } 12300003 - Account not found.
1149     * @throws { BusinessError } 12300010 - Account service busy.
1150     * @throws { BusinessError } 12300113 - Authenticator service not found.
1151     * @throws { BusinessError } 12300114 - Authenticator service exception.
1152     * @syscap SystemCapability.Account.AppAccount
1153     * @since 9
1154     */
1155    auth(name: string, owner: string, authType: string, callback: AuthCallback): void;
1156
1157    /**
1158     * Authenticates an application account to get an auth token.
1159     *
1160     * @param { string } name - Indicates the account name of your application or third-party applications.
1161     * @param { string } owner - Indicates the account owner of your application or third-party applications.
1162     * @param { string } authType - Indicates the authentication type.
1163     * @param { Record<string, Object> } options - Indicates the authenticator-specific options for the request.
1164     * @param { AuthCallback } callback - Indicates the authenticator callback.
1165     * @throws { BusinessError } 401 - The parameter check failed.
1166     * @throws { BusinessError } 12300001 - System service exception.
1167     * @throws { BusinessError } 12300002 - Invalid name, owner, authType or options.
1168     * @throws { BusinessError } 12300003 - Account not found.
1169     * @throws { BusinessError } 12300010 - Account service busy.
1170     * @throws { BusinessError } 12300113 - Authenticator service not found.
1171     * @throws { BusinessError } 12300114 - Authenticator service exception.
1172     * @syscap SystemCapability.Account.AppAccount
1173     * @since 9
1174     */
1175    auth(
1176      name: string,
1177      owner: string,
1178      authType: string,
1179      options: Record<string, Object>,
1180      callback: AuthCallback
1181    ): void;
1182
1183    /**
1184     * Gets an oauth token with the specified authentication type from a particular application account.
1185     *
1186     * @param { string } name - Indicates the account name of your application or third-party applications.
1187     * @param { string } owner - Indicates the account owner of your application or third-party applications.
1188     * @param { string } authType - Indicates the authentication type.
1189     * @param { AsyncCallback<string> } callback - Asynchronous callback interface. Returns an oauth token.
1190     * @syscap SystemCapability.Account.AppAccount
1191     * @since 8
1192     * @deprecated since 9
1193     * @useinstead appAccount.AppAccountManager#getAuthToken
1194     */
1195    getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCallback<string>): void;
1196
1197    /**
1198     * Gets an oauth token with the specified authentication type from a particular application account.
1199     *
1200     * @param { string } name - Indicates the account name of your application or third-party applications.
1201     * @param { string } owner - Indicates the account owner of your application or third-party applications.
1202     * @param { string } authType - Indicates the authentication type.
1203     * @returns { Promise<string> } Returns an oauth token.
1204     * @syscap SystemCapability.Account.AppAccount
1205     * @since 8
1206     * @deprecated since 9
1207     * @useinstead appAccount.AppAccountManager#getAuthToken
1208     */
1209    getOAuthToken(name: string, owner: string, authType: string): Promise<string>;
1210
1211    /**
1212     * Gets an auth token with the specified authentication type from a particular application account.
1213     *
1214     * @param { string } name - Indicates the account name of your application or third-party applications.
1215     * @param { string } owner - Indicates the account owner of your application or third-party applications.
1216     * @param { string } authType - Indicates the authentication type.
1217     * @param { AsyncCallback<string> } callback - Asynchronous callback interface. Returns an auth token.
1218     * @throws { BusinessError } 401 - The parameter check failed.
1219     * @throws { BusinessError } 12300001 - System service exception.
1220     * @throws { BusinessError } 12300002 - Invalid name, owner or authType.
1221     * @throws { BusinessError } 12300003 - Account not found.
1222     * @throws { BusinessError } 12300107 - AuthType not found.
1223     * @syscap SystemCapability.Account.AppAccount
1224     * @since 9
1225     */
1226    getAuthToken(name: string, owner: string, authType: string, callback: AsyncCallback<string>): void;
1227
1228    /**
1229     * Gets an auth token with the specified authentication type from a particular application account.
1230     *
1231     * @param { string } name - Indicates the account name of your application or third-party applications.
1232     * @param { string } owner - Indicates the account owner of your application or third-party applications.
1233     * @param { string } authType - Indicates the authentication type.
1234     * @returns { Promise<string> } Returns an auth token.
1235     * @throws { BusinessError } 401 - The parameter check failed.
1236     * @throws { BusinessError } 12300001 - System service exception.
1237     * @throws { BusinessError } 12300002 - Invalid name, owner or authType.
1238     * @throws { BusinessError } 12300003 - Account not found.
1239     * @throws { BusinessError } 12300107 - AuthType not found.
1240     * @syscap SystemCapability.Account.AppAccount
1241     * @since 9
1242     */
1243    getAuthToken(name: string, owner: string, authType: string): Promise<string>;
1244
1245    /**
1246     * Sets an oauth token with the specified authentication type for a particular account.
1247     * <p>
1248     * Only the owner of the application account has the permission to call this method.
1249     *
1250     * @param { string } name - Indicates the account name of your application.
1251     * @param { string } authType - Indicates the authentication type.
1252     * @param { string } token - Indicates the oauth token.
1253     * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
1254     * @syscap SystemCapability.Account.AppAccount
1255     * @since 8
1256     * @deprecated since 9
1257     * @useinstead appAccount.AppAccountManager#setAuthToken
1258     */
1259    setOAuthToken(name: string, authType: string, token: string, callback: AsyncCallback<void>): void;
1260
1261    /**
1262     * Sets an oauth token with the specified authentication type for a particular account.
1263     * <p>
1264     * Only the owner of the application account has the permission to call this method.
1265     *
1266     * @param { string } name - Indicates the account name of your application.
1267     * @param { string } authType - Indicates the authentication type.
1268     * @param { string } token - Indicates the oauth token.
1269     * @returns { Promise<void> } The promise returned by the function.
1270     * @syscap SystemCapability.Account.AppAccount
1271     * @since 8
1272     * @deprecated since 9
1273     * @useinstead appAccount.AppAccountManager#setAuthToken
1274     */
1275    setOAuthToken(name: string, authType: string, token: string): Promise<void>;
1276
1277    /**
1278     * Sets an auth token with the specified authentication type for a particular account.
1279     * <p>
1280     * Only the owner of the application account has the permission to call this method.
1281     *
1282     * @param { string } name - Indicates the account name of your application.
1283     * @param { string } authType - Indicates the authentication type.
1284     * @param { string } token - Indicates the auth token.
1285     * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
1286     * @throws { BusinessError } 401 - The parameter check failed.
1287     * @throws { BusinessError } 12300001 - System service exception.
1288     * @throws { BusinessError } 12300002 - Invalid name, authType or token.
1289     * @throws { BusinessError } 12300003 - Account not found.
1290     * @throws { BusinessError } 12400004 - The number of tokens reaches the upper limit.
1291     * @syscap SystemCapability.Account.AppAccount
1292     * @since 9
1293     */
1294    setAuthToken(name: string, authType: string, token: string, callback: AsyncCallback<void>): void;
1295
1296    /**
1297     * Sets an auth token with the specified authentication type for a particular account.
1298     * <p>
1299     * Only the owner of the application account has the permission to call this method.
1300     *
1301     * @param { string } name - Indicates the account name of your application.
1302     * @param { string } authType - Indicates the authentication type.
1303     * @param { string } token - Indicates the auth token.
1304     * @returns { Promise<void> } The promise returned by the function.
1305     * @throws { BusinessError } 401 - The parameter check failed.
1306     * @throws { BusinessError } 12300001 - System service exception.
1307     * @throws { BusinessError } 12300002 - Invalid name, authType or token.
1308     * @throws { BusinessError } 12300003 - Account not found.
1309     * @throws { BusinessError } 12400004 - The number of tokens reaches the upper limit.
1310     * @syscap SystemCapability.Account.AppAccount
1311     * @since 9
1312     */
1313    setAuthToken(name: string, authType: string, token: string): Promise<void>;
1314
1315    /**
1316     * Deletes an oauth token for the specified application account.
1317     * <p>
1318     * Only tokens visible to the caller application can be deleted.
1319     *
1320     * @param { string } name - Indicates the account name of your application or third-party applications.
1321     * @param { string } owner - Indicates the account owner of your application or third-party applications.
1322     * @param { string } authType - Indicates the authentication type.
1323     * @param { string } token - Indicates the oauth token.
1324     * @param { AsyncCallback<void> } callback Asynchronous callback interface.
1325     * @syscap SystemCapability.Account.AppAccount
1326     * @since 8
1327     * @deprecated since 9
1328     * @useinstead appAccount.AppAccountManager#deleteAuthToken
1329     */
1330    deleteOAuthToken(name: string, owner: string, authType: string, token: string, callback: AsyncCallback<void>): void;
1331
1332    /**
1333     * Deletes an oauth token for the specified application account.
1334     * <p>
1335     * Only tokens visible to the caller application can be deleted.
1336     *
1337     * @param { string } name - Indicates the account name of your application or third-party applications.
1338     * @param { string } owner - Indicates the account owner of your application or third-party applications.
1339     * @param { string } authType - Indicates the authentication type.
1340     * @param { string } token - Indicates the oauth token.
1341     * @returns { Promise<void> } The promise returned by the function.
1342     * @syscap SystemCapability.Account.AppAccount
1343     * @since 8
1344     * @deprecated since 9
1345     * @useinstead appAccount.AppAccountManager#deleteAuthToken
1346     */
1347    deleteOAuthToken(name: string, owner: string, authType: string, token: string): Promise<void>;
1348
1349    /**
1350     * Deletes an auth token for the specified application account.
1351     * <p>
1352     * Only tokens visible to the caller application can be deleted.
1353     *
1354     * @param { string } name - Indicates the account name of your application or third-party applications.
1355     * @param { string } owner - Indicates the account owner of your application or third-party applications.
1356     * @param { string } authType - Indicates the authentication type.
1357     * @param { string } token - Indicates the auth token.
1358     * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
1359     * @throws { BusinessError } 401 - The parameter check failed.
1360     * @throws { BusinessError } 12300001 - System service exception.
1361     * @throws { BusinessError } 12300002 - Invalid name, owner, authType or token.
1362     * @throws { BusinessError } 12300003 - Account not found.
1363     * @throws { BusinessError } 12300107 - AuthType not found.
1364     * @syscap SystemCapability.Account.AppAccount
1365     * @since 9
1366     */
1367    deleteAuthToken(name: string, owner: string, authType: string, token: string, callback: AsyncCallback<void>): void;
1368
1369    /**
1370     * Deletes an auth token for the specified application account.
1371     * <p>
1372     * Only tokens visible to the caller application can be deleted.
1373     *
1374     * @param { string } name - Indicates the account name of your application or third-party applications.
1375     * @param { string } owner - Indicates the account owner of your application or third-party applications.
1376     * @param { string } authType - Indicates the authentication type.
1377     * @param { string } token - Indicates the auth token.
1378     * @returns { Promise<void> } The promise returned by the function.
1379     * @throws { BusinessError } 401 - The parameter check failed.
1380     * @throws { BusinessError } 12300001 - System service exception.
1381     * @throws { BusinessError } 12300002 - Invalid name, owner, authType or token.
1382     * @throws { BusinessError } 12300003 - Account not found.
1383     * @throws { BusinessError } 12300107 - AuthType not found.
1384     * @syscap SystemCapability.Account.AppAccount
1385     * @since 9
1386     */
1387    deleteAuthToken(name: string, owner: string, authType: string, token: string): Promise<void>;
1388
1389    /**
1390     * Sets the oauth token visibility of the specified authentication type to a third-party application.
1391     * <p>
1392     * Only the owner of the application account has the permission to call this method.
1393     *
1394     * @param { string } name - Indicates the account name of your application.
1395     * @param { string } authType - Indicates the authentication type.
1396     * @param { string } bundleName - Indicates the bundle name of the third-party application.
1397     * @param { boolean } isVisible - Indicates the bool value of visibility.
1398     * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
1399     * @syscap SystemCapability.Account.AppAccount
1400     * @since 8
1401     * @deprecated since 9
1402     * @useinstead appAccount.AppAccountManager#setAuthTokenVisibility
1403     */
1404    setOAuthTokenVisibility(
1405      name: string,
1406      authType: string,
1407      bundleName: string,
1408      isVisible: boolean,
1409      callback: AsyncCallback<void>
1410    ): void;
1411
1412    /**
1413     * Sets the oauth token visibility of the specified authentication type to a third-party application.
1414     * <p>
1415     * Only the owner of the application account has the permission to call this method.
1416     *
1417     * @param { string } name - Indicates the account name of your application.
1418     * @param { string } authType - Indicates the authentication type.
1419     * @param { string } bundleName - Indicates the bundle name of the third-party application.
1420     * @param { boolean } isVisible - Indicates the bool value of visibility.
1421     * @returns { Promise<void> } The promise returned by the function.
1422     * @syscap SystemCapability.Account.AppAccount
1423     * @since 8
1424     * @deprecated since 9
1425     * @useinstead appAccount.AppAccountManager#setAuthTokenVisibility
1426     */
1427    setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean): Promise<void>;
1428
1429    /**
1430     * Sets the auth token visibility of the specified authentication type to a third-party application.
1431     * <p>
1432     * Only the owner of the application account has the permission to call this method.
1433     *
1434     * @param { string } name - Indicates the account name of your application.
1435     * @param { string } authType - Indicates the authentication type.
1436     * @param { string } bundleName - Indicates the bundle name of the third-party application.
1437     * @param { boolean } isVisible - Indicates the bool value of visibility.
1438     * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
1439     * @throws { BusinessError } 401 - The parameter check failed.
1440     * @throws { BusinessError } 12300001 - System service exception.
1441     * @throws { BusinessError } 12300002 - Invalid name, authType or bundleName.
1442     * @throws { BusinessError } 12300003 - Account not found.
1443     * @throws { BusinessError } 12300107 - AuthType not found.
1444     * @throws { BusinessError } 12400001 - Application not found.
1445     * @throws { BusinessError } 12400005 - The size of authorization list reaches the upper limit.
1446     * @syscap SystemCapability.Account.AppAccount
1447     * @since 9
1448     */
1449    setAuthTokenVisibility(
1450      name: string,
1451      authType: string,
1452      bundleName: string,
1453      isVisible: boolean,
1454      callback: AsyncCallback<void>
1455    ): void;
1456
1457    /**
1458     * Sets the auth token visibility of the specified authentication type to a third-party application.
1459     * <p>
1460     * Only the owner of the application account has the permission to call this method.
1461     *
1462     * @param { string } name - Indicates the account name of your application.
1463     * @param { string } authType - Indicates the authentication type.
1464     * @param { string } bundleName - Indicates the bundle name of the third-party application.
1465     * @param { boolean } isVisible - Indicates the bool value of visibility.
1466     * @returns { Promise<void> } The promise returned by the function.
1467     * @throws { BusinessError } 401 - The parameter check failed.
1468     * @throws { BusinessError } 12300001 - System service exception.
1469     * @throws { BusinessError } 12300002 - Invalid name, authType or bundleName.
1470     * @throws { BusinessError } 12300003 - Account not found.
1471     * @throws { BusinessError } 12300107 - AuthType not found.
1472     * @throws { BusinessError } 12400001 - Application not found.
1473     * @throws { BusinessError } 12400005 - The size of authorization list reaches the upper limit.
1474     * @syscap SystemCapability.Account.AppAccount
1475     * @since 9
1476     */
1477    setAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean): Promise<void>;
1478
1479    /**
1480     * Checks the oauth token visibility of the specified authentication type for a third-party application.
1481     * <p>
1482     * Only the owner of the application account has the permission to call this method.
1483     *
1484     * @param { string } name - Indicates the account name of your application or third-party applications.
1485     * @param { string } authType - Indicates the authentication type.
1486     * @param { string } bundleName - Indicates the bundle name of the third-party application.
1487     * @param { AsyncCallback<boolean> } callback - Asynchronous callback interface. Returns the bool value of visibility.
1488     * @syscap SystemCapability.Account.AppAccount
1489     * @since 8
1490     * @deprecated since 9
1491     * @useinstead appAccount.AppAccountManager#checkAuthTokenVisibility
1492     */
1493    checkOAuthTokenVisibility(
1494      name: string,
1495      authType: string,
1496      bundleName: string,
1497      callback: AsyncCallback<boolean>
1498    ): void;
1499
1500    /**
1501     * Checks the oauth token visibility of the specified authentication type for a third-party application.
1502     * <p>
1503     * Only the owner of the application account has the permission to call this method.
1504     *
1505     * @param { string } name - Indicates the account name of your application or third-party applications.
1506     * @param { string } authType - Indicates the authentication type.
1507     * @param { string } bundleName - Indicates the bundle name of the third-party application.
1508     * @returns { Promise<boolean> } Returns the bool value of visibility.
1509     * @syscap SystemCapability.Account.AppAccount
1510     * @since 8
1511     * @deprecated since 9
1512     * @useinstead appAccount.AppAccountManager#checkAuthTokenVisibility
1513     */
1514    checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): Promise<boolean>;
1515
1516    /**
1517     * Checks the auth token visibility of the specified authentication type for a third-party application.
1518     * <p>
1519     * Only the owner of the application account has the permission to call this method.
1520     *
1521     * @param { string } name - Indicates the account name of your application or third-party applications.
1522     * @param { string } authType - Indicates the authentication type.
1523     * @param { string } bundleName - Indicates the bundle name of the third-party application.
1524     * @param { AsyncCallback<boolean> } callback - Asynchronous callback interface.
1525     * @throws { BusinessError } 401 - The parameter check failed.
1526     * @throws { BusinessError } 12300001 - System service exception.
1527     * @throws { BusinessError } 12300002 - Invalid name, authType or bundleName.
1528     * @throws { BusinessError } 12300003 - Account not found.
1529     * @throws { BusinessError } 12300107 - AuthType not found.
1530     * @syscap SystemCapability.Account.AppAccount
1531     * @since 9
1532     */
1533    checkAuthTokenVisibility(
1534      name: string,
1535      authType: string,
1536      bundleName: string,
1537      callback: AsyncCallback<boolean>
1538    ): void;
1539
1540    /**
1541     * Checks the auth token visibility of the specified authentication type for a third-party application.
1542     * <p>
1543     * Only the owner of the application account has the permission to call this method.
1544     *
1545     * @param { string } name - Indicates the account name of your application or third-party applications.
1546     * @param { string } authType - Indicates the authentication type.
1547     * @param { string } bundleName - Indicates the bundle name of the third-party application.
1548     * @returns { Promise<boolean> } Returns the bool value of visibility.
1549     * @throws { BusinessError } 401 - The parameter check failed.
1550     * @throws { BusinessError } 12300001 - System service exception.
1551     * @throws { BusinessError } 12300002 - Invalid name, authType or bundleName.
1552     * @throws { BusinessError } 12300003 - Account not found.
1553     * @throws { BusinessError } 12300107 - AuthType not found.
1554     * @syscap SystemCapability.Account.AppAccount
1555     * @since 9
1556     */
1557    checkAuthTokenVisibility(name: string, authType: string, bundleName: string): Promise<boolean>;
1558
1559    /**
1560     * Gets all oauth tokens visible to the caller application.
1561     *
1562     * @param { string } name - Indicates the account name of your application or third-party applications.
1563     * @param { string } owner - Indicates the account owner of your application or third-party applications.
1564     * @param { AsyncCallback<Array<OAuthTokenInfo>> } callback - Asynchronous callback interface.
1565     * @syscap SystemCapability.Account.AppAccount
1566     * @since 8
1567     * @deprecated since 9
1568     * @useinstead appAccount.AppAccountManager#getAllAuthTokens
1569     */
1570    getAllOAuthTokens(name: string, owner: string, callback: AsyncCallback<Array<OAuthTokenInfo>>): void;
1571
1572    /**
1573     * Gets all oauth tokens visible to the caller application.
1574     *
1575     * @param { string } name - Indicates the account name of your application or third-party applications.
1576     * @param { string } owner - Indicates the account owner of your application or third-party applications.
1577     * @returns { Promise<Array<OAuthTokenInfo>> } Returns a list of oauth tokens visible to the caller application.
1578     * @syscap SystemCapability.Account.AppAccount
1579     * @since 8
1580     * @deprecated since 9
1581     * @useinstead appAccount.AppAccountManager#getAllAuthTokens
1582     */
1583    getAllOAuthTokens(name: string, owner: string): Promise<Array<OAuthTokenInfo>>;
1584
1585    /**
1586     * Gets all auth tokens visible to the caller application.
1587     *
1588     * @param { string } name - Indicates the account name of your application or third-party applications.
1589     * @param { string } owner - Indicates the account owner of your application or third-party applications.
1590     * @param { AsyncCallback<Array<AuthTokenInfo>> } callback - Asynchronous callback interface.
1591     *   Returns a list of auth tokens visible to the caller application.
1592     * @throws { BusinessError } 401 - The parameter check failed.
1593     * @throws { BusinessError } 12300001 - System service exception.
1594     * @throws { BusinessError } 12300002 - Invalid name or owner.
1595     * @throws { BusinessError } 12300003 - Account not found.
1596     * @syscap SystemCapability.Account.AppAccount
1597     * @since 9
1598     */
1599    getAllAuthTokens(name: string, owner: string, callback: AsyncCallback<Array<AuthTokenInfo>>): void;
1600
1601    /**
1602     * Gets all auth tokens visible to the caller application.
1603     *
1604     * @param { string } name - Indicates the account name of your application or third-party applications.
1605     * @param { string } owner - Indicates the account owner of your application or third-party applications.
1606     * @returns { Promise<Array<AuthTokenInfo>> } Returns a list of auth tokens visible to the caller application.
1607     * @throws { BusinessError } 401 - The parameter check failed.
1608     * @throws { BusinessError } 12300001 - System service exception.
1609     * @throws { BusinessError } 12300002 - Invalid name or owner.
1610     * @throws { BusinessError } 12300003 - Account not found.
1611     * @syscap SystemCapability.Account.AppAccount
1612     * @since 9
1613     */
1614    getAllAuthTokens(name: string, owner: string): Promise<Array<AuthTokenInfo>>;
1615
1616    /**
1617     * Gets the open authorization list with a specified authentication type for a particular application account.
1618     * <p>
1619     * Only the owner of the application account has the permission to call this method.
1620     *
1621     * @param { string } name - Indicates the account name of your application.
1622     * @param { string } authType - Indicates the authentication type.
1623     * @param { AsyncCallback<Array<string>> } callback - Asynchronous callback interface.
1624     *   Returns the open authorization list of the specified authentication type.
1625     * @syscap SystemCapability.Account.AppAccount
1626     * @since 8
1627     * @deprecated since 9
1628     * @useinstead appAccount.AppAccountManager#getAuthList
1629     */
1630    getOAuthList(name: string, authType: string, callback: AsyncCallback<Array<string>>): void;
1631
1632    /**
1633     * Gets the open authorization list with a specified authentication type for a particular application account.
1634     * <p>
1635     * Only the owner of the application account has the permission to call this method.
1636     *
1637     * @param { string } name - Indicates the account name of your application.
1638     * @param { string } authType - Indicates the authentication type.
1639     * @returns { Promise<Array<string>> } Returns the open authorization list of the specified authentication type.
1640     * @syscap SystemCapability.Account.AppAccount
1641     * @since 8
1642     * @deprecated since 9
1643     * @useinstead appAccount.AppAccountManager#getAuthList
1644     */
1645    getOAuthList(name: string, authType: string): Promise<Array<string>>;
1646
1647    /**
1648     * Gets the open authorization list with a specified authentication type for a particular application account.
1649     * <p>
1650     * Only the owner of the application account has the permission to call this method.
1651     *
1652     * @param { string } name - Indicates the account name of your application.
1653     * @param { string } authType - Indicates the authentication type.
1654     * @param { AsyncCallback<Array<string>> } callback - Asynchronous callback interface.
1655     *   Returns the open authorization list of the specified authentication type.
1656     * @throws { BusinessError } 401 - The parameter check failed.
1657     * @throws { BusinessError } 12300001 - System service exception.
1658     * @throws { BusinessError } 12300002 - Invalid name or authType.
1659     * @throws { BusinessError } 12300003 - Account not found.
1660     * @throws { BusinessError } 12300107 - AuthType not found.
1661     * @syscap SystemCapability.Account.AppAccount
1662     * @since 9
1663     */
1664    getAuthList(name: string, authType: string, callback: AsyncCallback<Array<string>>): void;
1665
1666    /**
1667     * Gets the open authorization list with a specified authentication type for a particular application account.
1668     * <p>
1669     * Only the owner of the application account has the permission to call this method.
1670     *
1671     * @param { string } name - Indicates the account name of your application.
1672     * @param { string } authType - Indicates the authentication type.
1673     * @returns { Promise<Array<string>> } Returns the open authorization list of the specified authentication type.
1674     * @throws { BusinessError } 401 - The parameter check failed.
1675     * @throws { BusinessError } 12300001 - System service exception.
1676     * @throws { BusinessError } 12300002 - Invalid name or authType.
1677     * @throws { BusinessError } 12300003 - Account not found.
1678     * @throws { BusinessError } 12300107 - AuthType not found.
1679     * @syscap SystemCapability.Account.AppAccount
1680     * @since 9
1681     */
1682    getAuthList(name: string, authType: string): Promise<Array<string>>;
1683
1684    /**
1685     * Gets the authenticator callback with the specified session id.
1686     * <p>
1687     * Only the owner of the authenticator has the permission to call this method.
1688     *
1689     * @param { string } sessionId - Indicates the id of a authentication session.
1690     * @param { AsyncCallback<AuthenticatorCallback> } callback - Asynchronous callback interface.
1691     *   Returns the authenticator callback related to the session id.
1692     * @syscap SystemCapability.Account.AppAccount
1693     * @since 8
1694     * @deprecated since 9
1695     * @useinstead appAccount.AppAccountManager#getAuthCallback
1696     */
1697    getAuthenticatorCallback(sessionId: string, callback: AsyncCallback<AuthenticatorCallback>): void;
1698
1699    /**
1700     * Gets the authenticator callback with the specified session id.
1701     * <p>
1702     * Only the owner of the authenticator has the permission to call this method.
1703     *
1704     * @param { string } sessionId - Indicates the id of a authentication session.
1705     * @returns { Promise<AuthenticatorCallback> } Returns the authenticator callback related to the session id.
1706     * @syscap SystemCapability.Account.AppAccount
1707     * @since 8
1708     * @deprecated since 9
1709     * @useinstead appAccount.AppAccountManager#getAuthCallback
1710     */
1711    getAuthenticatorCallback(sessionId: string): Promise<AuthenticatorCallback>;
1712
1713    /**
1714     * Obtains the authenticator callback with the specified session id.
1715     * <p>
1716     * Only the owner of the authenticator has the permission to call this method.
1717     *
1718     * @param { string } sessionId - Indicates the id of a authentication session.
1719     * @param { AsyncCallback<AuthCallback> } callback - Asynchronous callback interface.
1720     *   Returns the authenticator callback related to the session id.
1721     * @throws { BusinessError } 401 - The parameter check failed.
1722     * @throws { BusinessError } 12300001 - System service exception.
1723     * @throws { BusinessError } 12300002 - Invalid sessionId.
1724     * @throws { BusinessError } 12300108 - Session not found.
1725     * @syscap SystemCapability.Account.AppAccount
1726     * @since 9
1727     */
1728    getAuthCallback(sessionId: string, callback: AsyncCallback<AuthCallback>): void;
1729
1730    /**
1731     * Obtains the authenticator callback with the specified session id.
1732     * <p>
1733     * Only the owner of the authenticator has the permission to call this method.
1734     *
1735     * @param { string } sessionId - Indicates the id of a authentication session.
1736     * @returns { Promise<AuthCallback> } Returns the authenticator callback related to the session id.
1737     * @throws { BusinessError } 401 - The parameter check failed.
1738     * @throws { BusinessError } 12300001 - System service exception.
1739     * @throws { BusinessError } 12300002 - Invalid sessionId.
1740     * @throws { BusinessError } 12300108 - Session not found.
1741     * @syscap SystemCapability.Account.AppAccount
1742     * @since 9
1743     */
1744    getAuthCallback(sessionId: string): Promise<AuthCallback>;
1745
1746    /**
1747     * Gets the authenticator information of an application account.
1748     *
1749     * @param { string } owner - Indicates the account owner of your application or third-party applications.
1750     * @param { AsyncCallback<AuthenticatorInfo> } callback - Asynchronous callback interface.
1751     *   Returns the authenticator information of the application account.
1752     * @syscap SystemCapability.Account.AppAccount
1753     * @since 8
1754     * @deprecated since 9
1755     * @useinstead appAccount.AppAccountManager#queryAuthenticatorInfo
1756     */
1757    getAuthenticatorInfo(owner: string, callback: AsyncCallback<AuthenticatorInfo>): void;
1758
1759    /**
1760     * Gets the authenticator information of an application account.
1761     *
1762     * @param { string } owner - Indicates the account owner of your application or third-party applications.
1763     * @returns { Promise<AuthenticatorInfo> } Returns the authenticator information of the application account.
1764     * @syscap SystemCapability.Account.AppAccount
1765     * @since 8
1766     * @deprecated since 9
1767     * @useinstead appAccount.AppAccountManager#queryAuthenticatorInfo
1768     */
1769    getAuthenticatorInfo(owner: string): Promise<AuthenticatorInfo>;
1770
1771    /**
1772     * Queries the authenticator information of an application account.
1773     *
1774     * @param { string } owner - Indicates the account owner of your application or third-party applications.
1775     * @param { AsyncCallback<AuthenticatorInfo> } callback - Asynchronous callback interface.
1776     *   Returns the authenticator information of the application account.
1777     * @throws { BusinessError } 401 - The parameter check failed.
1778     * @throws { BusinessError } 12300001 - System service exception.
1779     * @throws { BusinessError } 12300002 - Invalid owner.
1780     * @throws { BusinessError } 12300113 - Authenticator service not found.
1781     * @syscap SystemCapability.Account.AppAccount
1782     * @since 9
1783     */
1784    queryAuthenticatorInfo(owner: string, callback: AsyncCallback<AuthenticatorInfo>): void;
1785
1786    /**
1787     * Queries the authenticator information of an application account.
1788     *
1789     * @param { string } owner - Indicates the account owner of your application or third-party applications.
1790     * @returns { Promise<AuthenticatorInfo> } Returns the authenticator information of the application account.
1791     * @throws { BusinessError } 401 - The parameter check failed.
1792     * @throws { BusinessError } 12300001 - System service exception.
1793     * @throws { BusinessError } 12300002 - Invalid owner.
1794     * @throws { BusinessError } 12300113 - Authenticator service not found.
1795     * @syscap SystemCapability.Account.AppAccount
1796     * @since 9
1797     */
1798    queryAuthenticatorInfo(owner: string): Promise<AuthenticatorInfo>;
1799
1800    /**
1801     * Checks whether a particular account has all specified labels.
1802     *
1803     * @param { string } name - Indicates the account name.
1804     * @param { string } owner - Indicates the account owner.
1805     * @param { Array<string> } labels - Indicates an array of labels to check.
1806     * @param { AsyncCallback<boolean> } callback - Asynchronous callback interface.
1807     * @throws { BusinessError } 401 - The parameter check failed.
1808     * @throws { BusinessError } 12300001 - System service exception.
1809     * @throws { BusinessError } 12300002 - Invalid name, owner or labels.
1810     * @throws { BusinessError } 12300003 - Account not found.
1811     * @throws { BusinessError } 12300010 - Account service busy.
1812     * @throws { BusinessError } 12300113 - Authenticator service not found.
1813     * @throws { BusinessError } 12300114 - Authenticator service exception.
1814     * @syscap SystemCapability.Account.AppAccount
1815     * @since 9
1816     */
1817    checkAccountLabels(name: string, owner: string, labels: Array<string>, callback: AsyncCallback<boolean>): void;
1818
1819    /**
1820     * Checks whether a particular account has all specified labels.
1821     *
1822     * @param { string } name - Indicates the account name.
1823     * @param { string } owner - Indicates the account owner.
1824     * @param { Array<string> } labels - Indicates an array of labels to check.
1825     * @returns { Promise<boolean> } The promise returned by the function.
1826     * @throws { BusinessError } 401 - The parameter check failed.
1827     * @throws { BusinessError } 12300001 - System service exception.
1828     * @throws { BusinessError } 12300002 - Invalid name, owner or labels.
1829     * @throws { BusinessError } 12300003 - Account not found.
1830     * @throws { BusinessError } 12300010 - Account service busy.
1831     * @throws { BusinessError } 12300113 - Authenticator service not found.
1832     * @throws { BusinessError } 12300114 - Authenticator service exception.
1833     * @syscap SystemCapability.Account.AppAccount
1834     * @since 9
1835     */
1836    checkAccountLabels(name: string, owner: string, labels: Array<string>): Promise<boolean>;
1837
1838    /**
1839     * Deletes the credential of the specified application account.
1840     *
1841     * @param { string } name - Indicates the account name.
1842     * @param { string } credentialType - Indicates the type of the credential to delete.
1843     * @param { AsyncCallback<void> } callback - Asynchronous callback interface.
1844     * @throws { BusinessError } 401 - The parameter check failed.
1845     * @throws { BusinessError } 12300001 - System service exception.
1846     * @throws { BusinessError } 12300002 - Invalid name or credentialType.
1847     * @throws { BusinessError } 12300003 - Account not found.
1848     * @throws { BusinessError } 12300102 - Credential not found.
1849     * @syscap SystemCapability.Account.AppAccount
1850     * @since 9
1851     */
1852    deleteCredential(name: string, credentialType: string, callback: AsyncCallback<void>): void;
1853
1854    /**
1855     * Deletes the credential of the specified application account.
1856     *
1857     * @param { string } name - Indicates the account name.
1858     * @param { string } credentialType - Indicates the type of the credential to delete.
1859     * @returns { Promise<void> } The promise returned by the function.
1860     * @throws { BusinessError } 401 - The parameter check failed.
1861     * @throws { BusinessError } 12300001 - System service exception.
1862     * @throws { BusinessError } 12300002 - Invalid name or credentialType.
1863     * @throws { BusinessError } 12300003 - Account not found.
1864     * @throws { BusinessError } 12300102 - Credential not found.
1865     * @syscap SystemCapability.Account.AppAccount
1866     * @since 9
1867     */
1868    deleteCredential(name: string, credentialType: string): Promise<void>;
1869
1870    /**
1871     * Selects a list of accounts that satisfied with the specified options.
1872     *
1873     * @param { SelectAccountsOptions } options - Indicates the options for selecting account.
1874     * @param { AsyncCallback<Array<AppAccountInfo>> } callback - Asynchronous callback interface.
1875     * @throws { BusinessError } 401 - The parameter check failed.
1876     * @throws { BusinessError } 12300001 - System service exception.
1877     * @throws { BusinessError } 12300002 - Invalid options.
1878     * @throws { BusinessError } 12300010 - Account service busy.
1879     * @throws { BusinessError } 12300114 - Authenticator service exception.
1880     * @syscap SystemCapability.Account.AppAccount
1881     * @since 9
1882     */
1883    selectAccountsByOptions(options: SelectAccountsOptions, callback: AsyncCallback<Array<AppAccountInfo>>): void;
1884
1885    /**
1886     * Selects a list of accounts that satisfied with the specified options.
1887     *
1888     * @param { SelectAccountsOptions } options - Indicates the options for selecting account.
1889     * @returns { Promise<Array<AppAccountInfo>> } Returns a list of accounts.
1890     * @throws { BusinessError } 401 - The parameter check failed.
1891     * @throws { BusinessError } 12300001 - System service exception.
1892     * @throws { BusinessError } 12300002 - Invalid options.
1893     * @throws { BusinessError } 12300010 - Account service busy.
1894     * @throws { BusinessError } 12300114 - Authenticator service exception.
1895     * @syscap SystemCapability.Account.AppAccount
1896     * @since 9
1897     */
1898    selectAccountsByOptions(options: SelectAccountsOptions): Promise<Array<AppAccountInfo>>;
1899
1900    /**
1901     * Verifies the credential to ensure the user is the owner of the specified account.
1902     *
1903     * @param { string } name - Indicates the account name.
1904     * @param { string } owner - Indicates the account owner.
1905     * @param { AuthCallback } callback - Indicates the authenticator callback.
1906     * @throws { BusinessError } 401 - The parameter check failed.
1907     * @throws { BusinessError } 12300001 - System service exception.
1908     * @throws { BusinessError } 12300002 - Invalid name or owner.
1909     * @throws { BusinessError } 12300003 - Account not found.
1910     * @throws { BusinessError } 12300010 - Account service busy.
1911     * @throws { BusinessError } 12300113 - Authenticator service not found.
1912     * @throws { BusinessError } 12300114 - Authenticator service exception.
1913     * @syscap SystemCapability.Account.AppAccount
1914     * @since 9
1915     */
1916    verifyCredential(name: string, owner: string, callback: AuthCallback): void;
1917    /**
1918     * Verifies the credential to ensure the user is the owner of the specified account.
1919     *
1920     * @param { string } name - Indicates the account name.
1921     * @param { string } owner - Indicates the account owner.
1922     * @param { VerifyCredentialOptions } options - Indicates the options for verifying credential.
1923     * @param { AuthCallback } callback - Indicates the authenticator callback.
1924     * @throws { BusinessError } 401 - The parameter check failed.
1925     * @throws { BusinessError } 12300001 - System service exception.
1926     * @throws { BusinessError } 12300002 - Invalid name, owner or options.
1927     * @throws { BusinessError } 12300003 - Account not found.
1928     * @throws { BusinessError } 12300010 - Account service busy.
1929     * @throws { BusinessError } 12300113 - Authenticator service not found.
1930     * @throws { BusinessError } 12300114 - Authenticator service exception.
1931     * @syscap SystemCapability.Account.AppAccount
1932     * @since 9
1933     */
1934    verifyCredential(name: string, owner: string, options: VerifyCredentialOptions, callback: AuthCallback): void;
1935
1936    /**
1937     * Sets properties for the specified account authenticator.
1938     * <p>
1939     * If the authenticator supports setting its properties,
1940     * the caller will normally be redirected to an Ability specified by Want for property setting.
1941     *
1942     * @param { string } owner - Indicates the owner of authenticator.
1943     * @param { AuthCallback } callback - Indicates the authenticator callback.
1944     * @throws { BusinessError } 401 - The parameter check failed.
1945     * @throws { BusinessError } 12300001 - System service exception.
1946     * @throws { BusinessError } 12300002 - Invalid owner.
1947     * @throws { BusinessError } 12300010 - Account service busy.
1948     * @throws { BusinessError } 12300113 - Authenticator service not found.
1949     * @throws { BusinessError } 12300114 - Authenticator service exception.
1950     * @syscap SystemCapability.Account.AppAccount
1951     * @since 9
1952     */
1953    setAuthenticatorProperties(owner: string, callback: AuthCallback): void;
1954    /**
1955     * Sets properties for the specified account authenticator.
1956     * <p>
1957     * If the authenticator supports setting its properties,
1958     * the caller will normally be redirected to an Ability specified by Want for property setting.
1959     *
1960     * @param { string } owner - Indicates the owner of authenticator.
1961     * @param { SetPropertiesOptions } options - Indicates the options for setting properties.
1962     * @param { AuthCallback } callback - Indicates the authenticator callback.
1963     * @throws { BusinessError } 401 - The parameter check failed.
1964     * @throws { BusinessError } 12300001 - System service exception.
1965     * @throws { BusinessError } 12300002 - Invalid owner or options.
1966     * @throws { BusinessError } 12300010 - Account service busy.
1967     * @throws { BusinessError } 12300113 - Authenticator service not found.
1968     * @throws { BusinessError } 12300114 - Authenticator service exception.
1969     * @syscap SystemCapability.Account.AppAccount
1970     * @since 9
1971     */
1972    setAuthenticatorProperties(owner: string, options: SetPropertiesOptions, callback: AuthCallback): void;
1973  }
1974
1975  /**
1976   * Provides basic information of an application account, including the account owner and name.
1977   *
1978   * @interface AppAccountInfo
1979   * @syscap SystemCapability.Account.AppAccount
1980   * @since 7
1981   */
1982  interface AppAccountInfo {
1983    /**
1984     * The owner an application account.
1985     *
1986     * @type { string }
1987     * @syscap SystemCapability.Account.AppAccount
1988     * @since 7
1989     */
1990    owner: string;
1991
1992    /**
1993     * The name an application account.
1994     *
1995     * @type { string }
1996     * @syscap SystemCapability.Account.AppAccount
1997     * @since 7
1998     */
1999    name: string;
2000  }
2001
2002  /**
2003   * Provides basic information of an oauth token, including the authentication type and token value.
2004   *
2005   * @interface OAuthTokenInfo
2006   * @syscap SystemCapability.Account.AppAccount
2007   * @since 8
2008   * @deprecated since 9
2009   * @useinstead appAccount.AuthTokenInfo
2010   */
2011  interface OAuthTokenInfo {
2012    /**
2013     * The authentication type.
2014     *
2015     * @type { string }
2016     * @syscap SystemCapability.Account.AppAccount
2017     * @since 8
2018     * @deprecated since 9
2019     */
2020    authType: string;
2021
2022    /**
2023     * The token value.
2024     *
2025     * @type { string }
2026     * @syscap SystemCapability.Account.AppAccount
2027     * @since 8
2028     * @deprecated since 9
2029     */
2030    token: string;
2031  }
2032
2033  /**
2034   * Provides basic information of an auth token, including the authentication type and token value.
2035   *
2036   * @interface AuthTokenInfo
2037   * @syscap SystemCapability.Account.AppAccount
2038   * @since 9
2039   */
2040  interface AuthTokenInfo {
2041    /**
2042     * The authentication type.
2043     *
2044     * @type { string }
2045     * @syscap SystemCapability.Account.AppAccount
2046     * @since 9
2047     */
2048    authType: string;
2049
2050    /**
2051     * The token value.
2052     *
2053     * @type { string }
2054     * @syscap SystemCapability.Account.AppAccount
2055     * @since 9
2056     */
2057    token: string;
2058
2059    /**
2060     * The account to which the token belongs.
2061     *
2062     * @type { ?AppAccountInfo }
2063     * @syscap SystemCapability.Account.AppAccount
2064     * @since 9
2065     */
2066    account?: AppAccountInfo;
2067  }
2068
2069  /**
2070   * Provides basic information of an authenticator, including the authenticator owner, icon id and label id.
2071   *
2072   * @interface AuthenticatorInfo
2073   * @syscap SystemCapability.Account.AppAccount
2074   * @since 8
2075   */
2076  interface AuthenticatorInfo {
2077    /**
2078     * The owner of an authenticator.
2079     *
2080     * @type { string }
2081     * @syscap SystemCapability.Account.AppAccount
2082     * @since 8
2083     */
2084    owner: string;
2085
2086    /**
2087     * The icon id of an authenticator.
2088     *
2089     * @type { number }
2090     * @syscap SystemCapability.Account.AppAccount
2091     * @since 8
2092     */
2093    iconId: number;
2094
2095    /**
2096     * The label id of an authenticator.
2097     *
2098     * @type { number }
2099     * @syscap SystemCapability.Account.AppAccount
2100     * @since 8
2101     */
2102    labelId: number;
2103  }
2104
2105  /**
2106   * Provides the definition of the authentication result.
2107   *
2108   * @interface AuthResult
2109   * @syscap SystemCapability.Account.AppAccount
2110   * @since 9
2111   */
2112  interface AuthResult {
2113    /**
2114     * The account information.
2115     *
2116     * @type { ?AppAccountInfo }
2117     * @syscap SystemCapability.Account.AppAccount
2118     * @since 9
2119     */
2120    account?: AppAccountInfo;
2121
2122    /**
2123     * The token information.
2124     *
2125     * @type { ?AuthTokenInfo }
2126     * @syscap SystemCapability.Account.AppAccount
2127     * @since 9
2128     */
2129    tokenInfo?: AuthTokenInfo;
2130  }
2131
2132  /**
2133   * Provides the available options for creating an account.
2134   *
2135   * @interface CreateAccountOptions
2136   * @syscap SystemCapability.Account.AppAccount
2137   * @since 9
2138   */
2139  interface CreateAccountOptions {
2140    /**
2141     * The custom data for creating an account,
2142     * which can be further modified by function setCustomData.
2143     *
2144     * @type { ?Record<string, string> }
2145     * @syscap SystemCapability.Account.AppAccount
2146     * @since 9
2147     */
2148    customData?: Record<string, string>;
2149  }
2150
2151  /**
2152   * Provides the available options for creating an account implicitly.
2153   *
2154   * @interface CreateAccountImplicitlyOptions
2155   * @syscap SystemCapability.Account.AppAccount
2156   * @since 9
2157   */
2158  interface CreateAccountImplicitlyOptions {
2159    /**
2160     * The required labels for creating an account.
2161     *
2162     * @type { ?Array<string> }
2163     * @syscap SystemCapability.Account.AppAccount
2164     * @since 9
2165     */
2166    requiredLabels?: Array<string>;
2167
2168    /**
2169     * The authentication type.
2170     *
2171     * @type { ?string }
2172     * @syscap SystemCapability.Account.AppAccount
2173     * @since 9
2174     */
2175    authType?: string;
2176
2177    /**
2178     * The authenticator-specific parameters.
2179     * The list of reserved parameter name:
2180     * 1. Constants.KEY_CALLER_BUNDLE_NAME;
2181     * The above parameters are set by the appAccount management service and can be used for identify the caller.
2182     *
2183     * @type { ?Record<string, Object> }
2184     * @syscap SystemCapability.Account.AppAccount
2185     * @since 9
2186     */
2187    parameters?: Record<string, Object>;
2188  }
2189
2190  /**
2191   * Provides the available options for selecting accounts.
2192   *
2193   * @interface SelectAccountsOptions
2194   * @syscap SystemCapability.Account.AppAccount
2195   * @since 9
2196   */
2197  interface SelectAccountsOptions {
2198    /**
2199     * The list of accounts allowed to be selected.
2200     *
2201     * @type { ?Array<AppAccountInfo> }
2202     * @syscap SystemCapability.Account.AppAccount
2203     * @since 9
2204     */
2205    allowedAccounts?: Array<AppAccountInfo>;
2206
2207    /**
2208     * The list of account owners, whose accounts allowed to be selected.
2209     *
2210     * @type { ?Array<string> }
2211     * @syscap SystemCapability.Account.AppAccount
2212     * @since 9
2213     */
2214    allowedOwners?: Array<string>;
2215
2216    /**
2217     * The labels required for the selected accounts.
2218     *
2219     * @type { ?Array<string> }
2220     * @syscap SystemCapability.Account.AppAccount
2221     * @since 9
2222     */
2223    requiredLabels?: Array<string>;
2224  }
2225
2226  /**
2227   * Provides the available options for verifying credential.
2228   *
2229   * @interface VerifyCredentialOptions
2230   * @syscap SystemCapability.Account.AppAccount
2231   * @since 9
2232   */
2233  interface VerifyCredentialOptions {
2234    /**
2235     * The credential type to be verified.
2236     *
2237     * @type { ?string }
2238     * @syscap SystemCapability.Account.AppAccount
2239     * @since 9
2240     */
2241    credentialType?: string;
2242
2243    /**
2244     * The credential to be verified.
2245     *
2246     * @type { ?string }
2247     * @syscap SystemCapability.Account.AppAccount
2248     * @since 9
2249     */
2250    credential?: string;
2251
2252    /**
2253     * The authenticator-specific parameters.
2254     * The list of reserved parameter name:
2255     * 1. Constants.KEY_CALLER_BUNDLE_NAME;
2256     * The above parameters are set by the appAccount management service and can be used for identify the caller.
2257     *
2258     * @type { ?Record<string, Object> }
2259     * @syscap SystemCapability.Account.AppAccount
2260     * @since 9
2261     */
2262    parameters?: Record<string, Object>;
2263  }
2264
2265  /**
2266   * Provides the available options for setting properties.
2267   *
2268   * @interface SetPropertiesOptions
2269   * @syscap SystemCapability.Account.AppAccount
2270   * @since 9
2271   */
2272  interface SetPropertiesOptions {
2273    /**
2274     * The properties to be set.
2275     *
2276     * @type { ?Record<string, Object> }
2277     * @syscap SystemCapability.Account.AppAccount
2278     * @since 9
2279     */
2280    properties?: Record<string, Object>;
2281
2282    /**
2283     * The authenticator-specific parameters.
2284     * The list of reserved parameter name:
2285     * 1. Constants.KEY_CALLER_BUNDLE_NAME;
2286     * The above parameters are set by the appAccount management service and can be used for identify the caller.
2287     *
2288     * @type { ?Record<string, Object> }
2289     * @syscap SystemCapability.Account.AppAccount
2290     * @since 9
2291     */
2292    parameters?: Record<string, Object>;
2293  }
2294
2295  /**
2296   * Provides constants definition.
2297   *
2298   * @enum { string } Constants
2299   * @syscap SystemCapability.Account.AppAccount
2300   * @since 8
2301   */
2302  enum Constants {
2303    /**
2304     * Indicates the action for adding account implicitly.
2305     *
2306     * @syscap SystemCapability.Account.AppAccount
2307     * @since 8
2308     * @deprecated since 9
2309     * @useinstead appAccount.Constants#ACTION_CREATE_ACCOUNT_IMPLICITLY
2310     */
2311    ACTION_ADD_ACCOUNT_IMPLICITLY = 'addAccountImplicitly',
2312
2313    /**
2314     * Indicates the action for authenticating.
2315     *
2316     * @syscap SystemCapability.Account.AppAccount
2317     * @since 8
2318     * @deprecated since 9
2319     * @useinstead appAccount.Constants#ACTION_AUTH
2320     */
2321    ACTION_AUTHENTICATE = 'authenticate',
2322
2323    /**
2324     * Indicates the action for creating account implicitly.
2325     *
2326     * @syscap SystemCapability.Account.AppAccount
2327     * @since 9
2328     */
2329    ACTION_CREATE_ACCOUNT_IMPLICITLY = 'createAccountImplicitly',
2330
2331    /**
2332     * Indicates the action for authenticating.
2333     *
2334     * @syscap SystemCapability.Account.AppAccount
2335     * @since 9
2336     */
2337    ACTION_AUTH = 'auth',
2338
2339    /**
2340     * Indicates the action for verifying credential.
2341     *
2342     * @syscap SystemCapability.Account.AppAccount
2343     * @since 9
2344     */
2345    ACTION_VERIFY_CREDENTIAL = 'verifyCredential',
2346
2347    /**
2348     * Indicates the action for set authenticator properties.
2349     *
2350     * @syscap SystemCapability.Account.AppAccount
2351     * @since 9
2352     */
2353    ACTION_SET_AUTHENTICATOR_PROPERTIES = 'setAuthenticatorProperties',
2354
2355    /**
2356     * Indicates the key of name.
2357     *
2358     * @syscap SystemCapability.Account.AppAccount
2359     * @since 8
2360     */
2361    KEY_NAME = 'name',
2362
2363    /**
2364     * Indicates the key of owner.
2365     *
2366     * @syscap SystemCapability.Account.AppAccount
2367     * @since 8
2368     */
2369    KEY_OWNER = 'owner',
2370
2371    /**
2372     * Indicates the key of token.
2373     *
2374     * @syscap SystemCapability.Account.AppAccount
2375     * @since 8
2376     */
2377    KEY_TOKEN = 'token',
2378
2379    /**
2380     * Indicates the key of action.
2381     *
2382     * @syscap SystemCapability.Account.AppAccount
2383     * @since 8
2384     */
2385    KEY_ACTION = 'action',
2386
2387    /**
2388     * Indicates the key of authentication type.
2389     *
2390     * @syscap SystemCapability.Account.AppAccount
2391     * @since 8
2392     */
2393    KEY_AUTH_TYPE = 'authType',
2394
2395    /**
2396     * Indicates the key of session id.
2397     *
2398     * @syscap SystemCapability.Account.AppAccount
2399     * @since 8
2400     */
2401    KEY_SESSION_ID = 'sessionId',
2402
2403    /**
2404     * Indicates the key of caller pid.
2405     *
2406     * @syscap SystemCapability.Account.AppAccount
2407     * @since 8
2408     */
2409    KEY_CALLER_PID = 'callerPid',
2410
2411    /**
2412     * Indicates the key of caller uid.
2413     *
2414     * @syscap SystemCapability.Account.AppAccount
2415     * @since 8
2416     */
2417    KEY_CALLER_UID = 'callerUid',
2418
2419    /**
2420     * Indicates the key of caller bundle name.
2421     *
2422     * @syscap SystemCapability.Account.AppAccount
2423     * @since 8
2424     */
2425    KEY_CALLER_BUNDLE_NAME = 'callerBundleName',
2426
2427    /**
2428     * Indicates the key of required labels.
2429     *
2430     * @syscap SystemCapability.Account.AppAccount
2431     * @since 9
2432     */
2433    KEY_REQUIRED_LABELS = 'requiredLabels',
2434
2435    /**
2436     * Indicates the key of boolean result.
2437     *
2438     * @syscap SystemCapability.Account.AppAccount
2439     * @since 9
2440     */
2441    KEY_BOOLEAN_RESULT = 'booleanResult'
2442  }
2443
2444  /**
2445   * Provides result code definition.
2446   *
2447   * @enum { number } ResultCode
2448   * @syscap SystemCapability.Account.AppAccount
2449   * @since 8
2450   * @deprecated since 9
2451   */
2452  enum ResultCode {
2453    /**
2454    * Indicates the success result.
2455    *
2456    * @syscap SystemCapability.Account.AppAccount
2457    * @since 8
2458    * @deprecated since 9
2459    */
2460    SUCCESS = 0,
2461
2462    /**
2463    * Indicates the result of account not exist.
2464    *
2465    * @syscap SystemCapability.Account.AppAccount
2466    * @since 8
2467    * @deprecated since 9
2468    */
2469    ERROR_ACCOUNT_NOT_EXIST = 10001,
2470
2471    /**
2472    * Indicates the result of account service exception.
2473    *
2474    * @syscap SystemCapability.Account.AppAccount
2475    * @since 8
2476    * @deprecated since 9
2477    */
2478    ERROR_APP_ACCOUNT_SERVICE_EXCEPTION = 10002,
2479
2480    /**
2481    * Indicates the result of password is invalid.
2482    *
2483    * @syscap SystemCapability.Account.AppAccount
2484    * @since 8
2485    * @deprecated since 9
2486    */
2487    ERROR_INVALID_PASSWORD = 10003,
2488
2489    /**
2490    * Indicates the result of request is invalid.
2491    *
2492    * @syscap SystemCapability.Account.AppAccount
2493    * @since 8
2494    * @deprecated since 9
2495    */
2496    ERROR_INVALID_REQUEST = 10004,
2497
2498    /**
2499    * Indicates the result of response is invalid.
2500    *
2501    * @syscap SystemCapability.Account.AppAccount
2502    * @since 8
2503    * @deprecated since 9
2504    */
2505    ERROR_INVALID_RESPONSE = 10005,
2506
2507    /**
2508    * Indicates the result of network exception.
2509    *
2510    * @syscap SystemCapability.Account.AppAccount
2511    * @since 8
2512    * @deprecated since 9
2513    */
2514    ERROR_NETWORK_EXCEPTION = 10006,
2515
2516    /**
2517    * Indicates the result of network exception.
2518    *
2519    * @syscap SystemCapability.Account.AppAccount
2520    * @since 8
2521    * @deprecated since 9
2522    */
2523    ERROR_OAUTH_AUTHENTICATOR_NOT_EXIST = 10007,
2524
2525    /**
2526    * Indicates the result of auth has been canceled.
2527    *
2528    * @syscap SystemCapability.Account.AppAccount
2529    * @since 8
2530    * @deprecated since 9
2531    */
2532    ERROR_OAUTH_CANCELED = 10008,
2533
2534    /**
2535    * Indicates the result of auth list is too large.
2536    *
2537    * @syscap SystemCapability.Account.AppAccount
2538    * @since 8
2539    * @deprecated since 9
2540    */
2541    ERROR_OAUTH_LIST_TOO_LARGE = 10009,
2542
2543    /**
2544    * Indicates the result of auth service is busy.
2545    *
2546    * @syscap SystemCapability.Account.AppAccount
2547    * @since 8
2548    * @deprecated since 9
2549    */
2550    ERROR_OAUTH_SERVICE_BUSY = 10010,
2551
2552    /**
2553    * Indicates the result of auth service exception.
2554    *
2555    * @syscap SystemCapability.Account.AppAccount
2556    * @since 8
2557    * @deprecated since 9
2558    */
2559    ERROR_OAUTH_SERVICE_EXCEPTION = 10011,
2560
2561    /**
2562    * Indicates the result of auth session is not exist.
2563    *
2564    * @syscap SystemCapability.Account.AppAccount
2565    * @since 8
2566    * @deprecated since 9
2567    */
2568    ERROR_OAUTH_SESSION_NOT_EXIST = 10012,
2569
2570    /**
2571    * Indicates the result of auth timeout.
2572    *
2573    * @syscap SystemCapability.Account.AppAccount
2574    * @since 8
2575    * @deprecated since 9
2576    */
2577    ERROR_OAUTH_TIMEOUT = 10013,
2578
2579    /**
2580    * Indicates the result of token is not exist.
2581    *
2582    * @syscap SystemCapability.Account.AppAccount
2583    * @since 8
2584    * @deprecated since 9
2585    */
2586    ERROR_OAUTH_TOKEN_NOT_EXIST = 10014,
2587
2588    /**
2589    * Indicates the result of token is too many.
2590    *
2591    * @syscap SystemCapability.Account.AppAccount
2592    * @since 8
2593    * @deprecated since 9
2594    */
2595    ERROR_OAUTH_TOKEN_TOO_MANY = 10015,
2596
2597    /**
2598    * Indicates the result of not supported action.
2599    *
2600    * @syscap SystemCapability.Account.AppAccount
2601    * @since 8
2602    * @deprecated since 9
2603    */
2604    ERROR_OAUTH_UNSUPPORT_ACTION = 10016,
2605
2606    /**
2607    * Indicates the result of not supported auth type.
2608    *
2609    * @syscap SystemCapability.Account.AppAccount
2610    * @since 8
2611    * @deprecated since 9
2612    */
2613    ERROR_OAUTH_UNSUPPORT_AUTH_TYPE = 10017,
2614
2615    /**
2616    * Indicates the result of permission denied.
2617    *
2618    * @syscap SystemCapability.Account.AppAccount
2619    * @since 8
2620    * @deprecated since 9
2621    */
2622    ERROR_PERMISSION_DENIED = 10018
2623  }
2624
2625  /**
2626   * Provides methods for authenticator callback.
2627   *
2628   * @interface AuthenticatorCallback
2629   * @syscap SystemCapability.Account.AppAccount
2630   * @since 8
2631   * @deprecated since 9
2632   * @useinstead AppAccount.AuthCallback
2633   */
2634  interface AuthenticatorCallback {
2635    /**
2636     * Notifies the client of the authentication result.
2637     *
2638     * @syscap SystemCapability.Account.AppAccount
2639     * @since 8
2640     * @deprecated since 9
2641     */
2642    onResult: (code: number, result: { [key: string]: any }) => void;
2643
2644    /**
2645     * Notifies the client that the authentication request need to be redirected.
2646     *
2647     * @syscap SystemCapability.Account.AppAccount
2648     * @since 8
2649     * @deprecated since 9
2650     */
2651    onRequestRedirected: (request: Want) => void;
2652  }
2653
2654  /**
2655   * Provides methods for authentication callback.
2656   *
2657   * @interface AuthCallback
2658   * @syscap SystemCapability.Account.AppAccount
2659   * @since 9
2660   */
2661  interface AuthCallback {
2662    /**
2663     * Notifies the client of the authentication result.
2664     *
2665     * @syscap SystemCapability.Account.AppAccount
2666     * @since 9
2667     */
2668    onResult: (code: number, result?: AuthResult) => void;
2669
2670    /**
2671     * Notifies the client that the authentication request need to be redirected.
2672     *
2673     * @syscap SystemCapability.Account.AppAccount
2674     * @since 9
2675     */
2676    onRequestRedirected: (request: Want) => void;
2677
2678    /**
2679     * Notifies the client that the request is continued.
2680     *
2681     * @syscap SystemCapability.Account.AppAccount
2682     * @since 9
2683     */
2684    onRequestContinued?: () => void;
2685  }
2686
2687  /**
2688   * Provides methods for authenticator.
2689   *
2690   * @syscap SystemCapability.Account.AppAccount
2691   * @since 8
2692   * @name Authenticator
2693   */
2694  class Authenticator {
2695    /**
2696     * Adds an application account of a specified owner implicitly.
2697     *
2698     * @param { string } authType - Indicates the authentication type.
2699     * @param { string } callerBundleName - Indicates the caller bundle name.
2700     * @param { object } options - Indicates the authenticator-specific options for the request.
2701     * @param { AuthenticatorCallback } callback - Indicates the authenticator callback.
2702     * @syscap SystemCapability.Account.AppAccount
2703     * @since 8
2704     * @deprecated since 9
2705     * @useinstead appAccount.Authenticator#createAccountImplicitly
2706     */
2707    addAccountImplicitly(
2708      authType: string,
2709      callerBundleName: string,
2710      options: { [key: string]: any },
2711      callback: AuthenticatorCallback
2712    ): void;
2713
2714    /**
2715     * Creates an application account of a specified owner implicitly.
2716     *
2717     * @param { CreateAccountImplicitlyOptions } options - Indicates the authenticator-specific options for the request.
2718     * @param { AuthCallback } callback - Indicates the authenticator callback.
2719     * @syscap SystemCapability.Account.AppAccount
2720     * @since 9
2721     */
2722    createAccountImplicitly(options: CreateAccountImplicitlyOptions, callback: AuthCallback): void;
2723
2724    /**
2725     * Authenticates an application account to get an oauth token.
2726     *
2727     * @param { string } name - Indicates the account name.
2728     * @param { string } authType - Indicates the authentication type.
2729     * @param { string } callerBundleName - Indicates the caller bundle name.
2730     * @param { object } options - Indicates the authenticator-specific options for the request.
2731     * @param { AuthenticatorCallback } callback - Indicates the authenticator callback.
2732     * @syscap SystemCapability.Account.AppAccount
2733     * @since 8
2734     * @deprecated since 9
2735     * @useinstead appAccount.Authenticator#auth
2736     */
2737    authenticate(
2738      name: string,
2739      authType: string,
2740      callerBundleName: string,
2741      options: { [key: string]: any },
2742      callback: AuthenticatorCallback
2743    ): void;
2744
2745    /**
2746     * Authenticates an application account to get an oauth token.
2747     *
2748     * @param { string } name - Indicates the account name.
2749     * @param { string } authType - Indicates the authentication type.
2750     * @param { Record<string, Object> } options - Indicates the authenticator-specific options for the request.
2751     * @param { AuthCallback } callback - Indicates the authenticator callback.
2752     * @syscap SystemCapability.Account.AppAccount
2753     * @since 9
2754     */
2755    auth(name: string, authType: string, options: Record<string, Object>, callback: AuthCallback): void;
2756
2757    /**
2758     * Verifies the credential to ensure the user is the owner of the specified application account.
2759     * <p>
2760     * The credential can be provided in the options, otherwise an Ability will normally be returned,
2761     * which can be started by the caller to further verify credential.
2762     *
2763     * @param { string } name - Indicates the name of the application account.
2764     * @param { VerifyCredentialOptions } options - Indicates the options for verifying credential.
2765     * @param { AuthCallback } callback - Indicates the authenticator callback.
2766     * @syscap SystemCapability.Account.AppAccount
2767     * @since 9
2768     */
2769    verifyCredential(name: string, options: VerifyCredentialOptions, callback: AuthCallback): void;
2770
2771    /**
2772     * Sets properties for the authenticator.
2773     *
2774     * @param { SetPropertiesOptions } options - Indicates the options for setting properties.
2775     * @param { AuthCallback } callback - Indicates the authenticator callback.
2776     * @syscap SystemCapability.Account.AppAccount
2777     * @since 9
2778     */
2779    setProperties(options: SetPropertiesOptions, callback: AuthCallback): void;
2780
2781    /**
2782     * Checks whether a particular account has all specified labels.
2783     *
2784     * @param { string } name - Indicates the account name.
2785     * @param { Array<string> } labels - Indicates an array of labels to check.
2786     * @param { AuthCallback } callback - Indicates the authenticator callback.
2787     * @syscap SystemCapability.Account.AppAccount
2788     * @since 9
2789     */
2790    checkAccountLabels(name: string, labels: Array<string>, callback: AuthCallback): void;
2791
2792    /**
2793     * Checks whether the specified account can be removed.
2794     *
2795     * @param { string } name - Indicates the account name.
2796     * @param { AuthCallback } callback - Indicates the authenticator callback.
2797     * @syscap SystemCapability.Account.AppAccount
2798     * @since 9
2799     */
2800    checkAccountRemovable(name: string, callback: AuthCallback): void;
2801
2802    /**
2803     * Gets the remote object of the authenticator for remote procedure call.
2804     *
2805     * @returns { rpc.RemoteObject } Returns a remote object.
2806     * @syscap SystemCapability.Account.AppAccount
2807     * @since 9
2808     */
2809    getRemoteObject(): rpc.RemoteObject;
2810  }
2811}
2812
2813export default appAccount;
2814