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