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