1/* 2 * Copyright (c) 2024 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 AssetStoreKit 19 */ 20 21/** 22 * This module provides the capabilities for life cycle management of sensitive user data (Asset) such as passwords 23 * and tokens, including adding, removing, updating, and querying. 24 * 25 * @namespace asset 26 * @syscap SystemCapability.Security.Asset 27 * @since 11 28 */ 29/** 30 * This module provides the capabilities for life cycle management of sensitive user data (Asset) such as passwords 31 * and tokens, including adding, removing, updating, and querying. 32 * 33 * @namespace asset 34 * @syscap SystemCapability.Security.Asset 35 * @atomicservice 36 * @since 14 37 */ 38declare namespace asset { 39 /** 40 * Add an Asset. 41 * Permission ohos.permission.STORE_PERSISTENT_DATA is required when the Asset needs to be stored persistently 42 * by setting {@link Tag.IS_PERSISTENT} tag. 43 * 44 * @param { AssetMap } attributes - a map object containing attributes of the Asset to be added. 45 * @returns { Promise<void> } the promise object returned by the function. 46 * @throws { BusinessError } 201 - The caller doesn't have the permission. 47 * @throws { BusinessError } 401 - Parameter error. Possible causes: 48 * 1. Mandatory parameters are left unspecified. 49 * 2. Incorrect parameter types. 50 * 3. Parameter verification failed. 51 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 52 * @throws { BusinessError } 24000003 - The asset already exists. 53 * @throws { BusinessError } 24000005 - The screen lock status does not match. 54 * @throws { BusinessError } 24000006 - Insufficient memory. 55 * @throws { BusinessError } 24000007 - The asset is corrupted. 56 * @throws { BusinessError } 24000008 - The database operation failed. 57 * @throws { BusinessError } 24000009 - The cryptography operation failed. 58 * @throws { BusinessError } 24000010 - IPC failed. 59 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 60 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 61 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 62 * @throws { BusinessError } 24000014 - The file operation failed. 63 * @throws { BusinessError } 24000015 - Getting the system time failed. 64 * @syscap SystemCapability.Security.Asset 65 * @since 11 66 */ 67 /** 68 * Add an asset. This API uses a promise to return the result. 69 * To set {@link Tag.IS_PERSISTENT}, the application must have the ohos.permission.STORE_PERSISTENT_DATA permission. 70 * 71 * @param { AssetMap } attributes - Attributes of the asset to add, including the asset plaintext, 72 * access control attributes, and custom data. 73 * @returns { Promise<void> } Promise that returns no value. 74 * @throws { BusinessError } 201 - The caller doesn't have the permission. 75 * @throws { BusinessError } 401 - Parameter error. Possible causes: 76 * 1. Mandatory parameters are left unspecified. 77 * 2. Incorrect parameter types. 78 * 3. Parameter verification failed. 79 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 80 * @throws { BusinessError } 24000003 - The asset already exists. 81 * @throws { BusinessError } 24000005 - The screen lock status does not match. 82 * @throws { BusinessError } 24000006 - Insufficient memory. 83 * @throws { BusinessError } 24000007 - The asset is corrupted. 84 * @throws { BusinessError } 24000008 - The database operation failed. 85 * @throws { BusinessError } 24000009 - The cryptography operation failed. 86 * @throws { BusinessError } 24000010 - IPC failed. 87 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 88 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 89 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 90 * @throws { BusinessError } 24000014 - The file operation failed. 91 * @throws { BusinessError } 24000015 - Getting the system time failed. 92 * @syscap SystemCapability.Security.Asset 93 * @atomicservice 94 * @since 14 95 */ 96 function add(attributes: AssetMap): Promise<void>; 97 98 /** 99 * Add an Asset to a specific user space. 100 * Permission ohos.permission.STORE_PERSISTENT_DATA is required when the Asset needs to be stored persistently 101 * by setting {@link Tag.IS_PERSISTENT} tag. 102 * 103 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 104 * @param { number } userId - the user identifier to add an Asset. The user identifier cannot be lower than 100. 105 * @param { AssetMap } attributes - a map object containing attributes of the Asset to be added. 106 * @returns { Promise<void> } the promise object returned by the function. 107 * @throws { BusinessError } 201 - The caller doesn't have the permission. 108 * @throws { BusinessError } 202 - Non-system applications use system APIs. 109 * @throws { BusinessError } 401 - Parameter error. Possible causes: 110 * 1. Mandatory parameters are left unspecified. 111 * 2. Incorrect parameter types. 112 * 3. Parameter verification failed. 113 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 114 * @throws { BusinessError } 24000003 - The asset already exists. 115 * @throws { BusinessError } 24000005 - The screen lock status does not match. 116 * @throws { BusinessError } 24000006 - Insufficient memory. 117 * @throws { BusinessError } 24000007 - The asset is corrupted. 118 * @throws { BusinessError } 24000008 - The database operation failed. 119 * @throws { BusinessError } 24000009 - The cryptography operation failed. 120 * @throws { BusinessError } 24000010 - IPC failed. 121 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 122 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 123 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 124 * @throws { BusinessError } 24000014 - The file operation failed. 125 * @throws { BusinessError } 24000015 - Getting the system time failed. 126 * @syscap SystemCapability.Security.Asset 127 * @systemapi 128 * @since 12 129 */ 130 function addAsUser(userId: number, attributes: AssetMap): Promise<void>; 131 132 /** 133 * Add an Asset. 134 * Permission ohos.permission.STORE_PERSISTENT_DATA is required when the Asset needs to be stored persistently 135 * by setting {@link Tag.IS_PERSISTENT} tag. 136 * 137 * @param { AssetMap } attributes - a map object containing attributes of the Asset to be added. 138 * @throws { BusinessError } 201 - The caller doesn't have the permission. 139 * @throws { BusinessError } 401 - Parameter error. Possible causes: 140 * 1. Mandatory parameters are left unspecified. 141 * 2. Incorrect parameter types. 142 * 3. Parameter verification failed. 143 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 144 * @throws { BusinessError } 24000003 - The asset already exists. 145 * @throws { BusinessError } 24000005 - The screen lock status does not match. 146 * @throws { BusinessError } 24000006 - Insufficient memory. 147 * @throws { BusinessError } 24000007 - The asset is corrupted. 148 * @throws { BusinessError } 24000008 - The database operation failed. 149 * @throws { BusinessError } 24000009 - The cryptography operation failed. 150 * @throws { BusinessError } 24000010 - IPC failed. 151 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 152 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 153 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 154 * @throws { BusinessError } 24000014 - The file operation failed. 155 * @throws { BusinessError } 24000015 - Getting the system time failed. 156 * @syscap SystemCapability.Security.Asset 157 * @since 12 158 */ 159 /** 160 * Add an asset. This API returns the result synchronously. 161 * To set {@link Tag.IS_PERSISTENT}, the application must have the ohos.permission.STORE_PERSISTENT_DATA permission. 162 * 163 * @param { AssetMap } attributes - Attributes of the asset to add, including the asset plaintext, 164 * access control attributes, and custom data. 165 * @throws { BusinessError } 201 - The caller doesn't have the permission. 166 * @throws { BusinessError } 401 - Parameter error. Possible causes: 167 * 1. Mandatory parameters are left unspecified. 168 * 2. Incorrect parameter types. 169 * 3. Parameter verification failed. 170 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 171 * @throws { BusinessError } 24000003 - The asset already exists. 172 * @throws { BusinessError } 24000005 - The screen lock status does not match. 173 * @throws { BusinessError } 24000006 - Insufficient memory. 174 * @throws { BusinessError } 24000007 - The asset is corrupted. 175 * @throws { BusinessError } 24000008 - The database operation failed. 176 * @throws { BusinessError } 24000009 - The cryptography operation failed. 177 * @throws { BusinessError } 24000010 - IPC failed. 178 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 179 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 180 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 181 * @throws { BusinessError } 24000014 - The file operation failed. 182 * @throws { BusinessError } 24000015 - Getting the system time failed. 183 * @syscap SystemCapability.Security.Asset 184 * @atomicservice 185 * @since 14 186 */ 187 function addSync(attributes: AssetMap): void; 188 189 /** 190 * Remove one or more Assets that match a search query. 191 * 192 * @param { AssetMap } query - a map object containing attributes of the Asset to be removed. 193 * @returns { Promise<void> } the promise object returned by the function. 194 * @throws { BusinessError } 401 - Parameter error. Possible causes: 195 * 1. Incorrect parameter types. 196 * 2. Parameter verification failed. 197 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 198 * @throws { BusinessError } 24000002 - The asset is not found. 199 * @throws { BusinessError } 24000006 - Insufficient memory. 200 * @throws { BusinessError } 24000007 - The asset is corrupted. 201 * @throws { BusinessError } 24000008 - The database operation failed. 202 * @throws { BusinessError } 24000010 - IPC failed. 203 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 204 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 205 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 206 * @throws { BusinessError } 24000015 - Getting the system time failed. 207 * @syscap SystemCapability.Security.Asset 208 * @since 11 209 */ 210 /** 211 * Removes one or more assets. This API uses a promise to return the result. 212 * 213 * @param { AssetMap } query - Attributes of the asset to remove, such as the asset alias, 214 * access control attributes, and custom data. 215 * @returns { Promise<void> } Promise that returns no value. 216 * @throws { BusinessError } 401 - Parameter error. Possible causes: 217 * 1. Incorrect parameter types. 218 * 2. Parameter verification failed. 219 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 220 * @throws { BusinessError } 24000002 - The asset is not found. 221 * @throws { BusinessError } 24000006 - Insufficient memory. 222 * @throws { BusinessError } 24000007 - The asset is corrupted. 223 * @throws { BusinessError } 24000008 - The database operation failed. 224 * @throws { BusinessError } 24000010 - IPC failed. 225 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 226 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 227 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 228 * @throws { BusinessError } 24000015 - Getting the system time failed. 229 * @syscap SystemCapability.Security.Asset 230 * @atomicservice 231 * @since 14 232 */ 233 function remove(query: AssetMap): Promise<void>; 234 235 /** 236 * Remove one or more Assets that match a search query from a specific user space. 237 * 238 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 239 * @param { number } userId - the user identifier to remove one or more Assets. The user identifier cannot be lower 240 * than 100. 241 * @param { AssetMap } query - a map object containing attributes of the Asset to be removed. 242 * @returns { Promise<void> } the promise object returned by the function. 243 * @throws { BusinessError } 201 - The caller doesn't have the permission. 244 * @throws { BusinessError } 202 - Non-system applications use system APIs. 245 * @throws { BusinessError } 401 - Parameter error. Possible causes: 246 * 1. Incorrect parameter types. 247 * 2. Parameter verification failed. 248 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 249 * @throws { BusinessError } 24000002 - The asset is not found. 250 * @throws { BusinessError } 24000006 - Insufficient memory. 251 * @throws { BusinessError } 24000007 - The asset is corrupted. 252 * @throws { BusinessError } 24000008 - The database operation failed. 253 * @throws { BusinessError } 24000010 - IPC failed. 254 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 255 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 256 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 257 * @throws { BusinessError } 24000015 - Getting the system time failed. 258 * @syscap SystemCapability.Security.Asset 259 * @systemapi 260 * @since 12 261 */ 262 function removeAsUser(userId: number, query: AssetMap): Promise<void>; 263 264 /** 265 * Remove one or more Assets that match a search query. 266 * 267 * @param { AssetMap } query - a map object containing attributes of the Asset to be removed. 268 * @throws { BusinessError } 401 - Parameter error. Possible causes: 269 * 1. Incorrect parameter types. 270 * 2. Parameter verification failed. 271 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 272 * @throws { BusinessError } 24000002 - The asset is not found. 273 * @throws { BusinessError } 24000006 - Insufficient memory. 274 * @throws { BusinessError } 24000007 - The asset is corrupted. 275 * @throws { BusinessError } 24000008 - The database operation failed. 276 * @throws { BusinessError } 24000010 - IPC failed. 277 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 278 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 279 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 280 * @throws { BusinessError } 24000015 - Getting the system time failed. 281 * @syscap SystemCapability.Security.Asset 282 * @since 12 283 */ 284 /** 285 * Removes one or more assets. This API returns the result synchronously. 286 * 287 * @param { AssetMap } query - Attributes of the asset to remove, such as the asset alias, 288 * access control attributes, and custom data. 289 * @throws { BusinessError } 401 - Parameter error. Possible causes: 290 * 1. Incorrect parameter types. 291 * 2. Parameter verification failed. 292 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 293 * @throws { BusinessError } 24000002 - The asset is not found. 294 * @throws { BusinessError } 24000006 - Insufficient memory. 295 * @throws { BusinessError } 24000007 - The asset is corrupted. 296 * @throws { BusinessError } 24000008 - The database operation failed. 297 * @throws { BusinessError } 24000010 - IPC failed. 298 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 299 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 300 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 301 * @throws { BusinessError } 24000015 - Getting the system time failed. 302 * @syscap SystemCapability.Security.Asset 303 * @atomicservice 304 * @since 14 305 */ 306 function removeSync(query: AssetMap): void; 307 308 /** 309 * Update an Asset that matches a search query. 310 * 311 * @param { AssetMap } query - a map object containing attributes of the Asset to be updated. 312 * @param { AssetMap } attributesToUpdate - a map object containing attributes with new values. 313 * @returns { Promise<void> } the promise object returned by the function. 314 * @throws { BusinessError } 401 - Parameter error. Possible causes: 315 * 1. Mandatory parameters are left unspecified. 316 * 2. Incorrect parameter types. 317 * 3. Parameter verification failed. 318 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 319 * @throws { BusinessError } 24000002 - The asset is not found. 320 * @throws { BusinessError } 24000005 - The screen lock status does not match. 321 * @throws { BusinessError } 24000006 - Insufficient memory. 322 * @throws { BusinessError } 24000007 - The asset is corrupted. 323 * @throws { BusinessError } 24000008 - The database operation failed. 324 * @throws { BusinessError } 24000009 - The cryptography operation failed. 325 * @throws { BusinessError } 24000010 - IPC failed. 326 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 327 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 328 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 329 * @throws { BusinessError } 24000015 - Getting the system time failed. 330 * @syscap SystemCapability.Security.Asset 331 * @since 11 332 */ 333 /** 334 * Updates an asset. This API uses a promise to return the result. 335 * 336 * @param { AssetMap } query - Attributes of the asset to update, such as the asset alias, 337 * access control attributes, and custom data. 338 * @param { AssetMap } attributesToUpdate - New attributes of the asset, such as the asset plaintext and custom data. 339 * @returns { Promise<void> } Promise that returns no value. 340 * @throws { BusinessError } 401 - Parameter error. Possible causes: 341 * 1. Mandatory parameters are left unspecified. 342 * 2. Incorrect parameter types. 343 * 3. Parameter verification failed. 344 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 345 * @throws { BusinessError } 24000002 - The asset is not found. 346 * @throws { BusinessError } 24000005 - The screen lock status does not match. 347 * @throws { BusinessError } 24000006 - Insufficient memory. 348 * @throws { BusinessError } 24000007 - The asset is corrupted. 349 * @throws { BusinessError } 24000008 - The database operation failed. 350 * @throws { BusinessError } 24000009 - The cryptography operation failed. 351 * @throws { BusinessError } 24000010 - IPC failed. 352 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 353 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 354 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 355 * @throws { BusinessError } 24000015 - Getting the system time failed. 356 * @syscap SystemCapability.Security.Asset 357 * @atomicservice 358 * @since 14 359 */ 360 function update(query: AssetMap, attributesToUpdate: AssetMap): Promise<void>; 361 362 /** 363 * Update an Asset that matches a search query in a specific user space. 364 * 365 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 366 * @param { number } userId - the user identifier to update an Asset. The user identifier cannot be lower than 100. 367 * @param { AssetMap } query - a map object containing attributes of the Asset to be updated. 368 * @param { AssetMap } attributesToUpdate - a map object containing attributes with new values. 369 * @returns { Promise<void> } the promise object returned by the function. 370 * @throws { BusinessError } 201 - The caller doesn't have the permission. 371 * @throws { BusinessError } 202 - Non-system applications use system APIs. 372 * @throws { BusinessError } 401 - Parameter error. Possible causes: 373 * 1. Mandatory parameters are left unspecified. 374 * 2. Incorrect parameter types. 375 * 3. Parameter verification failed. 376 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 377 * @throws { BusinessError } 24000002 - The asset is not found. 378 * @throws { BusinessError } 24000005 - The screen lock status does not match. 379 * @throws { BusinessError } 24000006 - Insufficient memory. 380 * @throws { BusinessError } 24000007 - The asset is corrupted. 381 * @throws { BusinessError } 24000008 - The database operation failed. 382 * @throws { BusinessError } 24000009 - The cryptography operation failed. 383 * @throws { BusinessError } 24000010 - IPC failed. 384 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 385 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 386 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 387 * @throws { BusinessError } 24000015 - Getting the system time failed. 388 * @syscap SystemCapability.Security.Asset 389 * @systemapi 390 * @since 12 391 */ 392 function updateAsUser(userId: number, query: AssetMap, attributesToUpdate: AssetMap): Promise<void>; 393 394 /** 395 * Update an Asset that matches a search query. 396 * 397 * @param { AssetMap } query - a map object containing attributes of the Asset to be updated. 398 * @param { AssetMap } attributesToUpdate - a map object containing attributes with new values. 399 * @throws { BusinessError } 401 - Parameter error. Possible causes: 400 * 1. Mandatory parameters are left unspecified. 401 * 2. Incorrect parameter types. 402 * 3. Parameter verification failed. 403 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 404 * @throws { BusinessError } 24000002 - The asset is not found. 405 * @throws { BusinessError } 24000005 - The screen lock status does not match. 406 * @throws { BusinessError } 24000006 - Insufficient memory. 407 * @throws { BusinessError } 24000007 - The asset is corrupted. 408 * @throws { BusinessError } 24000008 - The database operation failed. 409 * @throws { BusinessError } 24000009 - The cryptography operation failed. 410 * @throws { BusinessError } 24000010 - IPC failed. 411 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 412 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 413 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 414 * @throws { BusinessError } 24000015 - Getting the system time failed. 415 * @syscap SystemCapability.Security.Asset 416 * @since 12 417 */ 418 /** 419 * Updates an asset. This API returns the result synchronously. 420 * 421 * @param { AssetMap } query - Attributes of the asset to update, such as the asset alias, 422 * access control attributes, and custom data. 423 * @param { AssetMap } attributesToUpdate - New attributes of the asset, such as the asset plaintext and custom data. 424 * @throws { BusinessError } 401 - Parameter error. Possible causes: 425 * 1. Mandatory parameters are left unspecified. 426 * 2. Incorrect parameter types. 427 * 3. Parameter verification failed. 428 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 429 * @throws { BusinessError } 24000002 - The asset is not found. 430 * @throws { BusinessError } 24000005 - The screen lock status does not match. 431 * @throws { BusinessError } 24000006 - Insufficient memory. 432 * @throws { BusinessError } 24000007 - The asset is corrupted. 433 * @throws { BusinessError } 24000008 - The database operation failed. 434 * @throws { BusinessError } 24000009 - The cryptography operation failed. 435 * @throws { BusinessError } 24000010 - IPC failed. 436 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 437 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 438 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 439 * @throws { BusinessError } 24000015 - Getting the system time failed. 440 * @syscap SystemCapability.Security.Asset 441 * @atomicservice 442 * @since 14 443 */ 444 function updateSync(query: AssetMap, attributesToUpdate: AssetMap): void; 445 446 /** 447 * Preprocessing (e.g. get challenge) for querying one or more Assets that require user authentication. 448 * 449 * @param { AssetMap } query - a map object containing attributes of the Asset to be queried. 450 * @returns { Promise<Uint8Array> } the promise object returned by the function. 451 * @throws { BusinessError } 401 - Parameter error. Possible causes: 452 * 1. Incorrect parameter types. 453 * 2. Parameter verification failed. 454 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 455 * @throws { BusinessError } 24000002 - The asset is not found. 456 * @throws { BusinessError } 24000005 - The screen lock status does not match. 457 * @throws { BusinessError } 24000006 - Insufficient memory. 458 * @throws { BusinessError } 24000007 - The asset is corrupted. 459 * @throws { BusinessError } 24000008 - The database operation failed. 460 * @throws { BusinessError } 24000009 - The cryptography operation failed. 461 * @throws { BusinessError } 24000010 - IPC failed. 462 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 463 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 464 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 465 * @throws { BusinessError } 24000016 - The cache exceeds the limit. 466 * @throws { BusinessError } 24000017 - The capability is not supported. 467 * @syscap SystemCapability.Security.Asset 468 * @since 11 469 */ 470 /** 471 * Performs preprocessing for the asset query. This API is used when user authentication is required for 472 * the access to the asset. After the user authentication is successful, call {@link query} and 473 * {@link postQuery}. This API uses a promise to return the result. 474 * 475 * @param { AssetMap } query - Attributes of the asset to query, such as the asset alias, 476 * access control attributes, and custom data. 477 * @returns { Promise<Uint8Array> } Promise used to return a challenge value. 478 * @throws { BusinessError } 401 - Parameter error. Possible causes: 479 * 1. Incorrect parameter types. 480 * 2. Parameter verification failed. 481 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 482 * @throws { BusinessError } 24000002 - The asset is not found. 483 * @throws { BusinessError } 24000005 - The screen lock status does not match. 484 * @throws { BusinessError } 24000006 - Insufficient memory. 485 * @throws { BusinessError } 24000007 - The asset is corrupted. 486 * @throws { BusinessError } 24000008 - The database operation failed. 487 * @throws { BusinessError } 24000009 - The cryptography operation failed. 488 * @throws { BusinessError } 24000010 - IPC failed. 489 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 490 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 491 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 492 * @throws { BusinessError } 24000016 - The cache exceeds the limit. 493 * @throws { BusinessError } 24000017 - The capability is not supported. 494 * @syscap SystemCapability.Security.Asset 495 * @atomicservice 496 * @since 14 497 */ 498 function preQuery(query: AssetMap): Promise<Uint8Array>; 499 500 /** 501 * Preprocessing (e.g. get challenge) for querying one or more Assets 502 * that require user authentication in a specific user space. 503 * 504 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 505 * @param { number } userId - the user identifier to pre-query one or more Assets. The user identifier cannot be 506 * lower than 100. 507 * @param { AssetMap } query - a map object containing attributes of the Asset to be queried. 508 * @returns { Promise<Uint8Array> } the promise object returned by the function. 509 * @throws { BusinessError } 201 - The caller doesn't have the permission. 510 * @throws { BusinessError } 202 - Non-system applications use system APIs. 511 * @throws { BusinessError } 401 - Parameter error. Possible causes: 512 * 1. Incorrect parameter types. 513 * 2. Parameter verification failed. 514 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 515 * @throws { BusinessError } 24000002 - The asset is not found. 516 * @throws { BusinessError } 24000005 - The screen lock status does not match. 517 * @throws { BusinessError } 24000006 - Insufficient memory. 518 * @throws { BusinessError } 24000007 - The asset is corrupted. 519 * @throws { BusinessError } 24000008 - The database operation failed. 520 * @throws { BusinessError } 24000009 - The cryptography operation failed. 521 * @throws { BusinessError } 24000010 - IPC failed. 522 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 523 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 524 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 525 * @throws { BusinessError } 24000016 - The cache exceeds the limit. 526 * @throws { BusinessError } 24000017 - The capability is not supported. 527 * @syscap SystemCapability.Security.Asset 528 * @systemapi 529 * @since 12 530 */ 531 function preQueryAsUser(userId: number, query: AssetMap): Promise<Uint8Array>; 532 533 /** 534 * Preprocessing (e.g. get challenge) for querying one or more Assets that require user authentication. 535 * 536 * @param { AssetMap } query - a map object containing attributes of the Asset to be queried. 537 * @returns { Uint8Array } the challenge value to be used when {@link querySync} is called. 538 * @throws { BusinessError } 401 - Parameter error. Possible causes: 539 * 1. Incorrect parameter types. 540 * 2. Parameter verification failed. 541 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 542 * @throws { BusinessError } 24000002 - The asset is not found. 543 * @throws { BusinessError } 24000005 - The screen lock status does not match. 544 * @throws { BusinessError } 24000006 - Insufficient memory. 545 * @throws { BusinessError } 24000007 - The asset is corrupted. 546 * @throws { BusinessError } 24000008 - The database operation failed. 547 * @throws { BusinessError } 24000009 - The cryptography operation failed. 548 * @throws { BusinessError } 24000010 - IPC failed. 549 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 550 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 551 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 552 * @throws { BusinessError } 24000016 - The cache exceeds the limit. 553 * @throws { BusinessError } 24000017 - The capability is not supported. 554 * @syscap SystemCapability.Security.Asset 555 * @since 12 556 */ 557 /** 558 * Performs preprocessing for the asset query. This API is used when user authentication is required for 559 * the access to the asset. After the user authentication is successful, call {@link querySync} and 560 * {@link postQuerySync}. This API returns the result synchronously. 561 * 562 * @param { AssetMap } query - Attributes of the asset to query, such as the asset alias, 563 * access control attributes, and custom data. 564 * @returns { Uint8Array } Challenge value. 565 * @throws { BusinessError } 401 - Parameter error. Possible causes: 566 * 1. Incorrect parameter types. 567 * 2. Parameter verification failed. 568 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 569 * @throws { BusinessError } 24000002 - The asset is not found. 570 * @throws { BusinessError } 24000005 - The screen lock status does not match. 571 * @throws { BusinessError } 24000006 - Insufficient memory. 572 * @throws { BusinessError } 24000007 - The asset is corrupted. 573 * @throws { BusinessError } 24000008 - The database operation failed. 574 * @throws { BusinessError } 24000009 - The cryptography operation failed. 575 * @throws { BusinessError } 24000010 - IPC failed. 576 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 577 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 578 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 579 * @throws { BusinessError } 24000016 - The cache exceeds the limit. 580 * @throws { BusinessError } 24000017 - The capability is not supported. 581 * @syscap SystemCapability.Security.Asset 582 * @atomicservice 583 * @since 14 584 */ 585 function preQuerySync(query: AssetMap): Uint8Array; 586 587 /** 588 * Query one or more Assets that match a search query. 589 * 590 * @param { AssetMap } query - a map object containing attributes of the Asset to be queried. 591 * @returns { Promise<Array<AssetMap>> } the promise object returned by the function. 592 * @throws { BusinessError } 401 - Parameter error. Possible causes: 593 * 1. Incorrect parameter types. 594 * 2. Parameter verification failed. 595 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 596 * @throws { BusinessError } 24000002 - The asset is not found. 597 * @throws { BusinessError } 24000004 - Access denied. 598 * @throws { BusinessError } 24000005 - The screen lock status does not match. 599 * @throws { BusinessError } 24000006 - Insufficient memory. 600 * @throws { BusinessError } 24000007 - The asset is corrupted. 601 * @throws { BusinessError } 24000008 - The database operation failed. 602 * @throws { BusinessError } 24000009 - The cryptography operation failed. 603 * @throws { BusinessError } 24000010 - IPC failed. 604 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 605 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 606 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 607 * @throws { BusinessError } 24000017 - The capability is not supported. 608 * @syscap SystemCapability.Security.Asset 609 * @since 11 610 */ 611 /** 612 * Queries one or more assets. If user authentication is required for the access to the asset, 613 * call {@link preQuery} before this API and call {@link postQuery} after this API. 614 * For details about the development procedure, see Querying an Asset with User Authentication. 615 * This API uses a promise to return the result. 616 * 617 * @param { AssetMap } query - Attributes of the asset to query, such as the asset alias, 618 * access control attributes, and custom data. 619 * @returns { Promise<Array<AssetMap>> } Promise used to return the result obtained. 620 * @throws { BusinessError } 401 - Parameter error. Possible causes: 621 * 1. Incorrect parameter types. 622 * 2. Parameter verification failed. 623 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 624 * @throws { BusinessError } 24000002 - The asset is not found. 625 * @throws { BusinessError } 24000004 - Access denied. 626 * @throws { BusinessError } 24000005 - The screen lock status does not match. 627 * @throws { BusinessError } 24000006 - Insufficient memory. 628 * @throws { BusinessError } 24000007 - The asset is corrupted. 629 * @throws { BusinessError } 24000008 - The database operation failed. 630 * @throws { BusinessError } 24000009 - The cryptography operation failed. 631 * @throws { BusinessError } 24000010 - IPC failed. 632 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 633 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 634 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 635 * @throws { BusinessError } 24000017 - The capability is not supported. 636 * @syscap SystemCapability.Security.Asset 637 * @atomicservice 638 * @since 14 639 */ 640 function query(query: AssetMap): Promise<Array<AssetMap>>; 641 642 /** 643 * Query one or more Assets that match a search query in a specific user space. 644 * 645 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 646 * @param { number } userId - the user identifier to query one or more Assets. The user identifier cannot be lower 647 * than 100. 648 * @param { AssetMap } query - a map object containing attributes of the Asset to be queried. 649 * @returns { Promise<Array<AssetMap>> } the promise object returned by the function. 650 * @throws { BusinessError } 201 - The caller doesn't have the permission. 651 * @throws { BusinessError } 202 - Non-system applications use system APIs. 652 * @throws { BusinessError } 401 - Parameter error. Possible causes: 653 * 1. Incorrect parameter types. 654 * 2. Parameter verification failed. 655 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 656 * @throws { BusinessError } 24000002 - The asset is not found. 657 * @throws { BusinessError } 24000004 - Access denied. 658 * @throws { BusinessError } 24000005 - The screen lock status does not match. 659 * @throws { BusinessError } 24000006 - Insufficient memory. 660 * @throws { BusinessError } 24000007 - The asset is corrupted. 661 * @throws { BusinessError } 24000008 - The database operation failed. 662 * @throws { BusinessError } 24000009 - The cryptography operation failed. 663 * @throws { BusinessError } 24000010 - IPC failed. 664 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 665 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 666 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 667 * @throws { BusinessError } 24000017 - The capability is not supported. 668 * @syscap SystemCapability.Security.Asset 669 * @systemapi 670 * @since 12 671 */ 672 function queryAsUser(userId: number, query: AssetMap): Promise<Array<AssetMap>>; 673 674 /** 675 * Query one or more Assets that match a search query. 676 * 677 * @param { AssetMap } query - a map object containing attributes of the Asset to be queried. 678 * @returns { Array<AssetMap> } the query result. 679 * @throws { BusinessError } 401 - Parameter error. Possible causes: 680 * 1. Incorrect parameter types. 681 * 2. Parameter verification failed. 682 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 683 * @throws { BusinessError } 24000002 - The asset is not found. 684 * @throws { BusinessError } 24000004 - Access denied. 685 * @throws { BusinessError } 24000005 - The screen lock status does not match. 686 * @throws { BusinessError } 24000006 - Insufficient memory. 687 * @throws { BusinessError } 24000007 - The asset is corrupted. 688 * @throws { BusinessError } 24000008 - The database operation failed. 689 * @throws { BusinessError } 24000009 - The cryptography operation failed. 690 * @throws { BusinessError } 24000010 - IPC failed. 691 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 692 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 693 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 694 * @throws { BusinessError } 24000017 - The capability is not supported. 695 * @syscap SystemCapability.Security.Asset 696 * @since 12 697 */ 698 /** 699 * Queries one or more assets. If user authentication is required for the access to the asset, 700 * call {@link preQuerySync} before this API and call {@link postQuerySync} after this API. 701 * For details about the development procedure, see Querying an Asset with User Authentication. 702 * This API returns the result synchronously. 703 * 704 * @param { AssetMap } query - Attributes of the asset to query, such as the asset alias, 705 * access control attributes, and custom data. 706 * @returns { Array<AssetMap> } Array of query results. 707 * @throws { BusinessError } 401 - Parameter error. Possible causes: 708 * 1. Incorrect parameter types. 709 * 2. Parameter verification failed. 710 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 711 * @throws { BusinessError } 24000002 - The asset is not found. 712 * @throws { BusinessError } 24000004 - Access denied. 713 * @throws { BusinessError } 24000005 - The screen lock status does not match. 714 * @throws { BusinessError } 24000006 - Insufficient memory. 715 * @throws { BusinessError } 24000007 - The asset is corrupted. 716 * @throws { BusinessError } 24000008 - The database operation failed. 717 * @throws { BusinessError } 24000009 - The cryptography operation failed. 718 * @throws { BusinessError } 24000010 - IPC failed. 719 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 720 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 721 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 722 * @throws { BusinessError } 24000017 - The capability is not supported. 723 * @syscap SystemCapability.Security.Asset 724 * @atomicservice 725 * @since 14 726 */ 727 function querySync(query: AssetMap): Array<AssetMap>; 728 729 /** 730 * Post-processing (e.g. release cached resource) for querying multiple Assets that require user authentication. 731 * 732 * @param { AssetMap } handle - a map object containing the handle returned by {@link preQuery}. 733 * @returns { Promise<void> } the promise object returned by the function. 734 * @throws { BusinessError } 401 - Parameter error. Possible causes: 735 * 1. Mandatory parameters are left unspecified. 736 * 2. Incorrect parameter types. 737 * 3. Parameter verification failed. 738 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 739 * @throws { BusinessError } 24000006 - Insufficient memory. 740 * @throws { BusinessError } 24000010 - IPC failed. 741 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 742 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 743 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 744 * @syscap SystemCapability.Security.Asset 745 * @since 11 746 */ 747 /** 748 * Performs postprocessing for the asset query. This API is used when user authentication is required for 749 * the access to the asset. This API must be used with {@link preQuery} together. 750 * This API uses a promise to return the result. 751 * 752 * @param { AssetMap } handle - Handle of the query operation, 753 * including the challenge value returned by {@link preQuery}. 754 * @returns { Promise<void> } Promise that returns no value. 755 * @throws { BusinessError } 401 - Parameter error. Possible causes: 756 * 1. Mandatory parameters are left unspecified. 757 * 2. Incorrect parameter types. 758 * 3. Parameter verification failed. 759 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 760 * @throws { BusinessError } 24000006 - Insufficient memory. 761 * @throws { BusinessError } 24000010 - IPC failed. 762 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 763 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 764 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 765 * @syscap SystemCapability.Security.Asset 766 * @atomicservice 767 * @since 14 768 */ 769 function postQuery(handle: AssetMap): Promise<void>; 770 771 /** 772 * Post-processing (e.g. release cached resource) for querying multiple Assets that require user authentication in a 773 * specific user space. 774 * 775 * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 776 * @param { number } userId - the user identifier to post-query one or more Assets. The user identifier cannot be 777 * lower than 100. 778 * @param { AssetMap } handle - a map object containing the handle returned by {@link preQueryAsUser}. 779 * @returns { Promise<void> } the promise object returned by the function. 780 * @throws { BusinessError } 201 - The caller doesn't have the permission. 781 * @throws { BusinessError } 202 - Non-system applications use system APIs. 782 * @throws { BusinessError } 401 - Parameter error. Possible causes: 783 * 1. Mandatory parameters are left unspecified. 784 * 2. Incorrect parameter types. 785 * 3. Parameter verification failed. 786 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 787 * @throws { BusinessError } 24000006 - Insufficient memory. 788 * @throws { BusinessError } 24000010 - IPC failed. 789 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 790 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 791 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 792 * @syscap SystemCapability.Security.Asset 793 * @systemapi 794 * @since 12 795 */ 796 function postQueryAsUser(userId:number, handle: AssetMap): Promise<void>; 797 798 /** 799 * Post-processing (e.g. release cached resource) for querying multiple Assets that require user authentication. 800 * 801 * @param { AssetMap } handle - a map object containing the handle returned by {@link preQuerySync}. 802 * @throws { BusinessError } 401 - Parameter error. Possible causes: 803 * 1. Mandatory parameters are left unspecified. 804 * 2. Incorrect parameter types. 805 * 3. Parameter verification failed. 806 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 807 * @throws { BusinessError } 24000006 - Insufficient memory. 808 * @throws { BusinessError } 24000010 - IPC failed. 809 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 810 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 811 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 812 * @syscap SystemCapability.Security.Asset 813 * @since 12 814 */ 815 /** 816 * Performs postprocessing for the asset query. This API is used when user authentication is required for 817 * the access to the asset. This API must be used with {@link preQuerySync} together. 818 * This API returns the result synchronously. 819 * 820 * @param { AssetMap } handle - Handle of the query operation, 821 * including the challenge value returned by {@link preQuerySync}. 822 * @throws { BusinessError } 401 - Parameter error. Possible causes: 823 * 1. Mandatory parameters are left unspecified. 824 * 2. Incorrect parameter types. 825 * 3. Parameter verification failed. 826 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 827 * @throws { BusinessError } 24000006 - Insufficient memory. 828 * @throws { BusinessError } 24000010 - IPC failed. 829 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 830 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 831 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 832 * @syscap SystemCapability.Security.Asset 833 * @atomicservice 834 * @since 14 835 */ 836 function postQuerySync(handle: AssetMap): void; 837 838 /** 839 * The ASSET service provides the ability to synchronize Assets between devices. 840 * This function is used to query the synchronization result. 841 * 842 * @param { AssetMap } query - a map object containing attributes of the Asset to be synchronized. 843 * @returns { Promise<SyncResult> } a promise object that can be resolved into the result of asset synchronization. 844 * @throws { BusinessError } 24000001 - The ASSET service is unavailable. 845 * @throws { BusinessError } 24000006 - Insufficient memory. 846 * @throws { BusinessError } 24000010 - IPC failed. 847 * @throws { BusinessError } 24000011 - Calling the Bundle Manager service failed. 848 * @throws { BusinessError } 24000012 - Calling the OS Account service failed. 849 * @throws { BusinessError } 24000013 - Calling the Access Token service failed. 850 * @throws { BusinessError } 24000014 - The file operation failed. 851 * @throws { BusinessError } 24000018 - Parameter verification failed. 852 * @syscap SystemCapability.Security.Asset 853 * @since 20 854 */ 855 function querySyncResult(query: AssetMap): Promise<SyncResult>; 856 857 /** 858 * A Map type containing tag-value pairs that describe the attributes of an Asset. 859 * 860 * @typedef { Map<Tag, Value> } 861 * @syscap SystemCapability.Security.Asset 862 * @since 11 863 */ 864 /** 865 * Represents a set of asset attributes in the form of KV pairs. 866 * 867 * @typedef { Map<Tag, Value> } 868 * @syscap SystemCapability.Security.Asset 869 * @atomicservice 870 * @since 14 871 */ 872 type AssetMap = Map<Tag, Value>; 873 874 /** 875 * A type that indicates the secret or attribute value of an Asset tag. 876 * 877 * @typedef { boolean | number | Uint8Array } 878 * @syscap SystemCapability.Security.Asset 879 * @since 11 880 */ 881 /** 882 * Represents the value of each attribute in {@link AssetMap}. 883 * 884 * @typedef { boolean | number | Uint8Array } 885 * @syscap SystemCapability.Security.Asset 886 * @atomicservice 887 * @since 14 888 */ 889 type Value = boolean | number | Uint8Array; 890 891 /** 892 * An enum type indicates when the Asset is accessible. 893 * 894 * @enum { number } 895 * @syscap SystemCapability.Security.Asset 896 * @since 11 897 */ 898 /** 899 * Enumerates the types of access control based on the lock screen status. 900 * 901 * @enum { number } 902 * @syscap SystemCapability.Security.Asset 903 * @atomicservice 904 * @since 14 905 */ 906 enum Accessibility { 907 /** 908 * The secret value in the Asset can only be accessed after the device is powered on. 909 * 910 * @syscap SystemCapability.Security.Asset 911 * @since 11 912 */ 913 /** 914 * The asset can be accessed after the device is powered on. 915 * 916 * @syscap SystemCapability.Security.Asset 917 * @atomicservice 918 * @since 14 919 */ 920 DEVICE_POWERED_ON = 0, 921 /** 922 * The secret value in the Asset can only be accessed after the device is first unlocked. 923 * 924 * @syscap SystemCapability.Security.Asset 925 * @since 11 926 */ 927 /** 928 * The asset can be accessed only after the device is unlocked for the first time. 929 * <p><strong>NOTE</strong>: 930 * If no lock screen password is set, this option is equivalent to <strong>DEVICE_POWERED_ON</strong>. 931 * </p> 932 * 933 * @syscap SystemCapability.Security.Asset 934 * @atomicservice 935 * @since 14 936 */ 937 DEVICE_FIRST_UNLOCKED = 1, 938 /** 939 * The secret value in the Asset can only be accessed while the device is unlocked. 940 * 941 * @syscap SystemCapability.Security.Asset 942 * @since 11 943 */ 944 /** 945 * The asset can be accessed only when the device is unlocked. 946 * <p><strong>NOTE</strong>: 947 * If no lock screen password is set, this option is equivalent to <strong>DEVICE_POWERED_ON</strong>. 948 * </p> 949 * 950 * @syscap SystemCapability.Security.Asset 951 * @atomicservice 952 * @since 14 953 */ 954 DEVICE_UNLOCKED = 2, 955 } 956 957 /** 958 * An enum type indicates the user authentication type for Asset access control. 959 * 960 * @enum { number } 961 * @syscap SystemCapability.Security.Asset 962 * @since 11 963 */ 964 /** 965 * Enumerates the types of user authentication supported by an asset. 966 * 967 * @enum { number } 968 * @syscap SystemCapability.Security.Asset 969 * @atomicservice 970 * @since 14 971 */ 972 enum AuthType { 973 /** 974 * The access to an Asset doesn't require user authentication. 975 * 976 * @syscap SystemCapability.Security.Asset 977 * @since 11 978 */ 979 /** 980 * No user authentication is required before the asset is accessed. 981 * 982 * @syscap SystemCapability.Security.Asset 983 * @atomicservice 984 * @since 14 985 */ 986 NONE = 0x00, 987 /** 988 * The access to an Asset requires user authentication using either PIN/pattern/password or biometric traits. 989 * 990 * @syscap SystemCapability.Security.Asset 991 * @since 11 992 */ 993 /** 994 * The asset can be accessed if any user authentication (such as PIN, facial, or fingerprint authentication) 995 * is successful. 996 * 997 * @syscap SystemCapability.Security.Asset 998 * @atomicservice 999 * @since 14 1000 */ 1001 ANY = 0xFF, 1002 } 1003 1004 /** 1005 * An enum type indicates the type of Asset synchronization. 1006 * 1007 * @enum { number } 1008 * @syscap SystemCapability.Security.Asset 1009 * @since 11 1010 */ 1011 /** 1012 * Enumerates the sync types supported by an asset. 1013 * <p><strong>NOTE</strong>: 1014 * This field is an embedded parameter. Currently, asset sync is not supported. 1015 * </p> 1016 * 1017 * @enum { number } 1018 * @syscap SystemCapability.Security.Asset 1019 * @atomicservice 1020 * @since 14 1021 */ 1022 enum SyncType { 1023 /** 1024 * An Asset with this attribute value is never allowed to be transferred out. 1025 * 1026 * @syscap SystemCapability.Security.Asset 1027 * @since 11 1028 */ 1029 /** 1030 * Asset sync is not allowed. 1031 * 1032 * @syscap SystemCapability.Security.Asset 1033 * @atomicservice 1034 * @since 14 1035 */ 1036 NEVER = 0, 1037 /** 1038 * An Asset with this attribute value can only be restored to the device from which it was transferred out. 1039 * 1040 * @syscap SystemCapability.Security.Asset 1041 * @since 11 1042 */ 1043 /** 1044 * Asset sync is allowed only on the local device, for example, in data restore on the local device. 1045 * 1046 * @syscap SystemCapability.Security.Asset 1047 * @atomicservice 1048 * @since 14 1049 */ 1050 THIS_DEVICE = 1 << 0, 1051 /** 1052 * An Asset with this attribute value can only be transferred out to a trusted device (user authorized). 1053 * 1054 * @syscap SystemCapability.Security.Asset 1055 * @since 11 1056 */ 1057 /** 1058 * Asset sync is allowed only between trusted devices, for example, in the case of cloning. 1059 * 1060 * @syscap SystemCapability.Security.Asset 1061 * @atomicservice 1062 * @since 14 1063 */ 1064 TRUSTED_DEVICE = 1 << 1, 1065 /** 1066 * An Asset with this attribute value can only be transferred out to devices logged in with trusted accounts. 1067 * 1068 * @syscap SystemCapability.Security.Asset 1069 * @since 12 1070 */ 1071 /** 1072 * Asset sync is allowed only between the devices that are logged in with trusted accounts, for example, 1073 * in cloud sync scenarios. 1074 * 1075 * @syscap SystemCapability.Security.Asset 1076 * @atomicservice 1077 * @since 14 1078 */ 1079 TRUSTED_ACCOUNT = 1 << 2, 1080 } 1081 1082 /** 1083 * An enum type indicates the type of Asset encapsulation. 1084 * 1085 * @enum { number } 1086 * @syscap SystemCapability.Security.Asset 1087 * @since 18 1088 */ 1089 enum WrapType { 1090 /** 1091 * An Asset with this attribute value is never allowed to be wrapped up. 1092 * 1093 * @syscap SystemCapability.Security.Asset 1094 * @since 18 1095 */ 1096 NEVER = 0, 1097 /** 1098 * An Asset with this attribute value can only be wrapped or unwrapped on devices logged in with trusted accounts. 1099 * 1100 * @syscap SystemCapability.Security.Asset 1101 * @since 18 1102 */ 1103 TRUSTED_ACCOUNT = 1, 1104 } 1105 1106 /** 1107 * An enum type indicates the strategy for conflict resolution when handling duplicated Asset alias. 1108 * 1109 * @enum { number } 1110 * @syscap SystemCapability.Security.Asset 1111 * @since 11 1112 */ 1113 /** 1114 * Enumerates the policies for resolving conflicts (for example, a duplicate alias) when an asset is added. 1115 * 1116 * @enum { number } 1117 * @syscap SystemCapability.Security.Asset 1118 * @atomicservice 1119 * @since 14 1120 */ 1121 enum ConflictResolution { 1122 /** 1123 * Directly overwrite an Asset with duplicated alias when a conflict is detected. 1124 * 1125 * @syscap SystemCapability.Security.Asset 1126 * @since 11 1127 */ 1128 /** 1129 * Overwrite the original asset. 1130 * 1131 * @syscap SystemCapability.Security.Asset 1132 * @atomicservice 1133 * @since 14 1134 */ 1135 OVERWRITE = 0, 1136 /** 1137 * Throw an error so that the caller can take measures when a conflict is detected. 1138 * 1139 * @syscap SystemCapability.Security.Asset 1140 * @since 11 1141 */ 1142 /** 1143 * Throw an exception for the service to perform subsequent processing. 1144 * 1145 * @syscap SystemCapability.Security.Asset 1146 * @atomicservice 1147 * @since 14 1148 */ 1149 THROW_ERROR = 1, 1150 } 1151 1152 /** 1153 * An enum type indicates the return type of the queried Asset. 1154 * 1155 * @enum { number } 1156 * @syscap SystemCapability.Security.Asset 1157 * @since 11 1158 */ 1159 /** 1160 * Enumerates the type of information returned by an asset query operation. 1161 * 1162 * @enum { number } 1163 * @syscap SystemCapability.Security.Asset 1164 * @atomicservice 1165 * @since 14 1166 */ 1167 enum ReturnType { 1168 /** 1169 * Specify that the return data should contain both secret value and attributes. 1170 * 1171 * @syscap SystemCapability.Security.Asset 1172 * @since 11 1173 */ 1174 /** 1175 * The query result contains the asset plaintext and its attributes. 1176 * <p><strong>NOTE</strong>: 1177 * Use this option when you need to query the plaintext of a single asset. 1178 * </p> 1179 * 1180 * @syscap SystemCapability.Security.Asset 1181 * @atomicservice 1182 * @since 14 1183 */ 1184 ALL = 0, 1185 /** 1186 * Specify that the return data contains only attributes. 1187 * 1188 * @syscap SystemCapability.Security.Asset 1189 * @since 11 1190 */ 1191 /** 1192 * The query result contains only the asset attributes. 1193 * <p><strong>NOTE</strong>: 1194 * Use this option when you need to query attributes of multiple assets. 1195 * </p> 1196 * 1197 * @syscap SystemCapability.Security.Asset 1198 * @atomicservice 1199 * @since 14 1200 */ 1201 ATTRIBUTES = 1, 1202 } 1203 1204 /** 1205 * Enumerates the types of additional operation to perform. 1206 * 1207 * @enum { number } 1208 * @syscap SystemCapability.Security.Asset 1209 * @since 12 1210 */ 1211 enum OperationType { 1212 /** 1213 * Sync. 1214 * 1215 * @syscap SystemCapability.Security.Asset 1216 * @since 12 1217 */ 1218 NEED_SYNC = 0, 1219 /** 1220 * Logout. 1221 * 1222 * @syscap SystemCapability.Security.Asset 1223 * @since 12 1224 */ 1225 NEED_LOGOUT = 1, 1226 } 1227 1228 /** 1229 * Interface of synchronization result. 1230 * 1231 * @typedef SyncResult 1232 * @syscap SystemCapability.Security.Asset 1233 * @since 20 1234 */ 1235 interface SyncResult { 1236 /** 1237 * The result code of synchronization. 1238 * 1239 * @type { number } 1240 * @readonly 1241 * @syscap SystemCapability.Security.Asset 1242 * @since 20 1243 */ 1244 readonly resultCode: number; 1245 /** 1246 * The total count of synchronized Assets. 1247 * 1248 * @type { ?number } 1249 * @readonly 1250 * @syscap SystemCapability.Security.Asset 1251 * @since 20 1252 */ 1253 readonly totalCount?: number; 1254 /** 1255 * The count of Assets that fail to synchronize. 1256 * 1257 * @type { ?number } 1258 * @readonly 1259 * @syscap SystemCapability.Security.Asset 1260 * @since 20 1261 */ 1262 readonly failedCount?: number; 1263 } 1264 1265 /** 1266 * An enum type containing the data type definitions for Asset attribute value. 1267 * 1268 * @enum { number } 1269 * @syscap SystemCapability.Security.Asset 1270 * @since 11 1271 */ 1272 /** 1273 * Enumerates the asset attribute types. 1274 * 1275 * @enum { number } 1276 * @syscap SystemCapability.Security.Asset 1277 * @atomicservice 1278 * @since 14 1279 */ 1280 enum TagType { 1281 /** 1282 * The data type of Asset attribute value is bool. 1283 * 1284 * @syscap SystemCapability.Security.Asset 1285 * @since 11 1286 */ 1287 /** 1288 * Boolean. 1289 * 1290 * @syscap SystemCapability.Security.Asset 1291 * @atomicservice 1292 * @since 14 1293 */ 1294 BOOL = 0x01 << 28, 1295 /** 1296 * The data type of Asset attribute value is uint32. 1297 * 1298 * @syscap SystemCapability.Security.Asset 1299 * @since 11 1300 */ 1301 /** 1302 * Number. 1303 * 1304 * @syscap SystemCapability.Security.Asset 1305 * @atomicservice 1306 * @since 14 1307 */ 1308 NUMBER = 0x02 << 28, 1309 /** 1310 * The data type of Asset attribute value is byte array. 1311 * 1312 * @syscap SystemCapability.Security.Asset 1313 * @since 11 1314 */ 1315 /** 1316 * Byte array. 1317 * 1318 * @syscap SystemCapability.Security.Asset 1319 * @atomicservice 1320 * @since 14 1321 */ 1322 BYTES = 0x03 << 28, 1323 } 1324 1325 /** 1326 * An enum type containing the Asset attribute tags. 1327 * 1328 * @enum { number } 1329 * @syscap SystemCapability.Security.Asset 1330 * @since 11 1331 */ 1332 /** 1333 * Enumerate the keys of asset attributes ({@link AssetMap}), which are in key-value (KV) pairs. 1334 * 1335 * @enum { number } 1336 * @syscap SystemCapability.Security.Asset 1337 * @atomicservice 1338 * @since 14 1339 */ 1340 enum Tag { 1341 /** 1342 * A tag whose value is a byte array indicating the sensitive user data such as passwords and tokens. 1343 * 1344 * @syscap SystemCapability.Security.Asset 1345 * @since 11 1346 */ 1347 /** 1348 * Asset plaintext. 1349 * 1350 * @syscap SystemCapability.Security.Asset 1351 * @atomicservice 1352 * @since 14 1353 */ 1354 SECRET = TagType.BYTES | 0x01, 1355 /** 1356 * A tag whose value is a byte array identifying an Asset. 1357 * 1358 * @syscap SystemCapability.Security.Asset 1359 * @since 11 1360 */ 1361 /** 1362 * Asset alias, which uniquely identifies an asset. 1363 * 1364 * @syscap SystemCapability.Security.Asset 1365 * @atomicservice 1366 * @since 14 1367 */ 1368 ALIAS = TagType.BYTES | 0x02, 1369 /** 1370 * A tag whose value is a 32-bit unsigned integer indicating when the Asset can be accessed. 1371 * 1372 * @syscap SystemCapability.Security.Asset 1373 * @since 11 1374 */ 1375 /** 1376 * Access control based on the lock screen status. 1377 * 1378 * @syscap SystemCapability.Security.Asset 1379 * @atomicservice 1380 * @since 14 1381 */ 1382 ACCESSIBILITY = TagType.NUMBER | 0x03, 1383 /** 1384 * A tag whose value is a bool indicating whether a screen lock password is required for the device. 1385 * 1386 * @syscap SystemCapability.Security.Asset 1387 * @since 11 1388 */ 1389 /** 1390 * Whether the asset is accessible only when a lock screen password is set. 1391 * 1392 * @syscap SystemCapability.Security.Asset 1393 * @atomicservice 1394 * @since 14 1395 */ 1396 REQUIRE_PASSWORD_SET = TagType.BOOL | 0x04, 1397 /** 1398 * A tag whose value is a 32-bit unsigned integer indicating the user authentication type for Asset access control. 1399 * 1400 * @syscap SystemCapability.Security.Asset 1401 * @since 11 1402 */ 1403 /** 1404 * Type of user authentication required for accessing the asset. 1405 * 1406 * @syscap SystemCapability.Security.Asset 1407 * @atomicservice 1408 * @since 14 1409 */ 1410 AUTH_TYPE = TagType.NUMBER | 0x05, 1411 /** 1412 * A tag whose value is a 32-bit unsigned integer indicating the validity period in seconds of user authentication. 1413 * 1414 * @syscap SystemCapability.Security.Asset 1415 * @since 11 1416 */ 1417 /** 1418 * Validity period of the user authentication. 1419 * 1420 * @syscap SystemCapability.Security.Asset 1421 * @atomicservice 1422 * @since 14 1423 */ 1424 AUTH_VALIDITY_PERIOD = TagType.NUMBER | 0x06, 1425 /** 1426 * A tag whose value is a byte array indicating the authentication challenge for anti-replay protection. 1427 * 1428 * @syscap SystemCapability.Security.Asset 1429 * @since 11 1430 */ 1431 /** 1432 * Challenge for the user authentication. 1433 * 1434 * @syscap SystemCapability.Security.Asset 1435 * @atomicservice 1436 * @since 14 1437 */ 1438 AUTH_CHALLENGE = TagType.BYTES | 0x07, 1439 /** 1440 * A tag whose value is a byte array indicating the authentication token after a user is verified. 1441 * 1442 * @syscap SystemCapability.Security.Asset 1443 * @since 11 1444 */ 1445 /** 1446 * Authorization token obtained after the user authentication is successful. 1447 * 1448 * @syscap SystemCapability.Security.Asset 1449 * @atomicservice 1450 * @since 14 1451 */ 1452 AUTH_TOKEN = TagType.BYTES | 0x08, 1453 /** 1454 * A tag whose value is a 32-bit unsigned integer indicating the type of Asset synchronization. 1455 * 1456 * @syscap SystemCapability.Security.Asset 1457 * @since 11 1458 */ 1459 /** 1460 * Asset sync type. 1461 * 1462 * @syscap SystemCapability.Security.Asset 1463 * @atomicservice 1464 * @since 14 1465 */ 1466 SYNC_TYPE = TagType.NUMBER | 0x10, 1467 /** 1468 * Whether to retain the asset when the application is uninstalled. 1469 * 1470 * @syscap SystemCapability.Security.Asset 1471 * @since 11 1472 */ 1473 IS_PERSISTENT = TagType.BOOL | 0x11, 1474 /** 1475 * A tag whose value is a byte array indicating the first user-defined Asset data label (not allow to update). 1476 * 1477 * @syscap SystemCapability.Security.Asset 1478 * @since 11 1479 */ 1480 /** 1481 * Additional asset data customized by the service with integrity protection. 1482 * 1483 * @syscap SystemCapability.Security.Asset 1484 * @atomicservice 1485 * @since 14 1486 */ 1487 DATA_LABEL_CRITICAL_1 = TagType.BYTES | 0x20, 1488 /** 1489 * A tag whose value is a byte array indicating the second user-defined Asset data label (not allow to update). 1490 * 1491 * @syscap SystemCapability.Security.Asset 1492 * @since 11 1493 */ 1494 /** 1495 * Additional asset data customized by the service with integrity protection. 1496 * 1497 * @syscap SystemCapability.Security.Asset 1498 * @atomicservice 1499 * @since 14 1500 */ 1501 DATA_LABEL_CRITICAL_2 = TagType.BYTES | 0x21, 1502 /** 1503 * A tag whose value is a byte array indicating the third user-defined Asset data label (not allow to update). 1504 * 1505 * @syscap SystemCapability.Security.Asset 1506 * @since 11 1507 */ 1508 /** 1509 * Additional asset data customized by the service with integrity protection. 1510 * 1511 * @syscap SystemCapability.Security.Asset 1512 * @atomicservice 1513 * @since 14 1514 */ 1515 DATA_LABEL_CRITICAL_3 = TagType.BYTES | 0x22, 1516 /** 1517 * A tag whose value is a byte array indicating the fourth user-defined Asset data label (not allow to update). 1518 * 1519 * @syscap SystemCapability.Security.Asset 1520 * @since 11 1521 */ 1522 /** 1523 * Additional asset data customized by the service with integrity protection. 1524 * 1525 * @syscap SystemCapability.Security.Asset 1526 * @atomicservice 1527 * @since 14 1528 */ 1529 DATA_LABEL_CRITICAL_4 = TagType.BYTES | 0x23, 1530 /** 1531 * A tag whose value is a byte array indicating the first user-defined Asset data label (allow to update). 1532 * 1533 * @syscap SystemCapability.Security.Asset 1534 * @since 11 1535 */ 1536 /** 1537 * Additional asset data customized by the service without integrity protection. 1538 * 1539 * @syscap SystemCapability.Security.Asset 1540 * @atomicservice 1541 * @since 14 1542 */ 1543 DATA_LABEL_NORMAL_1 = TagType.BYTES | 0x30, 1544 /** 1545 * A tag whose value is a byte array indicating the second user-defined Asset data label (allow to update). 1546 * 1547 * @syscap SystemCapability.Security.Asset 1548 * @since 11 1549 */ 1550 /** 1551 * Additional asset data customized by the service without integrity protection. 1552 * 1553 * @syscap SystemCapability.Security.Asset 1554 * @atomicservice 1555 * @since 14 1556 */ 1557 DATA_LABEL_NORMAL_2 = TagType.BYTES | 0x31, 1558 /** 1559 * A tag whose value is a byte array indicating the third user-defined Asset data label (allow to update). 1560 * 1561 * @syscap SystemCapability.Security.Asset 1562 * @since 11 1563 */ 1564 /** 1565 * Additional asset data customized by the service without integrity protection. 1566 * 1567 * @syscap SystemCapability.Security.Asset 1568 * @atomicservice 1569 * @since 14 1570 */ 1571 DATA_LABEL_NORMAL_3 = TagType.BYTES | 0x32, 1572 /** 1573 * A tag whose value is a byte array indicating the fourth user-defined Asset data label (allow to update). 1574 * 1575 * @syscap SystemCapability.Security.Asset 1576 * @since 11 1577 */ 1578 /** 1579 * Additional asset data customized by the service without integrity protection. 1580 * 1581 * @syscap SystemCapability.Security.Asset 1582 * @atomicservice 1583 * @since 14 1584 */ 1585 DATA_LABEL_NORMAL_4 = TagType.BYTES | 0x33, 1586 /** 1587 * A local tag whose value is a byte array indicating the first user-defined Asset data label (allow to update). 1588 * The information of a local tag will not be synchronized. 1589 * 1590 * @syscap SystemCapability.Security.Asset 1591 * @since 12 1592 */ 1593 /** 1594 * Local information about the asset. The value is assigned by the service without integrity protection and 1595 * will not be synced. 1596 * 1597 * @syscap SystemCapability.Security.Asset 1598 * @atomicservice 1599 * @since 14 1600 */ 1601 DATA_LABEL_NORMAL_LOCAL_1 = TagType.BYTES | 0x34, 1602 /** 1603 * A local tag whose value is a byte array indicating the second user-defined Asset data label (allow to update). 1604 * The information of a local tag will not be synchronized. 1605 * 1606 * @syscap SystemCapability.Security.Asset 1607 * @since 12 1608 */ 1609 /** 1610 * Local information about the asset. The value is assigned by the service without integrity protection and 1611 * will not be synced. 1612 * 1613 * @syscap SystemCapability.Security.Asset 1614 * @atomicservice 1615 * @since 14 1616 */ 1617 DATA_LABEL_NORMAL_LOCAL_2 = TagType.BYTES | 0x35, 1618 /** 1619 * A local tag whose value is a byte array indicating the third user-defined Asset data label (allow to update). 1620 * The information of a local tag will not be synchronized. 1621 * 1622 * @syscap SystemCapability.Security.Asset 1623 * @since 12 1624 */ 1625 /** 1626 * Local information about the asset. The value is assigned by the service without integrity protection and 1627 * will not be synced. 1628 * 1629 * @syscap SystemCapability.Security.Asset 1630 * @atomicservice 1631 * @since 14 1632 */ 1633 DATA_LABEL_NORMAL_LOCAL_3 = TagType.BYTES | 0x36, 1634 /** 1635 * A local tag whose value is a byte array indicating the fourth user-defined Asset data label (allow to update). 1636 * The information of a local tag will not be synchronized. 1637 * 1638 * @syscap SystemCapability.Security.Asset 1639 * @since 12 1640 */ 1641 /** 1642 * Local information about the asset. The value is assigned by the service without integrity protection and 1643 * will not be synced. 1644 * 1645 * @syscap SystemCapability.Security.Asset 1646 * @atomicservice 1647 * @since 14 1648 */ 1649 DATA_LABEL_NORMAL_LOCAL_4 = TagType.BYTES | 0x37, 1650 /** 1651 * A tag whose value is a 32-bit unsigned integer indicating the return type of the queried Asset. 1652 * 1653 * @syscap SystemCapability.Security.Asset 1654 * @since 11 1655 */ 1656 /** 1657 * Type of the asset query result to return. 1658 * 1659 * @syscap SystemCapability.Security.Asset 1660 * @atomicservice 1661 * @since 14 1662 */ 1663 RETURN_TYPE = TagType.NUMBER | 0x40, 1664 /** 1665 * A tag whose value is a 32-bit unsigned integer indicating the maximum number of returned Assets in one query. 1666 * 1667 * @syscap SystemCapability.Security.Asset 1668 * @since 11 1669 */ 1670 /** 1671 * Maximum number of asset records to return. 1672 * 1673 * @syscap SystemCapability.Security.Asset 1674 * @atomicservice 1675 * @since 14 1676 */ 1677 RETURN_LIMIT = TagType.NUMBER | 0x41, 1678 /** 1679 * A tag whose value is a 32-bit unsigned integer indicating the offset of return data in batch query. 1680 * 1681 * @syscap SystemCapability.Security.Asset 1682 * @since 11 1683 */ 1684 /** 1685 * Offset of the asset query result. 1686 * <p><strong>NOTE</strong>: 1687 * This parameter specifies the starting asset record to return in batch asset query. 1688 * </p> 1689 * 1690 * @syscap SystemCapability.Security.Asset 1691 * @atomicservice 1692 * @since 14 1693 */ 1694 RETURN_OFFSET = TagType.NUMBER | 0x42, 1695 /** 1696 * A tag whose value is a 32-bit unsigned integer indicating how the query results are sorted. 1697 * 1698 * @syscap SystemCapability.Security.Asset 1699 * @since 11 1700 */ 1701 /** 1702 * Sorting order of the query results. Currently, the results can be sorted only by 1703 * <strong>ASSET_TAG_DATA_LABEL</strong>. 1704 * <p><strong>NOTE</strong>: 1705 * By default, assets are returned in the order in which they are added. 1706 * </p> 1707 * 1708 * @syscap SystemCapability.Security.Asset 1709 * @atomicservice 1710 * @since 14 1711 */ 1712 RETURN_ORDERED_BY = TagType.NUMBER | 0x43, 1713 /** 1714 * A tag whose value is a 32-bit unsigned integer indicating the strategy for resolving Asset conflicts. 1715 * 1716 * @syscap SystemCapability.Security.Asset 1717 * @since 11 1718 */ 1719 /** 1720 * Policy for resolving the conflict (for example, a duplicate alias). 1721 * 1722 * @syscap SystemCapability.Security.Asset 1723 * @atomicservice 1724 * @since 14 1725 */ 1726 CONFLICT_RESOLUTION = TagType.NUMBER | 0x44, 1727 /** 1728 * A tag whose value is a byte array indicating the update time of an Asset. 1729 * 1730 * @syscap SystemCapability.Security.Asset 1731 * @since 12 1732 */ 1733 /** 1734 * Data update time, in timestamp. 1735 * 1736 * @syscap SystemCapability.Security.Asset 1737 * @atomicservice 1738 * @since 14 1739 */ 1740 UPDATE_TIME = TagType.BYTES | 0x45, 1741 /** 1742 * Additional operation type. 1743 * 1744 * @syscap SystemCapability.Security.Asset 1745 * @since 12 1746 */ 1747 OPERATION_TYPE = TagType.NUMBER | 0x46, 1748 /** 1749 * Whether to encrypt the additional asset information customized by the service. 1750 * 1751 * @syscap SystemCapability.Security.Asset 1752 * @atomicservice 1753 * @since 14 1754 */ 1755 REQUIRE_ATTR_ENCRYPTED = TagType.BOOL | 0x47, 1756 /** 1757 * Group to which the asset belongs. 1758 * 1759 * @syscap SystemCapability.Security.Asset 1760 * @since 18 1761 */ 1762 GROUP_ID = TagType.BYTES | 0x48, 1763 /** 1764 * A tag whose value is a 32-bit unsigned integer indicating the type of Asset encapsulation. 1765 * 1766 * @syscap SystemCapability.Security.Asset 1767 * @since 18 1768 */ 1769 WRAP_TYPE = TagType.NUMBER | 0x49, 1770 } 1771 1772 /** 1773 * An enum type containing the Asset error codes. 1774 * 1775 * @enum { number } 1776 * @syscap SystemCapability.Security.Asset 1777 * @since 11 1778 */ 1779 /** 1780 * Enumerates the error codes. 1781 * 1782 * @enum { number } 1783 * @syscap SystemCapability.Security.Asset 1784 * @atomicservice 1785 * @since 14 1786 */ 1787 enum ErrorCode { 1788 /** 1789 * The error code indicates that the caller doesn't have the permission. 1790 * 1791 * @syscap SystemCapability.Security.Asset 1792 * @since 11 1793 */ 1794 PERMISSION_DENIED = 201, 1795 /** 1796 * The error code indicates that the caller is not a system application. 1797 * 1798 * @syscap SystemCapability.Security.Asset 1799 * @since 12 1800 */ 1801 NOT_SYSTEM_APPLICATION = 202, 1802 /** 1803 * The error code indicates that the argument is invalid. 1804 * 1805 * @syscap SystemCapability.Security.Asset 1806 * @since 11 1807 */ 1808 /** 1809 * The error code indicates that the argument is invalid. 1810 * 1811 * @syscap SystemCapability.Security.Asset 1812 * @atomicservice 1813 * @since 14 1814 */ 1815 INVALID_ARGUMENT = 401, 1816 /** 1817 * The error code indicates that the ASSET service is unavailable. 1818 * 1819 * @syscap SystemCapability.Security.Asset 1820 * @since 11 1821 */ 1822 /** 1823 * The error code indicates that the ASSET service is unavailable. 1824 * 1825 * @syscap SystemCapability.Security.Asset 1826 * @atomicservice 1827 * @since 14 1828 */ 1829 SERVICE_UNAVAILABLE = 24000001, 1830 /** 1831 * The error code indicates that the asset is not found. 1832 * 1833 * @syscap SystemCapability.Security.Asset 1834 * @since 11 1835 */ 1836 /** 1837 * The error code indicates that the asset is not found. 1838 * 1839 * @syscap SystemCapability.Security.Asset 1840 * @atomicservice 1841 * @since 14 1842 */ 1843 NOT_FOUND = 24000002, 1844 /** 1845 * The error code indicates that the asset already exists. 1846 * 1847 * @syscap SystemCapability.Security.Asset 1848 * @since 11 1849 */ 1850 /** 1851 * The error code indicates that the asset already exists. 1852 * 1853 * @syscap SystemCapability.Security.Asset 1854 * @atomicservice 1855 * @since 14 1856 */ 1857 DUPLICATED = 24000003, 1858 /** 1859 * The error code indicates that access to the asset is denied. 1860 * 1861 * @syscap SystemCapability.Security.Asset 1862 * @since 11 1863 */ 1864 /** 1865 * The error code indicates that access to the asset is denied. 1866 * 1867 * @syscap SystemCapability.Security.Asset 1868 * @atomicservice 1869 * @since 14 1870 */ 1871 ACCESS_DENIED = 24000004, 1872 /** 1873 * The error code indicates that the screen lock status does not match. 1874 * 1875 * @syscap SystemCapability.Security.Asset 1876 * @since 11 1877 */ 1878 /** 1879 * The error code indicates that the screen lock status does not match. 1880 * 1881 * @syscap SystemCapability.Security.Asset 1882 * @atomicservice 1883 * @since 14 1884 */ 1885 STATUS_MISMATCH = 24000005, 1886 /** 1887 * The error code indicates insufficient memory. 1888 * 1889 * @syscap SystemCapability.Security.Asset 1890 * @since 11 1891 */ 1892 /** 1893 * The error code indicates insufficient memory. 1894 * 1895 * @syscap SystemCapability.Security.Asset 1896 * @atomicservice 1897 * @since 14 1898 */ 1899 OUT_OF_MEMORY = 24000006, 1900 /** 1901 * The error code indicates that the asset is corrupted. 1902 * 1903 * @syscap SystemCapability.Security.Asset 1904 * @since 11 1905 */ 1906 /** 1907 * The error code indicates that the asset is corrupted. 1908 * 1909 * @syscap SystemCapability.Security.Asset 1910 * @atomicservice 1911 * @since 14 1912 */ 1913 DATA_CORRUPTED = 24000007, 1914 /** 1915 * The error code indicates that the database operation failed. 1916 * 1917 * @syscap SystemCapability.Security.Asset 1918 * @since 11 1919 */ 1920 /** 1921 * The error code indicates that the database operation failed. 1922 * 1923 * @syscap SystemCapability.Security.Asset 1924 * @atomicservice 1925 * @since 14 1926 */ 1927 DATABASE_ERROR = 24000008, 1928 /** 1929 * The error code indicates that the cryptography operation failed. 1930 * 1931 * @syscap SystemCapability.Security.Asset 1932 * @since 11 1933 */ 1934 /** 1935 * The error code indicates that the cryptography operation failed. 1936 * 1937 * @syscap SystemCapability.Security.Asset 1938 * @atomicservice 1939 * @since 14 1940 */ 1941 CRYPTO_ERROR = 24000009, 1942 /** 1943 * The error code indicates that the ipc failed. 1944 * 1945 * @syscap SystemCapability.Security.Asset 1946 * @since 11 1947 */ 1948 /** 1949 * The error code indicates that the ipc failed. 1950 * 1951 * @syscap SystemCapability.Security.Asset 1952 * @atomicservice 1953 * @since 14 1954 */ 1955 IPC_ERROR = 24000010, 1956 /** 1957 * The error code indicates that calling the Bundle Manager service failed. 1958 * 1959 * @syscap SystemCapability.Security.Asset 1960 * @since 11 1961 */ 1962 /** 1963 * The error code indicates that calling the Bundle Manager service failed. 1964 * 1965 * @syscap SystemCapability.Security.Asset 1966 * @atomicservice 1967 * @since 14 1968 */ 1969 BMS_ERROR = 24000011, 1970 /** 1971 * The error code indicates that calling the OS Account service failed. 1972 * 1973 * @syscap SystemCapability.Security.Asset 1974 * @since 11 1975 */ 1976 /** 1977 * The error code indicates that calling the OS Account service failed. 1978 * 1979 * @syscap SystemCapability.Security.Asset 1980 * @atomicservice 1981 * @since 14 1982 */ 1983 ACCOUNT_ERROR = 24000012, 1984 /** 1985 * The error code indicates that calling the Access Token service failed. 1986 * 1987 * @syscap SystemCapability.Security.Asset 1988 * @since 11 1989 */ 1990 /** 1991 * The error code indicates that calling the Access Token service failed. 1992 * 1993 * @syscap SystemCapability.Security.Asset 1994 * @atomicservice 1995 * @since 14 1996 */ 1997 ACCESS_TOKEN_ERROR = 24000013, 1998 /** 1999 * The error code indicates that the file operation failed. 2000 * 2001 * @syscap SystemCapability.Security.Asset 2002 * @since 11 2003 */ 2004 /** 2005 * The error code indicates that the file operation failed. 2006 * 2007 * @syscap SystemCapability.Security.Asset 2008 * @atomicservice 2009 * @since 14 2010 */ 2011 FILE_OPERATION_ERROR = 24000014, 2012 /** 2013 * The error code indicates that getting the system time failed. 2014 * 2015 * @syscap SystemCapability.Security.Asset 2016 * @since 11 2017 */ 2018 /** 2019 * The error code indicates that getting the system time failed. 2020 * 2021 * @syscap SystemCapability.Security.Asset 2022 * @atomicservice 2023 * @since 14 2024 */ 2025 GET_SYSTEM_TIME_ERROR = 24000015, 2026 /** 2027 * The error code indicates that the cache exceeds the limit. 2028 * 2029 * @syscap SystemCapability.Security.Asset 2030 * @since 11 2031 */ 2032 /** 2033 * The error code indicates that the cache exceeds the limit. 2034 * 2035 * @syscap SystemCapability.Security.Asset 2036 * @atomicservice 2037 * @since 14 2038 */ 2039 LIMIT_EXCEEDED = 24000016, 2040 /** 2041 * The error code indicates that the capability is not supported. 2042 * 2043 * @syscap SystemCapability.Security.Asset 2044 * @since 11 2045 */ 2046 /** 2047 * The error code indicates that the capability is not supported. 2048 * 2049 * @syscap SystemCapability.Security.Asset 2050 * @atomicservice 2051 * @since 14 2052 */ 2053 UNSUPPORTED = 24000017, 2054 /** 2055 * The error code indicates that verifying the parameter failed. 2056 * 2057 * @syscap SystemCapability.Security.Asset 2058 * @atomicservice 2059 * @since 20 2060 */ 2061 PARAM_VERIFICATION_FAILED = 24000018, 2062 } 2063} 2064 2065export default asset; 2066