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 * @useinstead appAccount.AuthTokenInfo.authType 2179 */ 2180 authType: string; 2181 2182 /** 2183 * The token value. 2184 * 2185 * @type { string } 2186 * @syscap SystemCapability.Account.AppAccount 2187 * @since 8 2188 * @deprecated since 9 2189 * @useinstead appAccount.AuthTokenInfo.token 2190 */ 2191 token: string; 2192 } 2193 2194 /** 2195 * Provides basic information of an auth token, including the authentication type and token value. 2196 * 2197 * @interface AuthTokenInfo 2198 * @syscap SystemCapability.Account.AppAccount 2199 * @since 9 2200 */ 2201 interface AuthTokenInfo { 2202 /** 2203 * The authentication type. 2204 * 2205 * @type { string } 2206 * @syscap SystemCapability.Account.AppAccount 2207 * @since 9 2208 */ 2209 authType: string; 2210 2211 /** 2212 * The token value. 2213 * 2214 * @type { string } 2215 * @syscap SystemCapability.Account.AppAccount 2216 * @since 9 2217 */ 2218 token: string; 2219 2220 /** 2221 * The account to which the token belongs. 2222 * 2223 * @type { ?AppAccountInfo } 2224 * @syscap SystemCapability.Account.AppAccount 2225 * @since 9 2226 */ 2227 account?: AppAccountInfo; 2228 } 2229 2230 /** 2231 * Provides basic information of an authenticator, including the authenticator owner, icon id and label id. 2232 * 2233 * @interface AuthenticatorInfo 2234 * @syscap SystemCapability.Account.AppAccount 2235 * @since 8 2236 */ 2237 interface AuthenticatorInfo { 2238 /** 2239 * The owner of an authenticator. 2240 * 2241 * @type { string } 2242 * @syscap SystemCapability.Account.AppAccount 2243 * @since 8 2244 */ 2245 owner: string; 2246 2247 /** 2248 * The icon id of an authenticator. 2249 * 2250 * @type { number } 2251 * @syscap SystemCapability.Account.AppAccount 2252 * @since 8 2253 */ 2254 iconId: number; 2255 2256 /** 2257 * The label id of an authenticator. 2258 * 2259 * @type { number } 2260 * @syscap SystemCapability.Account.AppAccount 2261 * @since 8 2262 */ 2263 labelId: number; 2264 } 2265 2266 /** 2267 * Provides the definition of the authentication result. 2268 * 2269 * @interface AuthResult 2270 * @syscap SystemCapability.Account.AppAccount 2271 * @since 9 2272 */ 2273 interface AuthResult { 2274 /** 2275 * The account information. 2276 * 2277 * @type { ?AppAccountInfo } 2278 * @syscap SystemCapability.Account.AppAccount 2279 * @since 9 2280 */ 2281 account?: AppAccountInfo; 2282 2283 /** 2284 * The token information. 2285 * 2286 * @type { ?AuthTokenInfo } 2287 * @syscap SystemCapability.Account.AppAccount 2288 * @since 9 2289 */ 2290 tokenInfo?: AuthTokenInfo; 2291 } 2292 2293 /** 2294 * Provides the available options for creating an account. 2295 * 2296 * @interface CreateAccountOptions 2297 * @syscap SystemCapability.Account.AppAccount 2298 * @since 9 2299 */ 2300 interface CreateAccountOptions { 2301 /** 2302 * The custom data for creating an account, 2303 * which can be further modified by function setCustomData. 2304 * 2305 * @type { ?Record<string, string> } 2306 * @syscap SystemCapability.Account.AppAccount 2307 * @since 9 2308 */ 2309 customData?: Record<string, string>; 2310 } 2311 2312 /** 2313 * Provides the available options for creating an account implicitly. 2314 * 2315 * @interface CreateAccountImplicitlyOptions 2316 * @syscap SystemCapability.Account.AppAccount 2317 * @since 9 2318 */ 2319 interface CreateAccountImplicitlyOptions { 2320 /** 2321 * The required labels for creating an account. 2322 * 2323 * @type { ?Array<string> } 2324 * @syscap SystemCapability.Account.AppAccount 2325 * @since 9 2326 */ 2327 requiredLabels?: Array<string>; 2328 2329 /** 2330 * The authentication type. 2331 * 2332 * @type { ?string } 2333 * @syscap SystemCapability.Account.AppAccount 2334 * @since 9 2335 */ 2336 authType?: string; 2337 2338 /** 2339 * The authenticator-specific parameters. 2340 * The list of reserved parameter name: 2341 * 1. Constants.KEY_CALLER_BUNDLE_NAME; 2342 * The above parameters are set by the appAccount management service and can be used for identify the caller. 2343 * 2344 * @type { ?Record<string, Object> } 2345 * @syscap SystemCapability.Account.AppAccount 2346 * @since 9 2347 */ 2348 parameters?: Record<string, Object>; 2349 } 2350 2351 /** 2352 * Provides the available options for selecting accounts. 2353 * 2354 * @interface SelectAccountsOptions 2355 * @syscap SystemCapability.Account.AppAccount 2356 * @since 9 2357 */ 2358 interface SelectAccountsOptions { 2359 /** 2360 * The list of accounts allowed to be selected. 2361 * 2362 * @type { ?Array<AppAccountInfo> } 2363 * @syscap SystemCapability.Account.AppAccount 2364 * @since 9 2365 */ 2366 allowedAccounts?: Array<AppAccountInfo>; 2367 2368 /** 2369 * The list of account owners, whose accounts allowed to be selected. 2370 * 2371 * @type { ?Array<string> } 2372 * @syscap SystemCapability.Account.AppAccount 2373 * @since 9 2374 */ 2375 allowedOwners?: Array<string>; 2376 2377 /** 2378 * The labels required for the selected accounts. 2379 * 2380 * @type { ?Array<string> } 2381 * @syscap SystemCapability.Account.AppAccount 2382 * @since 9 2383 */ 2384 requiredLabels?: Array<string>; 2385 } 2386 2387 /** 2388 * Provides the available options for verifying credential. 2389 * 2390 * @interface VerifyCredentialOptions 2391 * @syscap SystemCapability.Account.AppAccount 2392 * @since 9 2393 */ 2394 interface VerifyCredentialOptions { 2395 /** 2396 * The credential type to be verified. 2397 * 2398 * @type { ?string } 2399 * @syscap SystemCapability.Account.AppAccount 2400 * @since 9 2401 */ 2402 credentialType?: string; 2403 2404 /** 2405 * The credential to be verified. 2406 * 2407 * @type { ?string } 2408 * @syscap SystemCapability.Account.AppAccount 2409 * @since 9 2410 */ 2411 credential?: string; 2412 2413 /** 2414 * The authenticator-specific parameters. 2415 * The list of reserved parameter name: 2416 * 1. Constants.KEY_CALLER_BUNDLE_NAME; 2417 * The above parameters are set by the appAccount management service and can be used for identify the caller. 2418 * 2419 * @type { ?Record<string, Object> } 2420 * @syscap SystemCapability.Account.AppAccount 2421 * @since 9 2422 */ 2423 parameters?: Record<string, Object>; 2424 } 2425 2426 /** 2427 * Provides the available options for setting properties. 2428 * 2429 * @interface SetPropertiesOptions 2430 * @syscap SystemCapability.Account.AppAccount 2431 * @since 9 2432 */ 2433 interface SetPropertiesOptions { 2434 /** 2435 * The properties to be set. 2436 * 2437 * @type { ?Record<string, Object> } 2438 * @syscap SystemCapability.Account.AppAccount 2439 * @since 9 2440 */ 2441 properties?: Record<string, Object>; 2442 2443 /** 2444 * The authenticator-specific parameters. 2445 * The list of reserved parameter name: 2446 * 1. Constants.KEY_CALLER_BUNDLE_NAME; 2447 * The above parameters are set by the appAccount management service and can be used for identify the caller. 2448 * 2449 * @type { ?Record<string, Object> } 2450 * @syscap SystemCapability.Account.AppAccount 2451 * @since 9 2452 */ 2453 parameters?: Record<string, Object>; 2454 } 2455 2456 /** 2457 * Provides constants definition. 2458 * 2459 * @enum { string } Constants 2460 * @syscap SystemCapability.Account.AppAccount 2461 * @since 8 2462 */ 2463 enum Constants { 2464 /** 2465 * Indicates the action for adding account implicitly. 2466 * 2467 * @syscap SystemCapability.Account.AppAccount 2468 * @since 8 2469 * @deprecated since 9 2470 * @useinstead appAccount.Constants#ACTION_CREATE_ACCOUNT_IMPLICITLY 2471 */ 2472 ACTION_ADD_ACCOUNT_IMPLICITLY = 'addAccountImplicitly', 2473 2474 /** 2475 * Indicates the action for authenticating. 2476 * 2477 * @syscap SystemCapability.Account.AppAccount 2478 * @since 8 2479 * @deprecated since 9 2480 * @useinstead appAccount.Constants#ACTION_AUTH 2481 */ 2482 ACTION_AUTHENTICATE = 'authenticate', 2483 2484 /** 2485 * Indicates the action for creating account implicitly. 2486 * 2487 * @syscap SystemCapability.Account.AppAccount 2488 * @since 9 2489 */ 2490 ACTION_CREATE_ACCOUNT_IMPLICITLY = 'createAccountImplicitly', 2491 2492 /** 2493 * Indicates the action for authenticating. 2494 * 2495 * @syscap SystemCapability.Account.AppAccount 2496 * @since 9 2497 */ 2498 ACTION_AUTH = 'auth', 2499 2500 /** 2501 * Indicates the action for verifying credential. 2502 * 2503 * @syscap SystemCapability.Account.AppAccount 2504 * @since 9 2505 */ 2506 ACTION_VERIFY_CREDENTIAL = 'verifyCredential', 2507 2508 /** 2509 * Indicates the action for set authenticator properties. 2510 * 2511 * @syscap SystemCapability.Account.AppAccount 2512 * @since 9 2513 */ 2514 ACTION_SET_AUTHENTICATOR_PROPERTIES = 'setAuthenticatorProperties', 2515 2516 /** 2517 * Indicates the key of name. 2518 * 2519 * @syscap SystemCapability.Account.AppAccount 2520 * @since 8 2521 */ 2522 KEY_NAME = 'name', 2523 2524 /** 2525 * Indicates the key of owner. 2526 * 2527 * @syscap SystemCapability.Account.AppAccount 2528 * @since 8 2529 */ 2530 KEY_OWNER = 'owner', 2531 2532 /** 2533 * Indicates the key of token. 2534 * 2535 * @syscap SystemCapability.Account.AppAccount 2536 * @since 8 2537 */ 2538 KEY_TOKEN = 'token', 2539 2540 /** 2541 * Indicates the key of action. 2542 * 2543 * @syscap SystemCapability.Account.AppAccount 2544 * @since 8 2545 */ 2546 KEY_ACTION = 'action', 2547 2548 /** 2549 * Indicates the key of authentication type. 2550 * 2551 * @syscap SystemCapability.Account.AppAccount 2552 * @since 8 2553 */ 2554 KEY_AUTH_TYPE = 'authType', 2555 2556 /** 2557 * Indicates the key of session id. 2558 * 2559 * @syscap SystemCapability.Account.AppAccount 2560 * @since 8 2561 */ 2562 KEY_SESSION_ID = 'sessionId', 2563 2564 /** 2565 * Indicates the key of caller pid. 2566 * 2567 * @syscap SystemCapability.Account.AppAccount 2568 * @since 8 2569 */ 2570 KEY_CALLER_PID = 'callerPid', 2571 2572 /** 2573 * Indicates the key of caller uid. 2574 * 2575 * @syscap SystemCapability.Account.AppAccount 2576 * @since 8 2577 */ 2578 KEY_CALLER_UID = 'callerUid', 2579 2580 /** 2581 * Indicates the key of caller bundle name. 2582 * 2583 * @syscap SystemCapability.Account.AppAccount 2584 * @since 8 2585 */ 2586 KEY_CALLER_BUNDLE_NAME = 'callerBundleName', 2587 2588 /** 2589 * Indicates the key of required labels. 2590 * 2591 * @syscap SystemCapability.Account.AppAccount 2592 * @since 9 2593 */ 2594 KEY_REQUIRED_LABELS = 'requiredLabels', 2595 2596 /** 2597 * Indicates the key of boolean result. 2598 * 2599 * @syscap SystemCapability.Account.AppAccount 2600 * @since 9 2601 */ 2602 KEY_BOOLEAN_RESULT = 'booleanResult' 2603 } 2604 2605 /** 2606 * Provides result code definition. 2607 * 2608 * @enum { number } ResultCode 2609 * @syscap SystemCapability.Account.AppAccount 2610 * @since 8 2611 * @deprecated since 9 2612 */ 2613 enum ResultCode { 2614 /** 2615 * Indicates the success result. 2616 * 2617 * @syscap SystemCapability.Account.AppAccount 2618 * @since 8 2619 * @deprecated since 9 2620 */ 2621 SUCCESS = 0, 2622 2623 /** 2624 * Indicates the result of account not exist. 2625 * 2626 * @syscap SystemCapability.Account.AppAccount 2627 * @since 8 2628 * @deprecated since 9 2629 */ 2630 ERROR_ACCOUNT_NOT_EXIST = 10001, 2631 2632 /** 2633 * Indicates the result of account service exception. 2634 * 2635 * @syscap SystemCapability.Account.AppAccount 2636 * @since 8 2637 * @deprecated since 9 2638 */ 2639 ERROR_APP_ACCOUNT_SERVICE_EXCEPTION = 10002, 2640 2641 /** 2642 * Indicates the result of password is invalid. 2643 * 2644 * @syscap SystemCapability.Account.AppAccount 2645 * @since 8 2646 * @deprecated since 9 2647 */ 2648 ERROR_INVALID_PASSWORD = 10003, 2649 2650 /** 2651 * Indicates the result of request is invalid. 2652 * 2653 * @syscap SystemCapability.Account.AppAccount 2654 * @since 8 2655 * @deprecated since 9 2656 */ 2657 ERROR_INVALID_REQUEST = 10004, 2658 2659 /** 2660 * Indicates the result of response is invalid. 2661 * 2662 * @syscap SystemCapability.Account.AppAccount 2663 * @since 8 2664 * @deprecated since 9 2665 */ 2666 ERROR_INVALID_RESPONSE = 10005, 2667 2668 /** 2669 * Indicates the result of network exception. 2670 * 2671 * @syscap SystemCapability.Account.AppAccount 2672 * @since 8 2673 * @deprecated since 9 2674 */ 2675 ERROR_NETWORK_EXCEPTION = 10006, 2676 2677 /** 2678 * Indicates the result of network exception. 2679 * 2680 * @syscap SystemCapability.Account.AppAccount 2681 * @since 8 2682 * @deprecated since 9 2683 */ 2684 ERROR_OAUTH_AUTHENTICATOR_NOT_EXIST = 10007, 2685 2686 /** 2687 * Indicates the result of auth has been canceled. 2688 * 2689 * @syscap SystemCapability.Account.AppAccount 2690 * @since 8 2691 * @deprecated since 9 2692 */ 2693 ERROR_OAUTH_CANCELED = 10008, 2694 2695 /** 2696 * Indicates the result of auth list is too large. 2697 * 2698 * @syscap SystemCapability.Account.AppAccount 2699 * @since 8 2700 * @deprecated since 9 2701 */ 2702 ERROR_OAUTH_LIST_TOO_LARGE = 10009, 2703 2704 /** 2705 * Indicates the result of auth service is busy. 2706 * 2707 * @syscap SystemCapability.Account.AppAccount 2708 * @since 8 2709 * @deprecated since 9 2710 */ 2711 ERROR_OAUTH_SERVICE_BUSY = 10010, 2712 2713 /** 2714 * Indicates the result of auth service exception. 2715 * 2716 * @syscap SystemCapability.Account.AppAccount 2717 * @since 8 2718 * @deprecated since 9 2719 */ 2720 ERROR_OAUTH_SERVICE_EXCEPTION = 10011, 2721 2722 /** 2723 * Indicates the result of auth session is not exist. 2724 * 2725 * @syscap SystemCapability.Account.AppAccount 2726 * @since 8 2727 * @deprecated since 9 2728 */ 2729 ERROR_OAUTH_SESSION_NOT_EXIST = 10012, 2730 2731 /** 2732 * Indicates the result of auth timeout. 2733 * 2734 * @syscap SystemCapability.Account.AppAccount 2735 * @since 8 2736 * @deprecated since 9 2737 */ 2738 ERROR_OAUTH_TIMEOUT = 10013, 2739 2740 /** 2741 * Indicates the result of token is not exist. 2742 * 2743 * @syscap SystemCapability.Account.AppAccount 2744 * @since 8 2745 * @deprecated since 9 2746 */ 2747 ERROR_OAUTH_TOKEN_NOT_EXIST = 10014, 2748 2749 /** 2750 * Indicates the result of token is too many. 2751 * 2752 * @syscap SystemCapability.Account.AppAccount 2753 * @since 8 2754 * @deprecated since 9 2755 */ 2756 ERROR_OAUTH_TOKEN_TOO_MANY = 10015, 2757 2758 /** 2759 * Indicates the result of not supported action. 2760 * 2761 * @syscap SystemCapability.Account.AppAccount 2762 * @since 8 2763 * @deprecated since 9 2764 */ 2765 ERROR_OAUTH_UNSUPPORT_ACTION = 10016, 2766 2767 /** 2768 * Indicates the result of not supported auth type. 2769 * 2770 * @syscap SystemCapability.Account.AppAccount 2771 * @since 8 2772 * @deprecated since 9 2773 */ 2774 ERROR_OAUTH_UNSUPPORT_AUTH_TYPE = 10017, 2775 2776 /** 2777 * Indicates the result of permission denied. 2778 * 2779 * @syscap SystemCapability.Account.AppAccount 2780 * @since 8 2781 * @deprecated since 9 2782 */ 2783 ERROR_PERMISSION_DENIED = 10018 2784 } 2785 2786 /** 2787 * Provides methods for authenticator callback. 2788 * 2789 * @interface AuthenticatorCallback 2790 * @syscap SystemCapability.Account.AppAccount 2791 * @since 8 2792 * @deprecated since 9 2793 * @useinstead AppAccount.AuthCallback 2794 */ 2795 interface AuthenticatorCallback { 2796 /** 2797 * Notifies the client of the authentication result. 2798 * 2799 * @type { function } 2800 * @syscap SystemCapability.Account.AppAccount 2801 * @since 8 2802 * @deprecated since 9 2803 * @useinstead AppAccount.AuthCallback.onResult 2804 */ 2805 onResult: (code: number, result: { [key: string]: any }) => void; 2806 2807 /** 2808 * Notifies the client that the authentication request need to be redirected. 2809 * 2810 * @type { function } 2811 * @syscap SystemCapability.Account.AppAccount 2812 * @since 8 2813 * @deprecated since 9 2814 * @useinstead AppAccount.AuthCallback.onRequestRedirected 2815 */ 2816 onRequestRedirected: (request: Want) => void; 2817 } 2818 2819 /** 2820 * Provides methods for authentication callback. 2821 * 2822 * @interface AuthCallback 2823 * @syscap SystemCapability.Account.AppAccount 2824 * @since 9 2825 */ 2826 interface AuthCallback { 2827 /** 2828 * Notifies the client of the authentication result. 2829 * 2830 * @type { function } 2831 * @syscap SystemCapability.Account.AppAccount 2832 * @since 9 2833 */ 2834 onResult: (code: number, result?: AuthResult) => void; 2835 2836 /** 2837 * Notifies the client that the authentication request need to be redirected. 2838 * 2839 * @type { function } 2840 * @syscap SystemCapability.Account.AppAccount 2841 * @since 9 2842 */ 2843 onRequestRedirected: (request: Want) => void; 2844 2845 /** 2846 * Notifies the client that the request is continued. 2847 * 2848 * @type { ?function } 2849 * @syscap SystemCapability.Account.AppAccount 2850 * @since 9 2851 */ 2852 onRequestContinued?: () => void; 2853 } 2854 2855 /** 2856 * Provides methods for authenticator. 2857 * 2858 * @syscap SystemCapability.Account.AppAccount 2859 * @since 8 2860 * @name Authenticator 2861 */ 2862 class Authenticator { 2863 /** 2864 * Adds an application account of a specified owner implicitly. 2865 * 2866 * @param { string } authType - Indicates the authentication type. 2867 * @param { string } callerBundleName - Indicates the caller bundle name. 2868 * @param { object } options - Indicates the authenticator-specific options for the request. 2869 * @param { AuthenticatorCallback } callback - Indicates the authenticator callback. 2870 * @syscap SystemCapability.Account.AppAccount 2871 * @since 8 2872 * @deprecated since 9 2873 * @useinstead appAccount.Authenticator#createAccountImplicitly 2874 */ 2875 addAccountImplicitly( 2876 authType: string, 2877 callerBundleName: string, 2878 options: { [key: string]: any }, 2879 callback: AuthenticatorCallback 2880 ): void; 2881 2882 /** 2883 * Creates an application account of a specified owner implicitly. 2884 * 2885 * @param { CreateAccountImplicitlyOptions } options - Indicates the authenticator-specific options for the request. 2886 * @param { AuthCallback } callback - Indicates the authenticator callback. 2887 * @syscap SystemCapability.Account.AppAccount 2888 * @since 9 2889 */ 2890 createAccountImplicitly(options: CreateAccountImplicitlyOptions, callback: AuthCallback): void; 2891 2892 /** 2893 * Authenticates an application account to get an oauth token. 2894 * 2895 * @param { string } name - Indicates the account name. 2896 * @param { string } authType - Indicates the authentication type. 2897 * @param { string } callerBundleName - Indicates the caller bundle name. 2898 * @param { object } options - Indicates the authenticator-specific options for the request. 2899 * @param { AuthenticatorCallback } callback - Indicates the authenticator callback. 2900 * @syscap SystemCapability.Account.AppAccount 2901 * @since 8 2902 * @deprecated since 9 2903 * @useinstead appAccount.Authenticator#auth 2904 */ 2905 authenticate( 2906 name: string, 2907 authType: string, 2908 callerBundleName: string, 2909 options: { [key: string]: any }, 2910 callback: AuthenticatorCallback 2911 ): void; 2912 2913 /** 2914 * Authenticates an application account to get an oauth token. 2915 * 2916 * @param { string } name - Indicates the account name. 2917 * @param { string } authType - Indicates the authentication type. 2918 * @param { Record<string, Object> } options - Indicates the authenticator-specific options for the request. 2919 * @param { AuthCallback } callback - Indicates the authenticator callback. 2920 * @syscap SystemCapability.Account.AppAccount 2921 * @since 9 2922 */ 2923 auth(name: string, authType: string, options: Record<string, Object>, callback: AuthCallback): void; 2924 2925 /** 2926 * Verifies the credential to ensure the user is the owner of the specified application account. 2927 * <p> 2928 * The credential can be provided in the options, otherwise an Ability will normally be returned, 2929 * which can be started by the caller to further verify credential. 2930 * 2931 * @param { string } name - Indicates the name of the application account. 2932 * @param { VerifyCredentialOptions } options - Indicates the options for verifying credential. 2933 * @param { AuthCallback } callback - Indicates the authenticator callback. 2934 * @syscap SystemCapability.Account.AppAccount 2935 * @since 9 2936 */ 2937 verifyCredential(name: string, options: VerifyCredentialOptions, callback: AuthCallback): void; 2938 2939 /** 2940 * Sets properties for the authenticator. 2941 * 2942 * @param { SetPropertiesOptions } options - Indicates the options for setting properties. 2943 * @param { AuthCallback } callback - Indicates the authenticator callback. 2944 * @syscap SystemCapability.Account.AppAccount 2945 * @since 9 2946 */ 2947 setProperties(options: SetPropertiesOptions, callback: AuthCallback): void; 2948 2949 /** 2950 * Checks whether a particular account has all specified labels. 2951 * 2952 * @param { string } name - Indicates the account name. 2953 * @param { Array<string> } labels - Indicates an array of labels to check. 2954 * @param { AuthCallback } callback - Indicates the authenticator callback. 2955 * @syscap SystemCapability.Account.AppAccount 2956 * @since 9 2957 */ 2958 checkAccountLabels(name: string, labels: Array<string>, callback: AuthCallback): void; 2959 2960 /** 2961 * Checks whether the specified account can be removed. 2962 * 2963 * @param { string } name - Indicates the account name. 2964 * @param { AuthCallback } callback - Indicates the authenticator callback. 2965 * @syscap SystemCapability.Account.AppAccount 2966 * @since 9 2967 */ 2968 checkAccountRemovable(name: string, callback: AuthCallback): void; 2969 2970 /** 2971 * Gets the remote object of the authenticator for remote procedure call. 2972 * 2973 * @returns { rpc.RemoteObject } Returns a remote object. 2974 * @syscap SystemCapability.Account.AppAccount 2975 * @since 9 2976 */ 2977 getRemoteObject(): rpc.RemoteObject; 2978 } 2979} 2980 2981export default appAccount; 2982