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