1/* 2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit BasicServicesKit 19 */ 20 21import type distributedAccount from './@ohos.account.distributedAccount'; 22import type { AsyncCallback, Callback } from './@ohos.base'; 23 24/** 25 * This module provides the capability to manage os accounts. 26 * 27 * @namespace osAccount 28 * @syscap SystemCapability.Account.OsAccount 29 * @since 7 30 */ 31declare namespace osAccount { 32 /** 33 * Obtains the AccountManager instance. 34 * 35 * @returns { AccountManager } Returns the instance of the AccountManager. 36 * @syscap SystemCapability.Account.OsAccount 37 * @since 7 38 */ 39 function getAccountManager(): AccountManager; 40 41 /** 42 * Provides abilities for you to manage and perform operations on your OS accounts. 43 * 44 * @interface AccountManager 45 * @syscap SystemCapability.Account.OsAccount 46 * @since 7 47 */ 48 interface AccountManager { 49 /** 50 * Activates a specified OS account. 51 * <p> 52 * If multiple OS accounts are available, you can call this method to enable a specific OS account 53 * to run in the foreground. Then, the OS account originally running in the foreground will be 54 * switched to the background. 55 * </p> 56 * 57 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION 58 * @param { number } localId - Indicates the local ID of the OS account. 59 * @param { AsyncCallback<void> } callback - Asynchronous callback interface. 60 * @throws { BusinessError } 201 - Permission denied. 61 * @throws { BusinessError } 202 - Not system application. 62 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 63 * <br> 2. Incorrect parameter types. 64 * @throws { BusinessError } 12300001 - The system service works abnormally. 65 * @throws { BusinessError } 12300002 - Invalid localId. 66 * @throws { BusinessError } 12300003 - Account not found. 67 * @throws { BusinessError } 12300008 - Restricted Account. 68 * @throws { BusinessError } 12300009 - Account has been activated. 69 * @syscap SystemCapability.Account.OsAccount 70 * @systemapi Hide this for inner system use. 71 * @since 7 72 */ 73 /** 74 * Activates a specified OS account. 75 * <p> 76 * If multiple OS accounts are available, you can call this method to enable a specific OS account 77 * to run in the foreground. Then, the OS account originally running in the foreground will be 78 * switched to the background. 79 * </p> 80 * 81 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION 82 * @param { number } localId - Indicates the local ID of the OS account. 83 * @param { AsyncCallback<void> } callback - Asynchronous callback interface. 84 * @throws { BusinessError } 201 - Permission denied. 85 * @throws { BusinessError } 202 - Not system application. 86 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 87 * <br> 2. Incorrect parameter types. 88 * @throws { BusinessError } 12300001 - The system service works abnormally. 89 * @throws { BusinessError } 12300002 - Invalid localId. 90 * @throws { BusinessError } 12300003 - Account not found. 91 * @throws { BusinessError } 12300008 - Restricted Account. 92 * @throws { BusinessError } 12300016 - The number of logged in accounts reaches the upper limit. 93 * @syscap SystemCapability.Account.OsAccount 94 * @systemapi Hide this for inner system use. 95 * @since 12 96 */ 97 activateOsAccount(localId: number, callback: AsyncCallback<void>): void; 98 99 /** 100 * Activates a specified OS account. 101 * <p> 102 * If multiple OS accounts are available, you can call this method to enable a specific OS account 103 * to run in the foreground. Then, the OS account originally running in the foreground will be 104 * switched to the background. 105 * </p> 106 * 107 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION 108 * @param { number } localId - Indicates the local ID of the OS account. 109 * @returns { Promise<void> } The promise returned by the function. 110 * @throws { BusinessError } 201 - Permission denied. 111 * @throws { BusinessError } 202 - Not system application. 112 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 113 * <br> 2. Incorrect parameter types. 114 * @throws { BusinessError } 12300001 - The system service works abnormally. 115 * @throws { BusinessError } 12300002 - Invalid localId. 116 * @throws { BusinessError } 12300003 - Account not found. 117 * @throws { BusinessError } 12300008 - Restricted Account. 118 * @throws { BusinessError } 12300009 - Account has been activated. 119 * @syscap SystemCapability.Account.OsAccount 120 * @systemapi Hide this for inner system use. 121 * @since 7 122 */ 123 /** 124 * Activates a specified OS account. 125 * <p> 126 * If multiple OS accounts are available, you can call this method to enable a specific OS account 127 * to run in the foreground. Then, the OS account originally running in the foreground will be 128 * switched to the background. 129 * </p> 130 * 131 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION 132 * @param { number } localId - Indicates the local ID of the OS account. 133 * @returns { Promise<void> } The promise returned by the function. 134 * @throws { BusinessError } 201 - Permission denied. 135 * @throws { BusinessError } 202 - Not system application. 136 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 137 * <br> 2. Incorrect parameter types. 138 * @throws { BusinessError } 12300001 - The system service works abnormally. 139 * @throws { BusinessError } 12300002 - Invalid localId. 140 * @throws { BusinessError } 12300003 - Account not found. 141 * @throws { BusinessError } 12300008 - Restricted Account. 142 * @throws { BusinessError } 12300016 - The number of logged in accounts reaches the upper limit. 143 * @syscap SystemCapability.Account.OsAccount 144 * @systemapi Hide this for inner system use. 145 * @since 12 146 */ 147 activateOsAccount(localId: number): Promise<void>; 148 149 /** 150 * Deactivates a specified OS account. 151 * 152 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION 153 * @param { number } localId - Indicates the local ID of the OS account. 154 * @returns { Promise<void> } The promise returned by the function. 155 * @throws { BusinessError } 201 - Permission denied. 156 * @throws { BusinessError } 202 - Not system application. 157 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 158 * <br> 2. Incorrect parameter types. 159 * @throws { BusinessError } 12300001 - The system service works abnormally. 160 * @throws { BusinessError } 12300003 - Account not found. 161 * @throws { BusinessError } 12300008 - Restricted Account. 162 * @syscap SystemCapability.Account.OsAccount 163 * @systemapi Hide this for inner system use. 164 * @since 12 165 */ 166 deactivateOsAccount(localId: number): Promise<void>; 167 168 /** 169 * Checks whether the function of supporting multiple OS accounts is enabled. 170 * 171 * @param { AsyncCallback<boolean> } callback - Returns {@code true} if this function is enabled; returns {@code false} otherwise. 172 * @syscap SystemCapability.Account.OsAccount 173 * @since 7 174 * @deprecated since 9 175 * @useinstead osAccount.AccountManager#checkMultiOsAccountEnabled 176 */ 177 isMultiOsAccountEnable(callback: AsyncCallback<boolean>): void; 178 179 /** 180 * Checks whether the function of supporting multiple OS accounts is enabled. 181 * 182 * @returns { Promise<boolean> } Returns {@code true} if this function is enabled; returns {@code false} otherwise. 183 * @syscap SystemCapability.Account.OsAccount 184 * @since 7 185 * @deprecated since 9 186 * @useinstead osAccount.AccountManager#checkMultiOsAccountEnabled 187 */ 188 isMultiOsAccountEnable(): Promise<boolean>; 189 190 /** 191 * Checks whether the function of supporting multiple OS accounts is enabled. 192 * 193 * @param { AsyncCallback<boolean> } callback - Returns {@code true} if this function is enabled; returns {@code false} otherwise. 194 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 195 * <br> 2. Incorrect parameter types. 196 * @throws { BusinessError } 12300001 - The system service works abnormally. 197 * @syscap SystemCapability.Account.OsAccount 198 * @since 9 199 */ 200 checkMultiOsAccountEnabled(callback: AsyncCallback<boolean>): void; 201 202 /** 203 * Checks whether the function of supporting multiple OS accounts is enabled. 204 * 205 * @returns { Promise<boolean> } Returns {@code true} if this function is enabled; returns {@code false} otherwise. 206 * @throws { BusinessError } 12300001 - The system service works abnormally. 207 * @syscap SystemCapability.Account.OsAccount 208 * @since 9 209 */ 210 checkMultiOsAccountEnabled(): Promise<boolean>; 211 212 /** 213 * Checks whether an OS account is activated based on its local ID. 214 * 215 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 216 * @param { number } localId - Indicates the local ID of the OS account. 217 * @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether the OS account is activated. 218 * @syscap SystemCapability.Account.OsAccount 219 * @since 7 220 * @deprecated since 9 221 * @useinstead osAccount.AccountManager#checkOsAccountActivated 222 */ 223 isOsAccountActived(localId: number, callback: AsyncCallback<boolean>): void; 224 225 /** 226 * Checks whether an OS account is activated based on its local ID. 227 * 228 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 229 * @param { number } localId - Indicates the local ID of the OS account. 230 * @returns { Promise<boolean> } Returns {@code true} if the OS account is activated; returns {@code false} otherwise. 231 * @syscap SystemCapability.Account.OsAccount 232 * @since 7 233 * @deprecated since 9 234 * @useinstead osAccount.AccountManager#checkOsAccountActivated 235 */ 236 isOsAccountActived(localId: number): Promise<boolean>; 237 238 /** 239 * Checks whether an OS account is activated based on its local ID. 240 * 241 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 242 * @param { number } localId - Indicates the local ID of the OS account. 243 * @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether the OS account is activated. 244 * @throws { BusinessError } 201 - Permission denied. 245 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 246 * <br> 2. Incorrect parameter types. 247 * @throws { BusinessError } 12300001 - The system service works abnormally. 248 * @throws { BusinessError } 12300002 - Invalid localId. 249 * @throws { BusinessError } 12300003 - Account not found. 250 * @syscap SystemCapability.Account.OsAccount 251 * @since 9 252 * @deprecated since 11 253 */ 254 checkOsAccountActivated(localId: number, callback: AsyncCallback<boolean>): void; 255 256 /** 257 * Checks whether an OS account is activated based on its local ID. 258 * 259 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 260 * @param { number } localId - Indicates the local ID of the OS account. 261 * @returns { Promise<boolean> } - Returns {@code true} if the OS account is activated; returns {@code false} otherwise. 262 * @throws { BusinessError } 201 - Permission denied. 263 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 264 * <br> 2. Incorrect parameter types. 265 * @throws { BusinessError } 12300001 - The system service works abnormally. 266 * @throws { BusinessError } 12300002 - Invalid localId. 267 * @throws { BusinessError } 12300003 - Account not found. 268 * @syscap SystemCapability.Account.OsAccount 269 * @since 9 270 * @deprecated since 11 271 */ 272 checkOsAccountActivated(localId: number): Promise<boolean>; 273 274 /** 275 * Checks whether an OS account is activated based on its local ID. 276 * 277 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 278 * @param { number } localId - Indicates the local ID of the OS account. 279 * @returns { Promise<boolean> } - Returns {@code true} if the OS account is activated; returns {@code false} otherwise. 280 * @throws { BusinessError } 201 - Permission denied. 281 * @throws { BusinessError } 202 - Not system application. 282 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 283 * <br> 2. Incorrect parameter types. 284 * @throws { BusinessError } 12300001 - The system service works abnormally. 285 * @throws { BusinessError } 12300003 - Account not found. 286 * @syscap SystemCapability.Account.OsAccount 287 * @systemapi Hide this for inner system use. 288 * @since 11 289 */ 290 isOsAccountActivated(localId: number): Promise<boolean>; 291 292 /** 293 * Checks whether a constraint has been enabled for an OS account based on its local ID. 294 * 295 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 296 * @param { number } localId - Indicates the local ID of the OS account. 297 * @param { string } constraint - Indicates the constraint to check. The value can be: 298 * <br> {@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point. 299 * <br> {@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages. 300 * <br> {@code constraint.calls.outgoing} - Indicates the constraint on making calls. 301 * <br> {@code constraint.unknown.sources.install} - Indicates the constraint on installing applications 302 * <br> from unknown sources. 303 * @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether the constraint is enabled for the specified OS account. 304 * @syscap SystemCapability.Account.OsAccount 305 * @since 7 306 * @deprecated since 9 307 * @useinstead osAccount.AccountManager#checkOsAccountConstraintEnabled 308 */ 309 isOsAccountConstraintEnable(localId: number, constraint: string, callback: AsyncCallback<boolean>): void; 310 311 /** 312 * Checks whether a constraint has been enabled for an OS account based on its local ID. 313 * 314 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 315 * @param { number } localId - Indicates the local ID of the OS account. 316 * @param { string } constraint - Indicates the constraint to check. The value can be: 317 * <br> {@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point. 318 * <br> {@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages. 319 * <br> {@code constraint.calls.outgoing} - Indicates the constraint on making calls. 320 * <br> {@code constraint.unknown.sources.install} - Indicates the constraint on installing applications 321 * <br> from unknown sources. 322 * @returns { Promise<boolean> } Returns {@code true} if the constraint has been enabled for the OS account; 323 * returns {@code false} otherwise. 324 * @syscap SystemCapability.Account.OsAccount 325 * @since 7 326 * @deprecated since 9 327 * @useinstead osAccount.AccountManager#checkOsAccountConstraintEnabled 328 */ 329 isOsAccountConstraintEnable(localId: number, constraint: string): Promise<boolean>; 330 331 /** 332 * Checks whether the given constraint is enabled for the specified OS account. 333 * 334 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 335 * @param { number } localId - Indicates the local ID of the OS account. 336 * @param { string } constraint - Indicates the constraint to check. For example: the value can be: 337 * <br> {@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point. 338 * <br> {@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages. 339 * <br> {@code constraint.calls.outgoing} - Indicates the constraint on making calls. 340 * <br> {@code constraint.unknown.sources.install} - Indicates the constraint on installing applications 341 * <br> from unknown sources. 342 * @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether the constraint is enabled for the specified OS account. 343 * @throws { BusinessError } 201 - Permission denied. 344 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 345 * <br> 2. Incorrect parameter types. 346 * @throws { BusinessError } 12300001 - The system service works abnormally. 347 * @throws { BusinessError } 12300002 - Invalid localId or constraint. 348 * @throws { BusinessError } 12300003 - Account not found. 349 * @syscap SystemCapability.Account.OsAccount 350 * @since 9 351 * @deprecated since 11 352 */ 353 checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback<boolean>): void; 354 355 /** 356 * Checks whether the given constraint is enabled for the specified OS account. 357 * 358 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 359 * @param { number } localId - Indicates the local ID of the OS account. 360 * @param { string } constraint - Indicates the constraint to check. For example: the value can be: 361 * <br> {@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point. 362 * <br> {@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages. 363 * <br> {@code constraint.calls.outgoing} - Indicates the constraint on making calls. 364 * <br> {@code constraint.unknown.sources.install} - Indicates the constraint on installing applications 365 * <br> from unknown sources. 366 * @returns { Promise<boolean> } Returns whether the given constraint is enabled for the specified OS account. 367 * @throws { BusinessError } 201 - Permission denied. 368 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 369 * <br> 2. Incorrect parameter types. 370 * @throws { BusinessError } 12300001 - The system service works abnormally. 371 * @throws { BusinessError } 12300002 - Invalid localId or constraint. 372 * @throws { BusinessError } 12300003 - Account not found. 373 * @syscap SystemCapability.Account.OsAccount 374 * @since 9 375 * @deprecated since 11 376 */ 377 checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise<boolean>; 378 379 /** 380 * Checks whether the given constraint is enabled for the current OS account. 381 * 382 * @param { string } constraint - Indicates the constraint to check. For example: the value can be: 383 * <br> {@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point. 384 * <br> {@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages. 385 * <br> {@code constraint.calls.outgoing} - Indicates the constraint on making calls. 386 * <br> {@code constraint.unknown.sources.install} - Indicates the constraint on installing applications 387 * <br> from unknown sources. 388 * @returns { Promise<boolean> } Returns whether the given constraint is enabled for the current OS account. 389 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 390 * <br> 2. Incorrect parameter types. 391 * @throws { BusinessError } 12300001 - The system service works abnormally. 392 * @syscap SystemCapability.Account.OsAccount 393 * @since 11 394 */ 395 isOsAccountConstraintEnabled(constraint: string): Promise<boolean>; 396 397 /** 398 * Checks whether the given constraint is enabled for the specified OS account. 399 * 400 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 401 * @param { number } localId - Indicates the local ID of the OS account. 402 * @param { string } constraint - Indicates the constraint to check. For example: the value can be: 403 * <br> {@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point. 404 * <br> {@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages. 405 * <br> {@code constraint.calls.outgoing} - Indicates the constraint on making calls. 406 * <br> {@code constraint.unknown.sources.install} - Indicates the constraint on installing applications 407 * <br> from unknown sources. 408 * @returns { Promise<boolean> } Returns whether the given constraint is enabled for the specified OS account. 409 * @throws { BusinessError } 201 - Permission denied. 410 * @throws { BusinessError } 202 - Not system application. 411 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 412 * <br> 2. Incorrect parameter types. 413 * @throws { BusinessError } 12300001 - The system service works abnormally. 414 * @throws { BusinessError } 12300003 - Account not found. 415 * @syscap SystemCapability.Account.OsAccount 416 * @systemapi Hide this for inner system use. 417 * @since 11 418 */ 419 isOsAccountConstraintEnabled(localId: number, constraint: string): Promise<boolean>; 420 421 /** 422 * Checks whether this OS account is a test OS account. 423 * 424 * @param { AsyncCallback<boolean> } callback - Returns {@code true} if this OS account is a test OS account; returns {@code false} otherwise. 425 * @syscap SystemCapability.Account.OsAccount 426 * @since 7 427 * @deprecated since 9 428 * @useinstead osAccount.AccountManager#checkOsAccountTestable 429 */ 430 isTestOsAccount(callback: AsyncCallback<boolean>): void; 431 432 /** 433 * Checks whether this OS account is a test OS account. 434 * 435 * @returns { Promise<boolean> } Returns {@code true} if this OS account is a test OS account; returns {@code false} otherwise. 436 * @syscap SystemCapability.Account.OsAccount 437 * @since 7 438 * @deprecated since 9 439 * @useinstead osAccount.AccountManager#checkOsAccountTestable 440 */ 441 isTestOsAccount(): Promise<boolean>; 442 443 /** 444 * Checks whether current OS account is testable. 445 * 446 * @param { AsyncCallback<boolean> } callback - Returns {@code true} if this account is testable; returns {@code false} otherwise. 447 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 448 * <br> 2. Incorrect parameter types. 449 * @throws { BusinessError } 12300001 - The system service works abnormally. 450 * @syscap SystemCapability.Account.OsAccount 451 * @since 9 452 */ 453 checkOsAccountTestable(callback: AsyncCallback<boolean>): void; 454 455 /** 456 * Checks whether current OS account is testable. 457 * 458 * @returns { Promise<boolean> } Returns {@code true} if this account is testable; returns {@code false} otherwise. 459 * @throws { BusinessError } 12300001 - The system service works abnormally. 460 * @syscap SystemCapability.Account.OsAccount 461 * @since 9 462 */ 463 checkOsAccountTestable(): Promise<boolean>; 464 465 /** 466 * Checks whether an OS account has been verified based on its local ID. 467 * 468 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 469 * @param { AsyncCallback<boolean> } callback - Returns {@code true} if the OS account has been verified successfully; 470 * returns {@code false} otherwise. 471 * @syscap SystemCapability.Account.OsAccount 472 * @since 7 473 * @deprecated since 9 474 * @useinstead osAccount.AccountManager#checkOsAccountVerified 475 */ 476 isOsAccountVerified(callback: AsyncCallback<boolean>): void; 477 478 /** 479 * Checks whether an OS account has been verified based on its local ID. 480 * 481 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 482 * @param { number } localId - Indicates the local ID of the OS account. 483 * @param { AsyncCallback<boolean> } callback - Returns {@code true} if the OS account has been verified successfully; 484 * returns {@code false} otherwise. 485 * @syscap SystemCapability.Account.OsAccount 486 * @since 7 487 * @deprecated since 9 488 * @useinstead osAccount.AccountManager#checkOsAccountVerified 489 */ 490 isOsAccountVerified(localId: number, callback: AsyncCallback<boolean>): void; 491 492 /** 493 * Checks whether an OS account has been verified based on its local ID. 494 * 495 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 496 * @param { number } localId - Indicates the local ID of the OS account. 497 * @returns { Promise<boolean> } Returns {@code true} if the OS account has been verified successfully; 498 * returns {@code false} otherwise. 499 * @syscap SystemCapability.Account.OsAccount 500 * @since 7 501 * @deprecated since 9 502 * @useinstead osAccount.AccountManager#checkOsAccountVerified 503 */ 504 isOsAccountVerified(localId?: number): Promise<boolean>; 505 506 /** 507 * Checks whether the current OS account is verified. 508 * 509 * @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether the current OS account is verified. 510 * @throws { BusinessError } 12300001 - The system service works abnormally. 511 * @syscap SystemCapability.Account.OsAccount 512 * @since 9 513 * @deprecated since 11 514 * @useinstead osAccount.AccountManager#isOsAccountUnlocked 515 */ 516 checkOsAccountVerified(callback: AsyncCallback<boolean>): void; 517 518 /** 519 * Checks whether the current OS account is verified. 520 * 521 * @returns { Promise<boolean> } Returns whether the current OS account is verified. 522 * @throws { BusinessError } 12300001 - The system service works abnormally. 523 * @syscap SystemCapability.Account.OsAccount 524 * @since 9 525 * @deprecated since 11 526 * @useinstead osAccount.AccountManager#isOsAccountUnlocked 527 */ 528 checkOsAccountVerified(): Promise<boolean>; 529 530 /** 531 * Checks whether the specified OS account is verified. 532 * 533 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 534 * @param { number } localId - Indicates the local ID of the OS account. 535 * @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether the specified OS account is verified. 536 * @throws { BusinessError } 201 - Permission denied. 537 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 538 * <br> 2. Incorrect parameter types. 539 * @throws { BusinessError } 12300001 - The system service works abnormally. 540 * @throws { BusinessError } 12300002 - Invalid localId. 541 * @throws { BusinessError } 12300003 - Account not found. 542 * @syscap SystemCapability.Account.OsAccount 543 * @since 9 544 * @deprecated since 11 545 */ 546 checkOsAccountVerified(localId: number, callback: AsyncCallback<boolean>): void; 547 548 /** 549 * Checks whether the specified OS account is verified. 550 * 551 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 552 * @param { number } localId - Indicates the local ID of the OS account. 553 * @returns { Promise<boolean> } Returns whether the specified OS account is verified. 554 * @throws { BusinessError } 201 - Permission denied. 555 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 556 * <br> 2. Incorrect parameter types. 557 * @throws { BusinessError } 12300001 - The system service works abnormally. 558 * @throws { BusinessError } 12300002 - Invalid localId. 559 * @throws { BusinessError } 12300003 - Account not found. 560 * @syscap SystemCapability.Account.OsAccount 561 * @since 9 562 * @deprecated since 11 563 */ 564 checkOsAccountVerified(localId: number): Promise<boolean>; 565 566 /** 567 * Checks whether the current OS account is unlocked. 568 * 569 * @returns { Promise<boolean> } Returns whether the current OS account is unlocked. 570 * @throws { BusinessError } 12300001 - The system service works abnormally. 571 * @syscap SystemCapability.Account.OsAccount 572 * @since 11 573 */ 574 isOsAccountUnlocked(): Promise<boolean>; 575 576 /** 577 * Checks whether the specified OS account is unlocked. 578 * 579 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 580 * @param { number } localId - Indicates the local ID of the OS account. 581 * @returns { Promise<boolean> } Returns whether the specified OS account is unlocked. 582 * @throws { BusinessError } 201 - Permission denied. 583 * @throws { BusinessError } 202 - Not system application. 584 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 585 * <br> 2. Incorrect parameter types. 586 * @throws { BusinessError } 12300001 - The system service works abnormally. 587 * @throws { BusinessError } 12300003 - Account not found. 588 * @syscap SystemCapability.Account.OsAccount 589 * @systemapi Hide this for inner system use. 590 * @since 11 591 */ 592 isOsAccountUnlocked(localId: number): Promise<boolean>; 593 594 /** 595 * Removes an OS account based on its local ID. 596 * 597 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 598 * @param { number } localId - Indicates the local ID of the OS account. 599 * @param { AsyncCallback<void> } callback - Indicates the callback for removing the specified OS account. 600 * @throws { BusinessError } 201 - Permission denied. 601 * @throws { BusinessError } 202 - Not system application. 602 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 603 * <br> 2. Incorrect parameter types. 604 * @throws { BusinessError } 12300001 - The system service works abnormally. 605 * @throws { BusinessError } 12300002 - Invalid localId. 606 * @throws { BusinessError } 12300003 - Account not found. 607 * @throws { BusinessError } 12300008 - Restricted Account. 608 * @throws { BusinessError } 12300010 - Service busy. Possible causes: The target account is being operated. 609 * @syscap SystemCapability.Account.OsAccount 610 * @systemapi Hide this for inner system use. 611 * @since 7 612 */ 613 removeOsAccount(localId: number, callback: AsyncCallback<void>): void; 614 615 /** 616 * Removes an OS account based on its local ID. 617 * 618 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 619 * @param { number } localId - Indicates the local ID of the OS account. 620 * @returns { Promise<void> } The promise returned by the function. 621 * @throws { BusinessError } 201 - Permission denied. 622 * @throws { BusinessError } 202 - Not system application. 623 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 624 * <br> 2. Incorrect parameter types. 625 * @throws { BusinessError } 12300001 - The system service works abnormally. 626 * @throws { BusinessError } 12300002 - Invalid localId. 627 * @throws { BusinessError } 12300003 - Account not found. 628 * @throws { BusinessError } 12300008 - Restricted Account. 629 * @throws { BusinessError } 12300010 - Service busy. Possible causes: The target account is being operated. 630 * @syscap SystemCapability.Account.OsAccount 631 * @systemapi Hide this for inner system use. 632 * @since 7 633 */ 634 removeOsAccount(localId: number): Promise<void>; 635 636 /** 637 * Sets constraints for an OS account based on its local ID. 638 * 639 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 640 * @param { number } localId - Indicates the local ID of the OS account. 641 * @param { Array<string> } constraints - Indicates the constraints to set for the OS account. The value can be: 642 * <br> {@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point. 643 * <br> {@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages. 644 * <br> {@code constraint.calls.outgoing} - Indicates the constraint on making calls. 645 * <br> {@code constraint.unknown.sources.install} - Indicates the constraint on installing applications 646 * <br> from unknown sources. 647 * @param { boolean } enable - Specifies whether to enable the constraint. 648 * @param { AsyncCallback<void> } callback - Indicates the callback for setting the specified OS account constraints. 649 * @throws { BusinessError } 201 - Permission denied. 650 * @throws { BusinessError } 202 - Not system application. 651 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 652 * <br> 2. Incorrect parameter types. 653 * @throws { BusinessError } 12300001 - The system service works abnormally. 654 * @throws { BusinessError } 12300002 - Invalid localId or constraints. 655 * @throws { BusinessError } 12300003 - Account not found. 656 * @throws { BusinessError } 12300008 - Restricted Account. 657 * @syscap SystemCapability.Account.OsAccount 658 * @systemapi Hide this for inner system use. 659 * @since 7 660 */ 661 setOsAccountConstraints( 662 localId: number, 663 constraints: Array<string>, 664 enable: boolean, 665 callback: AsyncCallback<void> 666 ): void; 667 668 /** 669 * Sets constraints for an OS account based on its local ID. 670 * 671 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 672 * @param { number } localId - Indicates the local ID of the OS account. 673 * @param { Array<string> } constraints - Indicates the constraints to set for the OS account. The value can be: 674 * <br> {@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point. 675 * <br> {@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages. 676 * <br> {@code constraint.calls.outgoing} - Indicates the constraint on making calls. 677 * <br> {@code constraint.unknown.sources.install} - Indicates the constraint on installing applications 678 * <br> from unknown sources. 679 * @param { boolean } enable - Specifies whether to enable the constraint. 680 * @returns { Promise<void> } The promise returned by the function. 681 * @throws { BusinessError } 201 - Permission denied. 682 * @throws { BusinessError } 202 - Not system application. 683 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 684 * <br> 2. Incorrect parameter types. 685 * @throws { BusinessError } 12300001 - The system service works abnormally. 686 * @throws { BusinessError } 12300002 - Invalid localId or constraints. 687 * @throws { BusinessError } 12300003 - Account not found. 688 * @throws { BusinessError } 12300008 - Restricted Account. 689 * @syscap SystemCapability.Account.OsAccount 690 * @systemapi Hide this for inner system use. 691 * @since 7 692 */ 693 setOsAccountConstraints(localId: number, constraints: Array<string>, enable: boolean): Promise<void>; 694 695 /** 696 * Sets the local name for an OS account based on its local ID. 697 * 698 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 699 * @param { number } localId - Indicates the local ID of the OS account. 700 * @param { string } localName - Indicates the local name to set for the OS account. 701 * @param { AsyncCallback<void> } callback - Indicates the callback for setting the specified OS account name. 702 * @throws { BusinessError } 201 - Permission denied. 703 * @throws { BusinessError } 202 - Not system application. 704 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 705 * <br> 2. Incorrect parameter types. 706 * @throws { BusinessError } 12300001 - The system service works abnormally. 707 * @throws { BusinessError } 12300002 - Invalid localId or localName. 708 * @throws { BusinessError } 12300003 - Account not found. 709 * @throws { BusinessError } 12300008 - Restricted Account. 710 * @syscap SystemCapability.Account.OsAccount 711 * @systemapi Hide this for inner system use. 712 * @since 7 713 */ 714 setOsAccountName(localId: number, localName: string, callback: AsyncCallback<void>): void; 715 716 /** 717 * Sets the local name for an OS account based on its local ID. 718 * 719 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 720 * @param { number } localId - Indicates the local ID of the OS account. 721 * @param { string } localName - Indicates the local name to set for the OS account. 722 * @returns { Promise<void> } The promise returned by the function. 723 * @throws { BusinessError } 201 - Permission denied. 724 * @throws { BusinessError } 202 - Not system application. 725 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 726 * <br> 2. Incorrect parameter types. 727 * @throws { BusinessError } 12300001 - The system service works abnormally. 728 * @throws { BusinessError } 12300002 - Invalid localId or localName. 729 * @throws { BusinessError } 12300003 - Account not found. 730 * @throws { BusinessError } 12300008 - Restricted Account. 731 * @syscap SystemCapability.Account.OsAccount 732 * @systemapi Hide this for inner system use. 733 * @since 7 734 */ 735 setOsAccountName(localId: number, localName: string): Promise<void>; 736 737 /** 738 * Gets the name of the OS account to which the caller belongs. 739 * 740 * @returns { Promise<string> } The promise returned by the function. 741 * @throws { BusinessError } 12300001 - The system service works abnormally. 742 * @syscap SystemCapability.Account.OsAccount 743 * @since 12 744 */ 745 getOsAccountName(): Promise<string>; 746 747 /** 748 * Obtains the number of all OS accounts created on a device. 749 * 750 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 751 * @param { AsyncCallback<number> } callback - Returns the number of created OS accounts. 752 * @syscap SystemCapability.Account.OsAccount 753 * @since 7 754 * @deprecated since 9 755 * @useinstead osAccount.AccountManager#getOsAccountCount 756 */ 757 getCreatedOsAccountsCount(callback: AsyncCallback<number>): void; 758 759 /** 760 * Obtains the number of all OS accounts created on a device. 761 * 762 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 763 * @returns { Promise<number> } Returns the number of created OS accounts. 764 * @syscap SystemCapability.Account.OsAccount 765 * @since 7 766 * @deprecated since 9 767 * @useinstead osAccount.AccountManager#getOsAccountCount 768 */ 769 getCreatedOsAccountsCount(): Promise<number>; 770 771 /** 772 * Obtains the number of all OS accounts created on a device. 773 * 774 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 775 * @param { AsyncCallback<number> } callback - Returns the number of created OS accounts. 776 * @throws { BusinessError } 201 - Permission denied. 777 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 778 * <br> 2. Incorrect parameter types. 779 * @throws { BusinessError } 12300001 - The system service works abnormally. 780 * @syscap SystemCapability.Account.OsAccount 781 * This API can be called only by system applications. 782 * @since 9 783 */ 784 getOsAccountCount(callback: AsyncCallback<number>): void; 785 786 /** 787 * Obtains the number of all OS accounts created on a device. 788 * 789 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 790 * @returns { Promise<number> } Returns the number of created OS accounts. 791 * @throws { BusinessError } 201 - Permission denied. 792 * @throws { BusinessError } 12300001 - The system service works abnormally. 793 * @syscap SystemCapability.Account.OsAccount 794 * This API can be called only by system applications. 795 * @since 9 796 */ 797 getOsAccountCount(): Promise<number>; 798 799 /** 800 * Obtains the local ID of an OS account from the current process UID. 801 * 802 * @param { AsyncCallback<number> } callback - Returns the local ID of the OS account. 803 * @syscap SystemCapability.Account.OsAccount 804 * @since 7 805 * @deprecated since 9 806 * @useinstead osAccount.AccountManager#getOsAccountLocalId 807 */ 808 getOsAccountLocalIdFromProcess(callback: AsyncCallback<number>): void; 809 810 /** 811 * Obtains the local ID of an OS account from the current process UID. 812 * 813 * @returns { Promise<number> } Returns the local ID of the OS account. 814 * @syscap SystemCapability.Account.OsAccount 815 * @since 7 816 * @deprecated since 9 817 * @useinstead osAccount.AccountManager#getOsAccountLocalId 818 */ 819 getOsAccountLocalIdFromProcess(): Promise<number>; 820 821 /** 822 * Gets the local ID of the current OS account. 823 * 824 * @param { AsyncCallback<number> } callback - Indicates the callback for getting the local ID of the current OS account. 825 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 826 * <br> 2. Incorrect parameter types. 827 * @throws { BusinessError } 12300001 - The system service works abnormally. 828 * @syscap SystemCapability.Account.OsAccount 829 * @since 9 830 */ 831 getOsAccountLocalId(callback: AsyncCallback<number>): void; 832 833 /** 834 * Get the local ID of the current OS account. 835 * 836 * @returns { Promise<number> } Returns the local ID of the current account. 837 * @throws { BusinessError } 12300001 - The system service works abnormally. 838 * @syscap SystemCapability.Account.OsAccount 839 * @since 9 840 */ 841 getOsAccountLocalId(): Promise<number>; 842 843 /** 844 * Gets the local ID of an OS account from the process UID 845 * 846 * @param { number } uid - Indicates the process UID. 847 * @param { AsyncCallback<number> } callback - Returns the local ID of the OS account. 848 * @syscap SystemCapability.Account.OsAccount 849 * @since 7 850 * @deprecated since 9 851 * @useinstead osAccount.AccountManager#getOsAccountLocalIdForUid 852 */ 853 getOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback<number>): void; 854 855 /** 856 * Gets the local ID of an OS account from the process UID 857 * 858 * @param { number } uid - Indicates the process UID. 859 * @returns { Promise<number> } Returns the local ID of the OS account. 860 * @syscap SystemCapability.Account.OsAccount 861 * @since 7 862 * @deprecated since 9 863 * @useinstead osAccount.AccountManager#getOsAccountLocalIdForUid 864 */ 865 getOsAccountLocalIdFromUid(uid: number): Promise<number>; 866 867 /** 868 * Gets the local ID of the OS account associated with the specified UID. 869 * 870 * @param { number } uid - Indicates the process UID. 871 * @param { AsyncCallback<number> } callback - Indicates the callback for getting the local ID of the OS account associated with the specified UID. 872 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 873 * <br> 2. Incorrect parameter types. 874 * @throws { BusinessError } 12300001 - The system service works abnormally. 875 * @throws { BusinessError } 12300002 - Invalid uid. 876 * @syscap SystemCapability.Account.OsAccount 877 * @since 9 878 */ 879 getOsAccountLocalIdForUid(uid: number, callback: AsyncCallback<number>): void; 880 881 /** 882 * Get the local ID of the OS account associated with the specified UID. 883 * 884 * @param { number } uid - Indicates the process UID. 885 * @returns { Promise<number> } - Returns the local ID of the OS account associated with the specified UID. 886 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 887 * <br> 2. Incorrect parameter types. 888 * @throws { BusinessError } 12300001 - The system service works abnormally. 889 * @throws { BusinessError } 12300002 - Invalid uid. 890 * @syscap SystemCapability.Account.OsAccount 891 * @since 9 892 */ 893 getOsAccountLocalIdForUid(uid: number): Promise<number>; 894 895 /** 896 * Gets the local ID of the OS account associated with the specified UID synchronously. 897 * 898 * @param { number } uid - Indicates the process UID. 899 * @returns { number } Returns the local ID of the OS account associated with the specified UID. 900 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 901 * <br> 2. Incorrect parameter types. 902 * @throws { BusinessError } 12300002 - Invalid uid. 903 * @syscap SystemCapability.Account.OsAccount 904 * @since 10 905 */ 906 getOsAccountLocalIdForUidSync(uid: number): number; 907 908 /** 909 * Queries the local ID of an OS account which is bound to the specified domain account. 910 * 911 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 912 * @param { DomainAccountInfo } domainInfo - Indicates the domain account info. 913 * @param { AsyncCallback<number> } callback - Returns the local ID of the OS account. 914 * @syscap SystemCapability.Account.OsAccount 915 * @since 8 916 * @deprecated since 9 917 * @useinstead osAccount.AccountManager#getOsAccountLocalIdForDomain 918 */ 919 getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback<number>): void; 920 921 /** 922 * Queries the local ID of an OS account which is bound to the specified domain account. 923 * 924 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 925 * @param { DomainAccountInfo } domainInfo - Indicates the domain account info. 926 * @returns { Promise<number> } Returns the local ID of the OS account. 927 * @syscap SystemCapability.Account.OsAccount 928 * @since 8 929 * @deprecated since 9 930 * @useinstead osAccount.AccountManager#getOsAccountLocalIdForDomain 931 */ 932 getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise<number>; 933 934 /** 935 * Gets the local ID of the OS account associated with the specified domain account. 936 * 937 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 938 * @param { DomainAccountInfo } domainInfo - Indicates the domain account info. 939 * @param { AsyncCallback<number> } callback - Indicates the callback for 940 * getting the local ID of the OS account associated with the specified domain account. 941 * @throws { BusinessError } 201 - Permission denied. 942 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 943 * <br> 2. Incorrect parameter types. 944 * @throws { BusinessError } 12300001 - The system service works abnormally. 945 * @throws { BusinessError } 12300002 - Invalid domainInfo. 946 * @syscap SystemCapability.Account.OsAccount 947 * This API can be called only by system applications. 948 * @since 9 949 */ 950 getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback<number>): void; 951 952 /** 953 * Gets the local ID of the OS account associated with the specified domain account. 954 * 955 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 956 * @param { DomainAccountInfo } domainInfo - Indicates the domain account info. 957 * @returns { Promise<number> } Returns the local ID of the OS account associated with the specified domain account. 958 * @throws { BusinessError } 201 - Permission denied. 959 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 960 * <br> 2. Incorrect parameter types. 961 * @throws { BusinessError } 12300001 - The system service works abnormally. 962 * @throws { BusinessError } 12300002 - Invalid domainInfo. 963 * @syscap SystemCapability.Account.OsAccount 964 * This API can be called only by system applications. 965 * @since 9 966 */ 967 getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise<number>; 968 969 /** 970 * Queries the maximum number of OS accounts that can be created on a device. 971 * 972 * @param { AsyncCallback<number> } callback - Returns the maximum number of OS accounts that can be created. 973 * @throws { BusinessError } 202 - Not system application. 974 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 975 * <br> 2. Incorrect parameter types. 976 * @throws { BusinessError } 12300001 - The system service works abnormally. 977 * @syscap SystemCapability.Account.OsAccount 978 * @systemapi Hide this for inner system use. 979 * @since 7 980 */ 981 queryMaxOsAccountNumber(callback: AsyncCallback<number>): void; 982 983 /** 984 * Queries the maximum number of OS accounts that can be created on a device. 985 * 986 * @returns { Promise<number> } Returns the maximum number of OS accounts that can be created. 987 * @throws { BusinessError } 202 - Not system application. 988 * @throws { BusinessError } 12300001 - The system service works abnormally. 989 * @syscap SystemCapability.Account.OsAccount 990 * @systemapi Hide this for inner system use. 991 * @since 7 992 */ 993 queryMaxOsAccountNumber(): Promise<number>; 994 995 /** 996 * Queries the maximum number of OS accounts that can be logged in. 997 * 998 * @returns { Promise<number> } Returns the maximum number of OS accounts that can be logged in. 999 * @throws { BusinessError } 202 - Not system application. 1000 * @throws { BusinessError } 12300001 - The system service works abnormally. 1001 * @syscap SystemCapability.Account.OsAccount 1002 * @systemapi Hide this for inner system use. 1003 * @since 12 1004 */ 1005 queryMaxLoggedInOsAccountNumber(): Promise<number>; 1006 1007 /** 1008 * Obtains all constraints of an OS account based on its local ID. 1009 * 1010 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1011 * @param { number } localId - Indicates the local ID of the OS account. 1012 * @param { AsyncCallback<Array<string>> } callback - Returns a list of constraints. 1013 * @syscap SystemCapability.Account.OsAccount 1014 * @since 7 1015 * @deprecated since 9 1016 * @useinstead osAccount.AccountManager#getOsAccountConstraints 1017 */ 1018 getOsAccountAllConstraints(localId: number, callback: AsyncCallback<Array<string>>): void; 1019 1020 /** 1021 * Obtains all constraints of an OS account based on its local ID. 1022 * 1023 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1024 * @param { number } localId - Indicates the local ID of the OS account. 1025 * @returns { Promise<Array<string>> } Returns a list of constraints. 1026 * @syscap SystemCapability.Account.OsAccount 1027 * @since 7 1028 * @deprecated since 9 1029 * @useinstead osAccount.AccountManager#getOsAccountConstraints 1030 */ 1031 getOsAccountAllConstraints(localId: number): Promise<Array<string>>; 1032 1033 /** 1034 * Obtains all constraints of an account based on its ID. 1035 * 1036 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1037 * @param { number } localId - Indicates the local ID of the OS account. 1038 * @param { AsyncCallback<Array<string>> } callback - Returns a list of constraints. 1039 * @throws { BusinessError } 201 - Permission denied. 1040 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1041 * <br> 2. Incorrect parameter types. 1042 * @throws { BusinessError } 12300001 - The system service works abnormally. 1043 * @throws { BusinessError } 12300002 - Invalid localId. 1044 * @throws { BusinessError } 12300003 - Account not found. 1045 * @syscap SystemCapability.Account.OsAccount 1046 * @since 9 1047 * @deprecated since 11 1048 */ 1049 getOsAccountConstraints(localId: number, callback: AsyncCallback<Array<string>>): void; 1050 1051 /** 1052 * Obtains all constraints of an account based on its ID. 1053 * 1054 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1055 * @param { number } localId - Indicates the local ID of the OS account. 1056 * @returns { Promise<Array<string>> } Returns a list of constraints. 1057 * @throws { BusinessError } 201 - Permission denied. 1058 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1059 * <br> 2. Incorrect parameter types. 1060 * @throws { BusinessError } 12300001 - The system service works abnormally. 1061 * @throws { BusinessError } 12300002 - Invalid localId. 1062 * @throws { BusinessError } 12300003 - Account not found. 1063 * @syscap SystemCapability.Account.OsAccount 1064 * @since 9 1065 * @deprecated since 11 1066 */ 1067 getOsAccountConstraints(localId: number): Promise<Array<string>>; 1068 1069 /** 1070 * Gets all enabled constraints of the specified OS account by its local ID. 1071 * 1072 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1073 * @param { number } localId - Indicates the local ID of the OS account. 1074 * @returns { Promise<Array<string>> } Returns a list of constraints. 1075 * @throws { BusinessError } 201 - Permission denied. 1076 * @throws { BusinessError } 202 - Not system application. 1077 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1078 * <br> 2. Incorrect parameter types. 1079 * @throws { BusinessError } 12300001 - The system service works abnormally. 1080 * @throws { BusinessError } 12300003 - Account not found. 1081 * @syscap SystemCapability.Account.OsAccount 1082 * @systemapi Hide this for inner system use. 1083 * @since 11 1084 */ 1085 getEnabledOsAccountConstraints(localId: number): Promise<Array<string>>; 1086 1087 /** 1088 * Queries the list of all the OS accounts that have been created in the system. 1089 * 1090 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1091 * @param { AsyncCallback<Array<OsAccountInfo>> } callback - Returns a list of OS accounts. 1092 * @throws { BusinessError } 201 - Permission denied. 1093 * @throws { BusinessError } 202 - Not system application. 1094 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1095 * <br> 2. Incorrect parameter types. 1096 * @throws { BusinessError } 12300001 - The system service works abnormally. 1097 * @syscap SystemCapability.Account.OsAccount 1098 * @systemapi Hide this for inner system use. 1099 * @since 7 1100 */ 1101 queryAllCreatedOsAccounts(callback: AsyncCallback<Array<OsAccountInfo>>): void; 1102 1103 /** 1104 * Queries the list of all the OS accounts that have been created in the system. 1105 * 1106 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1107 * @returns { Promise<Array<OsAccountInfo>> } Returns a list of OS accounts. 1108 * @throws { BusinessError } 201 - Permission denied. 1109 * @throws { BusinessError } 202 - Not system application. 1110 * @throws { BusinessError } 12300001 - The system service works abnormally. 1111 * @syscap SystemCapability.Account.OsAccount 1112 * @systemapi Hide this for inner system use. 1113 * @since 7 1114 */ 1115 queryAllCreatedOsAccounts(): Promise<Array<OsAccountInfo>>; 1116 1117 /** 1118 * Queries the id list of all activated OS accounts. 1119 * 1120 * @param { AsyncCallback<Array<number>> } callback - Returns a id list of OS accounts. 1121 * @syscap SystemCapability.Account.OsAccount 1122 * @since 8 1123 * @deprecated since 9 1124 * @useinstead osAccount.AccountManager#getActivatedOsAccountLocalIds 1125 */ 1126 queryActivatedOsAccountIds(callback: AsyncCallback<Array<number>>): void; 1127 1128 /** 1129 * Queries the id list of all activated OS accounts. 1130 * 1131 * @returns { Promise<Array<number>> } Returns a id list of OS accounts. 1132 * @syscap SystemCapability.Account.OsAccount 1133 * @since 8 1134 * @deprecated since 9 1135 * @useinstead osAccount.AccountManager#getActivatedOsAccountLocalIds 1136 */ 1137 queryActivatedOsAccountIds(): Promise<Array<number>>; 1138 1139 /** 1140 * Gets the local IDs of all activated OS accounts. 1141 * 1142 * @param { AsyncCallback<Array<number>> } callback - Indicates the callback for getting the local IDs of all activated OS accounts. 1143 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1144 * <br> 2. Incorrect parameter types. 1145 * @throws { BusinessError } 12300001 - The system service works abnormally. 1146 * @syscap SystemCapability.Account.OsAccount 1147 * @since 9 1148 */ 1149 getActivatedOsAccountLocalIds(callback: AsyncCallback<Array<number>>): void; 1150 1151 /** 1152 * Gets the local IDs of all activated OS accounts. 1153 * 1154 * @returns { Promise<Array<number>> } Returns all activated accounts. 1155 * @throws { BusinessError } 12300001 - The system service works abnormally. 1156 * @syscap SystemCapability.Account.OsAccount 1157 * @since 9 1158 */ 1159 getActivatedOsAccountLocalIds(): Promise<Array<number>>; 1160 1161 /** 1162 * Gets the local ID of the foreground OS account. 1163 * 1164 * @returns { Promise<number> } Returns local ID of the foreground OS account. 1165 * @throws { BusinessError } 12300001 - The system service works abnormally. 1166 * @syscap SystemCapability.Account.OsAccount 1167 * @since 15 1168 */ 1169 getForegroundOsAccountLocalId(): Promise<number>; 1170 1171 /** 1172 * Creates an OS account using the local name and account type. 1173 * 1174 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1175 * @param { string } localName - Indicates the local name of the OS account to create. 1176 * @param { OsAccountType } type - Indicates the type of the OS account to create. 1177 * {@link OsAccountType} specifies the account types available in the system. 1178 * @param { AsyncCallback<OsAccountInfo> } callback - Returns information about the created OS account; returns {@code null} if the creation fails. 1179 * @throws { BusinessError } 201 - Permission denied. 1180 * @throws { BusinessError } 202 - Not system application. 1181 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1182 * <br> 2. Incorrect parameter types. 1183 * @throws { BusinessError } 12300001 - The system service works abnormally. 1184 * @throws { BusinessError } 12300002 - Invalid localName or type. 1185 * @throws { BusinessError } 12300005 - Multi-user not supported. 1186 * @throws { BusinessError } 12300006 - Unsupported account type. 1187 * @throws { BusinessError } 12300007 - The number of accounts has reached the upper limit. 1188 * @syscap SystemCapability.Account.OsAccount 1189 * @systemapi Hide this for inner system use. 1190 * @since 7 1191 */ 1192 /** 1193 * Creates an OS account with the specified local name and type. 1194 * 1195 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1196 * @param { string } localName - Indicates the local name of the OS account to create. 1197 * @param { OsAccountType } type - Indicates the type of the OS account to create. 1198 * {@link OsAccountType} specifies the account types available in the system. 1199 * @param { AsyncCallback<OsAccountInfo> } callback - Returns information about the created OS account; returns {@code null} if the creation fails. 1200 * @throws { BusinessError } 201 - Permission denied. 1201 * @throws { BusinessError } 202 - Not system application. 1202 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1203 * <br> 2. Incorrect parameter types. 1204 * @throws { BusinessError } 12300001 - The system service works abnormally. 1205 * @throws { BusinessError } 12300002 - Invalid localName or type. 1206 * @throws { BusinessError } 12300004 - Local name already exists. 1207 * @throws { BusinessError } 12300005 - Multi-user not supported. 1208 * @throws { BusinessError } 12300006 - Unsupported account type. 1209 * @throws { BusinessError } 12300007 - The number of accounts has reached the upper limit. 1210 * @syscap SystemCapability.Account.OsAccount 1211 * @systemapi Hide this for inner system use. 1212 * @since 12 1213 */ 1214 createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback<OsAccountInfo>): void; 1215 1216 /** 1217 * Creates an OS account using the local name and account type. 1218 * 1219 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1220 * @param { string } localName - Indicates the local name of the OS account to create. 1221 * @param { OsAccountType } type - Indicates the type of the OS account to create. 1222 * {@link OsAccountType} specifies the account types available in the system. 1223 * @returns { Promise<OsAccountInfo> } Returns information about the created OS account; returns {@code null} if the creation fails. 1224 * @throws { BusinessError } 201 - Permission denied. 1225 * @throws { BusinessError } 202 - Not system application. 1226 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1227 * <br> 2. Incorrect parameter types. 1228 * @throws { BusinessError } 12300001 - The system service works abnormally. 1229 * @throws { BusinessError } 12300002 - Invalid localName or type. 1230 * @throws { BusinessError } 12300005 - Multi-user not supported. 1231 * @throws { BusinessError } 12300006 - Unsupported account type. 1232 * @throws { BusinessError } 12300007 - The number of accounts has reached the upper limit. 1233 * @syscap SystemCapability.Account.OsAccount 1234 * @systemapi Hide this for inner system use. 1235 * @since 7 1236 */ 1237 /** 1238 * Creates an OS account with the specified local name, type and options. 1239 * 1240 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1241 * @param { string } localName - Indicates the local name of the OS account to create. 1242 * @param { OsAccountType } type - Indicates the type of the OS account to create. 1243 * {@link OsAccountType} specifies the account types available in the system. 1244 * @param { CreateOsAccountOptions } [options] - Indicates the options for creating an OS account. 1245 * @returns { Promise<OsAccountInfo> } Returns information about the created OS account; returns {@code null} if the creation fails. 1246 * @throws { BusinessError } 201 - Permission denied. 1247 * @throws { BusinessError } 202 - Not system application. 1248 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1249 * <br> 2. Incorrect parameter types. 1250 * @throws { BusinessError } 12300001 - The system service works abnormally. 1251 * @throws { BusinessError } 12300002 - Invalid localName, type or options. 1252 * @throws { BusinessError } 12300004 - Local name already exists. 1253 * @throws { BusinessError } 12300005 - Multi-user not supported. 1254 * @throws { BusinessError } 12300006 - Unsupported account type. 1255 * @throws { BusinessError } 12300007 - The number of accounts has reached the upper limit. 1256 * @throws { BusinessError } 12300015 - The short name already exists. 1257 * @syscap SystemCapability.Account.OsAccount 1258 * @systemapi Hide this for inner system use. 1259 * @since 12 1260 */ 1261 createOsAccount(localName: string, type: OsAccountType, options?: CreateOsAccountOptions): Promise<OsAccountInfo>; 1262 1263 /** 1264 * Creates an OS account using the account type and domain account info. 1265 * 1266 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1267 * @param { OsAccountType } type - Indicates the type of the OS account to create. 1268 * {@link OsAccountType} specifies the account types available in the system. 1269 * @param { DomainAccountInfo } domainInfo - Indicates the domain account info. 1270 * @param { AsyncCallback<OsAccountInfo> } callback - Returns information about the created OS account; returns {@code null} if the creation fails. 1271 * @throws { BusinessError } 201 - Permission denied. 1272 * @throws { BusinessError } 202 - Not system application. 1273 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1274 * <br> 2. Incorrect parameter types. 1275 * @throws { BusinessError } 12300001 - The system service works abnormally. 1276 * @throws { BusinessError } 12300002 - Invalid type or domainInfo. 1277 * @throws { BusinessError } 12300004 - Account already exists. 1278 * @throws { BusinessError } 12300005 - Multi-user not supported. 1279 * @throws { BusinessError } 12300006 - Unsupported account type. 1280 * @throws { BusinessError } 12300007 - The number of accounts has reached the upper limit. 1281 * @syscap SystemCapability.Account.OsAccount 1282 * @systemapi Hide this for inner system use. 1283 * @since 8 1284 */ 1285 /** 1286 * Creates an OS account using the account type and domain account info. 1287 * 1288 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1289 * @param { OsAccountType } type - Indicates the type of the OS account to create. 1290 * {@link OsAccountType} specifies the account types available in the system. 1291 * @param { DomainAccountInfo } domainInfo - Indicates the domain account info. 1292 * @param { AsyncCallback<OsAccountInfo> } callback - Returns information about the created OS account; returns {@code null} if the creation fails. 1293 * @throws { BusinessError } 201 - Permission denied. 1294 * @throws { BusinessError } 202 - Not system application. 1295 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1296 * <br> 2. Incorrect parameter types. 1297 * @throws { BusinessError } 801 - Capability not supported. 1298 * @throws { BusinessError } 12300001 - The system service works abnormally. 1299 * @throws { BusinessError } 12300002 - Invalid type or domainInfo. 1300 * @throws { BusinessError } 12300004 - Account already exists. 1301 * @throws { BusinessError } 12300005 - Multi-user not supported. 1302 * @throws { BusinessError } 12300006 - Unsupported account type. 1303 * @throws { BusinessError } 12300007 - The number of accounts has reached the upper limit. 1304 * @syscap SystemCapability.Account.OsAccount 1305 * @systemapi Hide this for inner system use. 1306 * @since 12 1307 */ 1308 createOsAccountForDomain( 1309 type: OsAccountType, 1310 domainInfo: DomainAccountInfo, 1311 callback: AsyncCallback<OsAccountInfo> 1312 ): void; 1313 1314 /** 1315 * Creates an OS account using the account type and domain account info. 1316 * 1317 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1318 * @param { OsAccountType } type - Indicates the type of the OS account to create. 1319 * {@link OsAccountType} specifies the account types available in the system. 1320 * @param { DomainAccountInfo } domainInfo - Indicates the domain account info. 1321 * @returns { Promise<OsAccountInfo> } Returns information about the created OS account; returns {@code null} if the creation fails. 1322 * @throws { BusinessError } 201 - Permission denied. 1323 * @throws { BusinessError } 202 - Not system application. 1324 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1325 * <br> 2. Incorrect parameter types. 1326 * @throws { BusinessError } 12300001 - The system service works abnormally. 1327 * @throws { BusinessError } 12300002 - Invalid type or domainInfo. 1328 * @throws { BusinessError } 12300004 - Account already exists. 1329 * @throws { BusinessError } 12300005 - Multi-user not supported. 1330 * @throws { BusinessError } 12300006 - Unsupported account type. 1331 * @throws { BusinessError } 12300007 - The number of accounts has reached the upper limit. 1332 * @syscap SystemCapability.Account.OsAccount 1333 * @systemapi Hide this for inner system use. 1334 * @since 8 1335 */ 1336 /** 1337 * Creates an OS account using the account type, domain account info and options. 1338 * 1339 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1340 * @param { OsAccountType } type - Indicates the type of the OS account to create. 1341 * {@link OsAccountType} specifies the account types available in the system. 1342 * @param { DomainAccountInfo } domainInfo - Indicates the domain account info. 1343 * @param { CreateOsAccountForDomainOptions } [options] - Indicates the options to create an OS account for domain. 1344 * @returns { Promise<OsAccountInfo> } Returns information about the created OS account; returns {@code null} if the creation fails. 1345 * @throws { BusinessError } 201 - Permission denied. 1346 * @throws { BusinessError } 202 - Not system application. 1347 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1348 * <br> 2. Incorrect parameter types. 1349 * @throws { BusinessError } 801 - Capability not supported. 1350 * @throws { BusinessError } 12300001 - The system service works abnormally. 1351 * @throws { BusinessError } 12300002 - Invalid type, domainInfo or options. 1352 * @throws { BusinessError } 12300004 - Account already exists. 1353 * @throws { BusinessError } 12300005 - Multi-user not supported. 1354 * @throws { BusinessError } 12300006 - Unsupported account type. 1355 * @throws { BusinessError } 12300007 - The number of accounts has reached the upper limit. 1356 * @throws { BusinessError } 12300015 - The short name already exists. 1357 * @syscap SystemCapability.Account.OsAccount 1358 * @systemapi Hide this for inner system use. 1359 * @since 12 1360 */ 1361 createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, options?: CreateOsAccountForDomainOptions): Promise<OsAccountInfo>; 1362 1363 /** 1364 * Queries information about the current OS account. 1365 * 1366 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1367 * @param { AsyncCallback<OsAccountInfo> } callback - Returns information about the current OS account; returns {@code null} if the query fails. 1368 * @syscap SystemCapability.Account.OsAccount 1369 * @since 7 1370 * @deprecated since 9 1371 * @useinstead osAccount.AccountManager#getCurrentOsAccount 1372 */ 1373 queryCurrentOsAccount(callback: AsyncCallback<OsAccountInfo>): void; 1374 1375 /** 1376 * Queries information about the current OS account. 1377 * 1378 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1379 * @returns { Promise<OsAccountInfo> } Returns information about the current OS account; returns {@code null} if the query fails. 1380 * @syscap SystemCapability.Account.OsAccount 1381 * @since 7 1382 * @deprecated since 9 1383 * @useinstead osAccount.AccountManager#getCurrentOsAccount 1384 */ 1385 queryCurrentOsAccount(): Promise<OsAccountInfo>; 1386 1387 /** 1388 * Gets information about the current OS account. 1389 * 1390 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1391 * @param { AsyncCallback<OsAccountInfo> } callback - Returns information about the current OS account; returns {@code null} if the query fails. 1392 * @throws { BusinessError } 201 - Permission denied. 1393 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1394 * <br> 2. Incorrect parameter types. 1395 * @throws { BusinessError } 12300001 - The system service works abnormally. 1396 * @syscap SystemCapability.Account.OsAccount 1397 * @since 9 1398 * @deprecated since 11 1399 */ 1400 /** 1401 * Gets information about the current OS account. 1402 * 1403 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.GET_LOCAL_ACCOUNTS 1404 * @param { AsyncCallback<OsAccountInfo> } callback - Returns information about the current OS account; returns {@code null} if the query fails. 1405 * @throws { BusinessError } 201 - Permission denied. 1406 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1407 * <br> 2. Incorrect parameter types. 1408 * @throws { BusinessError } 12300001 - The system service works abnormally. 1409 * @syscap SystemCapability.Account.OsAccount 1410 * @since 10 1411 * @deprecated since 11 1412 */ 1413 getCurrentOsAccount(callback: AsyncCallback<OsAccountInfo>): void; 1414 1415 /** 1416 * Gets information about the current OS account. 1417 * 1418 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1419 * @returns { Promise<OsAccountInfo> } Returns information about the current OS account; returns {@code null} if the query fails. 1420 * @throws { BusinessError } 201 - Permission denied. 1421 * @throws { BusinessError } 12300001 - The system service works abnormally. 1422 * @syscap SystemCapability.Account.OsAccount 1423 * @since 9 1424 * @deprecated since 11 1425 */ 1426 /** 1427 * Gets information about the current OS account. 1428 * 1429 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.GET_LOCAL_ACCOUNTS 1430 * @returns { Promise<OsAccountInfo> } Returns information about the current OS account; returns {@code null} if the query fails. 1431 * @throws { BusinessError } 201 - Permission denied. 1432 * @throws { BusinessError } 12300001 - The system service works abnormally. 1433 * @syscap SystemCapability.Account.OsAccount 1434 * @since 10 1435 * @deprecated since 11 1436 */ 1437 getCurrentOsAccount(): Promise<OsAccountInfo>; 1438 1439 /** 1440 * Queries the current OS account information. 1441 * 1442 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.GET_LOCAL_ACCOUNTS 1443 * @returns { Promise<OsAccountInfo> } Returns information about the current OS account 1444 * @throws { BusinessError } 201 - Permission denied. 1445 * @throws { BusinessError } 202 - Not system application. 1446 * @throws { BusinessError } 12300001 - The system service works abnormally. 1447 * @syscap SystemCapability.Account.OsAccount 1448 * @systemapi Hide this for inner system use. 1449 * @since 11 1450 */ 1451 queryOsAccount(): Promise<OsAccountInfo>; 1452 1453 /** 1454 * Queries OS account information based on the local ID. 1455 * 1456 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION 1457 * @param { number } localId - Indicates the local ID of the OS account. 1458 * @param { AsyncCallback<OsAccountInfo> } callback - Returns the OS account information; returns {@code null} if the query fails. 1459 * @throws { BusinessError } 201 - Permission denied. 1460 * @throws { BusinessError } 202 - Not system application. 1461 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1462 * <br> 2. Incorrect parameter types. 1463 * @throws { BusinessError } 12300001 - The system service works abnormally. 1464 * @throws { BusinessError } 12300002 - Invalid localId. 1465 * @throws { BusinessError } 12300003 - Account not found. 1466 * @syscap SystemCapability.Account.OsAccount 1467 * @systemapi Hide this for inner system use. 1468 * @since 7 1469 */ 1470 queryOsAccountById(localId: number, callback: AsyncCallback<OsAccountInfo>): void; 1471 1472 /** 1473 * Queries OS account information based on the local ID. 1474 * 1475 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION 1476 * @param { number } localId - Indicates the local ID of the OS account. 1477 * @returns { Promise<OsAccountInfo> } Returns the OS account information; returns {@code null} if the query fails. 1478 * @throws { BusinessError } 201 - Permission denied. 1479 * @throws { BusinessError } 202 - Not system application. 1480 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1481 * <br> 2. Incorrect parameter types. 1482 * @throws { BusinessError } 12300001 - The system service works abnormally. 1483 * @throws { BusinessError } 12300002 - Invalid localId. 1484 * @throws { BusinessError } 12300003 - Account not found. 1485 * @syscap SystemCapability.Account.OsAccount 1486 * @systemapi Hide this for inner system use. 1487 * @since 7 1488 */ 1489 queryOsAccountById(localId: number): Promise<OsAccountInfo>; 1490 1491 /** 1492 * Gets the domain account information associated with the specified OS account. 1493 * 1494 * @permission ohos.permission.GET_DOMAIN_ACCOUNTS and ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1495 * @param { number } localId - Indicates the local ID of the specified OS account. 1496 * @returns { Promise<DomainAccountInfo> } Returns the domain account information. 1497 * @throws { BusinessError } 201 - Permission denied. 1498 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1499 * <br> 2. Incorrect parameter types. 1500 * @throws { BusinessError } 12300001 - The system service works abnormally. 1501 * @throws { BusinessError } 12300003 - OS account not found. 1502 * @syscap SystemCapability.Account.OsAccount 1503 * @since 15 1504 */ 1505 getOsAccountDomainInfo(localId: number): Promise<DomainAccountInfo>; 1506 1507 /** 1508 * Obtains the type of this OS account from the current process. 1509 * 1510 * @param { AsyncCallback<OsAccountType> } callback - Returns the OS account type. The value can be {@link OsAccountType#ADMIN}, 1511 * {@link OsAccountType#NORMAL}, and {@link OsAccountType#GUEST}. 1512 * @syscap SystemCapability.Account.OsAccount 1513 * @since 7 1514 * @deprecated since 9 1515 * @useinstead osAccount.AccountManager#getOsAccountType 1516 */ 1517 getOsAccountTypeFromProcess(callback: AsyncCallback<OsAccountType>): void; 1518 1519 /** 1520 * Obtains the type of this OS account from the current process. 1521 * 1522 * @returns { Promise<OsAccountType> } Returns the OS account type. The value can be {@link OsAccountType#ADMIN}, 1523 * {@link OsAccountType#NORMAL}, and {@link OsAccountType#GUEST}. 1524 * @syscap SystemCapability.Account.OsAccount 1525 * @since 7 1526 * @deprecated since 9 1527 * @useinstead osAccount.AccountManager#getOsAccountType 1528 */ 1529 getOsAccountTypeFromProcess(): Promise<OsAccountType>; 1530 1531 /** 1532 * Obtains the type of this OS account from the current process. 1533 * 1534 * @param { AsyncCallback<OsAccountType> } callback - Returns the OS account type. The value can be {@link OsAccountType#ADMIN}, 1535 * {@link OsAccountType#NORMAL}, and {@link OsAccountType#GUEST}. 1536 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1537 * <br> 2. Incorrect parameter types. 1538 * @throws { BusinessError } 12300001 - The system service works abnormally. 1539 * @syscap SystemCapability.Account.OsAccount 1540 * @since 9 1541 */ 1542 getOsAccountType(callback: AsyncCallback<OsAccountType>): void; 1543 1544 /** 1545 * Obtains the type of this OS account from the current process. 1546 * 1547 * @returns { Promise<OsAccountType> } Returns the OS account type. The value can be {@link OsAccountType#ADMIN}, 1548 * {@link OsAccountType#NORMAL}, and {@link OsAccountType#GUEST}. 1549 * @throws { BusinessError } 12300001 - The system service works abnormally. 1550 * @syscap SystemCapability.Account.OsAccount 1551 * @since 9 1552 */ 1553 getOsAccountType(): Promise<OsAccountType>; 1554 1555 /** 1556 * Gets the type of the specified OS account. 1557 * 1558 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 1559 * @param { number } localId - Indicates the local ID of the OS account. 1560 * @returns { Promise<OsAccountType> } Returns the OS account type. 1561 * @throws { BusinessError } 201 - Permission denied. 1562 * @throws { BusinessError } 202 - Not system application. 1563 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1564 * <br> 2. Incorrect parameter types. 1565 * @throws { BusinessError } 12300001 - The system service works abnormally. 1566 * @throws { BusinessError } 12300003 - Account not found. 1567 * @syscap SystemCapability.Account.OsAccount 1568 * @systemapi Hide this for inner system use. 1569 * @since 12 1570 */ 1571 getOsAccountType(localId: number): Promise<OsAccountType>; 1572 1573 /** 1574 * Obtains the distributed virtual device ID (DVID). 1575 * <p> 1576 * If the same OHOS account has logged in to multiple devices, these devices constitute a super device 1577 * through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs. 1578 * The same application running on different devices obtains the same DVID, whereas different applications 1579 * obtain different DVIDs. 1580 * <p> 1581 * 1582 * @permission ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS 1583 * @param { AsyncCallback<string> } callback - Returns the DVID if obtained; returns an empty string if no OHOS account has logged in. 1584 * @syscap SystemCapability.Account.OsAccount 1585 * @since 7 1586 * @deprecated since 9 1587 * @useinstead osAccount.AccountManager#queryDistributedVirtualDeviceId 1588 */ 1589 getDistributedVirtualDeviceId(callback: AsyncCallback<string>): void; 1590 1591 /** 1592 * Obtains the distributed virtual device ID (DVID). 1593 * <p> 1594 * If the same OHOS account has logged in to multiple devices, these devices constitute a super device 1595 * through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs. 1596 * The same application running on different devices obtains the same DVID, whereas different applications 1597 * obtain different DVIDs. 1598 * <p> 1599 * 1600 * @permission ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS 1601 * @returns { Promise<string> } Returns the DVID if obtained; returns an empty string if no OHOS account has logged in. 1602 * @syscap SystemCapability.Account.OsAccount 1603 * @since 7 1604 * @deprecated since 9 1605 * @useinstead osAccount.AccountManager#queryDistributedVirtualDeviceId 1606 */ 1607 getDistributedVirtualDeviceId(): Promise<string>; 1608 1609 /** 1610 * Queries the distributed virtual device ID (DVID). 1611 * <p> 1612 * If the same OHOS account has logged in to multiple devices, these devices constitute a super device 1613 * through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs. 1614 * The same application running on different devices obtains the same DVID, whereas different applications 1615 * obtain different DVIDs. 1616 * <p> 1617 * 1618 * @permission ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS 1619 * @param { AsyncCallback<string> } callback - Returns the DVID if obtained; returns an empty string if no OHOS account has logged in. 1620 * @throws { BusinessError } 201 - Permission denied. 1621 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1622 * <br> 2. Incorrect parameter types. 1623 * @throws { BusinessError } 12300001 - The system service works abnormally. 1624 * @syscap SystemCapability.Account.OsAccount 1625 * @since 9 1626 */ 1627 queryDistributedVirtualDeviceId(callback: AsyncCallback<string>): void; 1628 1629 /** 1630 * Queries the distributed virtual device ID (DVID). 1631 * <p> 1632 * If the same OHOS account has logged in to multiple devices, these devices constitute a super device 1633 * through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs. 1634 * The same application running on different devices obtains the same DVID, whereas different applications 1635 * obtain different DVIDs. 1636 * <p> 1637 * 1638 * @permission ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS 1639 * @returns { Promise<string> } Returns the DVID if obtained; returns an empty string if no OHOS account has logged in. 1640 * @throws { BusinessError } 201 - Permission denied. 1641 * @throws { BusinessError } 12300001 - The system service works abnormally. 1642 * @syscap SystemCapability.Account.OsAccount 1643 * @since 9 1644 */ 1645 queryDistributedVirtualDeviceId(): Promise<string>; 1646 1647 /** 1648 * Obtains the profile photo of an OS account based on its local ID. 1649 * 1650 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1651 * @param { number } localId - Indicates the local ID of the OS account. 1652 * @param { AsyncCallback<string> } callback - Returns the profile photo if obtained; 1653 * returns {@code null} if the profile photo fails to be obtained. 1654 * @throws { BusinessError } 201 - Permission denied. 1655 * @throws { BusinessError } 202 - Not system application. 1656 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1657 * <br> 2. Incorrect parameter types. 1658 * @throws { BusinessError } 12300001 - The system service works abnormally. 1659 * @throws { BusinessError } 12300002 - Invalid localId. 1660 * @throws { BusinessError } 12300003 - Account not found. 1661 * @syscap SystemCapability.Account.OsAccount 1662 * @systemapi Hide this for inner system use. 1663 * @since 7 1664 */ 1665 getOsAccountProfilePhoto(localId: number, callback: AsyncCallback<string>): void; 1666 1667 /** 1668 * Obtains the profile photo of an OS account based on its local ID. 1669 * 1670 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1671 * @param { number } localId - Indicates the local ID of the OS account. 1672 * @returns { Promise<string> } Returns the profile photo if obtained; 1673 * returns {@code null} if the profile photo fails to be obtained. 1674 * @throws { BusinessError } 201 - Permission denied. 1675 * @throws { BusinessError } 202 - Not system application. 1676 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1677 * <br> 2. Incorrect parameter types. 1678 * @throws { BusinessError } 12300001 - The system service works abnormally. 1679 * @throws { BusinessError } 12300002 - Invalid localId. 1680 * @throws { BusinessError } 12300003 - Account not found. 1681 * @syscap SystemCapability.Account.OsAccount 1682 * @systemapi Hide this for inner system use. 1683 * @since 7 1684 */ 1685 getOsAccountProfilePhoto(localId: number): Promise<string>; 1686 1687 /** 1688 * Sets the profile photo for an OS account based on its local ID. 1689 * 1690 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1691 * @param { number } localId - Indicates the local ID of the OS account. 1692 * @param { string } photo - Indicates the profile photo to set for the OS account. 1693 * @param { AsyncCallback<void> } callback - Asynchronous callback interface. 1694 * @throws { BusinessError } 201 - Permission denied. 1695 * @throws { BusinessError } 202 - Not system application. 1696 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1697 * <br> 2. Incorrect parameter types. 1698 * @throws { BusinessError } 12300001 - The system service works abnormally. 1699 * @throws { BusinessError } 12300002 - Invalid localId or photo. 1700 * @throws { BusinessError } 12300003 - Account not found. 1701 * @throws { BusinessError } 12300008 - Restricted Account. 1702 * @syscap SystemCapability.Account.OsAccount 1703 * @systemapi Hide this for inner system use. 1704 * @since 7 1705 */ 1706 setOsAccountProfilePhoto(localId: number, photo: string, callback: AsyncCallback<void>): void; 1707 1708 /** 1709 * Sets the profile photo for an OS account based on its local ID. 1710 * 1711 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1712 * @param { number } localId - Indicates the local ID of the OS account. 1713 * @param { string } photo - Indicates the profile photo to set for the OS account. 1714 * @returns { Promise<void> } The promise returned by the function. 1715 * @throws { BusinessError } 201 - Permission denied. 1716 * @throws { BusinessError } 202 - Not system application. 1717 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1718 * <br> 2. Incorrect parameter types. 1719 * @throws { BusinessError } 12300001 - The system service works abnormally. 1720 * @throws { BusinessError } 12300002 - Invalid localId or photo. 1721 * @throws { BusinessError } 12300003 - Account not found. 1722 * @throws { BusinessError } 12300008 - Restricted Account. 1723 * @syscap SystemCapability.Account.OsAccount 1724 * @systemapi Hide this for inner system use. 1725 * @since 7 1726 */ 1727 setOsAccountProfilePhoto(localId: number, photo: string): Promise<void>; 1728 1729 /** 1730 * Obtain localId according to serial number 1731 * 1732 * @param { number } serialNumber - Indicates serial number. 1733 * @param { AsyncCallback<number> } callback - Returns localId. 1734 * @syscap SystemCapability.Account.OsAccount 1735 * @since 8 1736 * @deprecated since 9 1737 * @useinstead osAccount.AccountManager#getOsAccountLocalIdForSerialNumber 1738 */ 1739 getOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback<number>): void; 1740 1741 /** 1742 * Obtain localId according to serial number 1743 * 1744 * @param { number } serialNumber - Indicates serial number. 1745 * @returns { Promise<number> } Returns localId. 1746 * @syscap SystemCapability.Account.OsAccount 1747 * @since 8 1748 * @deprecated since 9 1749 * @useinstead osAccount.AccountManager#getOsAccountLocalIdForSerialNumber 1750 */ 1751 getOsAccountLocalIdBySerialNumber(serialNumber: number): Promise<number>; 1752 1753 /** 1754 * Gets the local ID of the OS account associated with the serial number. 1755 * 1756 * @param { number } serialNumber - Indicates serial number. 1757 * @param { AsyncCallback<number> } callback - Indicates the callback for getting the local ID of the OS account associated with the serial number. 1758 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1759 * <br> 2. Incorrect parameter types. 1760 * @throws { BusinessError } 12300001 - The system service works abnormally. 1761 * @throws { BusinessError } 12300002 - Invalid serialNumber. 1762 * @throws { BusinessError } 12300003 - The account indicated by serialNumber dose not exist. 1763 * @syscap SystemCapability.Account.OsAccount 1764 * @since 9 1765 */ 1766 getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback<number>): void; 1767 1768 /** 1769 * Gets the local ID of the OS account associated with the serial number. 1770 * 1771 * @param { number } serialNumber - Indicates serial number. 1772 * @returns { Promise<number> } Returns the local ID of the OS account associated with the serial number. 1773 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1774 * <br> 2. Incorrect parameter types. 1775 * @throws { BusinessError } 12300001 - The system service works abnormally. 1776 * @throws { BusinessError } 12300002 - Invalid serialNumber. 1777 * @throws { BusinessError } 12300003 - The account indicated by serialNumber dose not exist. 1778 * @syscap SystemCapability.Account.OsAccount 1779 * @since 9 1780 */ 1781 getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise<number>; 1782 1783 /** 1784 * Obtain serial number according to localId. 1785 * 1786 * @param { number } localId - Indicates the local ID of the OS account. 1787 * @param { AsyncCallback<number> } callback - Returns serial number. 1788 * @syscap SystemCapability.Account.OsAccount 1789 * @since 8 1790 * @deprecated since 9 1791 * @useinstead osAccount.AccountManager#getSerialNumberForOsAccountLocalId 1792 */ 1793 getSerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback<number>): void; 1794 1795 /** 1796 * Obtain serial number according to localId. 1797 * 1798 * @param { number } localId - Indicates the local ID of the OS account. 1799 * @returns { Promise<number> } Returns serial number. 1800 * @syscap SystemCapability.Account.OsAccount 1801 * @since 8 1802 * @deprecated since 9 1803 * @useinstead osAccount.AccountManager#getSerialNumberForOsAccountLocalId 1804 */ 1805 getSerialNumberByOsAccountLocalId(localId: number): Promise<number>; 1806 1807 /** 1808 * Gets the serial number for the specified os account local id. 1809 * 1810 * @param { number } localId - Indicates the local ID of the OS account. 1811 * @param { AsyncCallback<number> } callback - Indicates the callback for getting the serial number for the specified os account local id. 1812 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1813 * <br> 2. Incorrect parameter types. 1814 * @throws { BusinessError } 12300001 - The system service works abnormally. 1815 * @throws { BusinessError } 12300002 - Invalid localId. 1816 * @throws { BusinessError } 12300003 - Account not found. 1817 * @syscap SystemCapability.Account.OsAccount 1818 * @since 9 1819 */ 1820 getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback<number>): void; 1821 1822 /** 1823 * Gets the serial number for the specified os account local id. 1824 * 1825 * @param { number } localId - Indicates the local ID of the OS account. 1826 * @returns { Promise<number> } Returns the serial number according to local ID. 1827 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1828 * <br> 2. Incorrect parameter types. 1829 * @throws { BusinessError } 12300001 - The system service works abnormally. 1830 * @throws { BusinessError } 12300002 - Invalid localId. 1831 * @throws { BusinessError } 12300003 - Account not found. 1832 * @syscap SystemCapability.Account.OsAccount 1833 * @since 9 1834 */ 1835 getSerialNumberForOsAccountLocalId(localId: number): Promise<number>; 1836 1837 /** 1838 * Subscribes to the change events of accounts. 1839 * <p> 1840 * When user change the account, the subscriber will receive a notification 1841 * about the account change event. 1842 * 1843 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION 1844 * @param { 'activate' | 'activating' } type - Event type. 1845 * @param { string } name - Indicates the name of subscriber. 1846 * @param { Callback<number> } callback - Asynchronous callback interface. 1847 * @throws { BusinessError } 201 - Permission denied. 1848 * @throws { BusinessError } 202 - Not system application. 1849 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1850 * <br> 2. Incorrect parameter types. 1851 * @throws { BusinessError } 12300001 - The system service works abnormally. 1852 * @throws { BusinessError } 12300002 - Invalid type or name. 1853 * @syscap SystemCapability.Account.OsAccount 1854 * @systemapi Hide this for inner system use. 1855 * @since 7 1856 */ 1857 on(type: 'activate' | 'activating', name: string, callback: Callback<number>): void; 1858 1859 /** 1860 * Unsubscribes from account events. 1861 * 1862 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION 1863 * @param { 'activate' | 'activating' } type - Event type. 1864 * @param { string } name - Indicates the name of subscriber. 1865 * @param { Callback<number> } callback - Asynchronous callback interface. 1866 * @throws { BusinessError } 201 - Permission denied. 1867 * @throws { BusinessError } 202 - Not system application. 1868 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1869 * <br> 2. Incorrect parameter types. 1870 * @throws { BusinessError } 12300001 - The system service works abnormally. 1871 * @throws { BusinessError } 12300002 - Invalid type or name. 1872 * @syscap SystemCapability.Account.OsAccount 1873 * @systemapi Hide this for inner system use. 1874 * @since 7 1875 */ 1876 off(type: 'activate' | 'activating', name: string, callback?: Callback<number>): void; 1877 1878 /** 1879 * Subscribes to the OS account switching event. 1880 * 1881 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1882 * @param { 'switching' } type - Indicates the event type. 1883 * @param { Callback<OsAccountSwitchEventData> } callback - Indicates the callback for getting the event data. 1884 * @throws { BusinessError } 201 - Permission denied. 1885 * @throws { BusinessError } 202 - Not system application. 1886 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1887 * <br> 2. Incorrect parameter types. 1888 * @throws { BusinessError } 12300001 - The system service works abnormally. 1889 * @throws { BusinessError } 12300002 - Invalid type. 1890 * @syscap SystemCapability.Account.OsAccount 1891 * @systemapi Hide this for inner system use. 1892 * @since 12 1893 */ 1894 on(type: 'switching', callback: Callback<OsAccountSwitchEventData>): void; 1895 1896 /** 1897 * Unsubscribes from the OS account switching event. 1898 * 1899 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1900 * @param { 'switching' } type - Indicates the event type. 1901 * @param { Callback<OsAccountSwitchEventData> } [callback] - Indicates the callback for getting the event data. 1902 * @throws { BusinessError } 201 - Permission denied. 1903 * @throws { BusinessError } 202 - Not system application. 1904 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1905 * <br> 2. Incorrect parameter types. 1906 * @throws { BusinessError } 12300001 - The system service works abnormally. 1907 * @throws { BusinessError } 12300002 - Invalid type. 1908 * @syscap SystemCapability.Account.OsAccount 1909 * @systemapi Hide this for inner system use. 1910 * @since 12 1911 */ 1912 off(type: 'switching', callback?: Callback<OsAccountSwitchEventData>): void; 1913 1914 /** 1915 * Subscribes to the OS account switched event. 1916 * 1917 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1918 * @param { 'switched' } type - Indicates the event type. 1919 * @param { Callback<OsAccountSwitchEventData> } callback - Indicates the callback for getting the event data. 1920 * @throws { BusinessError } 201 - Permission denied. 1921 * @throws { BusinessError } 202 - Not system application. 1922 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1923 * <br> 2. Incorrect parameter types. 1924 * @throws { BusinessError } 12300001 - The system service works abnormally. 1925 * @throws { BusinessError } 12300002 - Invalid type. 1926 * @syscap SystemCapability.Account.OsAccount 1927 * @systemapi Hide this for inner system use. 1928 * @since 12 1929 */ 1930 on(type: 'switched', callback: Callback<OsAccountSwitchEventData>): void; 1931 1932 /** 1933 * Unsubscribes from the OS account switched event. 1934 * 1935 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 1936 * @param { 'switched' } type - Indicates the event type. 1937 * @param { Callback<OsAccountSwitchEventData> } [callback] - Indicates the callback for getting the event data. 1938 * @throws { BusinessError } 201 - Permission denied. 1939 * @throws { BusinessError } 202 - Not system application. 1940 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1941 * <br> 2. Incorrect parameter types. 1942 * @throws { BusinessError } 12300001 - The system service works abnormally. 1943 * @throws { BusinessError } 12300002 - Invalid type. 1944 * @syscap SystemCapability.Account.OsAccount 1945 * @systemapi Hide this for inner system use. 1946 * @since 12 1947 */ 1948 off(type: 'switched', callback?: Callback<OsAccountSwitchEventData>): void; 1949 1950 /** 1951 * Gets the bundle ID associated with the specified UID. 1952 * 1953 * @param { number } uid - Indicates the target uid. 1954 * @param { AsyncCallback<number> } callback - Indicates the callback for getting the bundle ID associated with the specified UID. 1955 * @throws { BusinessError } 202 - Not system application. 1956 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1957 * <br> 2. Incorrect parameter types. 1958 * @throws { BusinessError } 12300001 - The system service works abnormally. 1959 * @throws { BusinessError } 12300002 - Invalid uid. 1960 * @syscap SystemCapability.Account.OsAccount 1961 * @systemapi Hide this for inner system use. 1962 * @since 9 1963 */ 1964 getBundleIdForUid(uid: number, callback: AsyncCallback<number>): void; 1965 1966 /** 1967 * Gets the bundle ID associated with the specified UID. 1968 * 1969 * @param { number } uid - Indicates the target uid. 1970 * @returns { Promise<number> } Returns the bundle ID associated with the specified UID. 1971 * @throws { BusinessError } 202 - Not system application. 1972 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1973 * <br> 2. Incorrect parameter types. 1974 * @throws { BusinessError } 12300001 - The system service works abnormally. 1975 * @throws { BusinessError } 12300002 - Invalid uid. 1976 * @syscap SystemCapability.Account.OsAccount 1977 * @systemapi Hide this for inner system use. 1978 * @since 9 1979 */ 1980 getBundleIdForUid(uid: number): Promise<number>; 1981 1982 /** 1983 * Gets the bundle ID associated with the specified UID synchronously. 1984 * 1985 * @param { number } uid - Indicates the target uid. 1986 * @returns { number } Returns the bundle ID associated with the specified UID. 1987 * @throws { BusinessError } 202 - Not system application. 1988 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 1989 * <br> 2. Incorrect parameter types. 1990 * @throws { BusinessError } 12300002 - Invalid uid. 1991 * @syscap SystemCapability.Account.OsAccount 1992 * @systemapi Hide this for inner system use. 1993 * @since 10 1994 */ 1995 getBundleIdForUidSync(uid: number): number; 1996 1997 /** 1998 * Check whether current process belongs to the main account. 1999 * 2000 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 2001 * @param { AsyncCallback<boolean> } callback - Returns {@code true} if current process belongs to the main os account; 2002 * returns {@code false} otherwise. 2003 * @throws { BusinessError } 201 - Permission denied. 2004 * @throws { BusinessError } 202 - Not system application. 2005 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2006 * <br> 2. Incorrect parameter types. 2007 * @throws { BusinessError } 12300001 - The system service works abnormally. 2008 * @syscap SystemCapability.Account.OsAccount 2009 * @systemapi Hide this for inner system use. 2010 * @since 9 2011 */ 2012 isMainOsAccount(callback: AsyncCallback<boolean>): void; 2013 2014 /** 2015 * Check whether current process belongs to the main account. 2016 * 2017 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 2018 * @returns { Promise<boolean> } Returns {@code true} if current process belongs to the main os account; 2019 * returns {@code false} otherwise. 2020 * @throws { BusinessError } 201 - Permission denied. 2021 * @throws { BusinessError } 202 - Not system application. 2022 * @throws { BusinessError } 12300001 - The system service works abnormally. 2023 * @syscap SystemCapability.Account.OsAccount 2024 * @systemapi Hide this for inner system use. 2025 * @since 9 2026 */ 2027 isMainOsAccount(): Promise<boolean>; 2028 2029 /** 2030 * Gets a list of constraint source types for the specified os account. 2031 * 2032 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 2033 * @param { number } localId - Indicates the local ID of the OS account. 2034 * @param { string } constraint - Indicates the constraint to query the source type. 2035 * @param { AsyncCallback<Array<ConstraintSourceTypeInfo>> } callback - Indicates the callback for 2036 * getting a list of constraint source types for the specified os account. 2037 * @throws { BusinessError } 201 - Permission denied. 2038 * @throws { BusinessError } 202 - Not system application. 2039 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2040 * <br> 2. Incorrect parameter types. 2041 * @throws { BusinessError } 12300001 - The system service works abnormally. 2042 * @throws { BusinessError } 12300002 - Invalid name or constraint. 2043 * @throws { BusinessError } 12300003 - Account not found. 2044 * @syscap SystemCapability.Account.OsAccount 2045 * @systemapi Hide this for inner system use. 2046 * @since 9 2047 */ 2048 getOsAccountConstraintSourceTypes( 2049 localId: number, 2050 constraint: string, 2051 callback: AsyncCallback<Array<ConstraintSourceTypeInfo>> 2052 ): void; 2053 2054 /** 2055 * Gets a list of constraint source types for the specified os account. 2056 * 2057 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 2058 * @param { number } localId - Indicates the local ID of the OS account. 2059 * @param { string } constraint - Indicates the constraint to query the source type. 2060 * @returns { Promise<Array<ConstraintSourceTypeInfo>> } Returns a list of constraint source types for the specified os account. 2061 * @throws { BusinessError } 201 - Permission denied. 2062 * @throws { BusinessError } 202 - Not system application. 2063 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2064 * <br> 2. Incorrect parameter types. 2065 * @throws { BusinessError } 12300001 - The system service works abnormally. 2066 * @throws { BusinessError } 12300002 - Invalid name or constraint. 2067 * @throws { BusinessError } 12300003 - Account not found. 2068 * @syscap SystemCapability.Account.OsAccount 2069 * @systemapi Hide this for inner system use. 2070 * @since 9 2071 */ 2072 getOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise<Array<ConstraintSourceTypeInfo>>; 2073 } 2074 2075 /** 2076 * Provides information about OS accounts, including the local ID, local name, and type of an OS account. 2077 * 2078 * @interface OsAccountInfo 2079 * @syscap SystemCapability.Account.OsAccount 2080 * @since 7 2081 */ 2082 interface OsAccountInfo { 2083 /** 2084 * The local ID of an OS account. 2085 * 2086 * @type { number } 2087 * @syscap SystemCapability.Account.OsAccount 2088 * @since 7 2089 */ 2090 localId: number; 2091 2092 /** 2093 * The local name of an OS account. 2094 * 2095 * @type { string } 2096 * @syscap SystemCapability.Account.OsAccount 2097 * @since 7 2098 */ 2099 localName: string; 2100 2101 /** 2102 * The short name of an OS account. 2103 * 2104 * @type { ?string } 2105 * @syscap SystemCapability.Account.OsAccount 2106 * @systemapi Hide this for inner system use. 2107 * @since 12 2108 */ 2109 shortName?: string; 2110 2111 /** 2112 * Include: ADMIN, Normal, GUEST. 2113 * 2114 * @type { OsAccountType } 2115 * @syscap SystemCapability.Account.OsAccount 2116 * @since 7 2117 */ 2118 type: OsAccountType; 2119 2120 /** 2121 * Account constraints information. 2122 * 2123 * @type { Array<string> } 2124 * @syscap SystemCapability.Account.OsAccount 2125 * @since 7 2126 */ 2127 constraints: Array<string>; 2128 2129 /** 2130 * The account is verified or not. 2131 * 2132 * @type { boolean } 2133 * @syscap SystemCapability.Account.OsAccount 2134 * @since 8 2135 * @deprecated since 11 2136 * @useinstead osAccount.OsAccountInfo#isUnlocked 2137 */ 2138 isVerified: boolean; 2139 2140 /** 2141 * The OS account is unlocked or not. 2142 * 2143 * @type { boolean } 2144 * @syscap SystemCapability.Account.OsAccount 2145 * @since 11 2146 */ 2147 isUnlocked: boolean; 2148 2149 /** 2150 * OS account photo. 2151 * 2152 * @type { string } 2153 * @syscap SystemCapability.Account.OsAccount 2154 * @since 8 2155 */ 2156 photo: string; 2157 2158 /** 2159 * Os account create time. 2160 * 2161 * @type { number } 2162 * @syscap SystemCapability.Account.OsAccount 2163 * @since 8 2164 */ 2165 createTime: number; 2166 2167 /** 2168 * The last time to log in. 2169 * 2170 * @type { number } 2171 * @syscap SystemCapability.Account.OsAccount 2172 * @since 8 2173 */ 2174 lastLoginTime: number; 2175 2176 /** 2177 * Os account serial number. 2178 * 2179 * @type { number } 2180 * @syscap SystemCapability.Account.OsAccount 2181 * @since 8 2182 */ 2183 serialNumber: number; 2184 2185 /** 2186 * Os account is activated or not. 2187 * 2188 * @type { boolean } 2189 * @syscap SystemCapability.Account.OsAccount 2190 * @since 8 2191 * @deprecated since 11 2192 * @useinstead osAccount.OsAccountInfo#isActivated 2193 */ 2194 isActived: boolean; 2195 2196 /** 2197 * The OS account is activated or not. 2198 * 2199 * @type { boolean } 2200 * @syscap SystemCapability.Account.OsAccount 2201 * @since 11 2202 */ 2203 isActivated: boolean; 2204 2205 /** 2206 * Indicates whether the OS account is logged in. 2207 * 2208 * @type { ?boolean } 2209 * @syscap SystemCapability.Account.OsAccount 2210 * @systemapi Hide this for inner system use. 2211 * @since 12 2212 */ 2213 isLoggedIn?: boolean; 2214 2215 /** 2216 * Os account create completed or not. 2217 * 2218 * @type { boolean } 2219 * @syscap SystemCapability.Account.OsAccount 2220 * @since 8 2221 */ 2222 isCreateCompleted: boolean; 2223 2224 /** 2225 * Distributed account info. 2226 * 2227 * @type { distributedAccount.DistributedInfo } 2228 * @syscap SystemCapability.Account.OsAccount 2229 * @since 7 2230 */ 2231 distributedInfo: distributedAccount.DistributedInfo; 2232 2233 /** 2234 * Domain account info. 2235 * 2236 * @type { DomainAccountInfo } 2237 * @syscap SystemCapability.Account.OsAccount 2238 * @since 8 2239 */ 2240 domainInfo: DomainAccountInfo; 2241 } 2242 2243 /** 2244 * Defines the switching/switched event data structure for the OS account. 2245 * 2246 * @typedef OsAccountSwitchEventData 2247 * @syscap SystemCapability.Account.OsAccount 2248 * @systemapi Hide this for inner system use. 2249 * @since 12 2250 */ 2251 interface OsAccountSwitchEventData { 2252 /** 2253 * Indicates which OS account to switch from. 2254 * 2255 * @type { number } 2256 * @syscap SystemCapability.Account.OsAccount 2257 * @systemapi Hide this for inner system use. 2258 * @since 12 2259 */ 2260 fromAccountId: number; 2261 2262 /** 2263 * Indicates which OS account to switch to. 2264 * 2265 * @type { number } 2266 * @syscap SystemCapability.Account.OsAccount 2267 * @systemapi Hide this for inner system use. 2268 * @since 12 2269 */ 2270 toAccountId: number; 2271 } 2272 2273 /** 2274 * Options for creating an OS account. 2275 * 2276 * @interface CreateOsAccountOptions 2277 * @syscap SystemCapability.Account.OsAccount 2278 * @systemapi Hide this for inner system use. 2279 * @since 12 2280 */ 2281 interface CreateOsAccountOptions { 2282 /** 2283 * Indicates the short name of the OS account. 2284 * 2285 * @type { string } 2286 * @syscap SystemCapability.Account.OsAccount 2287 * @systemapi Hide this for inner system use. 2288 * @since 12 2289 */ 2290 shortName: string; 2291 } 2292 2293 /** 2294 * Options to create an OS account for domain. 2295 * 2296 * @extends CreateOsAccountOptions 2297 * @interface CreateOsAccountForDomainOptions 2298 * @syscap SystemCapability.Account.OsAccount 2299 * @systemapi Hide this for inner system use. 2300 * @since 12 2301 */ 2302 interface CreateOsAccountForDomainOptions extends CreateOsAccountOptions {} 2303 2304 /** 2305 * Provides information about domain accounts. 2306 * 2307 * @interface DomainAccountInfo 2308 * @syscap SystemCapability.Account.OsAccount 2309 * @since 8 2310 */ 2311 interface DomainAccountInfo { 2312 /** 2313 * The domain name 2314 * 2315 * @type { string } 2316 * @syscap SystemCapability.Account.OsAccount 2317 * @since 8 2318 */ 2319 domain: string; 2320 2321 /** 2322 * The account name in the domain 2323 * 2324 * @type { string } 2325 * @syscap SystemCapability.Account.OsAccount 2326 * @since 8 2327 */ 2328 accountName: string; 2329 2330 /** 2331 * The account identifier in the domain. 2332 * 2333 * @type { ?string } 2334 * @syscap SystemCapability.Account.OsAccount 2335 * @systemapi Hide this for inner system use. 2336 * @since 10 2337 */ 2338 accountId?: string; 2339 2340 /** 2341 * Indicates whether the account is authenticated. 2342 * 2343 * @type { ?boolean } 2344 * @syscap SystemCapability.Account.OsAccount 2345 * @systemapi Hide this for inner system use. 2346 * @since 11 2347 */ 2348 isAuthenticated?: boolean; 2349 2350 /** 2351 * Indicates the server config identifier for the domain to which the account belongs. 2352 * 2353 * @type { ?string } 2354 * @syscap SystemCapability.Account.OsAccount 2355 * @since 18 2356 */ 2357 serverConfigId?: string; 2358 } 2359 2360 /** 2361 * Enumerates OS account types. 2362 * 2363 * @enum { number } OsAccountType 2364 * @syscap SystemCapability.Account.OsAccount 2365 * @since 7 2366 */ 2367 enum OsAccountType { 2368 /** 2369 * Indicates the administrator account, which has the permission to manage other OS accounts. 2370 * 2371 * @syscap SystemCapability.Account.OsAccount 2372 * @since 7 2373 */ 2374 ADMIN = 0, 2375 2376 /** 2377 * Indicates a normal account, which has access to common functions of OS accounts. 2378 * 2379 * @syscap SystemCapability.Account.OsAccount 2380 * @since 7 2381 */ 2382 NORMAL, 2383 2384 /** 2385 * Indicates a guest account, which is used to temporarily access the device and may be deleted at any time. 2386 * 2387 * @syscap SystemCapability.Account.OsAccount 2388 * @since 7 2389 */ 2390 GUEST, 2391 2392 /** 2393 * Indicates a private account. 2394 * 2395 * @syscap SystemCapability.Account.OsAccount 2396 * @systemapi Hide this for inner system use. 2397 * @since 12 2398 */ 2399 PRIVATE = 1024 2400 } 2401 2402 /** 2403 * Provides the abilities for user authentication. 2404 * 2405 * @syscap SystemCapability.Account.OsAccount 2406 * @systemapi Hide this for inner system use. 2407 * @since 8 2408 * @name UserAuth 2409 */ 2410 class UserAuth { 2411 /** 2412 * Constructor to get the UserAuth class instance. 2413 * 2414 * @throws { BusinessError } 202 - Not system application. 2415 * @syscap SystemCapability.Account.OsAccount 2416 * @systemapi Hide this for inner system use. 2417 * @since 8 2418 */ 2419 constructor(); 2420 2421 /** 2422 * Gets version information. 2423 * 2424 * @returns { number } Returns the version information. 2425 * @throws { BusinessError } 202 - Not system application. 2426 * @syscap SystemCapability.Account.OsAccount 2427 * @systemapi Hide this for inner system use. 2428 * @since 8 2429 */ 2430 getVersion(): number; 2431 2432 /** 2433 * Checks whether the authentication capability is available. 2434 * 2435 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 2436 * @param { AuthType } authType - Indicates the credential type for authentication. 2437 * @param { AuthTrustLevel } authTrustLevel - Indicates the trust level of authentication result. 2438 * @returns { number } Returns a status result. 2439 * @throws { BusinessError } 201 - Permission denied. 2440 * @throws { BusinessError } 202 - Not system application. 2441 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2442 * <br> 2. Incorrect parameter types. 2443 * @throws { BusinessError } 12300001 - The system service works abnormally. 2444 * @throws { BusinessError } 12300002 - Invalid authType or authTrustLevel. 2445 * @syscap SystemCapability.Account.OsAccount 2446 * @systemapi Hide this for inner system use. 2447 * @since 8 2448 */ 2449 getAvailableStatus(authType: AuthType, authTrustLevel: AuthTrustLevel): number; 2450 2451 /** 2452 * Gets the property based on the specified request information. 2453 * 2454 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 2455 * @param { GetPropertyRequest } request - Indicates the request information, including authentication type, and property type list. 2456 * @param { AsyncCallback<ExecutorProperty> } callback - Returns an executor property. 2457 * @throws { BusinessError } 201 - Permission denied. 2458 * @throws { BusinessError } 202 - Not system application. 2459 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2460 * <br> 2. Incorrect parameter types. 2461 * @throws { BusinessError } 12300001 - The system service works abnormally. 2462 * @throws { BusinessError } 12300002 - Invalid request. 2463 * @syscap SystemCapability.Account.OsAccount 2464 * @systemapi Hide this for inner system use. 2465 * @since 8 2466 */ 2467 /** 2468 * Gets the property based on the specified request information. 2469 * 2470 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 2471 * @param { GetPropertyRequest } request - Indicates the request information, including authentication type, and property type list. 2472 * @param { AsyncCallback<ExecutorProperty> } callback - Returns an executor property. 2473 * @throws { BusinessError } 201 - Permission denied. 2474 * @throws { BusinessError } 202 - Not system application. 2475 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2476 * <br> 2. Incorrect parameter types. 2477 * @throws { BusinessError } 12300001 - The system service works abnormally. 2478 * @throws { BusinessError } 12300002 - Invalid request. 2479 * @throws { BusinessError } 12300003 - Account not found. 2480 * @syscap SystemCapability.Account.OsAccount 2481 * @systemapi Hide this for inner system use. 2482 * @since 12 2483 */ 2484 getProperty(request: GetPropertyRequest, callback: AsyncCallback<ExecutorProperty>): void; 2485 2486 /** 2487 * Gets the property based on the specified request information. 2488 * 2489 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 2490 * @param { GetPropertyRequest } request - Indicates the request information, including authentication type, and property type list. 2491 * @returns { Promise<ExecutorProperty> } Returns an executor property. 2492 * @throws { BusinessError } 201 - Permission denied. 2493 * @throws { BusinessError } 202 - Not system application. 2494 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2495 * <br> 2. Incorrect parameter types. 2496 * @throws { BusinessError } 12300001 - The system service works abnormally. 2497 * @throws { BusinessError } 12300002 - Invalid request. 2498 * @syscap SystemCapability.Account.OsAccount 2499 * @systemapi Hide this for inner system use. 2500 * @since 8 2501 */ 2502 /** 2503 * Gets the property based on the specified request information. 2504 * 2505 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 2506 * @param { GetPropertyRequest } request - Indicates the request information, including authentication type, and property type list. 2507 * @returns { Promise<ExecutorProperty> } Returns an executor property. 2508 * @throws { BusinessError } 201 - Permission denied. 2509 * @throws { BusinessError } 202 - Not system application. 2510 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2511 * <br> 2. Incorrect parameter types. 2512 * @throws { BusinessError } 12300001 - The system service works abnormally. 2513 * @throws { BusinessError } 12300002 - Invalid request. 2514 * @throws { BusinessError } 12300003 - Account not found. 2515 * @syscap SystemCapability.Account.OsAccount 2516 * @systemapi Hide this for inner system use. 2517 * @since 12 2518 */ 2519 getProperty(request: GetPropertyRequest): Promise<ExecutorProperty>; 2520 2521 /** 2522 * Gets the executor property associated with the specified credential. 2523 * 2524 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 2525 * @param { Uint8Array } credentialId - Indicates the id for getting the credential information. 2526 * @param { Array<GetPropertyType> } keys - Indicates the array of property types to get. 2527 * @returns { Promise<ExecutorProperty> } Returns an executor property. 2528 * @throws { BusinessError } 201 - Permission denied. 2529 * @throws { BusinessError } 202 - Not system application. 2530 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2531 * <br> 2. Incorrect parameter types. 2532 * @throws { BusinessError } 12300001 - The system service works abnormally. 2533 * @throws { BusinessError } 12300002 - Invalid keys. 2534 * @throws { BusinessError } 12300102 - The credential does not exist. 2535 * @syscap SystemCapability.Account.OsAccount 2536 * @systemapi Hide this for inner system use. 2537 * @since 14 2538 */ 2539 getPropertyByCredentialId(credentialId: Uint8Array, keys: Array<GetPropertyType>): Promise<ExecutorProperty>; 2540 2541 /** 2542 * Sets property that can be used to initialize algorithms. 2543 * 2544 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 2545 * @param { SetPropertyRequest } request - Indicates the request information, including authentication type and the key-value to be set. 2546 * @param { AsyncCallback<void> } callback - Asynchronous callback interface. 2547 * @throws { BusinessError } 201 - Permission denied. 2548 * @throws { BusinessError } 202 - Not system application. 2549 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2550 * <br> 2. Incorrect parameter types. 2551 * @throws { BusinessError } 12300001 - The system service works abnormally. 2552 * @throws { BusinessError } 12300002 - Invalid request. 2553 * @syscap SystemCapability.Account.OsAccount 2554 * @systemapi Hide this for inner system use. 2555 * @since 8 2556 */ 2557 setProperty(request: SetPropertyRequest, callback: AsyncCallback<void>): void; 2558 2559 /** 2560 * Sets property that can be used to initialize algorithms. 2561 * 2562 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 2563 * @param { SetPropertyRequest } request - Indicates the request information, including authentication type and the key-value to be set. 2564 * @returns { Promise<void> } The promise returned by the function. 2565 * @throws { BusinessError } 201 - Permission denied. 2566 * @throws { BusinessError } 202 - Not system application. 2567 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2568 * <br> 2. Incorrect parameter types. 2569 * @throws { BusinessError } 12300001 - The system service works abnormally. 2570 * @throws { BusinessError } 12300002 - Invalid request. 2571 * @syscap SystemCapability.Account.OsAccount 2572 * @systemapi Hide this for inner system use. 2573 * @since 8 2574 */ 2575 setProperty(request: SetPropertyRequest): Promise<void>; 2576 2577 /** 2578 * Prepares remote authentication. 2579 * 2580 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 2581 * @param { string } remoteNetworkId - Indicates the remote network identifier. 2582 * @returns { Promise<void> } The promise returned by the function. 2583 * @throws { BusinessError } 201 - Permission denied. 2584 * @throws { BusinessError } 202 - Not system application. 2585 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. 2586 * @throws { BusinessError } 12300001 - System service exception. 2587 * @throws { BusinessError } 12300002 - Invalid remoteNetworkId. 2588 * @syscap SystemCapability.Account.OsAccount 2589 * @systemapi Hide this for inner system use. 2590 * @since 12 2591 */ 2592 prepareRemoteAuth(remoteNetworkId: string): Promise<void>; 2593 2594 /** 2595 * Executes authentication. 2596 * 2597 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 2598 * @param { Uint8Array } challenge - Indicates the challenge value. 2599 * @param { AuthType } authType - Indicates the authentication type. 2600 * @param { AuthTrustLevel } authTrustLevel - Indicates the trust level of authentication result. 2601 * @param { IUserAuthCallback } callback - Indicates the callback to get result and acquireInfo. 2602 * @returns { Uint8Array } Returns a context ID for cancellation. 2603 * @throws { BusinessError } 201 - Permission denied. 2604 * @throws { BusinessError } 202 - Not system application. 2605 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2606 * <br> 2. Incorrect parameter types. 2607 * @throws { BusinessError } 12300001 - The system service works abnormally. 2608 * @throws { BusinessError } 12300002 - Invalid challenge, authType or authTrustLevel. 2609 * @throws { BusinessError } 12300101 - The credential is incorrect. 2610 * @throws { BusinessError } 12300102 - The credential does not exist. 2611 * @throws { BusinessError } 12300105 - The trust level is not supported. 2612 * @throws { BusinessError } 12300106 - The authentication type is not supported. 2613 * @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled. 2614 * @throws { BusinessError } 12300110 - The authentication is locked. 2615 * @throws { BusinessError } 12300111 - The authentication time out. 2616 * @throws { BusinessError } 12300112 - The authentication service is busy. 2617 * @syscap SystemCapability.Account.OsAccount 2618 * @systemapi Hide this for inner system use. 2619 * @since 8 2620 */ 2621 /** 2622 * Executes authentication. 2623 * 2624 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 2625 * @param { Uint8Array } challenge - Indicates the challenge value. 2626 * @param { AuthType } authType - Indicates the authentication type. 2627 * @param { AuthTrustLevel } authTrustLevel - Indicates the trust level of authentication result. 2628 * @param { IUserAuthCallback } callback - Indicates the callback to get result and acquireInfo. 2629 * @returns { Uint8Array } Returns a context ID for cancellation. 2630 * @throws { BusinessError } 201 - Permission denied. 2631 * @throws { BusinessError } 202 - Not system application. 2632 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2633 * <br> 2. Incorrect parameter types. 2634 * @throws { BusinessError } 12300001 - The system service works abnormally. 2635 * @throws { BusinessError } 12300002 - Invalid challenge, authType or authTrustLevel. 2636 * @throws { BusinessError } 12300013 - Network exception. 2637 * @throws { BusinessError } 12300101 - The credential is incorrect. 2638 * @throws { BusinessError } 12300102 - The credential does not exist. 2639 * @throws { BusinessError } 12300105 - The trust level is not supported. 2640 * @throws { BusinessError } 12300106 - The authentication type is not supported. 2641 * @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled. 2642 * @throws { BusinessError } 12300110 - The authentication is locked. 2643 * @throws { BusinessError } 12300111 - The authentication time out. 2644 * @throws { BusinessError } 12300112 - The authentication service is busy. 2645 * @throws { BusinessError } 12300113 - The authentication service does not exist. 2646 * @throws { BusinessError } 12300114 - The authentication service works abnormally. 2647 * @throws { BusinessError } 12300117 - PIN is expired. 2648 * @throws { BusinessError } 12300211 - Server unreachable. 2649 * @syscap SystemCapability.Account.OsAccount 2650 * @systemapi Hide this for inner system use. 2651 * @since 12 2652 */ 2653 auth( 2654 challenge: Uint8Array, 2655 authType: AuthType, 2656 authTrustLevel: AuthTrustLevel, 2657 callback: IUserAuthCallback 2658 ): Uint8Array; 2659 2660 /** 2661 * Executes authentication. 2662 * 2663 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 2664 * @param { Uint8Array } challenge - Indicates the challenge value. 2665 * @param { AuthType } authType - Indicates the authentication type. 2666 * @param { AuthTrustLevel } authTrustLevel - Indicates the trust level of authentication result. 2667 * @param { AuthOptions } options - Indicates authentication options. 2668 * @param { IUserAuthCallback } callback - Indicates the callback to get result and acquireInfo. 2669 * @returns { Uint8Array } Returns a context ID for cancellation. 2670 * @throws { BusinessError } 201 - Permission denied. 2671 * @throws { BusinessError } 202 - Not system application. 2672 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2673 * <br> 2. Incorrect parameter types. 2674 * @throws { BusinessError } 12300001 - The system service works abnormally. 2675 * @throws { BusinessError } 12300002 - Invalid challenge, authType, authTrustLevel or options. 2676 * @throws { BusinessError } 12300003 - Account not found. 2677 * @throws { BusinessError } 12300013 - Network exception. 2678 * @throws { BusinessError } 12300101 - The credential is incorrect. 2679 * @throws { BusinessError } 12300102 - The credential does not exist. 2680 * @throws { BusinessError } 12300105 - The trust level is not supported. 2681 * @throws { BusinessError } 12300106 - The authentication type is not supported. 2682 * @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled. 2683 * @throws { BusinessError } 12300110 - The authentication is locked. 2684 * @throws { BusinessError } 12300111 - The authentication time out. 2685 * @throws { BusinessError } 12300112 - The authentication service is busy. 2686 * @throws { BusinessError } 12300113 - The authentication service does not exist. 2687 * @throws { BusinessError } 12300114 - The authentication service works abnormally. 2688 * @throws { BusinessError } 12300117 - PIN is expired. 2689 * @throws { BusinessError } 12300211 - Server unreachable. 2690 * @syscap SystemCapability.Account.OsAccount 2691 * @systemapi Hide this for inner system use. 2692 * @since 12 2693 */ 2694 auth( 2695 challenge: Uint8Array, 2696 authType: AuthType, 2697 authTrustLevel: AuthTrustLevel, 2698 options: AuthOptions, 2699 callback: IUserAuthCallback 2700 ): Uint8Array; 2701 2702 /** 2703 * Executes user authentication. 2704 * 2705 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 2706 * @param { number } userId - Indicates the user identification. 2707 * @param { Uint8Array } challenge - Indicates the challenge value. 2708 * @param { AuthType } authType - Indicates the authentication type. 2709 * @param { AuthTrustLevel } authTrustLevel - Indicates the trust level of authentication result. 2710 * @param { IUserAuthCallback } callback - Indicates the callback to get result and acquireInfo. 2711 * @returns { Uint8Array } Returns a context ID for cancellation. 2712 * @throws { BusinessError } 201 - Permission denied. 2713 * @throws { BusinessError } 202 - Not system application. 2714 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2715 * <br> 2. Incorrect parameter types. 2716 * @throws { BusinessError } 12300001 - The system service works abnormally. 2717 * @throws { BusinessError } 12300002 - Invalid userId, challenge, authType or authTrustLevel. 2718 * @throws { BusinessError } 12300101 - The credential is incorrect. 2719 * @throws { BusinessError } 12300102 - The credential does not exist. 2720 * @throws { BusinessError } 12300105 - The trust level is not supported. 2721 * @throws { BusinessError } 12300106 - The authentication type is not supported. 2722 * @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled. 2723 * @throws { BusinessError } 12300110 - The authentication is locked. 2724 * @throws { BusinessError } 12300111 - The authentication time out. 2725 * @throws { BusinessError } 12300112 - The authentication service is busy. 2726 * @syscap SystemCapability.Account.OsAccount 2727 * @systemapi Hide this for inner system use. 2728 * @since 8 2729 */ 2730 /** 2731 * Executes user authentication. 2732 * 2733 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 2734 * @param { number } userId - Indicates the user identification. 2735 * @param { Uint8Array } challenge - Indicates the challenge value. 2736 * @param { AuthType } authType - Indicates the authentication type. 2737 * @param { AuthTrustLevel } authTrustLevel - Indicates the trust level of authentication result. 2738 * @param { IUserAuthCallback } callback - Indicates the callback to get result and acquireInfo. 2739 * @returns { Uint8Array } Returns a context ID for cancellation. 2740 * @throws { BusinessError } 201 - Permission denied. 2741 * @throws { BusinessError } 202 - Not system application. 2742 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2743 * <br> 2. Incorrect parameter types. 2744 * @throws { BusinessError } 12300001 - The system service works abnormally. 2745 * @throws { BusinessError } 12300002 - Invalid challenge, authType or authTrustLevel. 2746 * @throws { BusinessError } 12300003 - Account not found. 2747 * @throws { BusinessError } 12300013 - Network exception. 2748 * @throws { BusinessError } 12300101 - The credential is incorrect. 2749 * @throws { BusinessError } 12300102 - The credential does not exist. 2750 * @throws { BusinessError } 12300105 - The trust level is not supported. 2751 * @throws { BusinessError } 12300106 - The authentication type is not supported. 2752 * @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled. 2753 * @throws { BusinessError } 12300110 - The authentication is locked. 2754 * @throws { BusinessError } 12300111 - The authentication time out. 2755 * @throws { BusinessError } 12300112 - The authentication service is busy. 2756 * @throws { BusinessError } 12300113 - The authentication service does not exist. 2757 * @throws { BusinessError } 12300114 - The authentication service works abnormally. 2758 * @throws { BusinessError } 12300117 - PIN is expired. 2759 * @throws { BusinessError } 12300211 - Server unreachable. 2760 * @syscap SystemCapability.Account.OsAccount 2761 * @systemapi Hide this for inner system use. 2762 * @since 12 2763 */ 2764 authUser( 2765 userId: number, 2766 challenge: Uint8Array, 2767 authType: AuthType, 2768 authTrustLevel: AuthTrustLevel, 2769 callback: IUserAuthCallback 2770 ): Uint8Array; 2771 2772 /** 2773 * Cancels authentication with context ID. 2774 * 2775 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 2776 * @param { Uint8Array } contextID - Indicates the authentication context ID. 2777 * @throws { BusinessError } 201 - Permission denied. 2778 * @throws { BusinessError } 202 - Not system application. 2779 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2780 * <br> 2. Incorrect parameter types. 2781 * @throws { BusinessError } 12300001 - The system service works abnormally. 2782 * @throws { BusinessError } 12300002 - Invalid contextId. 2783 * @syscap SystemCapability.Account.OsAccount 2784 * @systemapi Hide this for inner system use. 2785 * @since 8 2786 */ 2787 cancelAuth(contextID: Uint8Array): void; 2788 } 2789 2790 /** 2791 * Provides the abilities for Pin code authentication. 2792 * 2793 * @syscap SystemCapability.Account.OsAccount 2794 * @systemapi Hide this for inner system use. 2795 * @since 8 2796 * @name PINAuth 2797 */ 2798 class PINAuth { 2799 /** 2800 * Constructor to get the PINAuth class instance. 2801 * 2802 * @throws { BusinessError } 202 - Not system application. 2803 * @syscap SystemCapability.Account.OsAccount 2804 * @systemapi Hide this for inner system use. 2805 * @since 8 2806 */ 2807 constructor(); 2808 2809 /** 2810 * Register inputer. 2811 * 2812 * @permission ohos.permission.ACCESS_PIN_AUTH 2813 * @param { IInputer } inputer - Indicates the password input box callback 2814 * @throws { BusinessError } 201 - Permission denied. 2815 * @throws { BusinessError } 202 - Not system application. 2816 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2817 * <br> 2. Incorrect parameter types. 2818 * @throws { BusinessError } 12300001 - The system service works abnormally. 2819 * @throws { BusinessError } 12300002 - Invalid inputer. 2820 * @throws { BusinessError } 12300103 - The credential inputer already exists. 2821 * @syscap SystemCapability.Account.OsAccount 2822 * @systemapi Hide this for inner system use. 2823 * @since 8 2824 */ 2825 registerInputer(inputer: IInputer): void; 2826 2827 /** 2828 * Unregister inputer. 2829 * 2830 * @permission ohos.permission.ACCESS_PIN_AUTH 2831 * @throws { BusinessError } 201 - Permission denied. 2832 * @throws { BusinessError } 202 - Not system application. 2833 * @syscap SystemCapability.Account.OsAccount 2834 * @systemapi Hide this for inner system use. 2835 * @since 8 2836 */ 2837 unregisterInputer(): void; 2838 } 2839 2840 /** 2841 * Provides the management of credential inputers. 2842 * 2843 * @syscap SystemCapability.Account.OsAccount 2844 * @systemapi Hide this for inner system use. 2845 * @since 9 2846 * @name InputerManager 2847 */ 2848 class InputerManager { 2849 /** 2850 * Register credential inputer by authentication type. 2851 * 2852 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL or ohos.permission.MANAGE_USER_IDM 2853 * @param { AuthType } authType - Indicates the authentication type. 2854 * @param { IInputer } inputer - Indicates the credential input box callback. 2855 * @throws { BusinessError } 201 - Permission denied. 2856 * @throws { BusinessError } 202 - Not system application. 2857 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2858 * <br> 2. Incorrect parameter types. 2859 * @throws { BusinessError } 12300001 - The system service works abnormally. 2860 * @throws { BusinessError } 12300002 - Invalid authType or inputer. 2861 * @throws { BusinessError } 12300103 - The credential inputer already exists. 2862 * @throws { BusinessError } 12300106 - The authentication type is not supported. 2863 * @static 2864 * @syscap SystemCapability.Account.OsAccount 2865 * @systemapi Hide this for inner system use. 2866 * @since 9 2867 */ 2868 static registerInputer(authType: AuthType, inputer: IInputer): void; 2869 2870 /** 2871 * Unregister credential inputer by authentication type. 2872 * 2873 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL or ohos.permission.MANAGE_USER_IDM 2874 * @param { AuthType } authType - Indicates the authentication type. 2875 * @throws { BusinessError } 201 - Permission denied. 2876 * @throws { BusinessError } 202 - Not system application. 2877 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2878 * <br> 2. Incorrect parameter types. 2879 * @throws { BusinessError } 12300002 - Invalid authType. 2880 * @static 2881 * @syscap SystemCapability.Account.OsAccount 2882 * @systemapi Hide this for inner system use. 2883 * @since 9 2884 */ 2885 static unregisterInputer(authType: AuthType): void; 2886 } 2887 2888 /** 2889 * Provides the AuthStatusInfo type. 2890 * 2891 * @interface AuthStatusInfo 2892 * @syscap SystemCapability.Account.OsAccount 2893 * @systemapi Hide this for inner system use. 2894 * @since 10 2895 */ 2896 interface AuthStatusInfo { 2897 /** 2898 * Indicates the remaining times that authentication can be performed. 2899 * 2900 * @type { number } 2901 * @syscap SystemCapability.Account.OsAccount 2902 * @systemapi Hide this for inner system use. 2903 * @since 10 2904 */ 2905 remainTimes: number; 2906 2907 /** 2908 * Indicates the freezing time before performing the next authentication. 2909 * 2910 * @type { number } 2911 * @syscap SystemCapability.Account.OsAccount 2912 * @systemapi Hide this for inner system use. 2913 * @since 10 2914 */ 2915 freezingTime: number; 2916 } 2917 2918 /** 2919 * Provides the GetDomainAccessTokenOptions type. 2920 * 2921 * @typedef GetDomainAccessTokenOptions 2922 * @syscap SystemCapability.Account.OsAccount 2923 * @systemapi Hide this for inner system use. 2924 * @since 10 2925 */ 2926 interface GetDomainAccessTokenOptions { 2927 /** 2928 * Indicates the domain account information. 2929 * 2930 * @type { DomainAccountInfo } 2931 * @syscap SystemCapability.Account.OsAccount 2932 * @systemapi Hide this for inner system use. 2933 * @since 10 2934 */ 2935 domainAccountInfo: DomainAccountInfo; 2936 2937 /** 2938 * Indicates the domain account token. 2939 * 2940 * @type { Uint8Array } 2941 * @syscap SystemCapability.Account.OsAccount 2942 * @systemapi Hide this for inner system use. 2943 * @since 10 2944 */ 2945 domainAccountToken: Uint8Array; 2946 2947 /** 2948 * Indicates the business parameters. 2949 * 2950 * @type { Record<string, Object> } 2951 * @syscap SystemCapability.Account.OsAccount 2952 * @systemapi Hide this for inner system use. 2953 * @since 10 2954 */ 2955 businessParams: Record<string, Object>; 2956 2957 /** 2958 * Indicates caller UID. 2959 * 2960 * @type { number } 2961 * @syscap SystemCapability.Account.OsAccount 2962 * @systemapi Hide this for inner system use. 2963 * @since 10 2964 */ 2965 callerUid: number; 2966 } 2967 2968 /** 2969 * Options for getting domain account information. 2970 * 2971 * @typedef GetDomainAccountInfoOptions 2972 * @syscap SystemCapability.Account.OsAccount 2973 * @systemapi Hide this for inner system use. 2974 * @since 10 2975 */ 2976 interface GetDomainAccountInfoOptions { 2977 /** 2978 * Indicates the account name. 2979 * 2980 * @type { string } 2981 * @syscap SystemCapability.Account.OsAccount 2982 * @systemapi Hide this for inner system use. 2983 * @since 10 2984 */ 2985 accountName: string; 2986 2987 /** 2988 * Indicates the domain to which the account belongs. 2989 * 2990 * @type { ?string } 2991 * @syscap SystemCapability.Account.OsAccount 2992 * @systemapi Hide this for inner system use. 2993 * @since 10 2994 */ 2995 domain?: string; 2996 2997 /** 2998 * Indicates the server config identifier for the domain to which the account belongs. 2999 * 3000 * @type { ?string } 3001 * @syscap SystemCapability.Account.OsAccount 3002 * @systemapi Hide this for inner system use. 3003 * @since 12 3004 */ 3005 serverConfigId?: string; 3006 } 3007 3008 /** 3009 * Options for getting domain account information in the domain plugin. 3010 * 3011 * @typedef GetDomainAccountInfoPluginOptions 3012 * @extends GetDomainAccountInfoOptions 3013 * @syscap SystemCapability.Account.OsAccount 3014 * @systemapi Hide this for inner system use. 3015 * @since 10 3016 */ 3017 interface GetDomainAccountInfoPluginOptions extends GetDomainAccountInfoOptions { 3018 /** 3019 * Indicates the caller UID. 3020 * 3021 * @type { number } 3022 * @syscap SystemCapability.Account.OsAccount 3023 * @systemapi Hide this for inner system use. 3024 * @since 10 3025 */ 3026 callerUid: number; 3027 } 3028 3029 /** 3030 * Provides the definition of domain plugin. 3031 * 3032 * @interface DomainPlugin 3033 * @syscap SystemCapability.Account.OsAccount 3034 * @systemapi Hide this for inner system use. 3035 * @since 9 3036 */ 3037 interface DomainPlugin { 3038 /** 3039 * Authenticates the specified domain account. 3040 * 3041 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information for authentication. 3042 * @param { Uint8Array } credential - Indicates the credential for authentication. 3043 * @param { IUserAuthCallback } callback - Indicates the authentication callback. 3044 * @syscap SystemCapability.Account.OsAccount 3045 * @systemapi Hide this for inner system use. 3046 * @since 9 3047 */ 3048 auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUserAuthCallback): void; 3049 3050 /** 3051 * Authenticates the specified domain account with a popup. 3052 * 3053 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information for authentication. 3054 * @param { IUserAuthCallback } callback - Indicates the callback for notifying the authentication result. 3055 * @syscap SystemCapability.Account.OsAccount 3056 * @systemapi Hide this for inner system use. 3057 * @since 10 3058 */ 3059 authWithPopup(domainAccountInfo: DomainAccountInfo, callback: IUserAuthCallback): void; 3060 3061 /** 3062 * Authenticates the specified domain account with an authorization token. 3063 * 3064 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information for authentication. 3065 * @param { Uint8Array } token - Indicates the authorization token generated when PIN or biometric authentication is successful. 3066 * @param { IUserAuthCallback } callback - Indicates the callback for notifying the authentication result. 3067 * @syscap SystemCapability.Account.OsAccount 3068 * @systemapi Hide this for inner system use. 3069 * @since 10 3070 */ 3071 authWithToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, callback: IUserAuthCallback): void; 3072 3073 /** 3074 * Gets the domain account information with the specified options. 3075 * 3076 * @param { GetDomainAccountInfoPluginOptions } options - Indicates the options for getting domain account information. 3077 * @param { AsyncCallback<DomainAccountInfo> } callback - Indicates the callback for notifying the domain account information. 3078 * @syscap SystemCapability.Account.OsAccount 3079 * @systemapi Hide this for inner system use. 3080 * @since 10 3081 */ 3082 getAccountInfo(options: GetDomainAccountInfoPluginOptions, callback: AsyncCallback<DomainAccountInfo>): void; 3083 3084 /** 3085 * Gets the domain authentication property for the specified domain account. 3086 * 3087 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information for authentication. 3088 * @param { AsyncCallback<AuthStatusInfo> } callback - Indicates the callback for notifying the domain authentication status information. 3089 * @syscap SystemCapability.Account.OsAccount 3090 * @systemapi Hide this for inner system use. 3091 * @since 10 3092 */ 3093 getAuthStatusInfo(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<AuthStatusInfo>): void; 3094 3095 /** 3096 * Binds the specified domain account with an OS account. 3097 * 3098 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information. 3099 * @param { number } localId - Indicates the local ID of the OS account. 3100 * @param { AsyncCallback<void> } callback - Indicates the callback for notifying the binding result. 3101 * @syscap SystemCapability.Account.OsAccount 3102 * @systemapi Hide this for inner system use. 3103 * @since 10 3104 */ 3105 bindAccount(domainAccountInfo: DomainAccountInfo, localId: number, callback: AsyncCallback<void>): void; 3106 3107 /** 3108 * Unbind the specified domain account. 3109 * 3110 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information. 3111 * @param { AsyncCallback<void> } callback - Indicates the callback for notifying the unbinding result. 3112 * @syscap SystemCapability.Account.OsAccount 3113 * @systemapi Hide this for inner system use. 3114 * @since 10 3115 */ 3116 unbindAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<void>): void; 3117 3118 /** 3119 * Checks whether the token of specified domain account is valid. 3120 * 3121 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information. 3122 * @param { Uint8Array } token - Indicates the account token. 3123 * @param { AsyncCallback<boolean> } callback - Indicates the callback for notifying the checking result. 3124 * @syscap SystemCapability.Account.OsAccount 3125 * @systemapi Hide this for inner system use. 3126 * @since 10 3127 */ 3128 isAccountTokenValid( 3129 domainAccountInfo: DomainAccountInfo, 3130 token: Uint8Array, 3131 callback: AsyncCallback<boolean> 3132 ): void; 3133 3134 /** 3135 * Gets the access token based on the specified options. 3136 * 3137 * @param { GetDomainAccessTokenOptions } options - Indicates the options for getting th access token. 3138 * @param { AsyncCallback<Uint8Array> } callback - Indicates the callback for returning the access token. 3139 * @syscap SystemCapability.Account.OsAccount 3140 * @systemapi Hide this for inner system use. 3141 * @since 10 3142 */ 3143 getAccessToken(options: GetDomainAccessTokenOptions, callback: AsyncCallback<Uint8Array>): void; 3144 } 3145 3146 /** 3147 * Provides abilities for the management of domain account. 3148 * 3149 * @syscap SystemCapability.Account.OsAccount 3150 * @since 18 3151 */ 3152 class DomainAccountManager { 3153 /** 3154 * Registers the domain plugin, which provides the capabilities for domain authentication. 3155 * 3156 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 3157 * @param { DomainPlugin } plugin - Indicates the domain plugin. 3158 * @throws { BusinessError } 201 - Permission denied. 3159 * @throws { BusinessError } 202 - Not system application. 3160 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3161 * <br> 2. Incorrect parameter types. 3162 * @throws { BusinessError } 12300201 - The domain plugin has been registered. 3163 * @static 3164 * @syscap SystemCapability.Account.OsAccount 3165 * @systemapi Hide this for inner system use. 3166 * @since 9 3167 */ 3168 /** 3169 * Registers the domain plugin, which provides the capabilities for domain authentication. 3170 * 3171 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 3172 * @param { DomainPlugin } plugin - Indicates the domain plugin. 3173 * @throws { BusinessError } 201 - Permission denied. 3174 * @throws { BusinessError } 202 - Not system application. 3175 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3176 * <br> 2. Incorrect parameter types. 3177 * @throws { BusinessError } 801 - Capability not supported. 3178 * @throws { BusinessError } 12300201 - The domain plugin has been registered. 3179 * @static 3180 * @syscap SystemCapability.Account.OsAccount 3181 * @systemapi Hide this for inner system use. 3182 * @since 18 3183 */ 3184 static registerPlugin(plugin: DomainPlugin): void; 3185 3186 /** 3187 * Unregisters domain plugin. 3188 * 3189 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 3190 * @throws { BusinessError } 201 - Permission denied. 3191 * @throws { BusinessError } 202 - Not system application. 3192 * @static 3193 * @syscap SystemCapability.Account.OsAccount 3194 * @systemapi Hide this for inner system use. 3195 * @since 9 3196 */ 3197 /** 3198 * Unregisters domain plugin. 3199 * 3200 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 3201 * @throws { BusinessError } 201 - Permission denied. 3202 * @throws { BusinessError } 202 - Not system application. 3203 * @throws { BusinessError } 801 - Capability not supported. 3204 * @static 3205 * @syscap SystemCapability.Account.OsAccount 3206 * @systemapi Hide this for inner system use. 3207 * @since 18 3208 */ 3209 static unregisterPlugin(): void; 3210 3211 /** 3212 * Authenticates the specified domain account with a credential. 3213 * 3214 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 3215 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information. 3216 * @param { Uint8Array } credential - Indicates the credential for authentication. 3217 * @param { IUserAuthCallback } callback - Indicates the callback for getting the authentication result. 3218 * @throws { BusinessError } 201 - Permission denied. 3219 * @throws { BusinessError } 202 - Not system application. 3220 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3221 * <br> 2. Incorrect parameter types. 3222 * @throws { BusinessError } 801 - Capability not supported. 3223 * @throws { BusinessError } 12300001 - The system service works abnormally. 3224 * @throws { BusinessError } 12300002 - Invalid domainAccountInfo or credential. 3225 * @throws { BusinessError } 12300003 - Domain account does not exist. 3226 * @throws { BusinessError } 12300013 - Network exception. 3227 * @throws { BusinessError } 12300101 - Authentication failed. 3228 * @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled. 3229 * @throws { BusinessError } 12300110 - The authentication is locked. 3230 * @throws { BusinessError } 12300111 - The authentication time out. 3231 * @throws { BusinessError } 12300112 - The authentication service is busy. 3232 * @throws { BusinessError } 12300113 - The account authentication service does not exist. 3233 * @throws { BusinessError } 12300114 - The account authentication service works abnormally. 3234 * @throws { BusinessError } 12300211 - Server unreachable. 3235 * @syscap SystemCapability.Account.OsAccount 3236 * @systemapi Hide this for inner system use. 3237 * @since 10 3238 */ 3239 static auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUserAuthCallback): void; 3240 3241 /** 3242 * Authenticates the domain account bound to the current OS account with a popup. 3243 * 3244 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 3245 * @param { IUserAuthCallback } callback - Indicates the callback for getting the authentication result. 3246 * @throws { BusinessError } 201 - Permission denied. 3247 * @throws { BusinessError } 202 - Not system application. 3248 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3249 * <br> 2. Incorrect parameter types. 3250 * @throws { BusinessError } 801 - Capability not supported. 3251 * @throws { BusinessError } 12300001 - The system service works abnormally. 3252 * @throws { BusinessError } 12300003 - No domain account is bound. 3253 * @throws { BusinessError } 12300013 - Network exception. 3254 * @throws { BusinessError } 12300101 - Authentication failed. 3255 * @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled. 3256 * @throws { BusinessError } 12300110 - The authentication is locked. 3257 * @throws { BusinessError } 12300111 - The authentication time out. 3258 * @throws { BusinessError } 12300112 - The authentication service is busy. 3259 * @throws { BusinessError } 12300113 - The account authentication service does not exist. 3260 * @throws { BusinessError } 12300114 - The account authentication service works abnormally. 3261 * @static 3262 * @syscap SystemCapability.Account.OsAccount 3263 * @systemapi Hide this for inner system use. 3264 * @since 10 3265 */ 3266 /** 3267 * Authenticates the domain account bound to the current OS account with a popup. 3268 * 3269 * @param { IUserAuthCallback } callback - Indicates the callback for getting the authentication result. 3270 * @throws { BusinessError } 202 - Not system application. 3271 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3272 * <br> 2. Incorrect parameter types. 3273 * @throws { BusinessError } 801 - Capability not supported. 3274 * @throws { BusinessError } 12300001 - The system service works abnormally. 3275 * @throws { BusinessError } 12300003 - No domain account is bound. 3276 * @throws { BusinessError } 12300013 - Network exception. 3277 * @throws { BusinessError } 12300101 - Authentication failed. 3278 * @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled. 3279 * @throws { BusinessError } 12300110 - The authentication is locked. 3280 * @throws { BusinessError } 12300111 - The authentication time out. 3281 * @throws { BusinessError } 12300112 - The authentication service is busy. 3282 * @throws { BusinessError } 12300113 - The account authentication service does not exist. 3283 * @throws { BusinessError } 12300114 - The account authentication service works abnormally. 3284 * @throws { BusinessError } 12300211 - Server unreachable. 3285 * @static 3286 * @syscap SystemCapability.Account.OsAccount 3287 * @systemapi Hide this for inner system use. 3288 * @since 11 3289 */ 3290 static authWithPopup(callback: IUserAuthCallback): void; 3291 3292 /** 3293 * Authenticates the domain account bound to the specified OS account with a popup. 3294 * 3295 * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL 3296 * @param { number } localId - Indicates the local ID of the specified OS account. 3297 * @param { IUserAuthCallback } callback - Indicates the callback for getting the authentication result. 3298 * @throws { BusinessError } 201 - Permission denied. 3299 * @throws { BusinessError } 202 - Not system application. 3300 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3301 * <br> 2. Incorrect parameter types. 3302 * @throws { BusinessError } 801 - Capability not supported. 3303 * @throws { BusinessError } 12300001 - The system service works abnormally. 3304 * @throws { BusinessError } 12300002 - Invalid localId. 3305 * @throws { BusinessError } 12300003 - No domain account is bound. 3306 * @throws { BusinessError } 12300013 - Network exception. 3307 * @throws { BusinessError } 12300101 - Authentication failed. 3308 * @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled. 3309 * @throws { BusinessError } 12300110 - The authentication is locked. 3310 * @throws { BusinessError } 12300111 - The authentication time out. 3311 * @throws { BusinessError } 12300112 - The authentication service is busy. 3312 * @throws { BusinessError } 12300113 - The account authentication service does not exist. 3313 * @throws { BusinessError } 12300114 - The account authentication service works abnormally. 3314 * @static 3315 * @syscap SystemCapability.Account.OsAccount 3316 * @systemapi Hide this for inner system use. 3317 * @since 10 3318 */ 3319 /** 3320 * Authenticates the domain account bound to the specified OS account with a popup. 3321 * 3322 * @param { number } localId - Indicates the local ID of the specified OS account. 3323 * @param { IUserAuthCallback } callback - Indicates the callback for getting the authentication result. 3324 * @throws { BusinessError } 202 - Not system application. 3325 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3326 * <br> 2. Incorrect parameter types. 3327 * @throws { BusinessError } 801 - Capability not supported. 3328 * @throws { BusinessError } 12300001 - The system service works abnormally. 3329 * @throws { BusinessError } 12300002 - Invalid localId. 3330 * @throws { BusinessError } 12300003 - No domain account is bound. 3331 * @throws { BusinessError } 12300013 - Network exception. 3332 * @throws { BusinessError } 12300101 - Authentication failed. 3333 * @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled. 3334 * @throws { BusinessError } 12300110 - The authentication is locked. 3335 * @throws { BusinessError } 12300111 - The authentication time out. 3336 * @throws { BusinessError } 12300112 - The authentication service is busy. 3337 * @throws { BusinessError } 12300113 - The account authentication service does not exist. 3338 * @throws { BusinessError } 12300114 - The account authentication service works abnormally. 3339 * @throws { BusinessError } 12300211 - Server unreachable. 3340 * @static 3341 * @syscap SystemCapability.Account.OsAccount 3342 * @systemapi Hide this for inner system use. 3343 * @since 11 3344 */ 3345 static authWithPopup(localId: number, callback: IUserAuthCallback): void; 3346 3347 /** 3348 * Checks whether the specified domain account exists. 3349 * 3350 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 3351 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information. 3352 * @param { AsyncCallback<boolean> } callback Indicates - The callback for checking whether the specified domain account exists. 3353 * @throws { BusinessError } 201 - Permission denied. 3354 * @throws { BusinessError } 202 - Not system application. 3355 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3356 * <br> 2. Incorrect parameter types. 3357 * @throws { BusinessError } 801 - Capability not supported. 3358 * @throws { BusinessError } 12300001 - The system service works abnormally. 3359 * @throws { BusinessError } 12300002 - Invalid domainAccountInfo. 3360 * @throws { BusinessError } 12300013 - Network exception. 3361 * @throws { BusinessError } 12300014 - Not authenticated. 3362 * @throws { BusinessError } 12300111 - The operation time out. 3363 * @throws { BusinessError } 12300114 - The authentication service works abnormally. 3364 * @throws { BusinessError } 12300211 - Server unreachable. 3365 * @static 3366 * @syscap SystemCapability.Account.OsAccount 3367 * @systemapi Hide this for inner system use. 3368 * @since 10 3369 */ 3370 static hasAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<boolean>): void; 3371 3372 /** 3373 * Checks whether the specified domain account exists. 3374 * 3375 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 3376 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information. 3377 * @returns { Promise<boolean> } Returns whether the specified domain account exists. 3378 * @throws { BusinessError } 201 - Permission denied. 3379 * @throws { BusinessError } 202 - Not system application. 3380 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3381 * <br> 2. Incorrect parameter types. 3382 * @throws { BusinessError } 801 - Capability not supported. 3383 * @throws { BusinessError } 12300001 - The system service works abnormally. 3384 * @throws { BusinessError } 12300002 - Invalid domainAccountInfo. 3385 * @throws { BusinessError } 12300013 - Network exception. 3386 * @throws { BusinessError } 12300014 - Not authenticated. 3387 * @throws { BusinessError } 12300111 - The operation time out. 3388 * @throws { BusinessError } 12300114 - The authentication service works abnormally. 3389 * @throws { BusinessError } 12300211 - Server unreachable. 3390 * @static 3391 * @syscap SystemCapability.Account.OsAccount 3392 * @systemapi Hide this for inner system use. 3393 * @since 10 3394 */ 3395 static hasAccount(domainAccountInfo: DomainAccountInfo): Promise<boolean>; 3396 3397 /** 3398 * Updates the token for the specified domain account. 3399 * <p>Only the registered domain plugin has the permission to call this function.<br/> 3400 * An empty token indicates the token of the target domain account is invalid.</p> 3401 * 3402 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 3403 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information. 3404 * @param { Uint8Array } token - Indicates the domain account token. 3405 * @param { AsyncCallback<void> } callback - Indicates the result callback. 3406 * @throws { BusinessError } 201 - Permission denied. 3407 * @throws { BusinessError } 202 - Not system application. 3408 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3409 * <br> 2. Incorrect parameter types. 3410 * @throws { BusinessError } 12300001 - The system service works abnormally. 3411 * @throws { BusinessError } 12300002 - Invalid token. 3412 * @throws { BusinessError } 12300003 - Account not found. 3413 * @static 3414 * @syscap SystemCapability.Account.OsAccount 3415 * @systemapi Hide this for inner system use. 3416 * @since 10 3417 */ 3418 static updateAccountToken( 3419 domainAccountInfo: DomainAccountInfo, 3420 token: Uint8Array, 3421 callback: AsyncCallback<void> 3422 ): void; 3423 3424 /** 3425 * Updates the token for the specified domain account. 3426 * <p>Only the registered domain plugin has the permission to call this function.<br/> 3427 * An empty token indicates the token of the target domain account is invalid.</p> 3428 * 3429 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS 3430 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information. 3431 * @param { Uint8Array } token - Indicates the domain account token. 3432 * @returns { Promise<void> } The promise returned by the function. 3433 * @throws { BusinessError } 201 - Permission denied. 3434 * @throws { BusinessError } 202 - Not system application. 3435 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3436 * <br> 2. Incorrect parameter types. 3437 * @throws { BusinessError } 12300001 - The system service works abnormally. 3438 * @throws { BusinessError } 12300002 - Invalid token. 3439 * @throws { BusinessError } 12300003 - Account not found. 3440 * @static 3441 * @syscap SystemCapability.Account.OsAccount 3442 * @systemapi Hide this for inner system use. 3443 * @since 10 3444 */ 3445 static updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array): Promise<void>; 3446 3447 /** 3448 * Updates the information of the specified domain account. 3449 * 3450 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.MANAGE_DOMAIN_ACCOUNTS 3451 * @param { DomainAccountInfo } oldAccountInfo - Indicates the old domain account information. 3452 * @param { DomainAccountInfo } newAccountInfo - Indicates the new domain account information. 3453 * @returns { Promise<void> } The promise returned by the function. 3454 * @throws { BusinessError } 201 - Permission denied. 3455 * @throws { BusinessError } 801 - Capability not supported. 3456 * @throws { BusinessError } 12300001 - The system service works abnormally. 3457 * @throws { BusinessError } 12300002 - The new account info is invalid. 3458 * @throws { BusinessError } 12300003 - The old account not found. 3459 * @throws { BusinessError } 12300004 - The new account already exists. 3460 * @static 3461 * @syscap SystemCapability.Account.OsAccount 3462 * @since 18 3463 */ 3464 static updateAccountInfo(oldAccountInfo: DomainAccountInfo, newAccountInfo: DomainAccountInfo): Promise<void>; 3465 3466 /** 3467 * Gets the specified domain account information. 3468 * 3469 * @permission ohos.permission.GET_DOMAIN_ACCOUNTS 3470 * @param { GetDomainAccountInfoOptions } options - Indicates the options for getting domain account information. 3471 * @param { AsyncCallback<DomainAccountInfo> } callback - Indicates the result callback. 3472 * @throws { BusinessError } 201 - Permission denied. 3473 * @throws { BusinessError } 202 - Not system application. 3474 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3475 * <br> 2. Incorrect parameter types. 3476 * @throws { BusinessError } 801 - Capability not supported. 3477 * @throws { BusinessError } 12300001 - The system service works abnormally. 3478 * @throws { BusinessError } 12300003 - Account not found. 3479 * @throws { BusinessError } 12300013 - Network exception. 3480 * @throws { BusinessError } 12300014 - Not authenticated. 3481 * @throws { BusinessError } 12300111 - The operation time out. 3482 * @throws { BusinessError } 12300114 - The authentication service works abnormally. 3483 * @throws { BusinessError } 12300211 - Server unreachable. 3484 * @static 3485 * @syscap SystemCapability.Account.OsAccount 3486 * @systemapi Hide this for inner system use. 3487 * @since 10 3488 */ 3489 static getAccountInfo(options: GetDomainAccountInfoOptions, callback: AsyncCallback<DomainAccountInfo>): void; 3490 3491 /** 3492 * Gets the specified domain account information. 3493 * 3494 * @permission ohos.permission.GET_DOMAIN_ACCOUNTS 3495 * @param { GetDomainAccountInfoOptions } options - Indicates the options for getting domain account information. 3496 * @returns { Promise<DomainAccountInfo> } The promise returned by the function. 3497 * @throws { BusinessError } 201 - Permission denied. 3498 * @throws { BusinessError } 202 - Not system application. 3499 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3500 * <br> 2. Incorrect parameter types. 3501 * @throws { BusinessError } 801 - Capability not supported. 3502 * @throws { BusinessError } 12300001 - The system service works abnormally. 3503 * @throws { BusinessError } 12300003 - Account not found. 3504 * @throws { BusinessError } 12300013 - Network exception. 3505 * @throws { BusinessError } 12300014 - Not authenticated. 3506 * @throws { BusinessError } 12300111 - The operation time out. 3507 * @throws { BusinessError } 12300114 - The authentication service works abnormally. 3508 * @throws { BusinessError } 12300211 - Server unreachable. 3509 * @static 3510 * @syscap SystemCapability.Account.OsAccount 3511 * @systemapi Hide this for inner system use. 3512 * @since 10 3513 */ 3514 static getAccountInfo(options: GetDomainAccountInfoOptions): Promise<DomainAccountInfo>; 3515 3516 /** 3517 * Gets the business access token of the current domain account. 3518 * 3519 * @param { Record<string, Object> } businessParams - Indicates the business parameters. 3520 * @param { AsyncCallback<Uint8Array> } callback - Indicates the result callback. 3521 * @throws { BusinessError } 202 - Not system application. 3522 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3523 * <br> 2. Incorrect parameter types. 3524 * @throws { BusinessError } 801 - Capability not supported. 3525 * @throws { BusinessError } 12300001 - The system service works abnormally. 3526 * @throws { BusinessError } 12300002 - Invalid business parameters. 3527 * @throws { BusinessError } 12300003 - Domain account not found. 3528 * @throws { BusinessError } 12300013 - Network exception. 3529 * @throws { BusinessError } 12300014 - The domain account is not authenticated. 3530 * @throws { BusinessError } 12300111 - The operation time out. 3531 * @throws { BusinessError } 12300114 - The authentication service works abnormally. 3532 * @throws { BusinessError } 12300211 - Server unreachable. 3533 * @static 3534 * @syscap SystemCapability.Account.OsAccount 3535 * @systemapi Hide this for inner system use. 3536 * @since 11 3537 */ 3538 static getAccessToken(businessParams: Record<string, Object>, callback: AsyncCallback<Uint8Array>): void; 3539 3540 /** 3541 * Gets the business access token for the current domain account. 3542 * 3543 * @param { Record<string, Object> } businessParams - Indicates the business parameters. 3544 * @returns { Promise<Uint8Array> } The promise returned by the function. 3545 * @throws { BusinessError } 202 - Not system application. 3546 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3547 * <br> 2. Incorrect parameter types. 3548 * @throws { BusinessError } 801 - Capability not supported. 3549 * @throws { BusinessError } 12300001 - The system service works abnormally. 3550 * @throws { BusinessError } 12300002 - Invalid business parameters. 3551 * @throws { BusinessError } 12300003 - Domain account not found. 3552 * @throws { BusinessError } 12300013 - Network exception. 3553 * @throws { BusinessError } 12300014 - The domain account is not authenticated. 3554 * @throws { BusinessError } 12300111 - The operation time out. 3555 * @throws { BusinessError } 12300114 - The authentication service works abnormally. 3556 * @throws { BusinessError } 12300211 - Server unreachable. 3557 * @static 3558 * @syscap SystemCapability.Account.OsAccount 3559 * @systemapi Hide this for inner system use. 3560 * @since 11 3561 */ 3562 static getAccessToken(businessParams: Record<string, Object>): Promise<Uint8Array>; 3563 3564 /** 3565 * Checks whether the authentication of the target domain account is expired. 3566 * 3567 * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 3568 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information. 3569 * @returns { Promise<boolean> } The promise returned by the function. 3570 * @throws { BusinessError } 201 - Permission denied. 3571 * @throws { BusinessError } 202 - Not system application. 3572 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3573 * <br> 2. Incorrect parameter types. 3574 * @throws { BusinessError } 801 - Capability not supported. 3575 * @throws { BusinessError } 12300001 - The system service works abnormally. 3576 * @throws { BusinessError } 12300003 - Domain account not found. 3577 * @static 3578 * @syscap SystemCapability.Account.OsAccount 3579 * @systemapi Hide this for inner system use. 3580 * @since 12 3581 */ 3582 static isAuthenticationExpired(domainAccountInfo: DomainAccountInfo): Promise<boolean>; 3583 } 3584 3585 /** 3586 * Defines the domain server config. 3587 * 3588 * @typedef DomainServerConfig 3589 * @syscap SystemCapability.Account.OsAccount 3590 * @since 18 3591 */ 3592 interface DomainServerConfig { 3593 /** 3594 * Indicates the detail config parameters. 3595 * 3596 * @type { Record<string, Object> } 3597 * @syscap SystemCapability.Account.OsAccount 3598 * @since 18 3599 */ 3600 parameters: Record<string, Object>; 3601 3602 /** 3603 * Indicates the config identifier. 3604 * 3605 * @type { string } 3606 * @syscap SystemCapability.Account.OsAccount 3607 * @since 18 3608 */ 3609 id: string; 3610 3611 /** 3612 * Indicates the domain to which the server config belongs. 3613 * 3614 * @type { string } 3615 * @syscap SystemCapability.Account.OsAccount 3616 * @since 18 3617 */ 3618 domain: string; 3619 } 3620 3621 /** 3622 * Provides abilities for managing domain server config. 3623 * 3624 * @syscap SystemCapability.Account.OsAccount 3625 * @since 18 3626 */ 3627 class DomainServerConfigManager { 3628 /** 3629 * Adds a domain server config. 3630 * 3631 * @permission ohos.permission.MANAGE_DOMAIN_ACCOUNT_SERVER_CONFIGS 3632 * @param { Record<string, Object> } parameters - Indicates the server config parameters. 3633 * @returns { Promise<DomainServerConfig> } Returns the added domain server config. 3634 * @throws { BusinessError } 201 - Permission denied. 3635 * @throws { BusinessError } 801 - Capability not supported. 3636 * @throws { BusinessError } 12300001 - The system service works abnormally. 3637 * @throws { BusinessError } 12300002 - Invalid server config parameters. 3638 * @throws { BusinessError } 12300211 - Server unreachable. 3639 * @throws { BusinessError } 12300213 - Server config already exists. 3640 * @throws { BusinessError } 12300215 - The number of server config reaches the upper limit. 3641 * @static 3642 * @syscap SystemCapability.Account.OsAccount 3643 * @since 18 3644 */ 3645 static addServerConfig(parameters: Record<string, Object>): Promise<DomainServerConfig>; 3646 3647 /** 3648 * Removes a domain server config. 3649 * 3650 * @permission ohos.permission.MANAGE_DOMAIN_ACCOUNT_SERVER_CONFIGS 3651 * @param { string } configId - Indicates the server config identifier. 3652 * @returns { Promise<void> } Returns void. 3653 * @throws { BusinessError } 201 - Permission denied. 3654 * @throws { BusinessError } 801 - Capability not supported. 3655 * @throws { BusinessError } 12300001 - The system service works abnormally. 3656 * @throws { BusinessError } 12300212 - Server config not found. 3657 * @throws { BusinessError } 12300214 - Server config has been associated with an account. 3658 * @static 3659 * @syscap SystemCapability.Account.OsAccount 3660 * @since 18 3661 */ 3662 static removeServerConfig(configId: string): Promise<void>; 3663 3664 /** 3665 * Updates the target server config with the specified parameters. 3666 * 3667 * @permission ohos.permission.MANAGE_DOMAIN_ACCOUNT_SERVER_CONFIGS 3668 * @param { string } configId - Indicates the server config identifier. 3669 * @param { Record<string, Object> } parameters - Indicates the server config parameters. 3670 * @returns { Promise<DomainServerConfig> } Returns the updated domain server config. 3671 * @throws { BusinessError } 201 - Permission denied. 3672 * @throws { BusinessError } 801 - Capability not supported. 3673 * @throws { BusinessError } 12300001 - The system service works abnormally. 3674 * @throws { BusinessError } 12300002 - Invalid server config parameters. 3675 * @throws { BusinessError } 12300211 - Server unreachable. 3676 * @throws { BusinessError } 12300212 - Server config not found. 3677 * @throws { BusinessError } 12300213 - Server config already exists. 3678 * @throws { BusinessError } 12300214 - Server config has been associated with an account. 3679 * @static 3680 * @syscap SystemCapability.Account.OsAccount 3681 * @since 18 3682 */ 3683 static updateServerConfig(configId: string, parameters: Record<string, Object>): Promise<DomainServerConfig>; 3684 3685 /** 3686 * Gets the specified server config by identifier. 3687 * 3688 * @permission ohos.permission.MANAGE_DOMAIN_ACCOUNT_SERVER_CONFIGS 3689 * @param { string } configId - Indicates the server config identifier. 3690 * @returns { Promise<DomainServerConfig> } Returns the server config. 3691 * @throws { BusinessError } 201 - Permission denied. 3692 * @throws { BusinessError } 801 - Capability not supported. 3693 * @throws { BusinessError } 12300001 - The system service works abnormally. 3694 * @throws { BusinessError } 12300212 - Server config not found. 3695 * @static 3696 * @syscap SystemCapability.Account.OsAccount 3697 * @since 18 3698 */ 3699 static getServerConfig(configId: string): Promise<DomainServerConfig>; 3700 3701 /** 3702 * Gets all server configs. 3703 * 3704 * @permission ohos.permission.MANAGE_DOMAIN_ACCOUNT_SERVER_CONFIGS 3705 * @returns { Promise<Array<DomainServerConfig>> } Returns a list of server configs. 3706 * @throws { BusinessError } 201 - Permission denied. 3707 * @throws { BusinessError } 801 - Capability not supported. 3708 * @throws { BusinessError } 12300001 - The system service works abnormally. 3709 * @static 3710 * @syscap SystemCapability.Account.OsAccount 3711 * @since 18 3712 */ 3713 static getAllServerConfigs(): Promise<Array<DomainServerConfig>>; 3714 3715 /** 3716 * Gets the server config of the specified domain account. 3717 * 3718 * @permission ohos.permission.MANAGE_DOMAIN_ACCOUNT_SERVER_CONFIGS 3719 * @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information. 3720 * @returns { Promise<DomainServerConfig> } Returns the domain server config. 3721 * @throws { BusinessError } 201 - Permission denied. 3722 * @throws { BusinessError } 801 - Capability not supported. 3723 * @throws { BusinessError } 12300001 - The system service works abnormally. 3724 * @throws { BusinessError } 12300003 - Domain account not found. 3725 * @static 3726 * @syscap SystemCapability.Account.OsAccount 3727 * @since 18 3728 */ 3729 static getAccountServerConfig(domainAccountInfo: DomainAccountInfo): Promise<DomainServerConfig>; 3730 } 3731 3732 /** 3733 * Provides the abilities for managing user identity. 3734 * 3735 * @syscap SystemCapability.Account.OsAccount 3736 * @systemapi Hide this for inner system use. 3737 * @since 8 3738 * @name UserIdentityManager 3739 */ 3740 class UserIdentityManager { 3741 /** 3742 * Constructor to get the UserIdentityManager class instance. 3743 * 3744 * @throws { BusinessError } 202 - Not system application. 3745 * @syscap SystemCapability.Account.OsAccount 3746 * @systemapi Hide this for inner system use. 3747 * @since 8 3748 */ 3749 constructor(); 3750 3751 /** 3752 * Opens session. 3753 * <p> 3754 * Start an IDM operation to obtain challenge value. 3755 * A challenge value of 0 indicates that opensession failed. 3756 * 3757 * @permission ohos.permission.MANAGE_USER_IDM 3758 * @param { AsyncCallback<Uint8Array> } callback - Returns a challenge value. 3759 * @throws { BusinessError } 201 - Permission denied. 3760 * @throws { BusinessError } 202 - Not system application. 3761 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3762 * <br> 2. Incorrect parameter types. 3763 * @throws { BusinessError } 12300001 - The system service works abnormally. 3764 * @syscap SystemCapability.Account.OsAccount 3765 * @systemapi Hide this for inner system use. 3766 * @since 8 3767 */ 3768 openSession(callback: AsyncCallback<Uint8Array>): void; 3769 3770 /** 3771 * Opens session. 3772 * <p> 3773 * Start an IDM operation to obtain challenge value. 3774 * A challenge value of 0 indicates that opensession failed. 3775 * 3776 * @permission ohos.permission.MANAGE_USER_IDM 3777 * @returns { Promise<Uint8Array> } Returns a challenge value. 3778 * @throws { BusinessError } 201 - Permission denied. 3779 * @throws { BusinessError } 202 - Not system application. 3780 * @throws { BusinessError } 401 - Parameter error. Possible causes: Incorrect parameter types. 3781 * @throws { BusinessError } 12300001 - The system service works abnormally. 3782 * @syscap SystemCapability.Account.OsAccount 3783 * @systemapi Hide this for inner system use. 3784 * @since 8 3785 */ 3786 /** 3787 * Opens a session. 3788 * <p> 3789 * Start an IDM operation to obtain challenge value. 3790 * 3791 * @permission ohos.permission.MANAGE_USER_IDM 3792 * @param { number } [accountId] - Indicates the local ID of the OS account. 3793 * @returns { Promise<Uint8Array> } Returns a challenge value. 3794 * @throws { BusinessError } 201 - Permission denied. 3795 * @throws { BusinessError } 202 - Not system application. 3796 * @throws { BusinessError } 401 - Parameter error. Possible causes: Incorrect parameter types. 3797 * @throws { BusinessError } 12300001 - The system service works abnormally. 3798 * @throws { BusinessError } 12300003 - Account not found. 3799 * @throws { BusinessError } 12300008 - Restricted account. 3800 * @syscap SystemCapability.Account.OsAccount 3801 * @systemapi Hide this for inner system use. 3802 * @since 12 3803 */ 3804 openSession(accountId?: number): Promise<Uint8Array>; 3805 3806 /** 3807 * Adds credential. 3808 * <p> 3809 * Add user credential information, pass in credential addition method and credential information 3810 * (credential type, subclass, if adding user's non password credentials, pass in password authentication token), 3811 * and get the result / acquireInfo callback. 3812 * 3813 * @permission ohos.permission.MANAGE_USER_IDM 3814 * @param { CredentialInfo } credentialInfo - Indicates the credential information. 3815 * @param { IIdmCallback } callback - Indicates the callback to get results and acquireInfo. 3816 * @throws { BusinessError } 201 - Permission denied. 3817 * @throws { BusinessError } 202 - Not system application. 3818 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3819 * <br> 2. Incorrect parameter types. 3820 * @throws { BusinessError } 12300001 - The system service works abnormally. 3821 * @throws { BusinessError } 12300002 - Invalid credentialInfo, i.e. authType or authSubType. 3822 * @throws { BusinessError } 12300101 - The token is invalid. 3823 * @throws { BusinessError } 12300106 - The authentication type is not supported. 3824 * @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled. 3825 * @throws { BusinessError } 12300111 - The operation time out. 3826 * @throws { BusinessError } 12300115 - The number of credentials reaches the upper limit. 3827 * @syscap SystemCapability.Account.OsAccount 3828 * @systemapi Hide this for inner system use. 3829 * @since 8 3830 */ 3831 /** 3832 * Adds a credential. 3833 * <p> 3834 * Add user credential information, pass in credential addition method and credential information 3835 * (credential type, subclass, if adding user's non password credentials, pass in password authentication token), 3836 * and get the result / acquireInfo callback. 3837 * 3838 * @permission ohos.permission.MANAGE_USER_IDM 3839 * @param { CredentialInfo } credentialInfo - Indicates the credential information. 3840 * @param { IIdmCallback } callback - Indicates the callback to get results and acquireInfo. 3841 * @throws { BusinessError } 201 - Permission denied. 3842 * @throws { BusinessError } 202 - Not system application. 3843 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3844 * <br> 2. Incorrect parameter types. 3845 * @throws { BusinessError } 12300001 - The system service works abnormally. 3846 * @throws { BusinessError } 12300002 - Invalid credentialInfo, i.e. authType or authSubType. 3847 * @throws { BusinessError } 12300101 - The token is invalid. 3848 * @throws { BusinessError } 12300003 - Account not found. 3849 * @throws { BusinessError } 12300106 - The authentication type is not supported. 3850 * @throws { BusinessError } 12300008 - Restricted account. 3851 * @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled. 3852 * @throws { BusinessError } 12300111 - The operation time out. 3853 * @throws { BusinessError } 12300115 - The number of credentials reaches the upper limit. 3854 * @throws { BusinessError } 12300116 - Credential complexity verification failed. 3855 * @syscap SystemCapability.Account.OsAccount 3856 * @systemapi Hide this for inner system use. 3857 * @since 12 3858 */ 3859 addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void; 3860 3861 /** 3862 * Updates credential. 3863 * 3864 * @permission ohos.permission.MANAGE_USER_IDM 3865 * @param { CredentialInfo } credentialInfo - Indicates the credential information. 3866 * @param { IIdmCallback } callback - Indicates the callback to get results and acquireInfo. 3867 * @throws { BusinessError } 201 - Permission denied. 3868 * @throws { BusinessError } 202 - Not system application. 3869 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3870 * <br> 2. Incorrect parameter types. 3871 * @throws { BusinessError } 12300001 - The system service works abnormally. 3872 * @throws { BusinessError } 12300002 - Invalid credentialInfo, i.e. authType or authSubType. 3873 * @throws { BusinessError } 12300101 - The token is invalid. 3874 * @throws { BusinessError } 12300102 - The credential does not exist. 3875 * @throws { BusinessError } 12300106 - The authentication type is not supported. 3876 * @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled. 3877 * @throws { BusinessError } 12300111 - The operation time out. 3878 * @syscap SystemCapability.Account.OsAccount 3879 * @systemapi Hide this for inner system use. 3880 * @since 8 3881 */ 3882 /** 3883 * Updates a credential. 3884 * 3885 * @permission ohos.permission.MANAGE_USER_IDM 3886 * @param { CredentialInfo } credentialInfo - Indicates the credential information. 3887 * @param { IIdmCallback } callback - Indicates the callback to get results and acquireInfo. 3888 * @throws { BusinessError } 201 - Permission denied. 3889 * @throws { BusinessError } 202 - Not system application. 3890 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3891 * <br> 2. Incorrect parameter types. 3892 * @throws { BusinessError } 12300001 - The system service works abnormally. 3893 * @throws { BusinessError } 12300002 - Invalid credentialInfo, i.e. authType or authSubType. 3894 * @throws { BusinessError } 12300003 - Account not found. 3895 * @throws { BusinessError } 12300101 - The token is invalid. 3896 * @throws { BusinessError } 12300102 - The credential does not exist. 3897 * @throws { BusinessError } 12300106 - The authentication type is not supported. 3898 * @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled. 3899 * @throws { BusinessError } 12300111 - The operation time out. 3900 * @throws { BusinessError } 12300116 - Credential complexity verification failed. 3901 * @syscap SystemCapability.Account.OsAccount 3902 * @systemapi Hide this for inner system use. 3903 * @since 12 3904 */ 3905 updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void; 3906 3907 /** 3908 * Closes session. 3909 * <p> 3910 * End an IDM operation. 3911 * 3912 * @permission ohos.permission.MANAGE_USER_IDM 3913 * @throws { BusinessError } 201 - Permission denied. 3914 * @throws { BusinessError } 202 - Not system application. 3915 * @syscap SystemCapability.Account.OsAccount 3916 * @systemapi Hide this for inner system use. 3917 * @since 8 3918 */ 3919 /** 3920 * Closes a session. 3921 * <p> 3922 * End an IDM operation. 3923 * 3924 * @permission ohos.permission.MANAGE_USER_IDM 3925 * @param { number } [accountId] - Indicates the local ID of the OS account. 3926 * @throws { BusinessError } 201 - Permission denied. 3927 * @throws { BusinessError } 202 - Not system application. 3928 * @throws { BusinessError } 401 - Parameter error. Possible causes: Incorrect parameter types. 3929 * @throws { BusinessError } 12300001 - The system service works abnormally. 3930 * @throws { BusinessError } 12300003 - Account not found. 3931 * @throws { BusinessError } 12300008 - Restricted account. 3932 * @syscap SystemCapability.Account.OsAccount 3933 * @systemapi Hide this for inner system use. 3934 * @since 12 3935 */ 3936 closeSession(accountId?: number): void; 3937 3938 /** 3939 * Cancels entry with a challenge value. 3940 * 3941 * @permission ohos.permission.MANAGE_USER_IDM 3942 * @param { Uint8Array } challenge - Indicates the challenge value. 3943 * @throws { BusinessError } 201 - Permission denied. 3944 * @throws { BusinessError } 202 - Not system application. 3945 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3946 * <br> 2. Incorrect parameter types. 3947 * @throws { BusinessError } 12300001 - The system service works abnormally. 3948 * @throws { BusinessError } 12300002 - Invalid challenge. 3949 * @syscap SystemCapability.Account.OsAccount 3950 * @systemapi Hide this for inner system use. 3951 * @since 8 3952 */ 3953 cancel(challenge: Uint8Array): void; 3954 3955 /** 3956 * Deletes the user with the authentication token. 3957 * 3958 * @permission ohos.permission.MANAGE_USER_IDM 3959 * @param { Uint8Array } token - Indicates the authentication token. 3960 * @param { IIdmCallback } callback - Indicates the callback to get the deletion result. 3961 * @throws { BusinessError } 201 - Permission denied. 3962 * @throws { BusinessError } 202 - Not system application. 3963 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3964 * <br> 2. Incorrect parameter types. 3965 * @throws { BusinessError } 12300001 - The system service works abnormally. 3966 * @throws { BusinessError } 12300101 - The token is invalid. 3967 * @syscap SystemCapability.Account.OsAccount 3968 * @systemapi Hide this for inner system use. 3969 * @since 8 3970 */ 3971 delUser(token: Uint8Array, callback: IIdmCallback): void; 3972 3973 /** 3974 * Deletes the user credential information. 3975 * 3976 * @permission ohos.permission.MANAGE_USER_IDM 3977 * @param { Uint8Array } credentialId - Indicates the credential index. 3978 * @param { Uint8Array } token - Indicates the authentication token. 3979 * @param { IIdmCallback } callback - Indicates the callback to get the deletion result. 3980 * @throws { BusinessError } 201 - Permission denied. 3981 * @throws { BusinessError } 202 - Not system application. 3982 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 3983 * <br> 2. Incorrect parameter types. 3984 * @throws { BusinessError } 12300001 - The system service works abnormally. 3985 * @throws { BusinessError } 12300002 - Invalid credentialId. 3986 * @throws { BusinessError } 12300101 - The token is invalid. 3987 * @throws { BusinessError } 12300102 - The credential does not exist. 3988 * @syscap SystemCapability.Account.OsAccount 3989 * @systemapi Hide this for inner system use. 3990 * @since 8 3991 */ 3992 delCred(credentialId: Uint8Array, token: Uint8Array, callback: IIdmCallback): void; 3993 3994 /** 3995 * Gets authentication information. 3996 * 3997 * @permission ohos.permission.USE_USER_IDM 3998 * @param { AsyncCallback<Array<EnrolledCredInfo>> } callback - Indicates the callback to get all registered credential information of 3999 * the specified type for the current user. 4000 * @throws { BusinessError } 201 - Permission denied. 4001 * @throws { BusinessError } 202 - Not system application. 4002 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4003 * <br> 2. Incorrect parameter types. 4004 * @throws { BusinessError } 12300001 - The system service works abnormally. 4005 * @syscap SystemCapability.Account.OsAccount 4006 * @systemapi Hide this for inner system use. 4007 * @since 8 4008 */ 4009 getAuthInfo(callback: AsyncCallback<Array<EnrolledCredInfo>>): void; 4010 4011 /** 4012 * Gets authentication information. 4013 * 4014 * @permission ohos.permission.USE_USER_IDM 4015 * @param { AuthType } authType - Indicates the authentication type. 4016 * @param { AsyncCallback<Array<EnrolledCredInfo>> } callback - Indicates the callback to get all registered credential information of 4017 * the specified type for the current user. 4018 * @throws { BusinessError } 201 - Permission denied. 4019 * @throws { BusinessError } 202 - Not system application. 4020 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4021 * <br> 2. Incorrect parameter types. 4022 * @throws { BusinessError } 12300001 - The system service works abnormally. 4023 * @throws { BusinessError } 12300002 - Invalid authType. 4024 * @syscap SystemCapability.Account.OsAccount 4025 * @systemapi Hide this for inner system use. 4026 * @since 8 4027 */ 4028 getAuthInfo(authType: AuthType, callback: AsyncCallback<Array<EnrolledCredInfo>>): void; 4029 4030 /** 4031 * Gets authentication information. 4032 * 4033 * @permission ohos.permission.USE_USER_IDM 4034 * @param { AuthType } authType - Indicates the authentication type. 4035 * @returns { Promise<Array<EnrolledCredInfo>> } Returns all registered credential information of 4036 * the specified type for the current user. 4037 * @throws { BusinessError } 201 - Permission denied. 4038 * @throws { BusinessError } 202 - Not system application. 4039 * @throws { BusinessError } 401 - Parameter error. Possible causes: Incorrect parameter types. 4040 * @throws { BusinessError } 12300001 - The system service works abnormally. 4041 * @throws { BusinessError } 12300002 - Invalid authType. 4042 * @syscap SystemCapability.Account.OsAccount 4043 * @systemapi Hide this for inner system use. 4044 * @since 8 4045 */ 4046 getAuthInfo(authType?: AuthType): Promise<Array<EnrolledCredInfo>>; 4047 4048 /** 4049 * Gets authentication information. 4050 * 4051 * @permission ohos.permission.USE_USER_IDM 4052 * @param { GetAuthInfoOptions } [options] - Indicates the options for getting the authentication information. 4053 * @returns { Promise<Array<EnrolledCredInfo>> } Returns all enrolled credential information 4054 * according to the options. 4055 * @throws { BusinessError } 201 - Permission denied. 4056 * @throws { BusinessError } 202 - Not system application. 4057 * @throws { BusinessError } 401 - Parameter error. Possible causes: Incorrect parameter types. 4058 * @throws { BusinessError } 12300001 - The system service works abnormally. 4059 * @throws { BusinessError } 12300002 - Invalid options. 4060 * @throws { BusinessError } 12300003 - Account not found. 4061 * @syscap SystemCapability.Account.OsAccount 4062 * @systemapi Hide this for inner system use. 4063 * @since 12 4064 */ 4065 getAuthInfo(options?: GetAuthInfoOptions): Promise<Array<EnrolledCredInfo>>; 4066 4067 /** 4068 * Gets the credential enrolled identifier of the specified authentication type. 4069 * 4070 * @permission ohos.permission.USE_USER_IDM 4071 * @param { AuthType } authType - Indicates the authentication type. 4072 * @param { number } [accountId] - Indicates the OS account identifier. 4073 * @returns { Promise<Uint8Array> } Returns the enrolled identifier. 4074 * @throws { BusinessError } 201 - Permission denied. 4075 * @throws { BusinessError } 202 - Not system application. 4076 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4077 * <br> 2. Incorrect parameter types. 4078 * @throws { BusinessError } 12300001 - The system service works abnormally. 4079 * @throws { BusinessError } 12300002 - Invalid authType. 4080 * @throws { BusinessError } 12300003 - Account not found. 4081 * @throws { BusinessError } 12300102 - The credential does not exist. 4082 * @throws { BusinessError } 12300106 - The authentication type is not supported. 4083 * @syscap SystemCapability.Account.OsAccount 4084 * @systemapi Hide this for inner system use. 4085 * @since 12 4086 */ 4087 getEnrolledId(authType: AuthType, accountId?: number): Promise<Uint8Array>; 4088 } 4089 4090 /** 4091 * Options for getting authentication information. 4092 * 4093 * @typedef GetAuthInfoOptions 4094 * @syscap SystemCapability.Account.OsAccount 4095 * @systemapi 4096 * @since 12 4097 */ 4098 interface GetAuthInfoOptions { 4099 /** 4100 * Indicates the authentication credential type. 4101 * 4102 * @type { ?AuthType } 4103 * @syscap SystemCapability.Account.OsAccount 4104 * @systemapi 4105 * @since 12 4106 */ 4107 authType?: AuthType; 4108 4109 /** 4110 * Indicates the OS account identifier. 4111 * 4112 * @type { ?number } 4113 * @syscap SystemCapability.Account.OsAccount 4114 * @systemapi 4115 * @since 12 4116 */ 4117 accountId?: number; 4118 } 4119 4120 /** 4121 * Indicates the enumeration of the authentication intent. 4122 * 4123 * @enum { number } AuthIntent 4124 * @syscap SystemCapability.Account.OsAccount 4125 * @systemapi 4126 * @since 12 4127 */ 4128 enum AuthIntent { 4129 /** 4130 * Indicates the intent to unlock screen. 4131 * 4132 * @syscap SystemCapability.Account.OsAccount 4133 * @systemapi 4134 * @since 12 4135 */ 4136 UNLOCK = 1, 4137 4138 /** 4139 * Indicates the intent of slient authentication. 4140 * 4141 * @syscap SystemCapability.Account.OsAccount 4142 * @systemapi 4143 * @since 14 4144 */ 4145 SILENT_AUTH = 2, 4146 4147 /** 4148 * Indicates the intent of question authentication. 4149 * 4150 * @syscap SystemCapability.Account.OsAccount 4151 * @systemapi 4152 * @since 14 4153 */ 4154 QUESTION_AUTH = 3, 4155 } 4156 4157 /** 4158 * Options for remote authentication. 4159 * 4160 * @interface RemoteAuthOptions 4161 * @syscap SystemCapability.Account.OsAccount 4162 * @systemapi 4163 * @since 12 4164 */ 4165 interface RemoteAuthOptions { 4166 /** 4167 * Indicates the verifier network identifier. 4168 * 4169 * @type { ?string } 4170 * @syscap SystemCapability.Account.OsAccount 4171 * @systemapi 4172 * @since 12 4173 */ 4174 verifierNetworkId?: string; 4175 4176 /** 4177 * Indicates the collector network identifier. 4178 * 4179 * @type { ?string } 4180 * @syscap SystemCapability.Account.OsAccount 4181 * @systemapi 4182 * @since 12 4183 */ 4184 collectorNetworkId?: string; 4185 4186 /** 4187 * Indicates the collector token identifier. 4188 * 4189 * @type { ?number } 4190 * @syscap SystemCapability.Account.OsAccount 4191 * @systemapi 4192 * @since 12 4193 */ 4194 collectorTokenId?: number; 4195 } 4196 4197 /** 4198 * Options for authentication. 4199 * 4200 * @interface AuthOptions 4201 * @syscap SystemCapability.Account.OsAccount 4202 * @systemapi 4203 * @since 12 4204 */ 4205 interface AuthOptions { 4206 /** 4207 * Indicates the local ID of the OS account to be authenticated. 4208 * 4209 * @type { ?number } 4210 * @syscap SystemCapability.Account.OsAccount 4211 * @systemapi 4212 * @since 12 4213 */ 4214 accountId?: number; 4215 4216 /** 4217 * Indicates the authentication intent. 4218 * 4219 * @type { ?AuthIntent } 4220 * @syscap SystemCapability.Account.OsAccount 4221 * @systemapi 4222 * @since 12 4223 */ 4224 authIntent?: AuthIntent; 4225 4226 /** 4227 * Indicates the remote authentication options. 4228 * 4229 * @type { ?RemoteAuthOptions } 4230 * @syscap SystemCapability.Account.OsAccount 4231 * @systemapi 4232 * @since 12 4233 */ 4234 remoteAuthOptions?: RemoteAuthOptions; 4235 } 4236 4237 /** 4238 * Password data callback. 4239 * 4240 * @interface IInputData 4241 * @syscap SystemCapability.Account.OsAccount 4242 * @systemapi Hide this for inner system use. 4243 * @since 8 4244 */ 4245 interface IInputData { 4246 /** 4247 * Notifies to set data. 4248 * 4249 * @type { function } 4250 * @throws { BusinessError } 202 - Not system application. 4251 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 4252 * <br> 2. Incorrect parameter types. 4253 * @throws { BusinessError } 12300002 - Invalid pinSubType. 4254 * @syscap SystemCapability.Account.OsAccount 4255 * @systemapi Hide this for inner system use. 4256 * @since 8 4257 */ 4258 onSetData: (authSubType: AuthSubType, data: Uint8Array) => void; 4259 } 4260 4261 /** 4262 * Options for getting input data. 4263 * 4264 * @interface GetInputDataOptions 4265 * @syscap SystemCapability.Account.OsAccount 4266 * @systemapi Hide this for inner system use. 4267 * @since 12 4268 */ 4269 interface GetInputDataOptions { 4270 /** 4271 * Indicates the challenge. 4272 * 4273 * @type { ?Uint8Array } 4274 * @syscap SystemCapability.Account.OsAccount 4275 * @systemapi Hide this for inner system use. 4276 * @since 12 4277 */ 4278 challenge?: Uint8Array; 4279 } 4280 4281 /** 4282 * Password input box callback. 4283 * 4284 * @interface IInputer 4285 * @syscap SystemCapability.Account.OsAccount 4286 * @systemapi Hide this for inner system use. 4287 * @since 8 4288 */ 4289 interface IInputer { 4290 /** 4291 * Notifies to get data. 4292 * 4293 * @type { function } 4294 * @syscap SystemCapability.Account.OsAccount 4295 * @systemapi Hide this for inner system use. 4296 * @since 8 4297 */ 4298 onGetData: (authSubType: AuthSubType, callback: IInputData, options: GetInputDataOptions) => void; 4299 } 4300 4301 /** 4302 * User authentication callback. 4303 * 4304 * @interface IUserAuthCallback 4305 * @syscap SystemCapability.Account.OsAccount 4306 * @systemapi Hide this for inner system use. 4307 * @since 8 4308 */ 4309 interface IUserAuthCallback { 4310 /** 4311 * The authentication result code is returned through the callback. 4312 * If the authentication is passed, the authentication token is returned in extraInfo, 4313 * If the authentication fails, the remaining authentication times are returned in extraInfo, 4314 * If the authentication executor is locked, the freezing time is returned in extraInfo. 4315 * 4316 * @type { function } 4317 * @syscap SystemCapability.Account.OsAccount 4318 * @systemapi Hide this for inner system use. 4319 * @since 8 4320 */ 4321 onResult: (result: number, extraInfo: AuthResult) => void; 4322 4323 /** 4324 * During an authentication, the TipsCode is returned through the callback. 4325 * 4326 * @type { ?function } 4327 * @syscap SystemCapability.Account.OsAccount 4328 * @systemapi Hide this for inner system use. 4329 * @since 8 4330 */ 4331 onAcquireInfo?: (module: number, acquire: number, extraInfo: Uint8Array) => void; 4332 } 4333 4334 /** 4335 * Identity manager callback. 4336 * 4337 * @interface IIdmCallback 4338 * @syscap SystemCapability.Account.OsAccount 4339 * @systemapi Hide this for inner system use. 4340 * @since 8 4341 */ 4342 interface IIdmCallback { 4343 /** 4344 * The authentication result code is returned through the callback. 4345 * 4346 * @type { function } 4347 * @syscap SystemCapability.Account.OsAccount 4348 * @systemapi Hide this for inner system use. 4349 * @since 8 4350 */ 4351 onResult: (result: number, extraInfo: RequestResult) => void; 4352 4353 /** 4354 * During an authentication, the TipsCode is returned through the callback. 4355 * 4356 * @type { ?function } 4357 * @syscap SystemCapability.Account.OsAccount 4358 * @systemapi Hide this for inner system use. 4359 * @since 8 4360 */ 4361 onAcquireInfo?: (module: number, acquire: number, extraInfo: Uint8Array) => void; 4362 } 4363 4364 /** 4365 * Provides the information of the get property request. 4366 * 4367 * @interface GetPropertyRequest 4368 * @syscap SystemCapability.Account.OsAccount 4369 * @systemapi Hide this for inner system use. 4370 * @since 8 4371 */ 4372 interface GetPropertyRequest { 4373 /** 4374 * Indicates the authentication credential type. 4375 * 4376 * @type { AuthType } 4377 * @syscap SystemCapability.Account.OsAccount 4378 * @systemapi Hide this for inner system use. 4379 * @since 8 4380 */ 4381 authType: AuthType; 4382 4383 /** 4384 * Indicates the array of property types to get. 4385 * 4386 * @type { Array<GetPropertyType> } 4387 * @syscap SystemCapability.Account.OsAccount 4388 * @systemapi Hide this for inner system use. 4389 * @since 8 4390 */ 4391 keys: Array<GetPropertyType>; 4392 4393 /** 4394 * Indicates the OS account identifier. 4395 * 4396 * @type { ?number } 4397 * @syscap SystemCapability.Account.OsAccount 4398 * @systemapi Hide this for inner system use. 4399 * @since 12 4400 */ 4401 accountId?: number; 4402 } 4403 4404 /** 4405 * Provides the information of the set property request. 4406 * 4407 * @interface SetPropertyRequest 4408 * @syscap SystemCapability.Account.OsAccount 4409 * @systemapi Hide this for inner system use. 4410 * @since 8 4411 */ 4412 interface SetPropertyRequest { 4413 /** 4414 * Indicates the authentication credential type. 4415 * 4416 * @type { AuthType } 4417 * @syscap SystemCapability.Account.OsAccount 4418 * @systemapi Hide this for inner system use. 4419 * @since 8 4420 */ 4421 authType: AuthType; 4422 4423 /** 4424 * Indicates the property type to set. 4425 * 4426 * @type { SetPropertyType } 4427 * @syscap SystemCapability.Account.OsAccount 4428 * @systemapi Hide this for inner system use. 4429 * @since 8 4430 */ 4431 key: SetPropertyType; 4432 4433 /** 4434 * Indicates the information to set. 4435 * 4436 * @type { Uint8Array } 4437 * @syscap SystemCapability.Account.OsAccount 4438 * @systemapi Hide this for inner system use. 4439 * @since 8 4440 */ 4441 setInfo: Uint8Array; 4442 } 4443 4444 /** 4445 * Provides the property of executor. 4446 * 4447 * @interface ExecutorProperty 4448 * @syscap SystemCapability.Account.OsAccount 4449 * @systemapi Hide this for inner system use. 4450 * @since 8 4451 */ 4452 interface ExecutorProperty { 4453 /** 4454 * Indicates the result. 4455 * 4456 * @type { number } 4457 * @syscap SystemCapability.Account.OsAccount 4458 * @systemapi Hide this for inner system use. 4459 * @since 8 4460 */ 4461 result: number; 4462 4463 /** 4464 * Indicates the authentication credential subtype. 4465 * 4466 * @type { AuthSubType } 4467 * @syscap SystemCapability.Account.OsAccount 4468 * @systemapi Hide this for inner system use. 4469 * @since 8 4470 */ 4471 authSubType: AuthSubType; 4472 4473 /** 4474 * Indicates the remaining times. 4475 * 4476 * @type { ?number } 4477 * @syscap SystemCapability.Account.OsAccount 4478 * @systemapi Hide this for inner system use. 4479 * @since 8 4480 */ 4481 remainTimes?: number; 4482 4483 /** 4484 * Indicates the freezing times. 4485 * 4486 * @type { ?number } 4487 * @syscap SystemCapability.Account.OsAccount 4488 * @systemapi Hide this for inner system use. 4489 * @since 8 4490 */ 4491 freezingTime?: number; 4492 4493 /** 4494 * Indicates next phase freezing time. 4495 * 4496 * @type { ?number } 4497 * @syscap SystemCapability.Account.OsAccount 4498 * @systemapi Hide this for inner system use. 4499 * @since 12 4500 */ 4501 nextPhaseFreezingTime?: number; 4502 4503 /** 4504 * Indicates the enrollment progress. 4505 * 4506 * @type { ?string } 4507 * @syscap SystemCapability.Account.OsAccount 4508 * @systemapi Hide this for inner system use. 4509 * @since 10 4510 */ 4511 enrollmentProgress?: string; 4512 4513 /** 4514 * Indicates the sensor information. 4515 * 4516 * @type { ?string } 4517 * @syscap SystemCapability.Account.OsAccount 4518 * @systemapi Hide this for inner system use. 4519 * @since 10 4520 */ 4521 sensorInfo?: string; 4522 } 4523 4524 /** 4525 * Indicates the information of authentication result. 4526 * 4527 * @interface AuthResult 4528 * @syscap SystemCapability.Account.OsAccount 4529 * @systemapi Hide this for inner system use. 4530 * @since 8 4531 */ 4532 interface AuthResult { 4533 /** 4534 * Indicates the authentication token. 4535 * 4536 * @type { ?Uint8Array } 4537 * @syscap SystemCapability.Account.OsAccount 4538 * @systemapi Hide this for inner system use. 4539 * @since 8 4540 */ 4541 token?: Uint8Array; 4542 4543 /** 4544 * Indicates the remaining times. 4545 * 4546 * @type { ?number } 4547 * @syscap SystemCapability.Account.OsAccount 4548 * @systemapi Hide this for inner system use. 4549 * @since 8 4550 */ 4551 remainTimes?: number; 4552 4553 /** 4554 * Indicates the freezing times. 4555 * 4556 * @type { ?number } 4557 * @syscap SystemCapability.Account.OsAccount 4558 * @systemapi Hide this for inner system use. 4559 * @since 8 4560 */ 4561 freezingTime?: number; 4562 4563 /** 4564 * Indicates next phase freezing time. 4565 * 4566 * @type { ?number } 4567 * @syscap SystemCapability.Account.OsAccount 4568 * @systemapi Hide this for inner system use. 4569 * @since 12 4570 */ 4571 nextPhaseFreezingTime?: number; 4572 4573 /** 4574 * Indicates the credential ID. 4575 * 4576 * @type { ?Uint8Array } 4577 * @syscap SystemCapability.Account.OsAccount 4578 * @systemapi Hide this for inner system use. 4579 * @since 12 4580 */ 4581 credentialId?: Uint8Array; 4582 4583 /** 4584 * Indicates the local ID of the authenticated OS account. 4585 * 4586 * @type { ?number } 4587 * @syscap SystemCapability.Account.OsAccount 4588 * @systemapi Hide this for inner system use. 4589 * @since 12 4590 */ 4591 accountId?: number; 4592 4593 /** 4594 * Indicates the validity period after which the PIN will expire. 4595 * 4596 * @type { ?number } 4597 * @syscap SystemCapability.Account.OsAccount 4598 * @systemapi Hide this for inner system use. 4599 * @since 12 4600 */ 4601 pinValidityPeriod?: number; 4602 } 4603 4604 /** 4605 * Indicates the information of credential. 4606 * 4607 * @interface CredentialInfo 4608 * @syscap SystemCapability.Account.OsAccount 4609 * @systemapi Hide this for inner system use. 4610 * @since 8 4611 */ 4612 interface CredentialInfo { 4613 /** 4614 * Indicates the credential type. 4615 * 4616 * @type { AuthType } 4617 * @syscap SystemCapability.Account.OsAccount 4618 * @systemapi Hide this for inner system use. 4619 * @since 8 4620 */ 4621 credType: AuthType; 4622 4623 /** 4624 * Indicates the credential subtype. 4625 * 4626 * @type { AuthSubType } 4627 * @syscap SystemCapability.Account.OsAccount 4628 * @systemapi Hide this for inner system use. 4629 * @since 8 4630 */ 4631 credSubType: AuthSubType; 4632 4633 /** 4634 * Indicates the authentication token. 4635 * 4636 * @type { Uint8Array } 4637 * @syscap SystemCapability.Account.OsAccount 4638 * @systemapi Hide this for inner system use. 4639 * @since 8 4640 */ 4641 token: Uint8Array; 4642 4643 /** 4644 * Indicates the local ID of the OS account to which the credential belongs. 4645 * 4646 * @type { ?number } 4647 * @syscap SystemCapability.Account.OsAccount 4648 * @systemapi Hide this for inner system use. 4649 * @since 12 4650 */ 4651 accountId?: number; 4652 } 4653 4654 /** 4655 * Indicates the information of request result. 4656 * 4657 * @interface RequestResult 4658 * @syscap SystemCapability.Account.OsAccount 4659 * @systemapi Hide this for inner system use. 4660 * @since 8 4661 */ 4662 interface RequestResult { 4663 /** 4664 * Indicates the credential index. 4665 * 4666 * @type { ?Uint8Array } 4667 * @syscap SystemCapability.Account.OsAccount 4668 * @systemapi Hide this for inner system use. 4669 * @since 8 4670 */ 4671 credentialId?: Uint8Array; 4672 } 4673 4674 /** 4675 * Indicates the information of enrolled credential. 4676 * 4677 * @interface EnrolledCredInfo 4678 * @syscap SystemCapability.Account.OsAccount 4679 * @systemapi Hide this for inner system use. 4680 * @since 8 4681 */ 4682 interface EnrolledCredInfo { 4683 /** 4684 * Indicates the credential index. 4685 * 4686 * @type { Uint8Array } 4687 * @syscap SystemCapability.Account.OsAccount 4688 * @systemapi Hide this for inner system use. 4689 * @since 8 4690 */ 4691 credentialId: Uint8Array; 4692 4693 /** 4694 * Indicates the authentication credential type. 4695 * 4696 * @type { AuthType } 4697 * @syscap SystemCapability.Account.OsAccount 4698 * @systemapi Hide this for inner system use. 4699 * @since 8 4700 */ 4701 authType: AuthType; 4702 4703 /** 4704 * Indicates the authentication credential subtype. 4705 * 4706 * @type { AuthSubType } 4707 * @syscap SystemCapability.Account.OsAccount 4708 * @systemapi Hide this for inner system use. 4709 * @since 8 4710 */ 4711 authSubType: AuthSubType; 4712 4713 /** 4714 * Indicates the credential template ID. 4715 * 4716 * @type { Uint8Array } 4717 * @syscap SystemCapability.Account.OsAccount 4718 * @systemapi Hide this for inner system use. 4719 * @since 8 4720 */ 4721 templateId: Uint8Array; 4722 } 4723 4724 /** 4725 * Indicates the property type to get. 4726 * 4727 * @enum { number } GetPropertyType 4728 * @syscap SystemCapability.Account.OsAccount 4729 * @systemapi Hide this for inner system use. 4730 * @since 8 4731 */ 4732 enum GetPropertyType { 4733 /** 4734 * Indicates the authentication subtype. 4735 * 4736 * @syscap SystemCapability.Account.OsAccount 4737 * @systemapi Hide this for inner system use. 4738 * @since 8 4739 */ 4740 AUTH_SUB_TYPE = 1, 4741 4742 /** 4743 * Indicates the remain times. 4744 * 4745 * @syscap SystemCapability.Account.OsAccount 4746 * @systemapi Hide this for inner system use. 4747 * @since 8 4748 */ 4749 REMAIN_TIMES = 2, 4750 4751 /** 4752 * Indicates the freezing time. 4753 * 4754 * @syscap SystemCapability.Account.OsAccount 4755 * @systemapi Hide this for inner system use. 4756 * @since 8 4757 */ 4758 FREEZING_TIME = 3, 4759 4760 /** 4761 * Indicates the enrollment progress. 4762 * 4763 * @syscap SystemCapability.Account.OsAccount 4764 * @systemapi Hide this for inner system use. 4765 * @since 10 4766 */ 4767 ENROLLMENT_PROGRESS = 4, 4768 4769 /** 4770 * Indicates the sensor information. 4771 * 4772 * @syscap SystemCapability.Account.OsAccount 4773 * @systemapi Hide this for inner system use. 4774 * @since 10 4775 */ 4776 SENSOR_INFO = 5, 4777 4778 /** 4779 * Indicates the next phase freezing time. 4780 * 4781 * @syscap SystemCapability.Account.OsAccount 4782 * @systemapi Hide this for inner system use. 4783 * @since 12 4784 */ 4785 NEXT_PHASE_FREEZING_TIME = 6 4786 } 4787 4788 /** 4789 * Indicates the property type to set. 4790 * 4791 * @enum { number } SetPropertyType 4792 * @syscap SystemCapability.Account.OsAccount 4793 * @systemapi Hide this for inner system use. 4794 * @since 8 4795 */ 4796 enum SetPropertyType { 4797 /** 4798 * Indicates the init algorithm. 4799 * 4800 * @syscap SystemCapability.Account.OsAccount 4801 * @systemapi Hide this for inner system use. 4802 * @since 8 4803 */ 4804 INIT_ALGORITHM = 1 4805 } 4806 4807 /** 4808 * Indicates the credential type for authentication. 4809 * 4810 * @enum { number } AuthType 4811 * @syscap SystemCapability.Account.OsAccount 4812 * @systemapi Hide this for inner system use. 4813 * @since 8 4814 */ 4815 enum AuthType { 4816 /** 4817 * Indicates the PIN authentication type. 4818 * 4819 * @syscap SystemCapability.Account.OsAccount 4820 * @systemapi Hide this for inner system use. 4821 * @since 8 4822 */ 4823 PIN = 1, 4824 4825 /** 4826 * Indicates the FACE authentication type. 4827 * 4828 * @syscap SystemCapability.Account.OsAccount 4829 * @systemapi Hide this for inner system use. 4830 * @since 8 4831 */ 4832 FACE = 2, 4833 4834 /** 4835 * Indicates the FINGERPRINT authentication type. 4836 * 4837 * @syscap SystemCapability.Account.OsAccount 4838 * @systemapi Hide this for inner system use. 4839 * @since 10 4840 */ 4841 FINGERPRINT = 4, 4842 4843 /** 4844 * Indicates the RECOVERY_KEY authentication type. 4845 * 4846 * @syscap SystemCapability.Account.OsAccount 4847 * @systemapi Hide this for inner system use. 4848 * @since 12 4849 */ 4850 RECOVERY_KEY = 8, 4851 4852 /** 4853 * Indicates the PRIVATE_PIN authentication type. 4854 * 4855 * @syscap SystemCapability.Account.OsAccount 4856 * @systemapi Hide this for inner system use. 4857 * @since 14 4858 */ 4859 PRIVATE_PIN = 16, 4860 4861 /** 4862 * Indicates the DOMAIN authentication type. 4863 * 4864 * @syscap SystemCapability.Account.OsAccount 4865 * @systemapi Hide this for inner system use. 4866 * @since 9 4867 */ 4868 DOMAIN = 1024 4869 } 4870 4871 /** 4872 * Indicates the credential subtype for authentication. 4873 * 4874 * @enum { number } AuthSubType 4875 * @syscap SystemCapability.Account.OsAccount 4876 * @systemapi Hide this for inner system use. 4877 * @since 8 4878 */ 4879 enum AuthSubType { 4880 /** 4881 * Indicates the 6-digit credential. 4882 * 4883 * @syscap SystemCapability.Account.OsAccount 4884 * @systemapi Hide this for inner system use. 4885 * @since 8 4886 */ 4887 PIN_SIX = 10000, 4888 4889 /** 4890 * Indicates the self-defined digital credential. 4891 * 4892 * @syscap SystemCapability.Account.OsAccount 4893 * @systemapi Hide this for inner system use. 4894 * @since 8 4895 */ 4896 PIN_NUMBER = 10001, 4897 4898 /** 4899 * Indicates the self-defined mixed credential. 4900 * 4901 * @syscap SystemCapability.Account.OsAccount 4902 * @systemapi Hide this for inner system use. 4903 * @since 8 4904 */ 4905 PIN_MIXED = 10002, 4906 4907 /** 4908 * Indicates the 4-digit credential. 4909 * 4910 * @syscap SystemCapability.Account.OsAccount 4911 * @systemapi Hide this for inner system use. 4912 * @since 12 4913 */ 4914 PIN_FOUR = 10003, 4915 4916 /** 4917 * Indicates the pattern credential. 4918 * 4919 * @syscap SystemCapability.Account.OsAccount 4920 * @systemapi Hide this for inner system use. 4921 * @since 12 4922 */ 4923 PIN_PATTERN = 10004, 4924 4925 /** 4926 * Indicates the question credential. 4927 * 4928 * @syscap SystemCapability.Account.OsAccount 4929 * @systemapi Hide this for inner system use. 4930 * @since 14 4931 */ 4932 PIN_QUESTION = 10005, 4933 4934 /** 4935 * Indicates the 2D face credential. 4936 * 4937 * @syscap SystemCapability.Account.OsAccount 4938 * @systemapi Hide this for inner system use. 4939 * @since 8 4940 */ 4941 FACE_2D = 20000, 4942 4943 /** 4944 * Indicates the 3D face credential. 4945 * 4946 * @syscap SystemCapability.Account.OsAccount 4947 * @systemapi Hide this for inner system use. 4948 * @since 8 4949 */ 4950 FACE_3D = 20001, 4951 4952 /** 4953 * Indicates the capacitive fingerprint credential. 4954 * 4955 * @syscap SystemCapability.Account.OsAccount 4956 * @systemapi Hide this for inner system use. 4957 * @since 10 4958 */ 4959 FINGERPRINT_CAPACITIVE = 30000, 4960 4961 /** 4962 * Indicates the optical fingerprint credential. 4963 * 4964 * @syscap SystemCapability.Account.OsAccount 4965 * @systemapi Hide this for inner system use. 4966 * @since 10 4967 */ 4968 FINGERPRINT_OPTICAL = 30001, 4969 4970 /** 4971 * Indicates the ultrasonic fingerprint credential. 4972 * 4973 * @syscap SystemCapability.Account.OsAccount 4974 * @systemapi Hide this for inner system use. 4975 * @since 10 4976 */ 4977 FINGERPRINT_ULTRASONIC = 30002, 4978 4979 /** 4980 * Indicates the mixed domain credential. 4981 * 4982 * @syscap SystemCapability.Account.OsAccount 4983 * @systemapi Hide this for inner system use. 4984 * @since 9 4985 */ 4986 DOMAIN_MIXED = 10240001 4987 } 4988 4989 /** 4990 * Indicates the trusted level of authentication results. 4991 * 4992 * @enum { number } AuthTrustLevel 4993 * @syscap SystemCapability.Account.OsAccount 4994 * @systemapi Hide this for inner system use. 4995 * @since 8 4996 */ 4997 enum AuthTrustLevel { 4998 /** 4999 * Indicates the trusted level 1. 5000 * 5001 * @syscap SystemCapability.Account.OsAccount 5002 * @systemapi Hide this for inner system use. 5003 * @since 8 5004 */ 5005 ATL1 = 10000, 5006 5007 /** 5008 * Indicates the trusted level 2. 5009 * 5010 * @syscap SystemCapability.Account.OsAccount 5011 * @systemapi Hide this for inner system use. 5012 * @since 8 5013 */ 5014 ATL2 = 20000, 5015 5016 /** 5017 * Indicates the trusted level 3. 5018 * 5019 * @syscap SystemCapability.Account.OsAccount 5020 * @systemapi Hide this for inner system use. 5021 * @since 8 5022 */ 5023 ATL3 = 30000, 5024 5025 /** 5026 * Indicates the trusted level 4. 5027 * 5028 * @syscap SystemCapability.Account.OsAccount 5029 * @systemapi Hide this for inner system use. 5030 * @since 8 5031 */ 5032 ATL4 = 40000 5033 } 5034 5035 /** 5036 * Indicates the module of acquired information. 5037 * 5038 * @enum { number } Module 5039 * @syscap SystemCapability.Account.OsAccount 5040 * @systemapi Hide this for inner system use. 5041 * @since 8 5042 */ 5043 enum Module { 5044 /** 5045 * Indicates the information acquired from FaceAuth. 5046 * 5047 * @syscap SystemCapability.Account.OsAccount 5048 * @systemapi Hide this for inner system use. 5049 * @since 8 5050 */ 5051 FACE_AUTH = 1 5052 } 5053 5054 /** 5055 * Indicates the enumeration of authentication result code. 5056 * 5057 * @enum { number } ResultCode 5058 * @syscap SystemCapability.Account.OsAccount 5059 * @systemapi Hide this for inner system use. 5060 * @since 8 5061 */ 5062 enum ResultCode { 5063 /** 5064 * Indicates that authentication is success or ability is supported. 5065 * 5066 * @syscap SystemCapability.Account.OsAccount 5067 * @systemapi Hide this for inner system use. 5068 * @since 8 5069 */ 5070 SUCCESS = 0, 5071 5072 /** 5073 * Indicates the authenticator fails to identify user. 5074 * 5075 * @syscap SystemCapability.Account.OsAccount 5076 * @systemapi Hide this for inner system use. 5077 * @since 8 5078 */ 5079 FAIL = 1, 5080 5081 /** 5082 * Indicates other errors. 5083 * 5084 * @syscap SystemCapability.Account.OsAccount 5085 * @systemapi Hide this for inner system use. 5086 * @since 8 5087 */ 5088 GENERAL_ERROR = 2, 5089 5090 /** 5091 * Indicates that authentication has been canceled. 5092 * 5093 * @syscap SystemCapability.Account.OsAccount 5094 * @systemapi Hide this for inner system use. 5095 * @since 8 5096 */ 5097 CANCELED = 3, 5098 5099 /** 5100 * Indicates that authentication has timed out. 5101 * 5102 * @syscap SystemCapability.Account.OsAccount 5103 * @systemapi Hide this for inner system use. 5104 * @since 8 5105 */ 5106 TIMEOUT = 4, 5107 5108 /** 5109 * Indicates that this authentication type is not supported. 5110 * 5111 * @syscap SystemCapability.Account.OsAccount 5112 * @systemapi Hide this for inner system use. 5113 * @since 8 5114 */ 5115 TYPE_NOT_SUPPORT = 5, 5116 5117 /** 5118 * Indicates that the authentication trust level is not supported. 5119 * 5120 * @syscap SystemCapability.Account.OsAccount 5121 * @systemapi Hide this for inner system use. 5122 * @since 8 5123 */ 5124 TRUST_LEVEL_NOT_SUPPORT = 6, 5125 5126 /** 5127 * Indicates that the authentication task is busy. Wait for a few seconds and try again. 5128 * 5129 * @syscap SystemCapability.Account.OsAccount 5130 * @systemapi Hide this for inner system use. 5131 * @since 8 5132 */ 5133 BUSY = 7, 5134 5135 /** 5136 * Indicates incorrect parameters. 5137 * 5138 * @syscap SystemCapability.Account.OsAccount 5139 * @systemapi Hide this for inner system use. 5140 * @since 8 5141 */ 5142 INVALID_PARAMETERS = 8, 5143 5144 /** 5145 * Indicates that the authenticator is locked. 5146 * 5147 * @syscap SystemCapability.Account.OsAccount 5148 * @systemapi Hide this for inner system use. 5149 * @since 8 5150 */ 5151 LOCKED = 9, 5152 5153 /** 5154 * Indicates that the user has not enrolled the authenticator. 5155 * 5156 * @syscap SystemCapability.Account.OsAccount 5157 * @systemapi Hide this for inner system use. 5158 * @since 8 5159 */ 5160 NOT_ENROLLED = 10 5161 } 5162 5163 /** 5164 * Indicates the enumeration of prompt codes in the process of face authentication. 5165 * 5166 * @enum { number } FaceTipsCode 5167 * @syscap SystemCapability.Account.OsAccount 5168 * @systemapi Hide this for inner system use. 5169 * @since 8 5170 */ 5171 enum FaceTipsCode { 5172 /** 5173 * Indicates that the obtained facial image is too bright due to high illumination. 5174 * 5175 * @syscap SystemCapability.Account.OsAccount 5176 * @systemapi Hide this for inner system use. 5177 * @since 8 5178 */ 5179 FACE_AUTH_TIP_TOO_BRIGHT = 1, 5180 5181 /** 5182 * Indicates that the obtained facial image is too dark due to low illumination. 5183 * 5184 * @syscap SystemCapability.Account.OsAccount 5185 * @systemapi Hide this for inner system use. 5186 * @since 8 5187 */ 5188 FACE_AUTH_TIP_TOO_DARK = 2, 5189 5190 /** 5191 * Indicates that the face is too close to the device. 5192 * 5193 * @syscap SystemCapability.Account.OsAccount 5194 * @systemapi Hide this for inner system use. 5195 * @since 8 5196 */ 5197 FACE_AUTH_TIP_TOO_CLOSE = 3, 5198 5199 /** 5200 * Indicates that the face is too far away from the device. 5201 * 5202 * @syscap SystemCapability.Account.OsAccount 5203 * @systemapi Hide this for inner system use. 5204 * @since 8 5205 */ 5206 FACE_AUTH_TIP_TOO_FAR = 4, 5207 5208 /** 5209 * Indicates that the device is too high, and that only the upper part of the face is captured. 5210 * 5211 * @syscap SystemCapability.Account.OsAccount 5212 * @systemapi Hide this for inner system use. 5213 * @since 8 5214 */ 5215 FACE_AUTH_TIP_TOO_HIGH = 5, 5216 5217 /** 5218 * Indicates that the device is too low, and that only the lower part of the face is captured. 5219 * 5220 * @syscap SystemCapability.Account.OsAccount 5221 * @systemapi Hide this for inner system use. 5222 * @since 8 5223 */ 5224 FACE_AUTH_TIP_TOO_LOW = 6, 5225 5226 /** 5227 * Indicates that the device is deviated to the right, and that only the right part of the face is captured. 5228 * 5229 * @syscap SystemCapability.Account.OsAccount 5230 * @systemapi Hide this for inner system use. 5231 * @since 8 5232 */ 5233 FACE_AUTH_TIP_TOO_RIGHT = 7, 5234 5235 /** 5236 * Indicates that the device is deviated to the left, and that only the left part of the face is captured. 5237 * 5238 * @syscap SystemCapability.Account.OsAccount 5239 * @systemapi Hide this for inner system use. 5240 * @since 8 5241 */ 5242 FACE_AUTH_TIP_TOO_LEFT = 8, 5243 5244 /** 5245 * Indicates that the face moves too fast during facial information collection. 5246 * 5247 * @syscap SystemCapability.Account.OsAccount 5248 * @systemapi Hide this for inner system use. 5249 * @since 8 5250 */ 5251 FACE_AUTH_TIP_TOO_MUCH_MOTION = 9, 5252 5253 /** 5254 * Indicates that the face is not facing the device. 5255 * 5256 * @syscap SystemCapability.Account.OsAccount 5257 * @systemapi Hide this for inner system use. 5258 * @since 8 5259 */ 5260 FACE_AUTH_TIP_POOR_GAZE = 10, 5261 5262 /** 5263 * Indicates that no face is detected. 5264 * 5265 * @syscap SystemCapability.Account.OsAccount 5266 * @systemapi Hide this for inner system use. 5267 * @since 8 5268 */ 5269 FACE_AUTH_TIP_NOT_DETECTED = 11 5270 } 5271 5272 /** 5273 * Indicates the enumeration of prompt codes in the process of fingerprint authentication. 5274 * 5275 * @enum { number } FingerprintTips 5276 * @syscap SystemCapability.Account.OsAccount 5277 * @systemapi Hide this for inner system use. 5278 * @since 8 5279 */ 5280 enum FingerprintTips { 5281 /** 5282 * Indicates that the image acquired is good. 5283 * 5284 * @syscap SystemCapability.Account.OsAccount 5285 * @systemapi Hide this for inner system use. 5286 * @since 8 5287 */ 5288 FINGERPRINT_TIP_GOOD = 0, 5289 5290 /** 5291 * Indicates that the fingerprint image is too noisy due to suspected or detected dirt on the sensor. 5292 * 5293 * @syscap SystemCapability.Account.OsAccount 5294 * @systemapi Hide this for inner system use. 5295 * @since 8 5296 */ 5297 FINGERPRINT_TIP_IMAGER_DIRTY = 1, 5298 5299 /** 5300 * Indicates that the fingerprint image is too noisy to process due to a detected condition. 5301 * 5302 * @syscap SystemCapability.Account.OsAccount 5303 * @systemapi Hide this for inner system use. 5304 * @since 8 5305 */ 5306 FINGERPRINT_TIP_INSUFFICIENT = 2, 5307 5308 /** 5309 * Indicates that only a partial fingerprint image is detected. 5310 * 5311 * @syscap SystemCapability.Account.OsAccount 5312 * @systemapi Hide this for inner system use. 5313 * @since 8 5314 */ 5315 FINGERPRINT_TIP_PARTIAL = 3, 5316 5317 /** 5318 * Indicates that the fingerprint image is incomplete due to quick motion. 5319 * 5320 * @syscap SystemCapability.Account.OsAccount 5321 * @systemapi Hide this for inner system use. 5322 * @since 8 5323 */ 5324 FINGERPRINT_TIP_TOO_FAST = 4, 5325 5326 /** 5327 * Indicates that the fingerprint image is unreadable due to lack of motion. 5328 * 5329 * @syscap SystemCapability.Account.OsAccount 5330 * @systemapi Hide this for inner system use. 5331 * @since 8 5332 */ 5333 FINGERPRINT_TIP_TOO_SLOW = 5, 5334 5335 /** 5336 * Indicates that the finger is down. 5337 * 5338 * @syscap SystemCapability.Account.OsAccount 5339 * @systemapi Hide this for inner system use. 5340 * @since 10 5341 */ 5342 FINGERPRINT_TIP_FINGER_DOWN = 6, 5343 5344 /** 5345 * Indicates that the finger is up. 5346 * 5347 * @syscap SystemCapability.Account.OsAccount 5348 * @systemapi Hide this for inner system use. 5349 * @since 10 5350 */ 5351 FINGERPRINT_TIP_FINGER_UP = 7 5352 } 5353 5354 /** 5355 * Enumerates for constraint source types. 5356 * 5357 * @enum { number } ConstraintSourceType 5358 * @syscap SystemCapability.Account.OsAccount 5359 * @systemapi Hide this for inner system use. 5360 * @since 9 5361 */ 5362 enum ConstraintSourceType { 5363 /** 5364 * No constraints are set 5365 * 5366 * @syscap SystemCapability.Account.OsAccount 5367 * @systemapi Hide this for inner system use. 5368 * @since 9 5369 */ 5370 CONSTRAINT_NOT_EXIST = 0, 5371 5372 /** 5373 * Constraint is set by setOsAccountConstraints 5374 * 5375 * @syscap SystemCapability.Account.OsAccount 5376 * @systemapi Hide this for inner system use. 5377 * @since 9 5378 */ 5379 CONSTRAINT_TYPE_BASE = 1, 5380 5381 /** 5382 * Constraint is set by device owner 5383 * 5384 * @syscap SystemCapability.Account.OsAccount 5385 * @systemapi Hide this for inner system use. 5386 * @since 9 5387 */ 5388 CONSTRAINT_TYPE_DEVICE_OWNER = 2, 5389 5390 /** 5391 * Constraint is set by profile owner 5392 * 5393 * @syscap SystemCapability.Account.OsAccount 5394 * @systemapi Hide this for inner system use. 5395 * @since 9 5396 */ 5397 CONSTRAINT_TYPE_PROFILE_OWNER = 3 5398 } 5399 5400 /** 5401 * Provides information about the constraint source type info of an os account. 5402 * 5403 * @interface ConstraintSourceTypeInfo 5404 * @syscap SystemCapability.Account.OsAccount 5405 * @systemapi Hide this for inner system use. 5406 * @since 9 5407 */ 5408 interface ConstraintSourceTypeInfo { 5409 /** 5410 * Indicates the id of an os account who set the constraint. 5411 * When type is CONSTRAINT_NOT_EXIST or CONSTRAINT_TYPE_BASE, localId will be -1. 5412 * 5413 * @type { number } 5414 * @syscap SystemCapability.Account.OsAccount 5415 * @systemapi Hide this for inner system use. 5416 * @since 9 5417 */ 5418 localId: number; 5419 5420 /** 5421 * Indicates the source type of the constraint. 5422 * 5423 * @type { ConstraintSourceType } 5424 * @syscap SystemCapability.Account.OsAccount 5425 * @systemapi Hide this for inner system use. 5426 * @since 9 5427 */ 5428 type: ConstraintSourceType; 5429 } 5430} 5431 5432export default osAccount;