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