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