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