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 16import distributedAccount from './@ohos.account.distributedAccount'; 17import { AsyncCallback, Callback } from './@ohos.base'; 18 19/** 20 * This module provides the capability to manage os accounts. 21 * 22 * @namespace osAccount 23 * @syscap SystemCapability.Account.OsAccount 24 * @since 7 25 */ 26declare namespace osAccount { 27 /** 28 * Obtains the AccountManager instance. 29 * 30 * @returns { AccountManager } Returns the instance of the AccountManager. 31 * @syscap SystemCapability.Account.OsAccount 32 * @since 7 33 */ 34 function getAccountManager(): AccountManager; 35 36 /** 37 * Provides abilities for you to manage and perform operations on your OS accounts. 38 * 39 * @interface AccountManager 40 * @syscap SystemCapability.Account.OsAccount 41 * @since 7 42 */ 43 interface AccountManager { 44 /** 45 * Activates a specified OS account. 46 * <p> 47 * If multiple OS accounts are available, you can call this method to enable a specific OS account 48 * to run in the foreground. Then, the OS account originally running in the foreground will be 49 * switched to the background. 50 * </p> 51 * 52 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION 53 * @param { number } localId - Indicates the local ID of the OS account. 54 * @param { AsyncCallback<void> } callback - Asynchronous callback interface. 55 * @throws { BusinessError } 201 - Permission denied. 56 * @throws { BusinessError } 202 - Not system application. 57 * @throws { BusinessError } 401 - The parameter check failed. 58 * @throws { BusinessError } 12300001 - System service exception. 59 * @throws { BusinessError } 12300002 - Invalid localId. 60 * @throws { BusinessError } 12300003 - Account not found. 61 * @throws { BusinessError } 12300008 - Restricted Account. 62 * @throws { BusinessError } 12300009 - Account has been activated. 63 * @syscap SystemCapability.Account.OsAccount 64 * @systemapi Hide this for inner system use. 65 * @since 7 66 */ 67 activateOsAccount(localId: number, callback: AsyncCallback<void>): void; 68 69 /** 70 * Activates a specified OS account. 71 * <p> 72 * If multiple OS accounts are available, you can call this method to enable a specific OS account 73 * to run in the foreground. Then, the OS account originally running in the foreground will be 74 * switched to the background. 75 * </p> 76 * 77 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION 78 * @param { number } localId - Indicates the local ID of the OS account. 79 * @returns { Promise<void> } The promise returned by the function. 80 * @throws { BusinessError } 201 - Permission denied. 81 * @throws { BusinessError } 202 - Not system application. 82 * @throws { BusinessError } 401 - The parameter check failed. 83 * @throws { BusinessError } 12300001 - System service exception. 84 * @throws { BusinessError } 12300002 - Invalid localId. 85 * @throws { BusinessError } 12300003 - Account not found. 86 * @throws { BusinessError } 12300008 - Restricted Account. 87 * @throws { BusinessError } 12300009 - Account has been activated. 88 * @syscap SystemCapability.Account.OsAccount 89 * @systemapi Hide this for inner system use. 90 * @since 7 91 */ 92 activateOsAccount(localId: number): Promise<void>; 93 94 /** 95 * Checks whether the function of supporting multiple OS accounts is enabled. 96 * 97 * @param { AsyncCallback<boolean> } callback - Returns {@code true} if this function is enabled; returns {@code false} otherwise. 98 * @syscap SystemCapability.Account.OsAccount 99 * @since 7 100 * @deprecated since 9 101 * @useinstead osAccount.AccountManager#checkMultiOsAccountEnabled 102 */ 103 isMultiOsAccountEnable(callback: AsyncCallback<boolean>): void; 104 105 /** 106 * Checks whether the function of supporting multiple OS accounts is enabled. 107 * 108 * @returns { Promise<boolean> } Returns {@code true} if this function is enabled; returns {@code false} otherwise. 109 * @syscap SystemCapability.Account.OsAccount 110 * @since 7 111 * @deprecated since 9 112 * @useinstead osAccount.AccountManager#checkMultiOsAccountEnabled 113 */ 114 isMultiOsAccountEnable(): Promise<boolean>; 115 116 /** 117 * Checks whether the function of supporting multiple OS accounts is enabled. 118 * 119 * @param { AsyncCallback<boolean> } callback - Returns {@code true} if this function is enabled; returns {@code false} otherwise. 120 * @throws { BusinessError } 401 - The parameter check failed. 121 * @throws { BusinessError } 12300001 - System service exception. 122 * @syscap SystemCapability.Account.OsAccount 123 * @since 9 124 */ 125 checkMultiOsAccountEnabled(callback: AsyncCallback<boolean>): void; 126 127 /** 128 * Checks whether the function of supporting multiple OS accounts is enabled. 129 * 130 * @returns { Promise<boolean> } Returns {@code true} if this function is enabled; returns {@code false} otherwise. 131 * @throws { BusinessError } 401 - The parameter check failed. 132 * @throws { BusinessError } 12300001 - System service exception. 133 * @syscap SystemCapability.Account.OsAccount 134 * @since 9 135 */ 136 checkMultiOsAccountEnabled(): Promise<boolean>; 137 138 /** 139 * Checks whether an OS account is activated based on its local ID. 140 * 141 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 142 * @param { number } localId - Indicates the local ID of the OS account. 143 * @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether the OS account is activated. 144 * @syscap SystemCapability.Account.OsAccount 145 * @since 7 146 * @deprecated since 9 147 * @useinstead osAccount.AccountManager#checkOsAccountActivated 148 */ 149 isOsAccountActived(localId: number, callback: AsyncCallback<boolean>): void; 150 151 /** 152 * Checks whether an OS account is activated based on its local ID. 153 * 154 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 155 * @param { number } localId - Indicates the local ID of the OS account. 156 * @returns { Promise<boolean> } Returns {@code true} if the OS account is activated; returns {@code false} otherwise. 157 * @syscap SystemCapability.Account.OsAccount 158 * @since 7 159 * @deprecated since 9 160 * @useinstead osAccount.AccountManager#checkOsAccountActivated 161 */ 162 isOsAccountActived(localId: number): Promise<boolean>; 163 164 /** 165 * Checks whether an OS account is activated based on its local ID. 166 * 167 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 168 * @param { number } localId - Indicates the local ID of the OS account. 169 * @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether the OS account is activated. 170 * @throws { BusinessError } 201 - Permission denied. 171 * @throws { BusinessError } 401 - The parameter check failed. 172 * @throws { BusinessError } 12300001 - System service exception. 173 * @throws { BusinessError } 12300002 - Invalid localId. 174 * @throws { BusinessError } 12300003 - Account not found. 175 * @syscap SystemCapability.Account.OsAccount 176 * @since 9 177 */ 178 checkOsAccountActivated(localId: number, callback: AsyncCallback<boolean>): void; 179 180 /** 181 * Checks whether an OS account is activated based on its local ID. 182 * 183 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 184 * @param { number } localId - Indicates the local ID of the OS account. 185 * @returns { Promise<boolean> } - Returns {@code true} if the OS account is activated; returns {@code false} otherwise. 186 * @throws { BusinessError } 201 - Permission denied. 187 * @throws { BusinessError } 401 - The parameter check failed. 188 * @throws { BusinessError } 12300001 - System service exception. 189 * @throws { BusinessError } 12300002 - Invalid localId. 190 * @throws { BusinessError } 12300003 - Account not found. 191 * @syscap SystemCapability.Account.OsAccount 192 * @since 9 193 */ 194 checkOsAccountActivated(localId: number): Promise<boolean>; 195 196 /** 197 * Checks whether a constraint has been enabled for an OS account based on its local ID. 198 * 199 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 200 * @param { number } localId - Indicates the local ID of the OS account. 201 * @param { string } constraint - Indicates the constraint to check. The value can be: 202 * <ul> 203 * <li>{@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point. 204 * </li> 205 * <li>{@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages. 206 * </li> 207 * <li>{@code constraint.calls.outgoing} - Indicates the constraint on making calls.</li> 208 * <li>{@code constraint.unknown.sources.install} - Indicates the constraint on installing applications 209 * from unknown sources.</li> 210 * </ul> 211 * @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether the constraint is enabled for the specified OS account. 212 * @syscap SystemCapability.Account.OsAccount 213 * @since 7 214 * @deprecated since 9 215 * @useinstead osAccount.AccountManager#checkConstraintEnabled 216 */ 217 isOsAccountConstraintEnable(localId: number, constraint: string, callback: AsyncCallback<boolean>): void; 218 219 /** 220 * Checks whether a constraint has been enabled for an OS account based on its local ID. 221 * 222 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 223 * @param { number } localId - Indicates the local ID of the OS account. 224 * @param { string } constraint - Indicates the constraint to check. The value can be: 225 * <ul> 226 * <li>{@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point. 227 * </li> 228 * <li>{@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages. 229 * </li> 230 * <li>{@code constraint.calls.outgoing} - Indicates the constraint on making calls.</li> 231 * <li>{@code constraint.unknown.sources.install} - Indicates the constraint on installing applications 232 * from unknown sources.</li> 233 * </ul> 234 * @returns { Promise<boolean> } Returns {@code true} if the constraint has been enabled for the OS account; 235 * returns {@code false} otherwise. 236 * @syscap SystemCapability.Account.OsAccount 237 * @since 7 238 * @deprecated since 9 239 * @useinstead osAccount.AccountManager#checkConstraintEnabled 240 */ 241 isOsAccountConstraintEnable(localId: number, constraint: string): Promise<boolean>; 242 243 /** 244 * Checks whether the given constraint is enabled for the specified OS account. 245 * 246 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 247 * @param { number } localId - Indicates the local ID of the OS account. 248 * @param { string } constraint - Indicates the constraint to check. For example: the value can be: 249 * <ul> 250 * <li>{@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point. 251 * </li> 252 * <li>{@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages. 253 * </li> 254 * <li>{@code constraint.calls.outgoing} - Indicates the constraint on making calls.</li> 255 * <li>{@code constraint.unknown.sources.install} - Indicates the constraint on installing applications 256 * from unknown sources.</li> 257 * </ul> 258 * @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether the constraint is enabled for the specified OS account. 259 * @throws { BusinessError } 201 - Permission denied. 260 * @throws { BusinessError } 401 - The parameter check failed. 261 * @throws { BusinessError } 12300001 - System service exception. 262 * @throws { BusinessError } 12300002 - Invalid localId or constraint. 263 * @throws { BusinessError } 12300003 - Account not found. 264 * @syscap SystemCapability.Account.OsAccount 265 * @since 9 266 */ 267 checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback<boolean>): void; 268 269 /** 270 * Checks whether the given constraint is enabled for the specified OS account. 271 * 272 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 273 * @param { number } localId - Indicates the local ID of the OS account. 274 * @param { string } constraint - Indicates the constraint to check. For example: the value can be: 275 * <ul> 276 * <li>{@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point. 277 * </li> 278 * <li>{@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages. 279 * </li> 280 * <li>{@code constraint.calls.outgoing} - Indicates the constraint on making calls.</li> 281 * <li>{@code constraint.unknown.sources.install} - Indicates the constraint on installing applications 282 * from unknown sources.</li> 283 * </ul> 284 * @returns { Promise<boolean> } Returns whether the given constraint is enabled for the specified OS account. 285 * @throws { BusinessError } 201 - Permission denied. 286 * @throws { BusinessError } 401 - The parameter check failed. 287 * @throws { BusinessError } 12300001 - System service exception. 288 * @throws { BusinessError } 12300002 - Invalid localId or constraint. 289 * @throws { BusinessError } 12300003 - Account not found. 290 * @syscap SystemCapability.Account.OsAccount 291 * @since 9 292 */ 293 checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise<boolean>; 294 295 /** 296 * Checks whether this OS account is a test OS account. 297 * 298 * @param { AsyncCallback<boolean> } callback - Returns {@code true} if this OS account is a test OS account; returns {@code false} otherwise. 299 * @syscap SystemCapability.Account.OsAccount 300 * @since 7 301 * @deprecated since 9 302 * @useinstead osAccount.AccountManager#checkOsAccountTestable 303 */ 304 isTestOsAccount(callback: AsyncCallback<boolean>): void; 305 306 /** 307 * Checks whether this OS account is a test OS account. 308 * 309 * @returns { Promise<boolean> } Returns {@code true} if this OS account is a test OS account; returns {@code false} otherwise. 310 * @syscap SystemCapability.Account.OsAccount 311 * @since 7 312 * @deprecated since 9 313 * @useinstead osAccount.AccountManager#checkOsAccountTestable 314 */ 315 isTestOsAccount(): Promise<boolean>; 316 317 /** 318 * Checks whether current OS account is testable. 319 * 320 * @param { AsyncCallback<boolean> } callback - Returns {@code true} if this account is testable; returns {@code false} otherwise. 321 * @throws { BusinessError } 401 - The parameter check failed. 322 * @throws { BusinessError } 12300001 - System service exception. 323 * @syscap SystemCapability.Account.OsAccount 324 * @since 9 325 */ 326 checkOsAccountTestable(callback: AsyncCallback<boolean>): void; 327 328 /** 329 * Checks whether current OS account is testable. 330 * 331 * @returns { Promise<boolean> } Returns {@code true} if this account is testable; returns {@code false} otherwise. 332 * @throws { BusinessError } 401 - The parameter check failed. 333 * @throws { BusinessError } 12300001 - System service exception. 334 * @syscap SystemCapability.Account.OsAccount 335 * @since 9 336 */ 337 checkOsAccountTestable(): Promise<boolean>; 338 339 /** 340 * Checks whether an OS account has been verified based on its local ID. 341 * 342 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 343 * @param { AsyncCallback<boolean> } callback - Returns {@code true} if the OS account has been verified successfully; 344 * returns {@code false} otherwise. 345 * @syscap SystemCapability.Account.OsAccount 346 * @since 7 347 * @deprecated since 9 348 * @useinstead osAccount.AccountManager#checkOsAccountVerified 349 */ 350 isOsAccountVerified(callback: AsyncCallback<boolean>): void; 351 352 /** 353 * Checks whether an OS account has been verified based on its local ID. 354 * 355 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 356 * @param { number } localId - Indicates the local ID of the OS account. 357 * @param { AsyncCallback<boolean> } callback - Returns {@code true} if the OS account has been verified successfully; 358 * returns {@code false} otherwise. 359 * @syscap SystemCapability.Account.OsAccount 360 * @since 7 361 * @deprecated since 9 362 * @useinstead osAccount.AccountManager#checkOsAccountVerified 363 */ 364 isOsAccountVerified(localId: number, callback: AsyncCallback<boolean>): void; 365 366 /** 367 * Checks whether an OS account has been verified based on its local ID. 368 * 369 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 370 * @param { number } localId - Indicates the local ID of the OS account. 371 * @returns { Promise<boolean> } Returns {@code true} if the OS account has been verified successfully; 372 * returns {@code false} otherwise. 373 * @syscap SystemCapability.Account.OsAccount 374 * @since 7 375 * @deprecated since 9 376 * @useinstead osAccount.AccountManager#checkOsAccountVerified 377 */ 378 isOsAccountVerified(localId?: number): Promise<boolean>; 379 380 /** 381 * Checks whether the current OS account is verified. 382 * 383 * @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether the current OS account is verified. 384 * @throws { BusinessError } 12300001 - System service exception. 385 * @syscap SystemCapability.Account.OsAccount 386 * @since 9 387 */ 388 checkOsAccountVerified(callback: AsyncCallback<boolean>): void; 389 390 /** 391 * Checks whether the current OS account is verified. 392 * 393 * @returns { Promise<boolean> } Returns whether the current OS account is verified. 394 * @throws { BusinessError } 12300001 - System service exception. 395 * @syscap SystemCapability.Account.OsAccount 396 * @since 9 397 */ 398 checkOsAccountVerified(): Promise<boolean>; 399 400 /** 401 * Checks whether the specified OS account is verified. 402 * 403 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 404 * @param { number } localId - Indicates the local ID of the OS account. 405 * @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether the specified OS account is verified. 406 * @throws { BusinessError } 201 - Permission denied. 407 * @throws { BusinessError } 401 - The parameter check failed. 408 * @throws { BusinessError } 12300001 - System service exception. 409 * @throws { BusinessError } 12300002 - Invalid localId. 410 * @throws { BusinessError } 12300003 - Account not found. 411 * @syscap SystemCapability.Account.OsAccount 412 * @since 9 413 */ 414 checkOsAccountVerified(localId: number, callback: AsyncCallback<boolean>): void; 415 416 /** 417 * Checks whether the specified OS account is verified. 418 * 419 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 420 * @param { number } localId - Indicates the local ID of the OS account. 421 * @returns { Promise<boolean> } Returns whether the specified OS account is verified. 422 * @throws { BusinessError } 201 - Permission denied. 423 * @throws { BusinessError } 401 - The parameter check failed. 424 * @throws { BusinessError } 12300001 - System service exception. 425 * @throws { BusinessError } 12300002 - Invalid localId. 426 * @throws { BusinessError } 12300003 - Account not found. 427 * @syscap SystemCapability.Account.OsAccount 428 * @since 9 429 */ 430 checkOsAccountVerified(localId: number): Promise<boolean>; 431 432 /** 433 * Removes an OS account based on its local ID. 434 * 435 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 436 * @param { number } localId - Indicates the local ID of the OS account. 437 * @param { AsyncCallback<void> } callback - Indicates the callback for removing the specified OS account. 438 * @throws { BusinessError } 201 - Permission denied. 439 * @throws { BusinessError } 202 - Not system application. 440 * @throws { BusinessError } 401 - The parameter check failed. 441 * @throws { BusinessError } 12300001 - System service exception. 442 * @throws { BusinessError } 12300002 - Invalid localId. 443 * @throws { BusinessError } 12300003 - Account not found. 444 * @throws { BusinessError } 12300008 - Restricted Account. 445 * @syscap SystemCapability.Account.OsAccount 446 * @systemapi Hide this for inner system use. 447 * @since 7 448 */ 449 removeOsAccount(localId: number, callback: AsyncCallback<void>): void; 450 451 /** 452 * Removes an OS account based on its local ID. 453 * 454 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 455 * @param { number } localId - Indicates the local ID of the OS account. 456 * @returns { Promise<void> } The promise returned by the function. 457 * @throws { BusinessError } 201 - Permission denied. 458 * @throws { BusinessError } 202 - Not system application. 459 * @throws { BusinessError } 401 - The parameter check failed. 460 * @throws { BusinessError } 12300001 - System service exception. 461 * @throws { BusinessError } 12300002 - Invalid localId. 462 * @throws { BusinessError } 12300003 - Account not found. 463 * @throws { BusinessError } 12300008 - Restricted Account. 464 * @syscap SystemCapability.Account.OsAccount 465 * @systemapi Hide this for inner system use. 466 * @since 7 467 */ 468 removeOsAccount(localId: number): Promise<void>; 469 470 /** 471 * Sets constraints for an OS account based on its local ID. 472 * 473 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 474 * @param { number } localId - Indicates the local ID of the OS account. 475 * @param { Array<string> } constraints - Indicates the constraints to set for the OS account. The value can be: 476 * <ul> 477 * <li>{@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point. 478 * </li> 479 * <li>{@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages. 480 * </li> 481 * <li>{@code constraint.calls.outgoing} - Indicates the constraint on making calls.</li> 482 * <li>{@code constraint.unknown.sources.install} - Indicates the constraint on installing applications 483 * from unknown sources.</li> 484 * </ul> 485 * @param { boolean } enable - Specifies whether to enable the constraint. 486 * @param { AsyncCallback<void> } callback - Indicates the callback for setting the specified OS account constraints. 487 * @throws { BusinessError } 201 - Permission denied. 488 * @throws { BusinessError } 202 - Not system application. 489 * @throws { BusinessError } 401 - The parameter check failed. 490 * @throws { BusinessError } 12300001 - System service exception. 491 * @throws { BusinessError } 12300002 - Invalid localId or constraints. 492 * @throws { BusinessError } 12300003 - Account not found. 493 * @throws { BusinessError } 12300008 - Restricted Account. 494 * @syscap SystemCapability.Account.OsAccount 495 * @systemapi Hide this for inner system use. 496 * @since 7 497 */ 498 setOsAccountConstraints( 499 localId: number, 500 constraints: Array<string>, 501 enable: boolean, 502 callback: AsyncCallback<void> 503 ): void; 504 505 /** 506 * Sets constraints for an OS account based on its local ID. 507 * 508 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 509 * @param { number } localId - Indicates the local ID of the OS account. 510 * @param { Array<string> } constraints - Indicates the constraints to set for the OS account. The value can be: 511 * <ul> 512 * <li>{@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point. 513 * </li> 514 * <li>{@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages. 515 * </li> 516 * <li>{@code constraint.calls.outgoing} - Indicates the constraint on making calls.</li> 517 * <li>{@code constraint.unknown.sources.install} - Indicates the constraint on installing applications 518 * from unknown sources.</li> 519 * </ul> 520 * @param { boolean } enable - Specifies whether to enable the constraint. 521 * @returns { Promise<void> } The promise returned by the function. 522 * @throws { BusinessError } 201 - Permission denied. 523 * @throws { BusinessError } 202 - Not system application. 524 * @throws { BusinessError } 401 - The parameter check failed. 525 * @throws { BusinessError } 12300001 - System service exception. 526 * @throws { BusinessError } 12300002 - Invalid localId or constraints. 527 * @throws { BusinessError } 12300003 - Account not found. 528 * @throws { BusinessError } 12300008 - Restricted Account. 529 * @syscap SystemCapability.Account.OsAccount 530 * @systemapi Hide this for inner system use. 531 * @since 7 532 */ 533 setOsAccountConstraints(localId: number, constraints: Array<string>, enable: boolean): Promise<void>; 534 535 /** 536 * Sets the local name for an OS account based on its local ID. 537 * 538 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 539 * @param { number } localId - Indicates the local ID of the OS account. 540 * @param { string } localName - Indicates the local name to set for the OS account. 541 * @param { AsyncCallback<void> } callback - Indicates the callback for setting the specified OS account name. 542 * @throws { BusinessError } 201 - Permission denied. 543 * @throws { BusinessError } 202 - Not system application. 544 * @throws { BusinessError } 401 - The parameter check failed. 545 * @throws { BusinessError } 12300001 - System service exception. 546 * @throws { BusinessError } 12300002 - Invalid localId or localName. 547 * @throws { BusinessError } 12300003 - Account not found. 548 * @throws { BusinessError } 12300008 - Restricted Account. 549 * @syscap SystemCapability.Account.OsAccount 550 * @systemapi Hide this for inner system use. 551 * @since 7 552 */ 553 setOsAccountName(localId: number, localName: string, callback: AsyncCallback<void>): void; 554 555 /** 556 * Sets the local name for an OS account based on its local ID. 557 * 558 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 559 * @param { number } localId - Indicates the local ID of the OS account. 560 * @param { string } localName - Indicates the local name to set for the OS account. 561 * @returns { Promise<void> } The promise returned by the function. 562 * @throws { BusinessError } 201 - Permission denied. 563 * @throws { BusinessError } 202 - Not system application. 564 * @throws { BusinessError } 401 - The parameter check failed. 565 * @throws { BusinessError } 12300001 - System service exception. 566 * @throws { BusinessError } 12300002 - Invalid localId or localName. 567 * @throws { BusinessError } 12300003 - Account not found. 568 * @throws { BusinessError } 12300008 - Restricted Account. 569 * @syscap SystemCapability.Account.OsAccount 570 * @systemapi Hide this for inner system use. 571 * @since 7 572 */ 573 setOsAccountName(localId: number, localName: string): Promise<void>; 574 575 /** 576 * Obtains the number of all OS accounts created on a device. 577 * 578 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 579 * @param { AsyncCallback<number> } callback - Returns the number of created OS accounts. 580 * @syscap SystemCapability.Account.OsAccount 581 * @since 7 582 * @deprecated since 9 583 * @useinstead osAccount.AccountManager#getOsAccountCount 584 */ 585 getCreatedOsAccountsCount(callback: AsyncCallback<number>): void; 586 587 /** 588 * Obtains the number of all OS accounts created on a device. 589 * 590 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 591 * @returns { Promise<number> } Returns the number of created OS accounts. 592 * @syscap SystemCapability.Account.OsAccount 593 * @since 7 594 * @deprecated since 9 595 * @useinstead osAccount.AccountManager#getOsAccountCount 596 */ 597 getCreatedOsAccountsCount(): Promise<number>; 598 599 /** 600 * Obtains the number of all OS accounts created on a device. 601 * 602 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 603 * @param { AsyncCallback<number> } callback - Returns the number of created OS accounts. 604 * @throws { BusinessError } 201 - Permission denied. 605 * @throws { BusinessError } 401 - The parameter check failed. 606 * @throws { BusinessError } 12300001 - System service exception. 607 * @syscap SystemCapability.Account.OsAccount 608 * @since 9 609 */ 610 getOsAccountCount(callback: AsyncCallback<number>): void; 611 612 /** 613 * Obtains the number of all OS accounts created on a device. 614 * 615 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 616 * @returns { Promise<number> } Returns the number of created OS accounts. 617 * @throws { BusinessError } 201 - Permission denied. 618 * @throws { BusinessError } 401 - The parameter check failed. 619 * @throws { BusinessError } 12300001 - System service exception. 620 * @syscap SystemCapability.Account.OsAccount 621 * @since 9 622 */ 623 getOsAccountCount(): Promise<number>; 624 625 /** 626 * Obtains the local ID of an OS account from the current process UID. 627 * 628 * @param { AsyncCallback<number> } callback - Returns the local ID of the OS account. 629 * @syscap SystemCapability.Account.OsAccount 630 * @since 7 631 * @deprecated since 9 632 * @useinstead osAccount.AccountManager#getOsAccountLocalId 633 */ 634 getOsAccountLocalIdFromProcess(callback: AsyncCallback<number>): void; 635 636 /** 637 * Obtains the local ID of an OS account from the current process UID. 638 * 639 * @returns { Promise<number> } Returns the local ID of the OS account. 640 * @syscap SystemCapability.Account.OsAccount 641 * @since 7 642 * @deprecated since 9 643 * @useinstead osAccount.AccountManager#getOsAccountLocalId 644 */ 645 getOsAccountLocalIdFromProcess(): Promise<number>; 646 647 /** 648 * Gets the local ID of the current OS account. 649 * 650 * @param { AsyncCallback<number> } callback - Indicates the callback for getting the local ID of the current OS account. 651 * @throws { BusinessError } 401 - The parameter check failed. 652 * @throws { BusinessError } 12300001 - System service exception. 653 * @syscap SystemCapability.Account.OsAccount 654 * @since 9 655 */ 656 getOsAccountLocalId(callback: AsyncCallback<number>): void; 657 658 /** 659 * Get the local ID of the current OS account. 660 * 661 * @returns { Promise<number> } Returns the local ID of the current account. 662 * @throws { BusinessError } 401 - The parameter check failed. 663 * @throws { BusinessError } 12300001 - System service exception. 664 * @syscap SystemCapability.Account.OsAccount 665 * @since 9 666 */ 667 getOsAccountLocalId(): Promise<number>; 668 669 /** 670 * Gets the local ID of an OS account from the process UID 671 * 672 * @param { number } uid - Indicates the process UID. 673 * @param { AsyncCallback<number> } callback - Returns the local ID of the OS account. 674 * @syscap SystemCapability.Account.OsAccount 675 * @since 7 676 * @deprecated since 9 677 * @useinstead osAccount.AccountManager#getOsAccountLocalIdForUid 678 */ 679 getOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback<number>): void; 680 681 /** 682 * Gets the local ID of an OS account from the process UID 683 * 684 * @param { number } uid - Indicates the process UID. 685 * @returns { Promise<number> } Returns the local ID of the OS account. 686 * @syscap SystemCapability.Account.OsAccount 687 * @since 7 688 * @deprecated since 9 689 * @useinstead osAccount.AccountManager#getOsAccountLocalIdForUid 690 */ 691 getOsAccountLocalIdFromUid(uid: number): Promise<number>; 692 693 /** 694 * Gets the local ID of the OS account associated with the specified UID. 695 * 696 * @param { number } uid - Indicates the process UID. 697 * @param { AsyncCallback<number> } callback - Indicates the callback for getting the local ID of the OS account associated with the specified UID. 698 * @throws { BusinessError } 401 - The parameter check failed. 699 * @throws { BusinessError } 12300001 - System service exception. 700 * @throws { BusinessError } 12300002 - Invalid uid. 701 * @syscap SystemCapability.Account.OsAccount 702 * @since 9 703 */ 704 getOsAccountLocalIdForUid(uid: number, callback: AsyncCallback<number>): void; 705 706 /** 707 * Get the local ID of the OS account associated with the specified UID. 708 * 709 * @param { number } uid - Indicates the process UID. 710 * @returns { Promise<number> } - Returns the local ID of the OS account associated with the specified UID. 711 * @throws { BusinessError } 401 - The parameter check failed. 712 * @throws { BusinessError } 12300001 - System service exception. 713 * @throws { BusinessError } 12300002 - Invalid uid. 714 * @syscap SystemCapability.Account.OsAccount 715 * @since 9 716 */ 717 getOsAccountLocalIdForUid(uid: number): Promise<number>; 718 719 /** 720 * Gets the local ID of the OS account associated with the specified UID synchronously. 721 * 722 * @param { number } uid - Indicates the process UID. 723 * @returns { number } Returns the local ID of the OS account associated with the specified UID. 724 * @throws { BusinessError } 401 - The parameter check failed. 725 * @throws { BusinessError } 12300002 - Invalid uid. 726 * @syscap SystemCapability.Account.OsAccount 727 * @since 10 728 */ 729 getOsAccountLocalIdForUidSync(uid: number): number; 730 731 /** 732 * Queries the local ID of an OS account which is bound to the specified domain account. 733 * 734 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 735 * @param { DomainAccountInfo } domainInfo - Indicates the domain account info. 736 * @param { AsyncCallback<number> } callback - Returns the local ID of the OS account. 737 * @syscap SystemCapability.Account.OsAccount 738 * @since 8 739 * @deprecated since 9 740 * @useinstead osAccount.AccountManager#getOsAccountLocalIdForDomain 741 */ 742 getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback<number>): void; 743 744 /** 745 * Queries the local ID of an OS account which is bound to the specified domain account. 746 * 747 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 748 * @param { DomainAccountInfo } domainInfo - Indicates the domain account info. 749 * @returns { Promise<number> } Returns the local ID of the OS account. 750 * @syscap SystemCapability.Account.OsAccount 751 * @since 8 752 * @deprecated since 9 753 * @useinstead osAccount.AccountManager#getOsAccountLocalIdForDomain 754 */ 755 getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise<number>; 756 757 /** 758 * Gets the local ID of the OS account associated with the specified domain account. 759 * 760 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 761 * @param { DomainAccountInfo } domainInfo - Indicates the domain account info. 762 * @param { AsyncCallback<number> } callback - Indicates the callback for 763 * getting the local ID of the OS account associated with the specified domain account. 764 * @throws { BusinessError } 201 - Permission denied. 765 * @throws { BusinessError } 401 - The parameter check failed. 766 * @throws { BusinessError } 12300001 - System service exception. 767 * @throws { BusinessError } 12300002 - Invalid domainInfo. 768 * @syscap SystemCapability.Account.OsAccount 769 * @since 9 770 */ 771 getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback<number>): void; 772 773 /** 774 * Gets the local ID of the OS account associated with the specified domain account. 775 * 776 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 777 * @param { DomainAccountInfo } domainInfo - Indicates the domain account info. 778 * @returns { Promise<number> } Returns the local ID of the OS account associated with the specified domain account. 779 * @throws { BusinessError } 201 - Permission denied. 780 * @throws { BusinessError } 401 - The parameter check failed. 781 * @throws { BusinessError } 12300001 - System service exception. 782 * @throws { BusinessError } 12300002 - Invalid domainInfo. 783 * @syscap SystemCapability.Account.OsAccount 784 * @since 9 785 */ 786 getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise<number>; 787 788 /** 789 * Queries the maximum number of OS accounts that can be created on a device. 790 * 791 * @param { AsyncCallback<number> } callback - Returns the maximum number of OS accounts that can be created. 792 * @throws { BusinessError } 202 - Not system application. 793 * @throws { BusinessError } 401 - The parameter check failed. 794 * @throws { BusinessError } 12300001 - System service exception. 795 * @syscap SystemCapability.Account.OsAccount 796 * @systemapi Hide this for inner system use. 797 * @since 7 798 */ 799 queryMaxOsAccountNumber(callback: AsyncCallback<number>): void; 800 801 /** 802 * Queries the maximum number of OS accounts that can be created on a device. 803 * 804 * @returns { Promise<number> } Returns the maximum number of OS accounts that can be created. 805 * @throws { BusinessError } 202 - Not system application. 806 * @throws { BusinessError } 401 - The parameter check failed. 807 * @throws { BusinessError } 12300001 - System service exception. 808 * @syscap SystemCapability.Account.OsAccount 809 * @systemapi Hide this for inner system use. 810 * @since 7 811 */ 812 queryMaxOsAccountNumber(): Promise<number>; 813 814 /** 815 * Obtains all constraints of an OS account based on its local ID. 816 * 817 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 818 * @param { number } localId - Indicates the local ID of the OS account. 819 * @param { AsyncCallback<Array<string>> } callback - Returns a list of constraints. 820 * @syscap SystemCapability.Account.OsAccount 821 * @since 7 822 * @deprecated since 9 823 * @useinstead osAccount.AccountManager#getOsAccountConstraints 824 */ 825 getOsAccountAllConstraints(localId: number, callback: AsyncCallback<Array<string>>): void; 826 827 /** 828 * Obtains all constraints of an OS account based on its local ID. 829 * 830 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 831 * @param { number } localId - Indicates the local ID of the OS account. 832 * @returns { Promise<Array<string>> } Returns a list of constraints. 833 * @syscap SystemCapability.Account.OsAccount 834 * @since 7 835 * @deprecated since 9 836 * @useinstead osAccount.AccountManager#getOsAccountConstraints 837 */ 838 getOsAccountAllConstraints(localId: number): Promise<Array<string>>; 839 840 /** 841 * Obtains all constraints of an account based on its ID. 842 * 843 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 844 * @param { number } localId - Indicates the local ID of the OS account. 845 * @param { AsyncCallback<Array<string>> } callback - Returns a list of constraints. 846 * @throws { BusinessError } 201 - Permission denied. 847 * @throws { BusinessError } 401 - The parameter check failed. 848 * @throws { BusinessError } 12300001 - System service exception. 849 * @throws { BusinessError } 12300002 - Invalid localId. 850 * @throws { BusinessError } 12300003 - Account not found. 851 * @syscap SystemCapability.Account.OsAccount 852 * @since 9 853 */ 854 getOsAccountConstraints(localId: number, callback: AsyncCallback<Array<string>>): void; 855 856 /** 857 * Obtains all constraints of an account based on its ID. 858 * 859 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 860 * @param { number } localId - Indicates the local ID of the OS account. 861 * @returns { Promise<Array<string>> } Returns a list of constraints. 862 * @throws { BusinessError } 201 - Permission denied. 863 * @throws { BusinessError } 401 - The parameter check failed. 864 * @throws { BusinessError } 12300001 - System service exception. 865 * @throws { BusinessError } 12300002 - Invalid localId. 866 * @throws { BusinessError } 12300003 - Account not found. 867 * @syscap SystemCapability.Account.OsAccount 868 * @since 9 869 */ 870 getOsAccountConstraints(localId: number): Promise<Array<string>>; 871 872 /** 873 * Queries the list of all the OS accounts that have been created in the system. 874 * 875 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 876 * @param { AsyncCallback<Array<OsAccountInfo>> } callback - Returns a list of OS accounts. 877 * @throws { BusinessError } 201 - Permission denied. 878 * @throws { BusinessError } 202 - Not system application. 879 * @throws { BusinessError } 401 - The parameter check failed. 880 * @throws { BusinessError } 12300001 - System service exception. 881 * @syscap SystemCapability.Account.OsAccount 882 * @systemapi Hide this for inner system use. 883 * @since 7 884 */ 885 queryAllCreatedOsAccounts(callback: AsyncCallback<Array<OsAccountInfo>>): void; 886 887 /** 888 * Queries the list of all the OS accounts that have been created in the system. 889 * 890 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 891 * @returns { Promise<Array<OsAccountInfo>> } Returns a list of OS accounts. 892 * @throws { BusinessError } 201 - Permission denied. 893 * @throws { BusinessError } 202 - Not system application. 894 * @throws { BusinessError } 401 - The parameter check failed. 895 * @throws { BusinessError } 12300001 - System service exception. 896 * @syscap SystemCapability.Account.OsAccount 897 * @systemapi Hide this for inner system use. 898 * @since 7 899 */ 900 queryAllCreatedOsAccounts(): Promise<Array<OsAccountInfo>>; 901 902 /** 903 * Queries the id list of all activated OS accounts. 904 * 905 * @param { AsyncCallback<Array<number>> } callback - Returns a id list of OS accounts. 906 * @syscap SystemCapability.Account.OsAccount 907 * @since 8 908 * @deprecated since 9 909 * @useinstead osAccount.AccountManager#getActivatedOsAccountLocalIds 910 */ 911 queryActivatedOsAccountIds(callback: AsyncCallback<Array<number>>): void; 912 913 /** 914 * Queries the id list of all activated OS accounts. 915 * 916 * @returns { Promise<Array<number>> } Returns a id list of OS accounts. 917 * @syscap SystemCapability.Account.OsAccount 918 * @since 8 919 * @deprecated since 9 920 * @useinstead osAccount.AccountManager#getActivatedOsAccountLocalIds 921 */ 922 queryActivatedOsAccountIds(): Promise<Array<number>>; 923 924 /** 925 * Gets the local IDs of all activated OS accounts. 926 * 927 * @param { AsyncCallback<Array<number>> } callback - Indicates the callback for getting the local IDs of all activated OS accounts. 928 * @throws { BusinessError } 401 - The parameter check failed. 929 * @throws { BusinessError } 12300001 - System service exception. 930 * @syscap SystemCapability.Account.OsAccount 931 * @since 9 932 */ 933 getActivatedOsAccountLocalIds(callback: AsyncCallback<Array<number>>): void; 934 935 /** 936 * Gets the local IDs of all activated OS accounts. 937 * 938 * @returns { Promise<Array<number>> } Returns all activated accounts. 939 * @throws { BusinessError } 401 - The parameter check failed. 940 * @throws { BusinessError } 12300001 - System service exception. 941 * @syscap SystemCapability.Account.OsAccount 942 * @since 9 943 */ 944 getActivatedOsAccountLocalIds(): Promise<Array<number>>; 945 946 /** 947 * Creates an OS account using the local name and account type. 948 * 949 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 950 * @param { string } localName - Indicates the local name of the OS account to create. 951 * @param { OsAccountType } type - Indicates the type of the OS account to create. 952 * {@link OsAccountType} specifies the account types available in the system. 953 * @param { AsyncCallback<OsAccountInfo> } callback - Returns information about the created OS account; returns {@code null} if the creation fails. 954 * @throws { BusinessError } 201 - Permission denied. 955 * @throws { BusinessError } 202 - Not system application. 956 * @throws { BusinessError } 401 - The parameter check failed. 957 * @throws { BusinessError } 12300001 - System service exception. 958 * @throws { BusinessError } 12300002 - Invalid localName or type. 959 * @throws { BusinessError } 12300005 - Multi-user not supported. 960 * @throws { BusinessError } 12300006 - Unsupported account type. 961 * @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit. 962 * @syscap SystemCapability.Account.OsAccount 963 * @systemapi Hide this for inner system use. 964 * @since 7 965 */ 966 createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback<OsAccountInfo>): void; 967 968 /** 969 * Creates an OS account using the local name and account type. 970 * 971 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 972 * @param { string } localName - Indicates the local name of the OS account to create. 973 * @param { OsAccountType } type - Indicates the type of the OS account to create. 974 * {@link OsAccountType} specifies the account types available in the system. 975 * @returns { Promise<OsAccountInfo> } Returns information about the created OS account; returns {@code null} if the creation fails. 976 * @throws { BusinessError } 201 - Permission denied. 977 * @throws { BusinessError } 202 - Not system application. 978 * @throws { BusinessError } 401 - The parameter check failed. 979 * @throws { BusinessError } 12300001 - System service exception. 980 * @throws { BusinessError } 12300002 - Invalid localName or type. 981 * @throws { BusinessError } 12300005 - Multi-user not supported. 982 * @throws { BusinessError } 12300006 - Unsupported account type. 983 * @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit. 984 * @syscap SystemCapability.Account.OsAccount 985 * @systemapi Hide this for inner system use. 986 * @since 7 987 */ 988 createOsAccount(localName: string, type: OsAccountType): Promise<OsAccountInfo>; 989 990 /** 991 * Creates an OS account using the account type and domain account info. 992 * 993 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 994 * @param { OsAccountType } type - Indicates the type of the OS account to create. 995 * {@link OsAccountType} specifies the account types available in the system. 996 * @param { DomainAccountInfo } domainInfo - Indicates the domain account info. 997 * @param { AsyncCallback<OsAccountInfo> } callback - Returns information about the created OS account; returns {@code null} if the creation fails. 998 * @throws { BusinessError } 201 - Permission denied. 999 * @throws { BusinessError } 202 - Not system application. 1000 * @throws { BusinessError } 401 - The parameter check failed. 1001 * @throws { BusinessError } 12300001 - System service exception. 1002 * @throws { BusinessError } 12300002 - Invalid type or domainInfo. 1003 * @throws { BusinessError } 12300005 - Multi-user not supported. 1004 * @throws { BusinessError } 12300006 - Unsupported account type. 1005 * @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit. 1006 * @syscap SystemCapability.Account.OsAccount 1007 * @systemapi Hide this for inner system use. 1008 * @since 8 1009 */ 1010 createOsAccountForDomain( 1011 type: OsAccountType, 1012 domainInfo: DomainAccountInfo, 1013 callback: AsyncCallback<OsAccountInfo> 1014 ): void; 1015 1016 /** 1017 * Creates an OS account using the account type and domain account info. 1018 * 1019 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1020 * @param { OsAccountType } type - Indicates the type of the OS account to create. 1021 * {@link OsAccountType} specifies the account types available in the system. 1022 * @param { DomainAccountInfo } domainInfo - Indicates the domain account info. 1023 * @returns { Promise<OsAccountInfo> } Returns information about the created OS account; returns {@code null} if the creation fails. 1024 * @throws { BusinessError } 201 - Permission denied. 1025 * @throws { BusinessError } 202 - Not system application. 1026 * @throws { BusinessError } 401 - The parameter check failed. 1027 * @throws { BusinessError } 12300001 - System service exception. 1028 * @throws { BusinessError } 12300002 - Invalid type or domainInfo. 1029 * @throws { BusinessError } 12300005 - Multi-user not supported. 1030 * @throws { BusinessError } 12300006 - Unsupported account type. 1031 * @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit. 1032 * @syscap SystemCapability.Account.OsAccount 1033 * @systemapi Hide this for inner system use. 1034 * @since 8 1035 */ 1036 createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Promise<OsAccountInfo>; 1037 1038 /** 1039 * Queries information about the current OS account. 1040 * 1041 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1042 * @param { AsyncCallback<OsAccountInfo> } callback - Returns information about the current OS account; returns {@code null} if the query fails. 1043 * @syscap SystemCapability.Account.OsAccount 1044 * @since 7 1045 * @deprecated since 9 1046 * @useinstead osAccount.AccountManager#getCurrentOsAccount 1047 */ 1048 queryCurrentOsAccount(callback: AsyncCallback<OsAccountInfo>): void; 1049 1050 /** 1051 * Queries information about the current OS account. 1052 * 1053 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1054 * @returns { Promise<OsAccountInfo> } Returns information about the current OS account; returns {@code null} if the query fails. 1055 * @syscap SystemCapability.Account.OsAccount 1056 * @since 7 1057 * @deprecated since 9 1058 * @useinstead osAccount.AccountManager#getCurrentOsAccount 1059 */ 1060 queryCurrentOsAccount(): Promise<OsAccountInfo>; 1061 1062 /** 1063 * Gets information about the current OS account. 1064 * 1065 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1066 * @param { AsyncCallback<OsAccountInfo> } callback - Returns information about the current OS account; returns {@code null} if the query fails. 1067 * @throws { BusinessError } 201 - Permission denied. 1068 * @throws { BusinessError } 401 - The parameter check failed. 1069 * @throws { BusinessError } 12300001 - System service exception. 1070 * @syscap SystemCapability.Account.OsAccount 1071 * @since 9 1072 */ 1073 /** 1074 * Gets information about the current OS account. 1075 * 1076 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.GET_LOCAL_ACCOUNTS 1077 * @param { AsyncCallback<OsAccountInfo> } callback - Returns information about the current OS account; returns {@code null} if the query fails. 1078 * @throws { BusinessError } 201 - Permission denied. 1079 * @throws { BusinessError } 401 - The parameter check failed. 1080 * @throws { BusinessError } 12300001 - System service exception. 1081 * @syscap SystemCapability.Account.OsAccount 1082 * @since 10 1083 */ 1084 getCurrentOsAccount(callback: AsyncCallback<OsAccountInfo>): void; 1085 1086 /** 1087 * Gets information about the current OS account. 1088 * 1089 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1090 * @returns { Promise<OsAccountInfo> } Returns information about the current OS account; returns {@code null} if the query fails. 1091 * @throws { BusinessError } 201 - Permission denied. 1092 * @throws { BusinessError } 401 - The parameter check failed. 1093 * @throws { BusinessError } 12300001 - System service exception. 1094 * @syscap SystemCapability.Account.OsAccount 1095 * @since 9 1096 */ 1097 /** 1098 * Gets information about the current OS account. 1099 * 1100 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.GET_LOCAL_ACCOUNTS 1101 * @returns { Promise<OsAccountInfo> } Returns information about the current OS account; returns {@code null} if the query fails. 1102 * @throws { BusinessError } 201 - Permission denied. 1103 * @throws { BusinessError } 401 - The parameter check failed. 1104 * @throws { BusinessError } 12300001 - System service exception. 1105 * @syscap SystemCapability.Account.OsAccount 1106 * @since 10 1107 */ 1108 getCurrentOsAccount(): Promise<OsAccountInfo>; 1109 1110 /** 1111 * Queries OS account information based on the local ID. 1112 * 1113 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION 1114 * @param { number } localId - Indicates the local ID of the OS account. 1115 * @param { AsyncCallback<OsAccountInfo> } callback - Returns the OS account information; returns {@code null} if the query fails. 1116 * @throws { BusinessError } 201 - Permission denied. 1117 * @throws { BusinessError } 202 - Not system application. 1118 * @throws { BusinessError } 401 - The parameter check failed. 1119 * @throws { BusinessError } 12300001 - System service exception. 1120 * @throws { BusinessError } 12300002 - Invalid localId. 1121 * @throws { BusinessError } 12300003 - Account not found. 1122 * @syscap SystemCapability.Account.OsAccount 1123 * @systemapi Hide this for inner system use. 1124 * @since 7 1125 */ 1126 queryOsAccountById(localId: number, callback: AsyncCallback<OsAccountInfo>): void; 1127 1128 /** 1129 * Queries OS account information based on the local ID. 1130 * 1131 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION 1132 * @param { number } localId - Indicates the local ID of the OS account. 1133 * @returns { Promise<OsAccountInfo> } Returns the OS account information; returns {@code null} if the query fails. 1134 * @throws { BusinessError } 201 - Permission denied. 1135 * @throws { BusinessError } 202 - Not system application. 1136 * @throws { BusinessError } 401 - The parameter check failed. 1137 * @throws { BusinessError } 12300001 - System service exception. 1138 * @throws { BusinessError } 12300002 - Invalid localId. 1139 * @throws { BusinessError } 12300003 - Account not found. 1140 * @syscap SystemCapability.Account.OsAccount 1141 * @systemapi Hide this for inner system use. 1142 * @since 7 1143 */ 1144 queryOsAccountById(localId: number): Promise<OsAccountInfo>; 1145 1146 /** 1147 * Obtains the type of this OS account from the current process. 1148 * 1149 * @param { AsyncCallback<OsAccountType> } callback - Returns the OS account type. The value can be {@link OsAccountType#ADMIN}, 1150 * {@link OsAccountType#NORMAL}, and {@link OsAccountType#GUEST}. 1151 * @syscap SystemCapability.Account.OsAccount 1152 * @since 7 1153 * @deprecated since 9 1154 * @useinstead osAccount.AccountManager#getOsAccountType 1155 */ 1156 getOsAccountTypeFromProcess(callback: AsyncCallback<OsAccountType>): void; 1157 1158 /** 1159 * Obtains the type of this OS account from the current process. 1160 * 1161 * @returns { Promise<OsAccountType> } Returns the OS account type. The value can be {@link OsAccountType#ADMIN}, 1162 * {@link OsAccountType#NORMAL}, and {@link OsAccountType#GUEST}. 1163 * @syscap SystemCapability.Account.OsAccount 1164 * @since 7 1165 * @deprecated since 9 1166 * @useinstead osAccount.AccountManager#getOsAccountType 1167 */ 1168 getOsAccountTypeFromProcess(): Promise<OsAccountType>; 1169 1170 /** 1171 * Obtains the type of this OS account from the current process. 1172 * 1173 * @param { AsyncCallback<OsAccountType> } callback - Returns the OS account type. The value can be {@link OsAccountType#ADMIN}, 1174 * {@link OsAccountType#NORMAL}, and {@link OsAccountType#GUEST}. 1175 * @throws { BusinessError } 401 - The parameter check failed. 1176 * @throws { BusinessError } 12300001 - System service exception. 1177 * @syscap SystemCapability.Account.OsAccount 1178 * @since 9 1179 */ 1180 getOsAccountType(callback: AsyncCallback<OsAccountType>): void; 1181 1182 /** 1183 * Obtains the type of this OS account from the current process. 1184 * 1185 * @returns { Promise<OsAccountType> } Returns the OS account type. The value can be {@link OsAccountType#ADMIN}, 1186 * {@link OsAccountType#NORMAL}, and {@link OsAccountType#GUEST}. 1187 * @throws { BusinessError } 401 - The parameter check failed. 1188 * @throws { BusinessError } 12300001 - System service exception. 1189 * @syscap SystemCapability.Account.OsAccount 1190 * @since 9 1191 */ 1192 getOsAccountType(): Promise<OsAccountType>; 1193 1194 /** 1195 * Obtains the distributed virtual device ID (DVID). 1196 * <p> 1197 * If the same OHOS account has logged in to multiple devices, these devices constitute a super device 1198 * through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs. 1199 * The same application running on different devices obtains the same DVID, whereas different applications 1200 * obtain different DVIDs. 1201 * <p> 1202 * 1203 * @permission ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS 1204 * @param { AsyncCallback<string> } callback - Returns the DVID if obtained; returns an empty string if no OHOS account has logged in. 1205 * @syscap SystemCapability.Account.OsAccount 1206 * @since 7 1207 * @deprecated since 9 1208 * @useinstead osAccount.AccountManager#queryDistributedVirtualDeviceId 1209 */ 1210 getDistributedVirtualDeviceId(callback: AsyncCallback<string>): void; 1211 1212 /** 1213 * Obtains the distributed virtual device ID (DVID). 1214 * <p> 1215 * If the same OHOS account has logged in to multiple devices, these devices constitute a super device 1216 * through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs. 1217 * The same application running on different devices obtains the same DVID, whereas different applications 1218 * obtain different DVIDs. 1219 * <p> 1220 * 1221 * @permission ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS 1222 * @returns { Promise<string> } Returns the DVID if obtained; returns an empty string if no OHOS account has logged in. 1223 * @syscap SystemCapability.Account.OsAccount 1224 * @since 7 1225 * @deprecated since 9 1226 * @useinstead osAccount.AccountManager#queryDistributedVirtualDeviceId 1227 */ 1228 getDistributedVirtualDeviceId(): Promise<string>; 1229 1230 /** 1231 * Queries the distributed virtual device ID (DVID). 1232 * <p> 1233 * If the same OHOS account has logged in to multiple devices, these devices constitute a super device 1234 * through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs. 1235 * The same application running on different devices obtains the same DVID, whereas different applications 1236 * obtain different DVIDs. 1237 * <p> 1238 * 1239 * @permission ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS 1240 * @param { AsyncCallback<string> } callback - Returns the DVID if obtained; returns an empty string if no OHOS account has logged in. 1241 * @throws { BusinessError } 201 - Permission denied. 1242 * @throws { BusinessError } 401 - The parameter check failed. 1243 * @throws { BusinessError } 12300001 - System service exception. 1244 * @syscap SystemCapability.Account.OsAccount 1245 * @since 9 1246 */ 1247 queryDistributedVirtualDeviceId(callback: AsyncCallback<string>): void; 1248 1249 /** 1250 * Queries the distributed virtual device ID (DVID). 1251 * <p> 1252 * If the same OHOS account has logged in to multiple devices, these devices constitute a super device 1253 * through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs. 1254 * The same application running on different devices obtains the same DVID, whereas different applications 1255 * obtain different DVIDs. 1256 * <p> 1257 * 1258 * @permission ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS 1259 * @returns { Promise<string> } Returns the DVID if obtained; returns an empty string if no OHOS account has logged in. 1260 * @throws { BusinessError } 201 - Permission denied. 1261 * @throws { BusinessError } 401 - The parameter check failed. 1262 * @throws { BusinessError } 12300001 - System service exception. 1263 * @syscap SystemCapability.Account.OsAccount 1264 * @since 9 1265 */ 1266 queryDistributedVirtualDeviceId(): Promise<string>; 1267 1268 /** 1269 * Obtains the profile photo of an OS account based on its local ID. 1270 * 1271 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1272 * @param { number } localId - Indicates the local ID of the OS account. 1273 * @param { AsyncCallback<string> } callback - Returns the profile photo if obtained; 1274 * returns {@code null} if the profile photo fails to be obtained. 1275 * @throws { BusinessError } 201 - Permission denied. 1276 * @throws { BusinessError } 202 - Not system application. 1277 * @throws { BusinessError } 401 - The parameter check failed. 1278 * @throws { BusinessError } 12300001 - System service exception. 1279 * @throws { BusinessError } 12300002 - Invalid localId. 1280 * @throws { BusinessError } 12300003 - Account not found. 1281 * @syscap SystemCapability.Account.OsAccount 1282 * @systemapi Hide this for inner system use. 1283 * @since 7 1284 */ 1285 getOsAccountProfilePhoto(localId: number, callback: AsyncCallback<string>): void; 1286 1287 /** 1288 * Obtains the profile photo of an OS account based on its local ID. 1289 * 1290 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1291 * @param { number } localId - Indicates the local ID of the OS account. 1292 * @returns { Promise<string> } Returns the profile photo if obtained; 1293 * returns {@code null} if the profile photo fails to be obtained. 1294 * @throws { BusinessError } 201 - Permission denied. 1295 * @throws { BusinessError } 202 - Not system application. 1296 * @throws { BusinessError } 401 - The parameter check failed. 1297 * @throws { BusinessError } 12300001 - System service exception. 1298 * @throws { BusinessError } 12300002 - Invalid localId. 1299 * @throws { BusinessError } 12300003 - Account not found. 1300 * @syscap SystemCapability.Account.OsAccount 1301 * @systemapi Hide this for inner system use. 1302 * @since 7 1303 */ 1304 getOsAccountProfilePhoto(localId: number): Promise<string>; 1305 1306 /** 1307 * Sets the profile photo for an OS account based on its local ID. 1308 * 1309 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1310 * @param { number } localId - Indicates the local ID of the OS account. 1311 * @param { string } photo - Indicates the profile photo to set for the OS account. 1312 * @param { AsyncCallback<void> } callback - Asynchronous callback interface. 1313 * @throws { BusinessError } 201 - Permission denied. 1314 * @throws { BusinessError } 202 - Not system application. 1315 * @throws { BusinessError } 401 - The parameter check failed. 1316 * @throws { BusinessError } 12300001 - System service exception. 1317 * @throws { BusinessError } 12300002 - Invalid localId or photo. 1318 * @throws { BusinessError } 12300003 - Account not found. 1319 * @throws { BusinessError } 12300008 - Restricted Account. 1320 * @syscap SystemCapability.Account.OsAccount 1321 * @systemapi Hide this for inner system use. 1322 * @since 7 1323 */ 1324 setOsAccountProfilePhoto(localId: number, photo: string, callback: AsyncCallback<void>): void; 1325 1326 /** 1327 * Sets the profile photo for an OS account based on its local ID. 1328 * 1329 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1330 * @param { number } localId - Indicates the local ID of the OS account. 1331 * @param { string } photo - Indicates the profile photo to set for the OS account. 1332 * @returns { Promise<void> } The promise returned by the function. 1333 * @throws { BusinessError } 201 - Permission denied. 1334 * @throws { BusinessError } 202 - Not system application. 1335 * @throws { BusinessError } 401 - The parameter check failed. 1336 * @throws { BusinessError } 12300001 - System service exception. 1337 * @throws { BusinessError } 12300002 - Invalid localId or photo. 1338 * @throws { BusinessError } 12300003 - Account not found. 1339 * @throws { BusinessError } 12300008 - Restricted Account. 1340 * @syscap SystemCapability.Account.OsAccount 1341 * @systemapi Hide this for inner system use. 1342 * @since 7 1343 */ 1344 setOsAccountProfilePhoto(localId: number, photo: string): Promise<void>; 1345 1346 /** 1347 * Obtain localId according to serial number 1348 * 1349 * @param { number } serialNumber - Indicates serial number. 1350 * @param { AsyncCallback<number> } callback - Returns localId. 1351 * @syscap SystemCapability.Account.OsAccount 1352 * @since 8 1353 * @deprecated since 9 1354 * @useinstead osAccount.AccountManager#getOsAccountLocalIdForSerialNumber 1355 */ 1356 getOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback<number>): void; 1357 1358 /** 1359 * Obtain localId according to serial number 1360 * 1361 * @param { number } serialNumber - Indicates serial number. 1362 * @returns { Promise<number> } Returns localId. 1363 * @syscap SystemCapability.Account.OsAccount 1364 * @since 8 1365 * @deprecated since 9 1366 * @useinstead osAccount.AccountManager#getOsAccountLocalIdForSerialNumber 1367 */ 1368 getOsAccountLocalIdBySerialNumber(serialNumber: number): Promise<number>; 1369 1370 /** 1371 * Gets the local ID of the OS account associated with the serial number. 1372 * 1373 * @param { number } serialNumber - Indicates serial number. 1374 * @param { AsyncCallback<number> } callback - Indicates the callback for getting the local ID of the OS account associated with the serial number. 1375 * @throws { BusinessError } 401 - The parameter check failed. 1376 * @throws { BusinessError } 12300001 - System service exception. 1377 * @throws { BusinessError } 12300002 - Invalid serialNumber. 1378 * @throws { BusinessError } 12300003 - The account indicated by serialNumber dose not exist. 1379 * @syscap SystemCapability.Account.OsAccount 1380 * @since 9 1381 */ 1382 getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback<number>): void; 1383 1384 /** 1385 * Gets the local ID of the OS account associated with the serial number. 1386 * 1387 * @param { number } serialNumber - Indicates serial number. 1388 * @returns { Promise<number> } Returns the local ID of the OS account associated with the serial number. 1389 * @throws { BusinessError } 401 - The parameter check failed. 1390 * @throws { BusinessError } 12300001 - System service exception. 1391 * @throws { BusinessError } 12300002 - Invalid serialNumber. 1392 * @throws { BusinessError } 12300003 - The account indicated by serialNumber dose not exist. 1393 * @syscap SystemCapability.Account.OsAccount 1394 * @since 9 1395 */ 1396 getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise<number>; 1397 1398 /** 1399 * Obtain serial number according to localId. 1400 * 1401 * @param { number } localId - Indicates the local ID of the OS account. 1402 * @param { AsyncCallback<number> } callback - Returns serial number. 1403 * @syscap SystemCapability.Account.OsAccount 1404 * @since 8 1405 * @deprecated since 9 1406 * @useinstead osAccount.AccountManager#getSerialNumberForOsAccountLocalId 1407 */ 1408 getSerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback<number>): void; 1409 1410 /** 1411 * Obtain serial number according to localId. 1412 * 1413 * @param { number } localId - Indicates the local ID of the OS account. 1414 * @returns { Promise<number> } Returns serial number. 1415 * @syscap SystemCapability.Account.OsAccount 1416 * @since 8 1417 * @deprecated since 9 1418 * @useinstead osAccount.AccountManager#getSerialNumberForOsAccountLocalId 1419 */ 1420 getSerialNumberByOsAccountLocalId(localId: number): Promise<number>; 1421 1422 /** 1423 * Gets the serial number for the specified os account local id. 1424 * 1425 * @param { number } localId - Indicates the local ID of the OS account. 1426 * @param { AsyncCallback<number> } callback - Indicates the callback for getting the serial number for the specified os account local id. 1427 * @throws { BusinessError } 401 - The parameter check failed. 1428 * @throws { BusinessError } 12300001 - System service exception. 1429 * @throws { BusinessError } 12300002 - Invalid localId. 1430 * @throws { BusinessError } 12300003 - Account not found. 1431 * @syscap SystemCapability.Account.OsAccount 1432 * @since 9 1433 */ 1434 getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback<number>): void; 1435 1436 /** 1437 * Gets the serial number for the specified os account local id. 1438 * 1439 * @param { number } localId - Indicates the local ID of the OS account. 1440 * @returns { Promise<number> } Returns the serial number according to local ID. 1441 * @throws { BusinessError } 401 - The parameter check failed. 1442 * @throws { BusinessError } 12300001 - System service exception. 1443 * @throws { BusinessError } 12300002 - Invalid localId. 1444 * @throws { BusinessError } 12300003 - Account not found. 1445 * @syscap SystemCapability.Account.OsAccount 1446 * @since 9 1447 */ 1448 getSerialNumberForOsAccountLocalId(localId: number): Promise<number>; 1449 1450 /** 1451 * Subscribes to the change events of accounts. 1452 * <p> 1453 * When user change the account, the subscriber will receive a notification 1454 * about the account change event. 1455 * 1456 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION 1457 * @param { 'activate' | 'activating' } type - Event type. 1458 * @param { string } name - Indicates the name of subscriber. 1459 * @param { Callback<number> } callback - Asynchronous callback interface. 1460 * @throws { BusinessError } 201 - Permission denied. 1461 * @throws { BusinessError } 202 - Not system application. 1462 * @throws { BusinessError } 401 - The parameter check failed. 1463 * @throws { BusinessError } 12300001 - System service exception. 1464 * @throws { BusinessError } 12300002 - Invalid type or name. 1465 * @syscap SystemCapability.Account.OsAccount 1466 * @systemapi Hide this for inner system use. 1467 * @since 7 1468 */ 1469 on(type: 'activate' | 'activating', name: string, callback: Callback<number>): void; 1470 1471 /** 1472 * Unsubscribes from account events. 1473 * 1474 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION 1475 * @param { 'activate' | 'activating' } type - Event type. 1476 * @param { string } name - Indicates the name of subscriber. 1477 * @param { Callback<number> } callback - Asynchronous callback interface. 1478 * @throws { BusinessError } 201 - Permission denied. 1479 * @throws { BusinessError } 202 - Not system application. 1480 * @throws { BusinessError } 401 - The parameter check failed. 1481 * @throws { BusinessError } 12300001 - System service exception. 1482 * @throws { BusinessError } 12300002 - Invalid type or name. 1483 * @syscap SystemCapability.Account.OsAccount 1484 * @systemapi Hide this for inner system use. 1485 * @since 7 1486 */ 1487 off(type: 'activate' | 'activating', name: string, callback?: Callback<number>): void; 1488 1489 /** 1490 * Gets the bundle ID associated with the specified UID. 1491 * 1492 * @param { number } uid - Indicates the target uid. 1493 * @param { AsyncCallback<number> } callback - Indicates the callback for getting the bundle ID associated with the specified UID. 1494 * @throws { BusinessError } 202 - Not system application. 1495 * @throws { BusinessError } 401 - The parameter check failed. 1496 * @throws { BusinessError } 12300001 - System service exception. 1497 * @throws { BusinessError } 12300002 - Invalid uid. 1498 * @syscap SystemCapability.Account.OsAccount 1499 * @systemapi Hide this for inner system use. 1500 * @since 9 1501 */ 1502 getBundleIdForUid(uid: number, callback: AsyncCallback<number>): void; 1503 1504 /** 1505 * Gets the bundle ID associated with the specified UID. 1506 * 1507 * @param { number } uid - Indicates the target uid. 1508 * @returns { Promise<number> } Returns the bundle ID associated with the specified UID. 1509 * @throws { BusinessError } 202 - Not system application. 1510 * @throws { BusinessError } 401 - The parameter check failed. 1511 * @throws { BusinessError } 12300001 - System service exception. 1512 * @throws { BusinessError } 12300002 - Invalid uid. 1513 * @syscap SystemCapability.Account.OsAccount 1514 * @systemapi Hide this for inner system use. 1515 * @since 9 1516 */ 1517 getBundleIdForUid(uid: number): Promise<number>; 1518 1519 /** 1520 * Gets the bundle ID associated with the specified UID synchronously. 1521 * 1522 * @param { number } uid - Indicates the target uid. 1523 * @returns { number } Returns the bundle ID associated with the specified UID. 1524 * @throws { BusinessError } 202 - Not system application. 1525 * @throws { BusinessError } 401 - The parameter check failed. 1526 * @throws { BusinessError } 12300002 - Invalid uid. 1527 * @syscap SystemCapability.Account.OsAccount 1528 * @systemapi Hide this for inner system use. 1529 * @since 10 1530 */ 1531 getBundleIdForUidSync(uid: number): number; 1532 1533 /** 1534 * Check whether current process belongs to the main account. 1535 * 1536 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1537 * @param { AsyncCallback<boolean> } callback - Returns {@code true} if current process belongs to the main os account; 1538 * returns {@code false} otherwise. 1539 * @throws { BusinessError } 201 - Permission denied. 1540 * @throws { BusinessError } 202 - Not system application. 1541 * @throws { BusinessError } 401 - The parameter check failed. 1542 * @throws { BusinessError } 12300001 - System service exception. 1543 * @syscap SystemCapability.Account.OsAccount 1544 * @systemapi Hide this for inner system use. 1545 * @since 9 1546 */ 1547 isMainOsAccount(callback: AsyncCallback<boolean>): void; 1548 1549 /** 1550 * Check whether current process belongs to the main account. 1551 * 1552 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1553 * @returns { Promise<boolean> } Returns {@code true} if current process belongs to the main os account; 1554 * returns {@code false} otherwise. 1555 * @throws { BusinessError } 201 - Permission denied. 1556 * @throws { BusinessError } 202 - Not system application. 1557 * @throws { BusinessError } 401 - The parameter check failed. 1558 * @throws { BusinessError } 12300001 - System service exception. 1559 * @syscap SystemCapability.Account.OsAccount 1560 * @systemapi Hide this for inner system use. 1561 * @since 9 1562 */ 1563 isMainOsAccount(): Promise<boolean>; 1564 1565 /** 1566 * Gets a list of constraint source types for the specified os account. 1567 * 1568 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1569 * @param { number } localId - Indicates the local ID of the OS account. 1570 * @param { string } constraint - Indicates the constraint to query the source type. 1571 * @param { AsyncCallback<Array<ConstraintSourceTypeInfo>> } callback - Indicates the callback for 1572 * getting a list of constraint source types for the specified os account. 1573 * @throws { BusinessError } 201 - Permission denied. 1574 * @throws { BusinessError } 202 - Not system application. 1575 * @throws { BusinessError } 401 - The parameter check failed. 1576 * @throws { BusinessError } 12300001 - System service exception. 1577 * @throws { BusinessError } 12300002 - Invalid name or constraint. 1578 * @throws { BusinessError } 12300003 - Account not found. 1579 * @syscap SystemCapability.Account.OsAccount 1580 * @systemapi Hide this for inner system use. 1581 * @since 9 1582 */ 1583 getOsAccountConstraintSourceTypes( 1584 localId: number, 1585 constraint: string, 1586 callback: AsyncCallback<Array<ConstraintSourceTypeInfo>> 1587 ): void; 1588 1589 /** 1590 * Gets a list of constraint source types for the specified os account. 1591 * 1592 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1593 * @param { number } localId - Indicates the local ID of the OS account. 1594 * @param { string } constraint - Indicates the constraint to query the source type. 1595 * @returns { Promise<Array<ConstraintSourceTypeInfo>> } Returns a list of constraint source types for the specified os account. 1596 * @throws { BusinessError } 201 - Permission denied. 1597 * @throws { BusinessError } 202 - Not system application. 1598 * @throws { BusinessError } 401 - The parameter check failed. 1599 * @throws { BusinessError } 12300001 - System service exception. 1600 * @throws { BusinessError } 12300002 - Invalid name or constraint. 1601 * @throws { BusinessError } 12300003 - Account not found. 1602 * @syscap SystemCapability.Account.OsAccount 1603 * @systemapi Hide this for inner system use. 1604 * @since 9 1605 */ 1606 getOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise<Array<ConstraintSourceTypeInfo>>; 1607 } 1608 1609 /** 1610 * Provides information about OS accounts, including the local ID, local name, and type of an OS account. 1611 * 1612 * @interface OsAccountInfo 1613 * @syscap SystemCapability.Account.OsAccount 1614 * @since 7 1615 */ 1616 interface OsAccountInfo { 1617 /** 1618 * The local ID of an OS account. 1619 * 1620 * @type { number } 1621 * @syscap SystemCapability.Account.OsAccount 1622 * @since 7 1623 */ 1624 localId: number; 1625 1626 /** 1627 * The local name of an OS account. 1628 * 1629 * @type { string } 1630 * @syscap SystemCapability.Account.OsAccount 1631 * @since 7 1632 */ 1633 localName: string; 1634 1635 /** 1636 * Include: ADMIN, Normal, GUEST. 1637 * 1638 * @type { OsAccountType } 1639 * @syscap SystemCapability.Account.OsAccount 1640 * @since 7 1641 */ 1642 type: OsAccountType; 1643 1644 /** 1645 * Account constraints information. 1646 * 1647 * @type { Array<string> } 1648 * @syscap SystemCapability.Account.OsAccount 1649 * @since 7 1650 */ 1651 constraints: Array<string>; 1652 1653 /** 1654 * The account is verified or not. 1655 * 1656 * @type { boolean } 1657 * @syscap SystemCapability.Account.OsAccount 1658 * @since 8 1659 */ 1660 isVerified: boolean; 1661 1662 /** 1663 * OS account photo. 1664 * 1665 * @type { string } 1666 * @syscap SystemCapability.Account.OsAccount 1667 * @since 8 1668 */ 1669 photo: string; 1670 1671 /** 1672 * Os account create time. 1673 * 1674 * @type { number } 1675 * @syscap SystemCapability.Account.OsAccount 1676 * @since 8 1677 */ 1678 createTime: number; 1679 1680 /** 1681 * The last time to log in. 1682 * 1683 * @type { number } 1684 * @syscap SystemCapability.Account.OsAccount 1685 * @since 8 1686 */ 1687 lastLoginTime: number; 1688 1689 /** 1690 * Os account serial number. 1691 * 1692 * @type { number } 1693 * @syscap SystemCapability.Account.OsAccount 1694 * @since 8 1695 */ 1696 serialNumber: number; 1697 1698 /** 1699 * Os account is activated or not. 1700 * 1701 * @type { boolean } 1702 * @syscap SystemCapability.Account.OsAccount 1703 * @since 8 1704 */ 1705 isActived: boolean; 1706 1707 /** 1708 * Os account create completed or not. 1709 * 1710 * @type { boolean } 1711 * @syscap SystemCapability.Account.OsAccount 1712 * @since 8 1713 */ 1714 isCreateCompleted: boolean; 1715 1716 /** 1717 * Distributed account info. 1718 * 1719 * @type { distributedAccount.DistributedInfo } 1720 * @syscap SystemCapability.Account.OsAccount 1721 * @since 7 1722 */ 1723 distributedInfo: distributedAccount.DistributedInfo; 1724 1725 /** 1726 * Domain account info. 1727 * 1728 * @type { DomainAccountInfo } 1729 * @syscap SystemCapability.Account.OsAccount 1730 * @since 8 1731 */ 1732 domainInfo: DomainAccountInfo; 1733 } 1734 1735 /** 1736 * Provides information about domain accounts. 1737 * 1738 * @interface DomainAccountInfo 1739 * @syscap SystemCapability.Account.OsAccount 1740 * @since 8 1741 */ 1742 interface DomainAccountInfo { 1743 /** 1744 * The domain name 1745 * 1746 * @type { string } 1747 * @syscap SystemCapability.Account.OsAccount 1748 * @since 8 1749 */ 1750 domain: string; 1751 1752 /** 1753 * The account name in the domain 1754 * 1755 * @type { string } 1756 * @syscap SystemCapability.Account.OsAccount 1757 * @since 8 1758 */ 1759 accountName: string; 1760 1761 /** 1762 * The account identifier in the domain. 1763 * 1764 * @type { ?string } 1765 * @syscap SystemCapability.Account.OsAccount 1766 * @systemapi Hide this for inner system use. 1767 * @since 10 1768 */ 1769 accountId?: string; 1770 } 1771 1772 /** 1773 * Enumerates OS account types. 1774 * 1775 * @enum { number } OsAccountType 1776 * @syscap SystemCapability.Account.OsAccount 1777 * @since 7 1778 */ 1779 enum OsAccountType { 1780 /** 1781 * Indicates the administrator account, which has the permission to manage other OS accounts. 1782 * 1783 * @syscap SystemCapability.Account.OsAccount 1784 * @since 7 1785 */ 1786 ADMIN = 0, 1787 1788 /** 1789 * Indicates a normal account, which has access to common functions of OS accounts. 1790 * 1791 * @syscap SystemCapability.Account.OsAccount 1792 * @since 7 1793 */ 1794 NORMAL, 1795 1796 /** 1797 * Indicates a guest account, which is used to temporarily access the device and may be deleted at any time. 1798 * 1799 * @syscap SystemCapability.Account.OsAccount 1800 * @since 7 1801 */ 1802 GUEST 1803 } 1804 1805 /** 1806 * Provides the abilities for user authentication. 1807 * 1808 * @syscap SystemCapability.Account.OsAccount 1809 * @systemapi Hide this for inner system use. 1810 * @since 8 1811 * @name UserAuth 1812 */ 1813 class UserAuth { 1814 /** 1815 * Constructor to get the UserAuth class instance. 1816 * 1817 * @throws { BusinessError } 202 - Not system application. 1818 * @syscap SystemCapability.Account.OsAccount 1819 * @systemapi Hide this for inner system use. 1820 * @since 8 1821 */ 1822 constructor(); 1823 1824 /** 1825 * Gets version information. 1826 * 1827 * @returns { number } Returns the version information. 1828 * @throws { BusinessError } 202 - Not system application. 1829 * @syscap SystemCapability.Account.OsAccount 1830 * @systemapi Hide this for inner system use. 1831 * @since 8 1832 */ 1833 getVersion(): number; 1834 1835 /** 1836 * Checks whether the authentication capability is available. 1837 * 1838 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 1839 * @param { AuthType } authType - Indicates the credential type for authentication. 1840 * @param { AuthTrustLevel } authTrustLevel - Indicates the trust level of authentication result. 1841 * @returns { number } Returns a status result. 1842 * @throws { BusinessError } 201 - Permission denied. 1843 * @throws { BusinessError } 202 - Not system application. 1844 * @throws { BusinessError } 401 - The parameter check failed. 1845 * @throws { BusinessError } 12300001 - System service exception. 1846 * @throws { BusinessError } 12300002 - Invalid authType or authTrustLevel. 1847 * @syscap SystemCapability.Account.OsAccount 1848 * @systemapi Hide this for inner system use. 1849 * @since 8 1850 */ 1851 getAvailableStatus(authType: AuthType, authTrustLevel: AuthTrustLevel): number; 1852 1853 /** 1854 * Gets the property based on the specified request information. 1855 * 1856 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 1857 * @param { GetPropertyRequest } request - Indicates the request information, including authentication type, and property type list. 1858 * @param { AsyncCallback<ExecutorProperty> } callback - Returns an executor property. 1859 * @throws { BusinessError } 201 - Permission denied. 1860 * @throws { BusinessError } 202 - Not system application. 1861 * @throws { BusinessError } 401 - The parameter check failed. 1862 * @throws { BusinessError } 12300001 - System service exception. 1863 * @throws { BusinessError } 12300002 - Invalid request. 1864 * @syscap SystemCapability.Account.OsAccount 1865 * @systemapi Hide this for inner system use. 1866 * @since 8 1867 */ 1868 getProperty(request: GetPropertyRequest, callback: AsyncCallback<ExecutorProperty>): void; 1869 1870 /** 1871 * Gets the property based on the specified request information. 1872 * 1873 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 1874 * @param { GetPropertyRequest } request - Indicates the request information, including authentication type, and property type list. 1875 * @returns { Promise<ExecutorProperty> } Returns an executor property. 1876 * @throws { BusinessError } 201 - Permission denied. 1877 * @throws { BusinessError } 202 - Not system application. 1878 * @throws { BusinessError } 401 - The parameter check failed. 1879 * @throws { BusinessError } 12300001 - System service exception. 1880 * @throws { BusinessError } 12300002 - Invalid request. 1881 * @syscap SystemCapability.Account.OsAccount 1882 * @systemapi Hide this for inner system use. 1883 * @since 8 1884 */ 1885 getProperty(request: GetPropertyRequest): Promise<ExecutorProperty>; 1886 1887 /** 1888 * Sets property that can be used to initialize algorithms. 1889 * 1890 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 1891 * @param { SetPropertyRequest } request - Indicates the request information, including authentication type and the key-value to be set. 1892 * @param { AsyncCallback<void> } callback - Asynchronous callback interface. 1893 * @throws { BusinessError } 201 - Permission denied. 1894 * @throws { BusinessError } 202 - Not system application. 1895 * @throws { BusinessError } 401 - The parameter check failed. 1896 * @throws { BusinessError } 12300001 - System service exception. 1897 * @throws { BusinessError } 12300002 - Invalid request. 1898 * @syscap SystemCapability.Account.OsAccount 1899 * @systemapi Hide this for inner system use. 1900 * @since 8 1901 */ 1902 setProperty(request: SetPropertyRequest, callback: AsyncCallback<void>): void; 1903 1904 /** 1905 * Sets property that can be used to initialize algorithms. 1906 * 1907 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 1908 * @param { SetPropertyRequest } request - Indicates the request information, including authentication type and the key-value to be set. 1909 * @returns { Promise<void> } The promise returned by the function. 1910 * @throws { BusinessError } 201 - Permission denied. 1911 * @throws { BusinessError } 202 - Not system application. 1912 * @throws { BusinessError } 401 - The parameter check failed. 1913 * @throws { BusinessError } 12300001 - System service exception. 1914 * @throws { BusinessError } 12300002 - Invalid request. 1915 * @syscap SystemCapability.Account.OsAccount 1916 * @systemapi Hide this for inner system use. 1917 * @since 8 1918 */ 1919 setProperty(request: SetPropertyRequest): Promise<void>; 1920 1921 /** 1922 * Executes authentication. 1923 * 1924 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 1925 * @param { Uint8Array } challenge - Indicates the challenge value. 1926 * @param { AuthType } authType - Indicates the authentication type. 1927 * @param { AuthTrustLevel } authTrustLevel - Indicates the trust level of authentication result. 1928 * @param { IUserAuthCallback } callback - Indicates the callback to get result and acquireInfo. 1929 * @returns { Uint8Array } Returns a context ID for cancellation. 1930 * @throws { BusinessError } 201 - Permission denied. 1931 * @throws { BusinessError } 202 - Not system application. 1932 * @throws { BusinessError } 401 - The parameter check failed. 1933 * @throws { BusinessError } 12300001 - System service exception. 1934 * @throws { BusinessError } 12300002 - Invalid challenge, authType or authTrustLevel. 1935 * @throws { BusinessError } 12300101 - Credential is incorrect. 1936 * @throws { BusinessError } 12300102 - Credential not enrolled. 1937 * @throws { BusinessError } 12300105 - Unsupported authTrustLevel. 1938 * @throws { BusinessError } 12300106 - Unsupported authType. 1939 * @throws { BusinessError } 12300109 - Authentication is canceled. 1940 * @throws { BusinessError } 12300110 - Authentication is locked. 1941 * @throws { BusinessError } 12300111 - Authentication timeout. 1942 * @throws { BusinessError } 12300112 - Authentication service is busy. 1943 * @syscap SystemCapability.Account.OsAccount 1944 * @systemapi Hide this for inner system use. 1945 * @since 8 1946 */ 1947 auth( 1948 challenge: Uint8Array, 1949 authType: AuthType, 1950 authTrustLevel: AuthTrustLevel, 1951 callback: IUserAuthCallback 1952 ): Uint8Array; 1953 1954 /** 1955 * Executes user authentication. 1956 * 1957 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 1958 * @param { number } userId - Indicates the user identification. 1959 * @param { Uint8Array } challenge - Indicates the challenge value. 1960 * @param { AuthType } authType - Indicates the authentication type. 1961 * @param { AuthTrustLevel } authTrustLevel - Indicates the trust level of authentication result. 1962 * @param { IUserAuthCallback } callback - Indicates the callback to get result and acquireInfo. 1963 * @returns { Uint8Array } Returns a context ID for cancellation. 1964 * @throws { BusinessError } 201 - Permission denied. 1965 * @throws { BusinessError } 202 - Not system application. 1966 * @throws { BusinessError } 401 - The parameter check failed. 1967 * @throws { BusinessError } 12300001 - System service exception. 1968 * @throws { BusinessError } 12300002 - Invalid userId, challenge, authType or authTrustLevel. 1969 * @throws { BusinessError } 12300101 - Credential is incorrect. 1970 * @throws { BusinessError } 12300102 - Credential not enrolled. 1971 * @throws { BusinessError } 12300105 - Unsupported authTrustLevel. 1972 * @throws { BusinessError } 12300106 - Unsupported authType. 1973 * @throws { BusinessError } 12300109 - Authentication is canceled. 1974 * @throws { BusinessError } 12300110 - Authentication is locked. 1975 * @throws { BusinessError } 12300111 - Authentication timeout. 1976 * @throws { BusinessError } 12300112 - Authentication service is busy. 1977 * @syscap SystemCapability.Account.OsAccount 1978 * @systemapi Hide this for inner system use. 1979 * @since 8 1980 */ 1981 authUser( 1982 userId: number, 1983 challenge: Uint8Array, 1984 authType: AuthType, 1985 authTrustLevel: AuthTrustLevel, 1986 callback: IUserAuthCallback 1987 ): Uint8Array; 1988 1989 /** 1990 * Cancels authentication with context ID. 1991 * 1992 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 1993 * @param { Uint8Array } contextID - Indicates the authentication context ID. 1994 * @throws { BusinessError } 201 - Permission denied. 1995 * @throws { BusinessError } 202 - Not system application. 1996 * @throws { BusinessError } 401 - The parameter check failed. 1997 * @throws { BusinessError } 12300001 - System service exception. 1998 * @throws { BusinessError } 12300002 - Invalid contextId. 1999 * @syscap SystemCapability.Account.OsAccount 2000 * @systemapi Hide this for inner system use. 2001 * @since 8 2002 */ 2003 cancelAuth(contextID: Uint8Array): void; 2004 } 2005 2006 /** 2007 * Provides the abilities for Pin code authentication. 2008 * 2009 * @syscap SystemCapability.Account.OsAccount 2010 * @systemapi Hide this for inner system use. 2011 * @since 8 2012 * @name PINAuth 2013 */ 2014 class PINAuth { 2015 /** 2016 * Constructor to get the PINAuth class instance. 2017 * 2018 * @throws { BusinessError } 202 - Not system application. 2019 * @syscap SystemCapability.Account.OsAccount 2020 * @systemapi Hide this for inner system use. 2021 * @since 8 2022 */ 2023 constructor(); 2024 2025 /** 2026 * Register inputer. 2027 * 2028 * @permission ohos.permission.ACCESS_PIN_AUTH 2029 * @param { IInputer } inputer - Indicates the password input box callback 2030 * @throws { BusinessError } 201 - Permission denied. 2031 * @throws { BusinessError } 202 - Not system application. 2032 * @throws { BusinessError } 401 - The parameter check failed. 2033 * @throws { BusinessError } 12300001 - System service exception. 2034 * @throws { BusinessError } 12300002 - Invalid inputer. 2035 * @throws { BusinessError } 12300103 - Inputer already registered. 2036 * @syscap SystemCapability.Account.OsAccount 2037 * @systemapi Hide this for inner system use. 2038 * @since 8 2039 */ 2040 registerInputer(inputer: IInputer): void; 2041 2042 /** 2043 * Unregister inputer. 2044 * 2045 * @permission ohos.permission.ACCESS_PIN_AUTH 2046 * @throws { BusinessError } 201 - Permission denied. 2047 * @throws { BusinessError } 202 - Not system application. 2048 * @syscap SystemCapability.Account.OsAccount 2049 * @systemapi Hide this for inner system use. 2050 * @since 8 2051 */ 2052 unregisterInputer(): void; 2053 } 2054 2055 /** 2056 * Provides the management of credential inputers. 2057 * 2058 * @syscap SystemCapability.Account.OsAccount 2059 * @systemapi Hide this for inner system use. 2060 * @since 9 2061 * @name InputerManager 2062 */ 2063 class InputerManager { 2064 /** 2065 * Register credential inputer by authentication type. 2066 * 2067 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL or ohos.permission.MANAGE_USER_IDM 2068 * @param { AuthType } authType - Indicates the authentication type. 2069 * @param { IInputer } inputer - Indicates the credential input box callback. 2070 * @throws { BusinessError } 201 - Permission denied. 2071 * @throws { BusinessError } 202 - Not system application. 2072 * @throws { BusinessError } 401 - The parameter check failed. 2073 * @throws { BusinessError } 12300001 - System service exception. 2074 * @throws { BusinessError } 12300002 - Invalid authType or inputer. 2075 * @throws { BusinessError } 12300103 - The credential inputer has been registered. 2076 * @throws { BusinessError } 12300106 - Unsupported authType. 2077 * @static 2078 * @syscap SystemCapability.Account.OsAccount 2079 * @systemapi Hide this for inner system use. 2080 * @since 9 2081 */ 2082 static registerInputer(authType: AuthType, inputer: IInputer): void; 2083 2084 /** 2085 * Unregister credential inputer by authentication type. 2086 * 2087 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL or ohos.permission.MANAGE_USER_IDM 2088 * @param { AuthType } authType - Indicates the authentication type. 2089 * @throws { BusinessError } 201 - Permission denied. 2090 * @throws { BusinessError } 202 - Not system application. 2091 * @throws { BusinessError } 401 - The parameter check failed. 2092 * @throws { BusinessError } 12300002 - Invalid authType. 2093 * @static 2094 * @syscap SystemCapability.Account.OsAccount 2095 * @systemapi Hide this for inner system use. 2096 * @since 9 2097 */ 2098 static unregisterInputer(authType: AuthType): void; 2099 } 2100 2101 /** 2102 * Provides the AuthStatusInfo type. 2103 * 2104 * @interface AuthStatusInfo 2105 * @syscap SystemCapability.Account.OsAccount 2106 * @systemapi Hide this for inner system use. 2107 * @since 10 2108 */ 2109 interface AuthStatusInfo { 2110 /** 2111 * Indicates the remaining times that authentication can be performed. 2112 * 2113 * @type { number } 2114 * @syscap SystemCapability.Account.OsAccount 2115 * @systemapi Hide this for inner system use. 2116 * @since 10 2117 */ 2118 remainTimes: number; 2119 2120 /** 2121 * Indicates the freezing time before performing the next authentication. 2122 * 2123 * @type { number } 2124 * @syscap SystemCapability.Account.OsAccount 2125 * @systemapi Hide this for inner system use. 2126 * @since 10 2127 */ 2128 freezingTime: number; 2129 } 2130 2131 /** 2132 * Provides the GetDomainAccessTokenOptions type. 2133 * 2134 * @typedef GetDomainAccessTokenOptions 2135 * @syscap SystemCapability.Account.OsAccount 2136 * @systemapi Hide this for inner system use. 2137 * @since 10 2138 */ 2139 interface GetDomainAccessTokenOptions { 2140 /** 2141 * Indicates the domain account information. 2142 * 2143 * @type { DomainAccountInfo } 2144 * @syscap SystemCapability.Account.OsAccount 2145 * @systemapi Hide this for inner system use. 2146 * @since 10 2147 */ 2148 domainAccountInfo: DomainAccountInfo; 2149 2150 /** 2151 * Indicates the domain account token. 2152 * 2153 * @type { Uint8Array } 2154 * @syscap SystemCapability.Account.OsAccount 2155 * @systemapi Hide this for inner system use. 2156 * @since 10 2157 */ 2158 domainAccountToken: Uint8Array; 2159 2160 /** 2161 * Indicates the business parameters. 2162 * 2163 * @type { object } 2164 * @syscap SystemCapability.Account.OsAccount 2165 * @systemapi Hide this for inner system use. 2166 * @since 10 2167 */ 2168 businessParams: { [key: string]: object }; 2169 2170 /** 2171 * Indicates caller UID. 2172 * 2173 * @type { number } 2174 * @syscap SystemCapability.Account.OsAccount 2175 * @systemapi Hide this for inner system use. 2176 * @since 10 2177 */ 2178 callerUid: number; 2179 } 2180 2181 /** 2182 * Options for getting domain account information. 2183 * 2184 * @typedef GetDomainAccountInfoOptions 2185 * @syscap SystemCapability.Account.OsAccount 2186 * @systemapi Hide this for inner system use. 2187 * @since 10 2188 */ 2189 interface GetDomainAccountInfoOptions { 2190 /** 2191 * Indicates the account name. 2192 * 2193 * @type { string } 2194 * @syscap SystemCapability.Account.OsAccount 2195 * @systemapi Hide this for inner system use. 2196 * @since 10 2197 */ 2198 accountName: string; 2199 2200 /** 2201 * Indicates the domain to which the account belongs. 2202 * 2203 * @type { ?string } 2204 * @syscap SystemCapability.Account.OsAccount 2205 * @systemapi Hide this for inner system use. 2206 * @since 10 2207 */ 2208 domain?: string; 2209 } 2210 2211 /** 2212 * Options for getting domain account information in the domain plugin. 2213 * 2214 * @typedef GetDomainAccountInfoPluginOptions 2215 * @syscap SystemCapability.Account.OsAccount 2216 * @systemapi Hide this for inner system use. 2217 * @since 10 2218 */ 2219 interface GetDomainAccountInfoPluginOptions extends GetDomainAccountInfoOptions { 2220 /** 2221 * Indicates the caller UID. 2222 * 2223 * @type { number } 2224 * @syscap SystemCapability.Account.OsAccount 2225 * @systemapi Hide this for inner system use. 2226 * @since 10 2227 */ 2228 callerUid: number; 2229 } 2230 2231 /** 2232 * Provides the definition of domain plugin. 2233 * 2234 * @interface DomainPlugin 2235 * @syscap SystemCapability.Account.OsAccount 2236 * @systemapi Hide this for inner system use. 2237 * @since 9 2238 */ 2239 interface DomainPlugin { 2240 /** 2241 * Authenticates the specified domain account. 2242 * 2243 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information for authentication. 2244 * @param { Uint8Array } credential - Indicates the credential for authentication. 2245 * @param { IUserAuthCallback } callback - Indicates the authentication callback. 2246 * @syscap SystemCapability.Account.OsAccount 2247 * @systemapi Hide this for inner system use. 2248 * @since 9 2249 */ 2250 auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUserAuthCallback): void; 2251 2252 /** 2253 * Authenticates the specified domain account with a popup. 2254 * 2255 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information for authentication. 2256 * @param { IUserAuthCallback } callback - Indicates the callback for notifying the authentication result. 2257 * @syscap SystemCapability.Account.OsAccount 2258 * @systemapi Hide this for inner system use. 2259 * @since 10 2260 */ 2261 authWithPopup(domainAccountInfo: DomainAccountInfo, callback: IUserAuthCallback): void; 2262 2263 /** 2264 * Authenticates the specified domain account with an authorization token. 2265 * 2266 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information for authentication. 2267 * @param { Uint8Array } token - Indicates the authorization token generated when PIN or biometric authentication is successful. 2268 * @param { IUserAuthCallback } callback - Indicates the callback for notifying the authentication result. 2269 * @syscap SystemCapability.Account.OsAccount 2270 * @systemapi Hide this for inner system use. 2271 * @since 10 2272 */ 2273 authWithToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, callback: IUserAuthCallback): void; 2274 2275 /** 2276 * Gets the domain account information with the specified options. 2277 * 2278 * @param { GetDomainAccountInfoPluginOptions } options - Indicates the options for getting domain account information. 2279 * @param { AsyncCallback<DomainAccountInfo> } callback - Indicates the callback for notifying the domain account information. 2280 * @syscap SystemCapability.Account.OsAccount 2281 * @systemapi Hide this for inner system use. 2282 * @since 10 2283 */ 2284 getAccountInfo(options: GetDomainAccountInfoPluginOptions, callback: AsyncCallback<DomainAccountInfo>): void; 2285 2286 /** 2287 * Gets the domain authentication property for the specified domain account. 2288 * 2289 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information for authentication. 2290 * @param { AsyncCallback<AuthStatusInfo> } callback - Indicates the callback for notifying the domain authentication status information. 2291 * @syscap SystemCapability.Account.OsAccount 2292 * @systemapi Hide this for inner system use. 2293 * @since 10 2294 */ 2295 getAuthStatusInfo(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<AuthStatusInfo>): void; 2296 2297 /** 2298 * Binds the specified domain account with an OS account. 2299 * 2300 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information. 2301 * @param { number } localId - Indicates the local ID of the OS account. 2302 * @param { AsyncCallback<void> } callback - Indicates the callback for notifying the binding result. 2303 * @syscap SystemCapability.Account.OsAccount 2304 * @systemapi Hide this for inner system use. 2305 * @since 10 2306 */ 2307 bindAccount(domainAccountInfo: DomainAccountInfo, localId: number, callback: AsyncCallback<void>): void; 2308 2309 /** 2310 * Unbind the specified domain account. 2311 * 2312 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information. 2313 * @param { AsyncCallback<void> } callback - Indicates the callback for notifying the unbinding result. 2314 * @syscap SystemCapability.Account.OsAccount 2315 * @systemapi Hide this for inner system use. 2316 * @since 10 2317 */ 2318 unbindAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<void>): void; 2319 2320 /** 2321 * Checks whether the token of specified domain account is valid. 2322 * 2323 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information. 2324 * @param { Uint8Array } token - Indicates the account token. 2325 * @param { AsyncCallback<boolean> } callback - Indicates the callback for notifying the checking result. 2326 * @syscap SystemCapability.Account.OsAccount 2327 * @systemapi Hide this for inner system use. 2328 * @since 10 2329 */ 2330 isAccountTokenValid( 2331 domainAccountInfo: DomainAccountInfo, 2332 token: Uint8Array, 2333 callback: AsyncCallback<boolean> 2334 ): void; 2335 2336 /** 2337 * Gets the access token based on the specified options. 2338 * 2339 * @param { GetDomainAccessTokenOptions } options - Indicates the options for getting th access token. 2340 * @param { AsyncCallback<Uint8Array> } callback - Indicates the callback for returning the access token. 2341 * @syscap SystemCapability.Account.OsAccount 2342 * @systemapi Hide this for inner system use. 2343 * @since 10 2344 */ 2345 getAccessToken(options: GetDomainAccessTokenOptions, callback: AsyncCallback<Uint8Array>): void; 2346 } 2347 2348 /** 2349 * Provides abilities for the management of domain account. 2350 * 2351 * @syscap SystemCapability.Account.OsAccount 2352 * @systemapi Hide this for inner system use. 2353 * @since 9 2354 */ 2355 class DomainAccountManager { 2356 /** 2357 * Registers the domain plugin, which provides the capabilities for domain authentication. 2358 * 2359 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 2360 * @param { DomainPlugin } plugin - Indicates the domain plugin. 2361 * @throws { BusinessError } 201 - Permission denied. 2362 * @throws { BusinessError } 202 - Not system application. 2363 * @throws { BusinessError } 401 - The parameter check failed. 2364 * @throws { BusinessError } 12300201 - The domain plugin has been registered. 2365 * @static 2366 * @syscap SystemCapability.Account.OsAccount 2367 * @systemapi Hide this for inner system use. 2368 * @since 9 2369 */ 2370 static registerPlugin(plugin: DomainPlugin): void; 2371 2372 /** 2373 * Unregisters domain plugin. 2374 * 2375 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 2376 * @throws { BusinessError } 201 - Permission denied. 2377 * @throws { BusinessError } 202 - Not system application. 2378 * @static 2379 * @syscap SystemCapability.Account.OsAccount 2380 * @systemapi Hide this for inner system use. 2381 * @since 9 2382 */ 2383 static unregisterPlugin(): void; 2384 2385 /** 2386 * Authenticates the specified domain account with a credential. 2387 * 2388 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 2389 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information. 2390 * @param { Uint8Array } credential - Indicates the credential for authentication. 2391 * @param { IUserAuthCallback } callback - Indicates the callback for getting the authentication result. 2392 * @throws { BusinessError } 201 - Permission denied. 2393 * @throws { BusinessError } 202 - Not system application. 2394 * @throws { BusinessError } 401 - The parameter check failed. 2395 * @throws { BusinessError } 801 - Capability not supported. 2396 * @throws { BusinessError } 12300001 - System service exception. 2397 * @throws { BusinessError } 12300002 - Invalid domainAccountInfo or credential. 2398 * @throws { BusinessError } 12300003 - Domain account does not exist. 2399 * @throws { BusinessError } 12300013 - Network exception. 2400 * @throws { BusinessError } 12300101 - Authentication failed. 2401 * @throws { BusinessError } 12300109 - Authentication is canceled. 2402 * @throws { BusinessError } 12300110 - Authentication is locked. 2403 * @throws { BusinessError } 12300111 - Authentication timeout. 2404 * @throws { BusinessError } 12300112 - Authentication service is busy. 2405 * @throws { BusinessError } 12300113 - Authentication service does not exist. 2406 * @throws { BusinessError } 12300114 - Authentication service exception. 2407 * @syscap SystemCapability.Account.OsAccount 2408 * @systemapi Hide this for inner system use. 2409 * @since 10 2410 */ 2411 static auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUserAuthCallback): void; 2412 2413 /** 2414 * Authenticates the domain account bound to the current OS account with a popup. 2415 * 2416 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 2417 * @param { IUserAuthCallback } callback - Indicates the callback for getting the authentication result. 2418 * @throws { BusinessError } 201 - Permission denied. 2419 * @throws { BusinessError } 202 - Not system application. 2420 * @throws { BusinessError } 401 - The parameter check failed. 2421 * @throws { BusinessError } 801 - Capability not supported. 2422 * @throws { BusinessError } 12300001 - System service exception. 2423 * @throws { BusinessError } 12300003 - No domain account is bound. 2424 * @throws { BusinessError } 12300013 - Network exception. 2425 * @throws { BusinessError } 12300101 - Authentication failed. 2426 * @throws { BusinessError } 12300109 - Authentication is canceled. 2427 * @throws { BusinessError } 12300110 - Authentication is locked. 2428 * @throws { BusinessError } 12300111 - Authentication timeout. 2429 * @throws { BusinessError } 12300112 - Authentication service is busy. 2430 * @throws { BusinessError } 12300113 - Authentication service does not exist. 2431 * @throws { BusinessError } 12300114 - Authentication service exception. 2432 * @static 2433 * @syscap SystemCapability.Account.OsAccount 2434 * @systemapi Hide this for inner system use. 2435 * @since 10 2436 */ 2437 static authWithPopup(callback: IUserAuthCallback): void; 2438 2439 /** 2440 * Authenticates the domain account bound to the specified OS account with a popup. 2441 * 2442 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 2443 * @param { number } localId - Indicates the local ID of the specified OS account. 2444 * @param { IUserAuthCallback } callback - Indicates the callback for getting the authentication result. 2445 * @throws { BusinessError } 201 - Permission denied. 2446 * @throws { BusinessError } 202 - Not system application. 2447 * @throws { BusinessError } 401 - The parameter check failed. 2448 * @throws { BusinessError } 801 - Capability not supported. 2449 * @throws { BusinessError } 12300001 - System service exception. 2450 * @throws { BusinessError } 12300002 - Invalid localId. 2451 * @throws { BusinessError } 12300003 - No domain account is bound. 2452 * @throws { BusinessError } 12300013 - Network exception. 2453 * @throws { BusinessError } 12300101 - Authentication failed. 2454 * @throws { BusinessError } 12300109 - Authentication is canceled. 2455 * @throws { BusinessError } 12300110 - Authentication is locked. 2456 * @throws { BusinessError } 12300111 - Authentication timeout. 2457 * @throws { BusinessError } 12300112 - Authentication service is busy. 2458 * @throws { BusinessError } 12300113 - Authentication service does not exist. 2459 * @throws { BusinessError } 12300114 - Authentication service exception. 2460 * @static 2461 * @syscap SystemCapability.Account.OsAccount 2462 * @systemapi Hide this for inner system use. 2463 * @since 10 2464 */ 2465 static authWithPopup(localId: number, callback: IUserAuthCallback): void; 2466 2467 /** 2468 * Checks whether the specified domain account exists. 2469 * 2470 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 2471 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information. 2472 * @param { AsyncCallback<boolean> } callback Indicates - The callback for checking whether the specified domain account exists. 2473 * @throws { BusinessError } 201 - Permission denied. 2474 * @throws { BusinessError } 202 - Not system application. 2475 * @throws { BusinessError } 401 - The parameter check failed. 2476 * @throws { BusinessError } 801 - Capability not supported. 2477 * @throws { BusinessError } 12300001 - System service exception. 2478 * @throws { BusinessError } 12300002 - Invalid domainAccountInfo. 2479 * @throws { BusinessError } 12300013 - Network exception. 2480 * @throws { BusinessError } 12300111 - Operation timeout. 2481 * @static 2482 * @syscap SystemCapability.Account.OsAccount 2483 * @systemapi Hide this for inner system use. 2484 * @since 10 2485 */ 2486 static hasAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<boolean>): void; 2487 2488 /** 2489 * Checks whether the specified domain account exists. 2490 * 2491 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 2492 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information. 2493 * @returns { Promise<boolean> } Returns whether the specified domain account exists. 2494 * @throws { BusinessError } 201 - Permission denied. 2495 * @throws { BusinessError } 202 - Not system application. 2496 * @throws { BusinessError } 401 - The parameter check failed. 2497 * @throws { BusinessError } 801 - Capability not supported. 2498 * @throws { BusinessError } 12300001 - System service exception. 2499 * @throws { BusinessError } 12300002 - Invalid domainAccountInfo. 2500 * @throws { BusinessError } 12300013 - Network exception. 2501 * @throws { BusinessError } 12300111 - Operation timeout. 2502 * @static 2503 * @syscap SystemCapability.Account.OsAccount 2504 * @systemapi Hide this for inner system use. 2505 * @since 10 2506 */ 2507 static hasAccount(domainAccountInfo: DomainAccountInfo): Promise<boolean>; 2508 2509 /** 2510 * Updates the token for the specified domain account. 2511 * <p>Only the registered domain plugin has the permission to call this function.<br/> 2512 * An empty token indicates the token of the target domain account is invalid.</p> 2513 * 2514 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 2515 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information. 2516 * @param { Uint8Array } token - Indicates the domain account token. 2517 * @param { AsyncCallback<void> } callback - Indicates the result callback. 2518 * @throws { BusinessError } 201 - Permission denied. 2519 * @throws { BusinessError } 202 - Not system application. 2520 * @throws { BusinessError } 401 - The parameter check failed. 2521 * @throws { BusinessError } 12300001 - System service exception. 2522 * @throws { BusinessError } 12300002 - Invalid token. 2523 * @throws { BusinessError } 12300003 - Account not found. 2524 * @static 2525 * @syscap SystemCapability.Account.OsAccount 2526 * @systemapi Hide this for inner system use. 2527 * @since 10 2528 */ 2529 static updateAccountToken( 2530 domainAccountInfo: DomainAccountInfo, 2531 token: Uint8Array, 2532 callback: AsyncCallback<void> 2533 ): void; 2534 2535 /** 2536 * Updates the token for the specified domain account. 2537 * <p>Only the registered domain plugin has the permission to call this function.<br/> 2538 * An empty token indicates the token of the target domain account is invalid.</p> 2539 * 2540 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 2541 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information. 2542 * @param { Uint8Array } token - Indicates the domain account token. 2543 * @returns { Promise<void> } The promise returned by the function. 2544 * @throws { BusinessError } 201 - Permission denied. 2545 * @throws { BusinessError } 202 - Not system application. 2546 * @throws { BusinessError } 401 - The parameter check failed. 2547 * @throws { BusinessError } 12300001 - System service exception. 2548 * @throws { BusinessError } 12300002 - Invalid token. 2549 * @throws { BusinessError } 12300003 - Account not found. 2550 * @static 2551 * @syscap SystemCapability.Account.OsAccount 2552 * @systemapi Hide this for inner system use. 2553 * @since 10 2554 */ 2555 static updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array): Promise<void>; 2556 2557 /** 2558 * Gets the specified domain account information. 2559 * 2560 * @permission ohos.permission.GET_DOMAIN_ACCOUNTS 2561 * @param { GetDomainAccountInfoOptions } options - Indicates the options for getting domain account information. 2562 * @param { AsyncCallback<DomainAccountInfo> } callback - Indicates the result callback. 2563 * @throws { BusinessError } 201 - Permission denied. 2564 * @throws { BusinessError } 202 - Not system application. 2565 * @throws { BusinessError } 401 - The parameter check failed. 2566 * @throws { BusinessError } 801 - Capability not supported. 2567 * @throws { BusinessError } 12300001 - System service exception. 2568 * @throws { BusinessError } 12300003 - Account not found. 2569 * @throws { BusinessError } 12300013 - Network exception. 2570 * @throws { BusinessError } 12300111 - Operation timeout. 2571 * @static 2572 * @syscap SystemCapability.Account.OsAccount 2573 * @systemapi Hide this for inner system use. 2574 * @since 10 2575 */ 2576 static getAccountInfo(options: GetDomainAccountInfoOptions, callback: AsyncCallback<DomainAccountInfo>): void; 2577 2578 /** 2579 * Gets the specified domain account information. 2580 * 2581 * @permission ohos.permission.GET_DOMAIN_ACCOUNTS 2582 * @param { GetDomainAccountInfoOptions } options - Indicates the options for getting domain account information. 2583 * @returns { Promise<DomainAccountInfo> } The promise returned by the function. 2584 * @throws { BusinessError } 201 - Permission denied. 2585 * @throws { BusinessError } 202 - Not system application. 2586 * @throws { BusinessError } 401 - The parameter check failed. 2587 * @throws { BusinessError } 801 - Capability not supported. 2588 * @throws { BusinessError } 12300001 - System service exception. 2589 * @throws { BusinessError } 12300003 - Account not found. 2590 * @throws { BusinessError } 12300013 - Network exception. 2591 * @throws { BusinessError } 12300111 - Operation timeout. 2592 * @static 2593 * @syscap SystemCapability.Account.OsAccount 2594 * @systemapi Hide this for inner system use. 2595 * @since 10 2596 */ 2597 static getAccountInfo(options: GetDomainAccountInfoOptions): Promise<DomainAccountInfo>; 2598 } 2599 2600 /** 2601 * Provides the abilities for managing user identity. 2602 * 2603 * @syscap SystemCapability.Account.OsAccount 2604 * @systemapi Hide this for inner system use. 2605 * @since 8 2606 * @name UserIdentityManager 2607 */ 2608 class UserIdentityManager { 2609 /** 2610 * Constructor to get the UserIdentityManager class instance. 2611 * 2612 * @throws { BusinessError } 202 - Not system application. 2613 * @syscap SystemCapability.Account.OsAccount 2614 * @systemapi Hide this for inner system use. 2615 * @since 8 2616 */ 2617 constructor(); 2618 2619 /** 2620 * Opens session. 2621 * <p> 2622 * Start an IDM operation to obtain challenge value. 2623 * A challenge value of 0 indicates that opensession failed. 2624 * 2625 * @permission ohos.permission.MANAGE_USER_IDM 2626 * @param { AsyncCallback<Uint8Array> } callback - Returns a challenge value. 2627 * @throws { BusinessError } 201 - Permission denied. 2628 * @throws { BusinessError } 202 - Not system application. 2629 * @throws { BusinessError } 401 - The parameter check failed. 2630 * @throws { BusinessError } 12300001 - System service exception. 2631 * @syscap SystemCapability.Account.OsAccount 2632 * @systemapi Hide this for inner system use. 2633 * @since 8 2634 */ 2635 openSession(callback: AsyncCallback<Uint8Array>): void; 2636 2637 /** 2638 * Opens session. 2639 * <p> 2640 * Start an IDM operation to obtain challenge value. 2641 * A challenge value of 0 indicates that opensession failed. 2642 * 2643 * @permission ohos.permission.MANAGE_USER_IDM 2644 * @returns { Promise<Uint8Array> } Returns a challenge value. 2645 * @throws { BusinessError } 201 - Permission denied. 2646 * @throws { BusinessError } 202 - Not system application. 2647 * @throws { BusinessError } 401 - The parameter check failed. 2648 * @throws { BusinessError } 12300001 - System service exception. 2649 * @syscap SystemCapability.Account.OsAccount 2650 * @systemapi Hide this for inner system use. 2651 * @since 8 2652 */ 2653 openSession(): Promise<Uint8Array>; 2654 2655 /** 2656 * Adds credential. 2657 * <p> 2658 * Add user credential information, pass in credential addition method and credential information 2659 * (credential type, subclass, if adding user's non password credentials, pass in password authentication token), 2660 * and get the result / acquireInfo callback. 2661 * 2662 * @permission ohos.permission.MANAGE_USER_IDM 2663 * @param { CredentialInfo } credentialInfo - Indicates the credential information. 2664 * @param { IIdmCallback } callback - Indicates the callback to get results and acquireInfo. 2665 * @throws { BusinessError } 201 - Permission denied. 2666 * @throws { BusinessError } 202 - Not system application. 2667 * @throws { BusinessError } 401 - The parameter check failed. 2668 * @throws { BusinessError } 12300001 - System service exception. 2669 * @throws { BusinessError } 12300002 - Invalid credentialInfo, i.e. authType or authSubType. 2670 * @throws { BusinessError } 12300101 - Token is invalid. 2671 * @throws { BusinessError } 12300106 - Unsupported authType. 2672 * @throws { BusinessError } 12300109 - Operation is canceled. 2673 * @throws { BusinessError } 12300111 - Operation timeout. 2674 * @throws { BusinessError } 12300115 - The number of credentials reaches the upper limit. 2675 * @syscap SystemCapability.Account.OsAccount 2676 * @systemapi Hide this for inner system use. 2677 * @since 8 2678 */ 2679 addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void; 2680 2681 /** 2682 * Updates credential. 2683 * 2684 * @permission ohos.permission.MANAGE_USER_IDM 2685 * @param { CredentialInfo } credentialInfo - Indicates the credential information. 2686 * @param { IIdmCallback } callback - Indicates the callback to get results and acquireInfo. 2687 * @throws { BusinessError } 201 - Permission denied. 2688 * @throws { BusinessError } 202 - Not system application. 2689 * @throws { BusinessError } 401 - The parameter check failed. 2690 * @throws { BusinessError } 12300001 - System service exception. 2691 * @throws { BusinessError } 12300002 - Invalid credentialInfo, i.e. authType or authSubType. 2692 * @throws { BusinessError } 12300101 - Token is invalid. 2693 * @throws { BusinessError } 12300102 - Credential not enrolled. 2694 * @throws { BusinessError } 12300106 - Unsupported authType. 2695 * @throws { BusinessError } 12300109 - Operation is canceled. 2696 * @throws { BusinessError } 12300111 - Operation timeout. 2697 * @syscap SystemCapability.Account.OsAccount 2698 * @systemapi Hide this for inner system use. 2699 * @since 8 2700 */ 2701 updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void; 2702 2703 /** 2704 * Closes session. 2705 * <p> 2706 * End an IDM operation. 2707 * 2708 * @permission ohos.permission.MANAGE_USER_IDM 2709 * @throws { BusinessError } 201 - Permission denied. 2710 * @throws { BusinessError } 202 - Not system application. 2711 * @syscap SystemCapability.Account.OsAccount 2712 * @systemapi Hide this for inner system use. 2713 * @since 8 2714 */ 2715 closeSession(): void; 2716 2717 /** 2718 * Cancels entry with a challenge value. 2719 * 2720 * @permission ohos.permission.MANAGE_USER_IDM 2721 * @param { Uint8Array } challenge - Indicates the challenge value. 2722 * @throws { BusinessError } 201 - Permission denied. 2723 * @throws { BusinessError } 202 - Not system application. 2724 * @throws { BusinessError } 401 - The parameter check failed. 2725 * @throws { BusinessError } 12300001 - System service exception. 2726 * @throws { BusinessError } 12300002 - Invalid challenge. 2727 * @syscap SystemCapability.Account.OsAccount 2728 * @systemapi Hide this for inner system use. 2729 * @since 8 2730 */ 2731 cancel(challenge: Uint8Array): void; 2732 2733 /** 2734 * Deletes the user with the authentication token. 2735 * 2736 * @permission ohos.permission.MANAGE_USER_IDM 2737 * @param { Uint8Array } token - Indicates the authentication token. 2738 * @param { IIdmCallback } callback - Indicates the callback to get the deletion result. 2739 * @throws { BusinessError } 201 - Permission denied. 2740 * @throws { BusinessError } 202 - Not system application. 2741 * @throws { BusinessError } 401 - The parameter check failed. 2742 * @throws { BusinessError } 12300001 - System service exception. 2743 * @throws { BusinessError } 12300101 - Token is invalid. 2744 * @syscap SystemCapability.Account.OsAccount 2745 * @systemapi Hide this for inner system use. 2746 * @since 8 2747 */ 2748 delUser(token: Uint8Array, callback: IIdmCallback): void; 2749 2750 /** 2751 * Deletes the user credential information. 2752 * 2753 * @permission ohos.permission.MANAGE_USER_IDM 2754 * @param { Uint8Array } credentialId - Indicates the credential index. 2755 * @param { Uint8Array } token - Indicates the authentication token. 2756 * @param { IIdmCallback } callback - Indicates the callback to get the deletion result. 2757 * @throws { BusinessError } 201 - Permission denied. 2758 * @throws { BusinessError } 202 - Not system application. 2759 * @throws { BusinessError } 401 - The parameter check failed. 2760 * @throws { BusinessError } 12300001 - System service exception. 2761 * @throws { BusinessError } 12300002 - Invalid credentialId. 2762 * @throws { BusinessError } 12300101 - Token is invalid. 2763 * @throws { BusinessError } 12300102 - Credential not enrolled. 2764 * @syscap SystemCapability.Account.OsAccount 2765 * @systemapi Hide this for inner system use. 2766 * @since 8 2767 */ 2768 delCred(credentialId: Uint8Array, token: Uint8Array, callback: IIdmCallback): void; 2769 2770 /** 2771 * Gets authentication information. 2772 * 2773 * @permission ohos.permission.USE_USER_IDM 2774 * @param { AsyncCallback<Array<EnrolledCredInfo>> } callback - Indicates the callback to get all registered credential information of 2775 * the specified type for the current user. 2776 * @throws { BusinessError } 201 - Permission denied. 2777 * @throws { BusinessError } 202 - Not system application. 2778 * @throws { BusinessError } 401 - The parameter check failed. 2779 * @throws { BusinessError } 12300001 - System service exception. 2780 * @throws { BusinessError } 12300102 - Credential not enrolled. 2781 * @syscap SystemCapability.Account.OsAccount 2782 * @systemapi Hide this for inner system use. 2783 * @since 8 2784 */ 2785 getAuthInfo(callback: AsyncCallback<Array<EnrolledCredInfo>>): void; 2786 2787 /** 2788 * Gets authentication information. 2789 * 2790 * @permission ohos.permission.USE_USER_IDM 2791 * @param { AuthType } authType - Indicates the authentication type. 2792 * @param { AsyncCallback<Array<EnrolledCredInfo>> } callback - Indicates the callback to get all registered credential information of 2793 * the specified type for the current user. 2794 * @throws { BusinessError } 201 - Permission denied. 2795 * @throws { BusinessError } 202 - Not system application. 2796 * @throws { BusinessError } 401 - The parameter check failed. 2797 * @throws { BusinessError } 12300001 - System service exception. 2798 * @throws { BusinessError } 12300002 - Invalid authType. 2799 * @throws { BusinessError } 12300102 - Credential not enrolled. 2800 * @syscap SystemCapability.Account.OsAccount 2801 * @systemapi Hide this for inner system use. 2802 * @since 8 2803 */ 2804 getAuthInfo(authType: AuthType, callback: AsyncCallback<Array<EnrolledCredInfo>>): void; 2805 2806 /** 2807 * Gets authentication information. 2808 * 2809 * @permission ohos.permission.USE_USER_IDM 2810 * @param { AuthType } authType - Indicates the authentication type. 2811 * @returns { Promise<Array<EnrolledCredInfo>> } Returns all registered credential information of 2812 * the specified type for the current user. 2813 * @throws { BusinessError } 201 - Permission denied. 2814 * @throws { BusinessError } 202 - Not system application. 2815 * @throws { BusinessError } 401 - The parameter check failed. 2816 * @throws { BusinessError } 12300001 - System service exception. 2817 * @throws { BusinessError } 12300002 - Invalid authType. 2818 * @throws { BusinessError } 12300102 - Credential not enrolled. 2819 * @syscap SystemCapability.Account.OsAccount 2820 * @systemapi Hide this for inner system use. 2821 * @since 8 2822 */ 2823 getAuthInfo(authType?: AuthType): Promise<Array<EnrolledCredInfo>>; 2824 } 2825 2826 /** 2827 * Password data callback. 2828 * 2829 * @interface IInputData 2830 * @syscap SystemCapability.Account.OsAccount 2831 * @systemapi Hide this for inner system use. 2832 * @since 8 2833 */ 2834 interface IInputData { 2835 /** 2836 * Notifies to set data. 2837 * 2838 * @throws { BusinessError } 202 - Not system application. 2839 * @throws { BusinessError } 401 - The parameter check failed. 2840 * @throws { BusinessError } 12300002 - Invalid pinSubType. 2841 * @syscap SystemCapability.Account.OsAccount 2842 * @systemapi Hide this for inner system use. 2843 * @since 8 2844 */ 2845 onSetData: (authSubType: AuthSubType, data: Uint8Array) => void; 2846 } 2847 2848 /** 2849 * Password input box callback. 2850 * 2851 * @interface IInputer 2852 * @syscap SystemCapability.Account.OsAccount 2853 * @systemapi Hide this for inner system use. 2854 * @since 8 2855 */ 2856 interface IInputer { 2857 /** 2858 * Notifies to get data. 2859 * 2860 * @syscap SystemCapability.Account.OsAccount 2861 * @systemapi Hide this for inner system use. 2862 * @since 8 2863 */ 2864 onGetData: (authSubType: AuthSubType, callback: IInputData) => void; 2865 } 2866 2867 /** 2868 * User authentication callback. 2869 * 2870 * @interface IUserAuthCallback 2871 * @syscap SystemCapability.Account.OsAccount 2872 * @systemapi Hide this for inner system use. 2873 * @since 8 2874 */ 2875 interface IUserAuthCallback { 2876 /** 2877 * The authentication result code is returned through the callback. 2878 * If the authentication is passed, the authentication token is returned in extraInfo, 2879 * If the authentication fails, the remaining authentication times are returned in extraInfo, 2880 * If the authentication executor is locked, the freezing time is returned in extraInfo. 2881 * 2882 * @syscap SystemCapability.Account.OsAccount 2883 * @systemapi Hide this for inner system use. 2884 * @since 8 2885 */ 2886 onResult: (result: number, extraInfo: AuthResult) => void; 2887 2888 /** 2889 * During an authentication, the TipsCode is returned through the callback. 2890 * 2891 * @syscap SystemCapability.Account.OsAccount 2892 * @systemapi Hide this for inner system use. 2893 * @since 8 2894 */ 2895 onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void; 2896 } 2897 2898 /** 2899 * Identity manager callback. 2900 * 2901 * @interface IIdmCallback 2902 * @syscap SystemCapability.Account.OsAccount 2903 * @systemapi Hide this for inner system use. 2904 * @since 8 2905 */ 2906 interface IIdmCallback { 2907 /** 2908 * The authentication result code is returned through the callback. 2909 * 2910 * @syscap SystemCapability.Account.OsAccount 2911 * @systemapi Hide this for inner system use. 2912 * @since 8 2913 */ 2914 onResult: (result: number, extraInfo: RequestResult) => void; 2915 2916 /** 2917 * During an authentication, the TipsCode is returned through the callback. 2918 * 2919 * @syscap SystemCapability.Account.OsAccount 2920 * @systemapi Hide this for inner system use. 2921 * @since 8 2922 */ 2923 onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void; 2924 } 2925 2926 /** 2927 * Provides the information of the get property request. 2928 * 2929 * @interface GetPropertyRequest 2930 * @syscap SystemCapability.Account.OsAccount 2931 * @systemapi Hide this for inner system use. 2932 * @since 8 2933 */ 2934 interface GetPropertyRequest { 2935 /** 2936 * Indicates the authentication credential type. 2937 * 2938 * @type { AuthType } 2939 * @syscap SystemCapability.Account.OsAccount 2940 * @systemapi Hide this for inner system use. 2941 * @since 8 2942 */ 2943 authType: AuthType; 2944 2945 /** 2946 * Indicates the array of property types to get. 2947 * 2948 * @type { Array<GetPropertyType> } 2949 * @syscap SystemCapability.Account.OsAccount 2950 * @systemapi Hide this for inner system use. 2951 * @since 8 2952 */ 2953 keys: Array<GetPropertyType>; 2954 } 2955 2956 /** 2957 * Provides the information of the set property request. 2958 * 2959 * @interface SetPropertyRequest 2960 * @syscap SystemCapability.Account.OsAccount 2961 * @systemapi Hide this for inner system use. 2962 * @since 8 2963 */ 2964 interface SetPropertyRequest { 2965 /** 2966 * Indicates the authentication credential type. 2967 * 2968 * @type { AuthType } 2969 * @syscap SystemCapability.Account.OsAccount 2970 * @systemapi Hide this for inner system use. 2971 * @since 8 2972 */ 2973 authType: AuthType; 2974 2975 /** 2976 * Indicates the property type to set. 2977 * 2978 * @type { SetPropertyType } 2979 * @syscap SystemCapability.Account.OsAccount 2980 * @systemapi Hide this for inner system use. 2981 * @since 8 2982 */ 2983 key: SetPropertyType; 2984 2985 /** 2986 * Indicates the information to set. 2987 * 2988 * @type { Uint8Array } 2989 * @syscap SystemCapability.Account.OsAccount 2990 * @systemapi Hide this for inner system use. 2991 * @since 8 2992 */ 2993 setInfo: Uint8Array; 2994 } 2995 2996 /** 2997 * Provides the property of executor. 2998 * 2999 * @interface ExecutorProperty 3000 * @syscap SystemCapability.Account.OsAccount 3001 * @systemapi Hide this for inner system use. 3002 * @since 8 3003 */ 3004 interface ExecutorProperty { 3005 /** 3006 * Indicates the result. 3007 * 3008 * @type { number } 3009 * @syscap SystemCapability.Account.OsAccount 3010 * @systemapi Hide this for inner system use. 3011 * @since 8 3012 */ 3013 result: number; 3014 3015 /** 3016 * Indicates the authentication credential subtype. 3017 * 3018 * @type { AuthSubType } 3019 * @syscap SystemCapability.Account.OsAccount 3020 * @systemapi Hide this for inner system use. 3021 * @since 8 3022 */ 3023 authSubType: AuthSubType; 3024 3025 /** 3026 * Indicates the remaining times. 3027 * 3028 * @type { ?number } 3029 * @syscap SystemCapability.Account.OsAccount 3030 * @systemapi Hide this for inner system use. 3031 * @since 8 3032 */ 3033 remainTimes?: number; 3034 3035 /** 3036 * Indicates the freezing times. 3037 * 3038 * @type { ?number } 3039 * @syscap SystemCapability.Account.OsAccount 3040 * @systemapi Hide this for inner system use. 3041 * @since 8 3042 */ 3043 freezingTime?: number; 3044 3045 /** 3046 * Indicates the enrollment progress. 3047 * 3048 * @type { ?string } 3049 * @syscap SystemCapability.Account.OsAccount 3050 * @systemapi Hide this for inner system use. 3051 * @since 10 3052 */ 3053 enrollmentProgress?: string; 3054 3055 /** 3056 * Indicates the sensor information. 3057 * 3058 * @type { ?string } 3059 * @syscap SystemCapability.Account.OsAccount 3060 * @systemapi Hide this for inner system use. 3061 * @since 10 3062 */ 3063 sensorInfo?: string; 3064 } 3065 3066 /** 3067 * Indicates the information of authentication result. 3068 * 3069 * @interface AuthResult 3070 * @syscap SystemCapability.Account.OsAccount 3071 * @systemapi Hide this for inner system use. 3072 * @since 8 3073 */ 3074 interface AuthResult { 3075 /** 3076 * Indicates the authentication token. 3077 * 3078 * @type { ?Uint8Array } 3079 * @syscap SystemCapability.Account.OsAccount 3080 * @systemapi Hide this for inner system use. 3081 * @since 8 3082 */ 3083 token?: Uint8Array; 3084 3085 /** 3086 * Indicates the remaining times. 3087 * 3088 * @type { ?number } 3089 * @syscap SystemCapability.Account.OsAccount 3090 * @systemapi Hide this for inner system use. 3091 * @since 8 3092 */ 3093 remainTimes?: number; 3094 3095 /** 3096 * Indicates the freezing times. 3097 * 3098 * @type { ?number } 3099 * @syscap SystemCapability.Account.OsAccount 3100 * @systemapi Hide this for inner system use. 3101 * @since 8 3102 */ 3103 freezingTime?: number; 3104 } 3105 3106 /** 3107 * Indicates the information of credential. 3108 * 3109 * @interface CredentialInfo 3110 * @syscap SystemCapability.Account.OsAccount 3111 * @systemapi Hide this for inner system use. 3112 * @since 8 3113 */ 3114 interface CredentialInfo { 3115 /** 3116 * Indicates the credential type. 3117 * 3118 * @type { AuthType } 3119 * @syscap SystemCapability.Account.OsAccount 3120 * @systemapi Hide this for inner system use. 3121 * @since 8 3122 */ 3123 credType: AuthType; 3124 3125 /** 3126 * Indicates the credential subtype. 3127 * 3128 * @type { AuthSubType } 3129 * @syscap SystemCapability.Account.OsAccount 3130 * @systemapi Hide this for inner system use. 3131 * @since 8 3132 */ 3133 credSubType: AuthSubType; 3134 3135 /** 3136 * Indicates the authentication token. 3137 * 3138 * @type { Uint8Array } 3139 * @syscap SystemCapability.Account.OsAccount 3140 * @systemapi Hide this for inner system use. 3141 * @since 8 3142 */ 3143 token: Uint8Array; 3144 } 3145 3146 /** 3147 * Indicates the information of request result. 3148 * 3149 * @interface RequestResult 3150 * @syscap SystemCapability.Account.OsAccount 3151 * @systemapi Hide this for inner system use. 3152 * @since 8 3153 */ 3154 interface RequestResult { 3155 /** 3156 * Indicates the credential index. 3157 * 3158 * @type { ?Uint8Array } 3159 * @syscap SystemCapability.Account.OsAccount 3160 * @systemapi Hide this for inner system use. 3161 * @since 8 3162 */ 3163 credentialId?: Uint8Array; 3164 } 3165 3166 /** 3167 * Indicates the information of enrolled credential. 3168 * 3169 * @interface EnrolledCredInfo 3170 * @syscap SystemCapability.Account.OsAccount 3171 * @systemapi Hide this for inner system use. 3172 * @since 8 3173 */ 3174 interface EnrolledCredInfo { 3175 /** 3176 * Indicates the credential index. 3177 * 3178 * @type { Uint8Array } 3179 * @syscap SystemCapability.Account.OsAccount 3180 * @systemapi Hide this for inner system use. 3181 * @since 8 3182 */ 3183 credentialId: Uint8Array; 3184 3185 /** 3186 * Indicates the authentication credential type. 3187 * 3188 * @type { AuthType } 3189 * @syscap SystemCapability.Account.OsAccount 3190 * @systemapi Hide this for inner system use. 3191 * @since 8 3192 */ 3193 authType: AuthType; 3194 3195 /** 3196 * Indicates the authentication credential subtype. 3197 * 3198 * @type { AuthSubType } 3199 * @syscap SystemCapability.Account.OsAccount 3200 * @systemapi Hide this for inner system use. 3201 * @since 8 3202 */ 3203 authSubType: AuthSubType; 3204 3205 /** 3206 * Indicates the credential template ID. 3207 * 3208 * @type { Uint8Array } 3209 * @syscap SystemCapability.Account.OsAccount 3210 * @systemapi Hide this for inner system use. 3211 * @since 8 3212 */ 3213 templateId: Uint8Array; 3214 } 3215 3216 /** 3217 * Indicates the property type to get. 3218 * 3219 * @enum { number } GetPropertyType 3220 * @syscap SystemCapability.Account.OsAccount 3221 * @systemapi Hide this for inner system use. 3222 * @since 8 3223 */ 3224 enum GetPropertyType { 3225 /** 3226 * Indicates the authentication subtype. 3227 * 3228 * @syscap SystemCapability.Account.OsAccount 3229 * @systemapi Hide this for inner system use. 3230 * @since 8 3231 */ 3232 AUTH_SUB_TYPE = 1, 3233 3234 /** 3235 * Indicates the remain times. 3236 * 3237 * @syscap SystemCapability.Account.OsAccount 3238 * @systemapi Hide this for inner system use. 3239 * @since 8 3240 */ 3241 REMAIN_TIMES = 2, 3242 3243 /** 3244 * Indicates the freezing time. 3245 * 3246 * @syscap SystemCapability.Account.OsAccount 3247 * @systemapi Hide this for inner system use. 3248 * @since 8 3249 */ 3250 FREEZING_TIME = 3, 3251 3252 /** 3253 * Indicates the enrollment progress. 3254 * 3255 * @syscap SystemCapability.Account.OsAccount 3256 * @systemapi Hide this for inner system use. 3257 * @since 10 3258 */ 3259 ENROLLMENT_PROGRESS = 4, 3260 3261 /** 3262 * Indicates the sensor information. 3263 * 3264 * @syscap SystemCapability.Account.OsAccount 3265 * @systemapi Hide this for inner system use. 3266 * @since 10 3267 */ 3268 SENSOR_INFO = 5 3269 } 3270 3271 /** 3272 * Indicates the property type to set. 3273 * 3274 * @enum { number } SetPropertyType 3275 * @syscap SystemCapability.Account.OsAccount 3276 * @systemapi Hide this for inner system use. 3277 * @since 8 3278 */ 3279 enum SetPropertyType { 3280 /** 3281 * Indicates the init algorithm. 3282 * 3283 * @syscap SystemCapability.Account.OsAccount 3284 * @systemapi Hide this for inner system use. 3285 * @since 8 3286 */ 3287 INIT_ALGORITHM = 1 3288 } 3289 3290 /** 3291 * Indicates the credential type for authentication. 3292 * 3293 * @enum { number } AuthType 3294 * @syscap SystemCapability.Account.OsAccount 3295 * @systemapi Hide this for inner system use. 3296 * @since 8 3297 */ 3298 enum AuthType { 3299 /** 3300 * Indicates the PIN authentication type. 3301 * 3302 * @syscap SystemCapability.Account.OsAccount 3303 * @systemapi Hide this for inner system use. 3304 * @since 8 3305 */ 3306 PIN = 1, 3307 3308 /** 3309 * Indicates the FACE authentication type. 3310 * 3311 * @syscap SystemCapability.Account.OsAccount 3312 * @systemapi Hide this for inner system use. 3313 * @since 8 3314 */ 3315 FACE = 2, 3316 3317 /** 3318 * Indicates the FINGERPRINT authentication type. 3319 * 3320 * @syscap SystemCapability.Account.OsAccount 3321 * @systemapi Hide this for inner system use. 3322 * @since 10 3323 */ 3324 FINGERPRINT = 4, 3325 3326 /** 3327 * Indicates the DOMAIN authentication type. 3328 * 3329 * @syscap SystemCapability.Account.OsAccount 3330 * @systemapi Hide this for inner system use. 3331 * @since 9 3332 */ 3333 DOMAIN = 1024 3334 } 3335 3336 /** 3337 * Indicates the credential subtype for authentication. 3338 * 3339 * @enum { number } AuthSubType 3340 * @syscap SystemCapability.Account.OsAccount 3341 * @systemapi Hide this for inner system use. 3342 * @since 8 3343 */ 3344 enum AuthSubType { 3345 /** 3346 * Indicates the 6-digit credential. 3347 * 3348 * @syscap SystemCapability.Account.OsAccount 3349 * @systemapi Hide this for inner system use. 3350 * @since 8 3351 */ 3352 PIN_SIX = 10000, 3353 3354 /** 3355 * Indicates the self-defined digital credential. 3356 * 3357 * @syscap SystemCapability.Account.OsAccount 3358 * @systemapi Hide this for inner system use. 3359 * @since 8 3360 */ 3361 PIN_NUMBER = 10001, 3362 3363 /** 3364 * Indicates the self-defined mixed credential. 3365 * 3366 * @syscap SystemCapability.Account.OsAccount 3367 * @systemapi Hide this for inner system use. 3368 * @since 8 3369 */ 3370 PIN_MIXED = 10002, 3371 3372 /** 3373 * Indicates the 2D face credential. 3374 * 3375 * @syscap SystemCapability.Account.OsAccount 3376 * @systemapi Hide this for inner system use. 3377 * @since 8 3378 */ 3379 FACE_2D = 20000, 3380 3381 /** 3382 * Indicates the 3D face credential. 3383 * 3384 * @syscap SystemCapability.Account.OsAccount 3385 * @systemapi Hide this for inner system use. 3386 * @since 8 3387 */ 3388 FACE_3D = 20001, 3389 3390 /** 3391 * Indicates the capacitive fingerprint credential. 3392 * 3393 * @syscap SystemCapability.Account.OsAccount 3394 * @systemapi Hide this for inner system use. 3395 * @since 10 3396 */ 3397 FINGERPRINT_CAPACITIVE = 30000, 3398 3399 /** 3400 * Indicates the optical fingerprint credential. 3401 * 3402 * @syscap SystemCapability.Account.OsAccount 3403 * @systemapi Hide this for inner system use. 3404 * @since 10 3405 */ 3406 FINGERPRINT_OPTICAL = 30001, 3407 3408 /** 3409 * Indicates the ultrasonic fingerprint credential. 3410 * 3411 * @syscap SystemCapability.Account.OsAccount 3412 * @systemapi Hide this for inner system use. 3413 * @since 10 3414 */ 3415 FINGERPRINT_ULTRASONIC = 30002, 3416 3417 /** 3418 * Indicates the mixed domain credential. 3419 * 3420 * @syscap SystemCapability.Account.OsAccount 3421 * @systemapi Hide this for inner system use. 3422 * @since 9 3423 */ 3424 DOMAIN_MIXED = 10240001 3425 } 3426 3427 /** 3428 * Indicates the trusted level of authentication results. 3429 * 3430 * @enum { number } AuthTrustLevel 3431 * @syscap SystemCapability.Account.OsAccount 3432 * @systemapi Hide this for inner system use. 3433 * @since 8 3434 */ 3435 enum AuthTrustLevel { 3436 /** 3437 * Indicates the trusted level 1. 3438 * 3439 * @syscap SystemCapability.Account.OsAccount 3440 * @systemapi Hide this for inner system use. 3441 * @since 8 3442 */ 3443 ATL1 = 10000, 3444 3445 /** 3446 * Indicates the trusted level 2. 3447 * 3448 * @syscap SystemCapability.Account.OsAccount 3449 * @systemapi Hide this for inner system use. 3450 * @since 8 3451 */ 3452 ATL2 = 20000, 3453 3454 /** 3455 * Indicates the trusted level 3. 3456 * 3457 * @syscap SystemCapability.Account.OsAccount 3458 * @systemapi Hide this for inner system use. 3459 * @since 8 3460 */ 3461 ATL3 = 30000, 3462 3463 /** 3464 * Indicates the trusted level 4. 3465 * 3466 * @syscap SystemCapability.Account.OsAccount 3467 * @systemapi Hide this for inner system use. 3468 * @since 8 3469 */ 3470 ATL4 = 40000 3471 } 3472 3473 /** 3474 * Indicates the module of acquired information. 3475 * 3476 * @enum { number } Module 3477 * @syscap SystemCapability.Account.OsAccount 3478 * @systemapi Hide this for inner system use. 3479 * @since 8 3480 */ 3481 enum Module { 3482 /** 3483 * Indicates the information acquired from FaceAuth. 3484 * 3485 * @syscap SystemCapability.Account.OsAccount 3486 * @systemapi Hide this for inner system use. 3487 * @since 8 3488 */ 3489 FACE_AUTH = 1 3490 } 3491 3492 /** 3493 * Indicates the enumeration of authentication result code. 3494 * 3495 * @enum { number } ResultCode 3496 * @syscap SystemCapability.Account.OsAccount 3497 * @systemapi Hide this for inner system use. 3498 * @since 8 3499 */ 3500 enum ResultCode { 3501 /** 3502 * Indicates that authentication is success or ability is supported. 3503 * 3504 * @syscap SystemCapability.Account.OsAccount 3505 * @systemapi Hide this for inner system use. 3506 * @since 8 3507 */ 3508 SUCCESS = 0, 3509 3510 /** 3511 * Indicates the authenticator fails to identify user. 3512 * 3513 * @syscap SystemCapability.Account.OsAccount 3514 * @systemapi Hide this for inner system use. 3515 * @since 8 3516 */ 3517 FAIL = 1, 3518 3519 /** 3520 * Indicates other errors. 3521 * 3522 * @syscap SystemCapability.Account.OsAccount 3523 * @systemapi Hide this for inner system use. 3524 * @since 8 3525 */ 3526 GENERAL_ERROR = 2, 3527 3528 /** 3529 * Indicates that authentication has been canceled. 3530 * 3531 * @syscap SystemCapability.Account.OsAccount 3532 * @systemapi Hide this for inner system use. 3533 * @since 8 3534 */ 3535 CANCELED = 3, 3536 3537 /** 3538 * Indicates that authentication has timed out. 3539 * 3540 * @syscap SystemCapability.Account.OsAccount 3541 * @systemapi Hide this for inner system use. 3542 * @since 8 3543 */ 3544 TIMEOUT = 4, 3545 3546 /** 3547 * Indicates that this authentication type is not supported. 3548 * 3549 * @syscap SystemCapability.Account.OsAccount 3550 * @systemapi Hide this for inner system use. 3551 * @since 8 3552 */ 3553 TYPE_NOT_SUPPORT = 5, 3554 3555 /** 3556 * Indicates that the authentication trust level is not supported. 3557 * 3558 * @syscap SystemCapability.Account.OsAccount 3559 * @systemapi Hide this for inner system use. 3560 * @since 8 3561 */ 3562 TRUST_LEVEL_NOT_SUPPORT = 6, 3563 3564 /** 3565 * Indicates that the authentication task is busy. Wait for a few seconds and try again. 3566 * 3567 * @syscap SystemCapability.Account.OsAccount 3568 * @systemapi Hide this for inner system use. 3569 * @since 8 3570 */ 3571 BUSY = 7, 3572 3573 /** 3574 * Indicates incorrect parameters. 3575 * 3576 * @syscap SystemCapability.Account.OsAccount 3577 * @systemapi Hide this for inner system use. 3578 * @since 8 3579 */ 3580 INVALID_PARAMETERS = 8, 3581 3582 /** 3583 * Indicates that the authenticator is locked. 3584 * 3585 * @syscap SystemCapability.Account.OsAccount 3586 * @systemapi Hide this for inner system use. 3587 * @since 8 3588 */ 3589 LOCKED = 9, 3590 3591 /** 3592 * Indicates that the user has not enrolled the authenticator. 3593 * 3594 * @syscap SystemCapability.Account.OsAccount 3595 * @systemapi Hide this for inner system use. 3596 * @since 8 3597 */ 3598 NOT_ENROLLED = 10 3599 } 3600 3601 /** 3602 * Indicates the enumeration of prompt codes in the process of face authentication. 3603 * 3604 * @enum { number } FaceTipsCode 3605 * @syscap SystemCapability.Account.OsAccount 3606 * @systemapi Hide this for inner system use. 3607 * @since 8 3608 */ 3609 enum FaceTipsCode { 3610 /** 3611 * Indicates that the obtained facial image is too bright due to high illumination. 3612 * 3613 * @syscap SystemCapability.Account.OsAccount 3614 * @systemapi Hide this for inner system use. 3615 * @since 8 3616 */ 3617 FACE_AUTH_TIP_TOO_BRIGHT = 1, 3618 3619 /** 3620 * Indicates that the obtained facial image is too dark due to low illumination. 3621 * 3622 * @syscap SystemCapability.Account.OsAccount 3623 * @systemapi Hide this for inner system use. 3624 * @since 8 3625 */ 3626 FACE_AUTH_TIP_TOO_DARK = 2, 3627 3628 /** 3629 * Indicates that the face is too close to the device. 3630 * 3631 * @syscap SystemCapability.Account.OsAccount 3632 * @systemapi Hide this for inner system use. 3633 * @since 8 3634 */ 3635 FACE_AUTH_TIP_TOO_CLOSE = 3, 3636 3637 /** 3638 * Indicates that the face is too far away from the device. 3639 * 3640 * @syscap SystemCapability.Account.OsAccount 3641 * @systemapi Hide this for inner system use. 3642 * @since 8 3643 */ 3644 FACE_AUTH_TIP_TOO_FAR = 4, 3645 3646 /** 3647 * Indicates that the device is too high, and that only the upper part of the face is captured. 3648 * 3649 * @syscap SystemCapability.Account.OsAccount 3650 * @systemapi Hide this for inner system use. 3651 * @since 8 3652 */ 3653 FACE_AUTH_TIP_TOO_HIGH = 5, 3654 3655 /** 3656 * Indicates that the device is too low, and that only the lower part of the face is captured. 3657 * 3658 * @syscap SystemCapability.Account.OsAccount 3659 * @systemapi Hide this for inner system use. 3660 * @since 8 3661 */ 3662 FACE_AUTH_TIP_TOO_LOW = 6, 3663 3664 /** 3665 * Indicates that the device is deviated to the right, and that only the right part of the face is captured. 3666 * 3667 * @syscap SystemCapability.Account.OsAccount 3668 * @systemapi Hide this for inner system use. 3669 * @since 8 3670 */ 3671 FACE_AUTH_TIP_TOO_RIGHT = 7, 3672 3673 /** 3674 * Indicates that the device is deviated to the left, and that only the left part of the face is captured. 3675 * 3676 * @syscap SystemCapability.Account.OsAccount 3677 * @systemapi Hide this for inner system use. 3678 * @since 8 3679 */ 3680 FACE_AUTH_TIP_TOO_LEFT = 8, 3681 3682 /** 3683 * Indicates that the face moves too fast during facial information collection. 3684 * 3685 * @syscap SystemCapability.Account.OsAccount 3686 * @systemapi Hide this for inner system use. 3687 * @since 8 3688 */ 3689 FACE_AUTH_TIP_TOO_MUCH_MOTION = 9, 3690 3691 /** 3692 * Indicates that the face is not facing the device. 3693 * 3694 * @syscap SystemCapability.Account.OsAccount 3695 * @systemapi Hide this for inner system use. 3696 * @since 8 3697 */ 3698 FACE_AUTH_TIP_POOR_GAZE = 10, 3699 3700 /** 3701 * Indicates that no face is detected. 3702 * 3703 * @syscap SystemCapability.Account.OsAccount 3704 * @systemapi Hide this for inner system use. 3705 * @since 8 3706 */ 3707 FACE_AUTH_TIP_NOT_DETECTED = 11 3708 } 3709 3710 /** 3711 * Indicates the enumeration of prompt codes in the process of fingerprint authentication. 3712 * 3713 * @enum { number } FingerprintTips 3714 * @syscap SystemCapability.Account.OsAccount 3715 * @systemapi Hide this for inner system use. 3716 * @since 8 3717 */ 3718 enum FingerprintTips { 3719 /** 3720 * Indicates that the image acquired is good. 3721 * 3722 * @syscap SystemCapability.Account.OsAccount 3723 * @systemapi Hide this for inner system use. 3724 * @since 8 3725 */ 3726 FINGERPRINT_TIP_GOOD = 0, 3727 3728 /** 3729 * Indicates that the fingerprint image is too noisy due to suspected or detected dirt on the sensor. 3730 * 3731 * @syscap SystemCapability.Account.OsAccount 3732 * @systemapi Hide this for inner system use. 3733 * @since 8 3734 */ 3735 FINGERPRINT_TIP_IMAGER_DIRTY = 1, 3736 3737 /** 3738 * Indicates that the fingerprint image is too noisy to process due to a detected condition. 3739 * 3740 * @syscap SystemCapability.Account.OsAccount 3741 * @systemapi Hide this for inner system use. 3742 * @since 8 3743 */ 3744 FINGERPRINT_TIP_INSUFFICIENT = 2, 3745 3746 /** 3747 * Indicates that only a partial fingerprint image is detected. 3748 * 3749 * @syscap SystemCapability.Account.OsAccount 3750 * @systemapi Hide this for inner system use. 3751 * @since 8 3752 */ 3753 FINGERPRINT_TIP_PARTIAL = 3, 3754 3755 /** 3756 * Indicates that the fingerprint image is incomplete due to quick motion. 3757 * 3758 * @syscap SystemCapability.Account.OsAccount 3759 * @systemapi Hide this for inner system use. 3760 * @since 8 3761 */ 3762 FINGERPRINT_TIP_TOO_FAST = 4, 3763 3764 /** 3765 * Indicates that the fingerprint image is unreadable due to lack of motion. 3766 * 3767 * @syscap SystemCapability.Account.OsAccount 3768 * @systemapi Hide this for inner system use. 3769 * @since 8 3770 */ 3771 FINGERPRINT_TIP_TOO_SLOW = 5, 3772 3773 /** 3774 * Indicates that the finger is down. 3775 * 3776 * @syscap SystemCapability.Account.OsAccount 3777 * @systemapi Hide this for inner system use. 3778 * @since 10 3779 */ 3780 FINGERPRINT_TIP_FINGER_DOWN = 6, 3781 3782 /** 3783 * Indicates that the finger is up. 3784 * 3785 * @syscap SystemCapability.Account.OsAccount 3786 * @systemapi Hide this for inner system use. 3787 * @since 10 3788 */ 3789 FINGERPRINT_TIP_FINGER_UP = 7 3790 } 3791 3792 /** 3793 * Enumerates for constraint source types. 3794 * 3795 * @enum { number } ConstraintSourceType 3796 * @syscap SystemCapability.Account.OsAccount 3797 * @systemapi Hide this for inner system use. 3798 * @since 9 3799 */ 3800 enum ConstraintSourceType { 3801 /** 3802 * No constraints are set 3803 * 3804 * @syscap SystemCapability.Account.OsAccount 3805 * @systemapi Hide this for inner system use. 3806 * @since 9 3807 */ 3808 CONSTRAINT_NOT_EXIST = 0, 3809 3810 /** 3811 * Constraint is set by setOsAccountConstraints 3812 * 3813 * @syscap SystemCapability.Account.OsAccount 3814 * @systemapi Hide this for inner system use. 3815 * @since 9 3816 */ 3817 CONSTRAINT_TYPE_BASE = 1, 3818 3819 /** 3820 * Constraint is set by device owner 3821 * 3822 * @syscap SystemCapability.Account.OsAccount 3823 * @systemapi Hide this for inner system use. 3824 * @since 9 3825 */ 3826 CONSTRAINT_TYPE_DEVICE_OWNER = 2, 3827 3828 /** 3829 * Constraint is set by profile owner 3830 * 3831 * @syscap SystemCapability.Account.OsAccount 3832 * @systemapi Hide this for inner system use. 3833 * @since 9 3834 */ 3835 CONSTRAINT_TYPE_PROFILE_OWNER = 3 3836 } 3837 3838 /** 3839 * Provides information about the constraint source type info of an os account. 3840 * 3841 * @interface ConstraintSourceTypeInfo 3842 * @syscap SystemCapability.Account.OsAccount 3843 * @systemapi Hide this for inner system use. 3844 * @since 9 3845 */ 3846 interface ConstraintSourceTypeInfo { 3847 /** 3848 * Indicates the id of an os account who set the constraint. 3849 * When type is CONSTRAINT_NOT_EXIST or CONSTRAINT_TYPE_BASE, localId will be -1. 3850 * 3851 * @type { number } 3852 * @syscap SystemCapability.Account.OsAccount 3853 * @systemapi Hide this for inner system use. 3854 * @since 9 3855 */ 3856 localId: number; 3857 3858 /** 3859 * Indicates the source type of the constraint. 3860 * 3861 * @type { ConstraintSourceType } 3862 * @syscap SystemCapability.Account.OsAccount 3863 * @systemapi Hide this for inner system use. 3864 * @since 9 3865 */ 3866 type: ConstraintSourceType; 3867 } 3868} 3869 3870export default osAccount;