AssetType
Overview
Defines the enums, structs, and error codes used in the asset store service (ASSET).
System capability: SystemCapability.Security.Asset
Since: 11
Summary
Files
Name | Description |
---|---|
asset_type.h | Defines the enums, structs, and error codes used in the ASSET. |
Structs
Name | Description |
---|---|
struct Asset_Blob | Defines a binary array, that is, an array of bytes with variable length. |
union Asset_Value | Defines the value of an asset attribute. |
struct Asset_Attr | Defines an asset attribute in the form of a key-value (KV) pair. |
struct Asset_Result | Defines the query result of an asset. |
struct Asset_ResultSet | Defines the query result of multiple assets. |
Macros
Name | Description |
---|---|
ASSET_TAG_TYPE_MASK (0xF << 28) | Defines the mask used to obtain the tag type of an asset attribute. |
Enums
Name | Description |
---|---|
Asset_TagType { ASSET_TYPE_BOOL = 0x1 << 28, ASSET_TYPE_NUMBER = 0x2 << 28, ASSET_TYPE_BYTES = 0x3 << 28 } |
Enumerates the tag types of the asset attributes. |
Asset_Tag { ASSET_TAG_SECRET = ASSET_TYPE_BYTES | 0x01, ASSET_TAG_ALIAS = ASSET_TYPE_BYTES | 0x02, ASSET_TAG_ACCESSIBILITY = ASSET_TYPE_NUMBER | 0x03, ASSET_TAG_REQUIRE_PASSWORD_SET = ASSET_TYPE_BOOL | 0x04, ASSET_TAG_AUTH_TYPE = ASSET_TYPE_NUMBER | 0x05, ASSET_TAG_AUTH_VALIDITY_PERIOD = ASSET_TYPE_NUMBER | 0x06, ASSET_TAG_AUTH_CHALLENGE = ASSET_TYPE_BYTES | 0x07, ASSET_TAG_AUTH_TOKEN = ASSET_TYPE_BYTES | 0x08, ASSET_TAG_SYNC_TYPE = ASSET_TYPE_NUMBER | 0x10, ASSET_TAG_IS_PERSISTENT = ASSET_TYPE_BOOL | 0x11, ASSET_TAG_DATA_LABEL_CRITICAL_1 = ASSET_TYPE_BYTES | 0x20, ASSET_TAG_DATA_LABEL_CRITICAL_2 = ASSET_TYPE_BYTES | 0x21, ASSET_TAG_DATA_LABEL_CRITICAL_3 = ASSET_TYPE_BYTES | 0x22, ASSET_TAG_DATA_LABEL_CRITICAL_4 = ASSET_TYPE_BYTES | 0x23, ASSET_TAG_DATA_LABEL_NORMAL_1 = ASSET_TYPE_BYTES | 0x30, ASSET_TAG_DATA_LABEL_NORMAL_2 = ASSET_TYPE_BYTES | 0x31, ASSET_TAG_DATA_LABEL_NORMAL_3 = ASSET_TYPE_BYTES | 0x32, ASSET_TAG_DATA_LABEL_NORMAL_4 = ASSET_TYPE_BYTES | 0x33, ASSET_TAG_RETURN_TYPE = ASSET_TYPE_NUMBER | 0x40, ASSET_TAG_RETURN_LIMIT = ASSET_TYPE_NUMBER | 0x41, ASSET_TAG_RETURN_OFFSET = ASSET_TYPE_NUMBER | 0x42, ASSET_TAG_RETURN_ORDERED_BY = ASSET_TYPE_NUMBER | 0x43, ASSET_TAG_CONFLICT_RESOLUTION = ASSET_TYPE_NUMBER | 0x44 } |
Enumerates the tags of asset attributes. |
Asset_ResultCode { ASSET_SUCCESS = 0, ASSET_PERMISSION_DENIED = 201, ASSET_INVALID_ARGUMENT = 401, ASSET_SERVICE_UNAVAILABLE = 24000001, ASSET_NOT_FOUND = 24000002, ASSET_DUPLICATED = 24000003, ASSET_ACCESS_DENIED = 24000004, ASSET_STATUS_MISMATCH = 24000005, ASSET_OUT_OF_MEMORY = 24000006, ASSET_DATA_CORRUPTED = 24000007, ASSET_DATABASE_ERROR = 24000008, ASSET_CRYPTO_ERROR = 24000009, ASSET_IPC_ERROR = 24000010, ASSET_BMS_ERROR = 24000011, ASSET_ACCOUNT_ERROR = 24000012, ASSET_ACCESS_TOKEN_ERROR = 24000013, ASSET_FILE_OPERATION_ERROR = 24000014, ASSET_GET_SYSTEM_TIME_ERROR = 24000015, ASSET_LIMIT_EXCEEDED = 24000016, ASSET_UNSUPPORTED = 24000017 } |
Enumerates the result codes returned by ASSET functions. |
Asset_Accessibility { ASSET_ACCESSIBILITY_DEVICE_POWERED_ON = 0, ASSET_ACCESSIBILITY_DEVICE_FIRST_UNLOCKED = 1, ASSET_ACCESSIBILITY_DEVICE_UNLOCKED = 2 } |
Enumerates the types of access control based on the lock screen status. |
Asset_AuthType { ASSET_AUTH_TYPE_NONE = 0x00, ASSET_AUTH_TYPE_ANY = 0xFF } |
Enumerates the user authentication types supported by assets. |
Asset_SyncType { ASSET_SYNC_TYPE_NEVER = 0, ASSET_SYNC_TYPE_THIS_DEVICE = 1 << 0, ASSET_SYNC_TYPE_TRUSTED_DEVICE = 1 << 1 } |
Enumerates the sync types supported by assets. |
Asset_ConflictResolution { ASSET_CONFLICT_OVERWRITE = 0, ASSET_CONFLICT_THROW_ERROR = 1 } |
Enumerates the policies for resolving the conflict (for example, a duplicate alias). |
Asset_ReturnType { ASSET_RETURN_ALL = 0, ASSET_RETURN_ATTRIBUTES = 1 } |
Enumerates the types of the asset query result to return. |
Macro Description
ASSET_TAG_TYPE_MASK
#define ASSET_TAG_TYPE_MASK (0xF << 28)
Description
Defines the mask used to obtain the tag type of an asset attribute.
Since: 11
Enum Description
Asset_Accessibility
enum Asset_Accessibility
Description
Enumerates the types of access control based on the lock screen status.
Since: 11
Value | Description |
---|---|
ASSET_ACCESSIBILITY_DEVICE_POWERED_ON | The asset can be accessed after the device is powered on. |
ASSET_ACCESSIBILITY_DEVICE_FIRST_UNLOCKED | The asset can be accessed only after the device is unlocked for the first time. |
ASSET_ACCESSIBILITY_DEVICE_UNLOCKED | The asset can be accessed only after the device is unlocked. |
Asset_AuthType
enum Asset_AuthType
Description
Enumerates the user authentication types supported by assets.
Since: 11
Value | Description |
---|---|
ASSET_AUTH_TYPE_NONE | No user authentication is required before the asset is accessed. |
ASSET_AUTH_TYPE_ANY | The asset can be accessed if any user authentication (such as PIN, facial, or fingerprint authentication) is successful. |
Asset_ConflictResolution
enum Asset_ConflictResolution
Description
Enumerates the policies for resolving the conflict (for example, a duplicate alias).
Since: 11
Value | Description |
---|---|
ASSET_CONFLICT_OVERWRITE | Overwrite the original asset. |
ASSET_CONFLICT_THROW_ERROR | Throw an exception for the service to perform subsequent processing. |
Asset_ResultCode
enum Asset_ResultCode
Description
Enumerates the result codes returned by ASSET functions.
Since: 11
Value | Description |
---|---|
ASSET_SUCCESS | The operation is successful. |
ASSET_PERMISSION_DENIED | The caller does not have the required permission. |
ASSET_INVALID_ARGUMENT | The parameter is invalid. |
ASSET_SERVICE_UNAVAILABLE | The asset store service is unavailable. |
ASSET_NOT_FOUND | The asset is not found. |
ASSET_DUPLICATED | The asset already exists. |
ASSET_ACCESS_DENIED | The access to the asset is denied. |
ASSET_STATUS_MISMATCH | The lock screen status does not match. |
ASSET_OUT_OF_MEMORY | The system memory is insufficient. |
ASSET_DATA_CORRUPTED | The asset is corrupted. |
ASSET_DATABASE_ERROR | The database operation failed. |
ASSET_CRYPTO_ERROR | The cryptographic operation failed. |
ASSET_IPC_ERROR | The IPC failed. |
ASSET_BMS_ERROR | The Bundle Manager service is abnormal. |
ASSET_ACCOUNT_ERROR | The Account service is abnormal. |
ASSET_ACCESS_TOKEN_ERROR | The Access Token service is abnormal. |
ASSET_FILE_OPERATION_ERROR | The file operation failed. |
ASSET_GET_SYSTEM_TIME_ERROR | Failed to obtain the system time. |
ASSET_LIMIT_EXCEEDED | The number of cached assets exceeds the limit. |
ASSET_UNSUPPORTED | The function is not supported. |
Asset_ReturnType
enum Asset_ReturnType
Description
Enumerates the types of the asset query result to return.
Since: 11
Value | Description |
---|---|
ASSET_RETURN_ALL | The query result contains the asset plaintext and its attributes. |
ASSET_RETURN_ATTRIBUTES | The query result contains only the asset attributes. |
Asset_SyncType
enum Asset_SyncType
Description
Enumerates the sync types supported by assets.
Since: 11
Value | Description |
---|---|
ASSET_SYNC_TYPE_NEVER | Asset sync is not allowed. |
ASSET_SYNC_TYPE_THIS_DEVICE | Asset sync is allowed only on the local device, for example, in data restore on the local device. |
ASSET_SYNC_TYPE_TRUSTED_DEVICE | Asset sync is allowed only between trusted devices, for example, in the case of cloning. |
Asset_Tag
enum Asset_Tag
Description
Enumerates the tags of asset attributes.
Since: 11
Value | Description |
---|---|
ASSET_TAG_SECRET | Sensitive user data in the form of bytes, such as passwords and tokens. |
ASSET_TAG_ALIAS | Asset alias (identifier) in the form of bytes. |
ASSET_TAG_ACCESSIBILITY | Access control based on the lock screen status. The value is of the uint32 type, which is a 32-bit unsigned integer. |
ASSET_TAG_REQUIRE_PASSWORD_SET | Whether the asset is available only after a lock screen password is set. |
ASSET_TAG_AUTH_TYPE | User authentication type for the asset. The value is of the uint32 type. |
ASSET_TAG_AUTH_VALIDITY_PERIOD | Validity period of the user authentication, in seconds. The value is of the uint32 type, in seconds. |
ASSET_TAG_AUTH_CHALLENGE | Challenge value, in the form of bytes, used for anti-replay during the authentication. |
ASSET_TAG_AUTH_TOKEN | Authentication token, in the form of bytes, obtained after a successful user authentication. |
ASSET_TAG_SYNC_TYPE | Asset sync type. The value is of the uint32 type. |
ASSET_TAG_IS_PERSISTENT | Whether the asset needs to be stored persistently. Permission verification is required if OH_Asset_Add is called with this tag passed in. Required permissions: ohos.permission.STORE_PERSISTENT_DATA |
ASSET_TAG_DATA_LABEL_CRITICAL_1 | Custom data, which is of the bytes type and cannot be changed. |
ASSET_TAG_DATA_LABEL_CRITICAL_2 | Custom data, which is of the bytes type and cannot be changed. |
ASSET_TAG_DATA_LABEL_CRITICAL_3 | Custom data, which is of the bytes type and cannot be changed. |
ASSET_TAG_DATA_LABEL_CRITICAL_4 | Custom data, which is of the bytes type and cannot be changed. |
ASSET_TAG_DATA_LABEL_NORMAL_1 | Custom data, which is of the bytes type and can be changed. |
ASSET_TAG_DATA_LABEL_NORMAL_2 | Custom data, which is of the bytes type and can be changed. |
ASSET_TAG_DATA_LABEL_NORMAL_3 | Custom data, which is of the bytes type and can be changed. |
ASSET_TAG_DATA_LABEL_NORMAL_4 | Custom data, which is of the bytes type and can be changed. |
ASSET_TAG_RETURN_TYPE | Type of asset information to return. The value is of the uint32 type. |
ASSET_TAG_RETURN_LIMIT | Maximum number of assets that can be returned in a query operation. The value is of the uint32 type. |
ASSET_TAG_RETURN_OFFSET | Offset of the returned assets in a batch query. The value is of the uint32 type. |
ASSET_TAG_RETURN_ORDERED_BY | Sorting order of the assets in the query result. The value is of the uint32 type. |
ASSET_TAG_CONFLICT_RESOLUTION | Policy for resolving the conflict when an asset is added. The value is of the uint32_t type. |
Asset_TagType
enum Asset_TagType
Description
Enumerates the tag types of asset attributes.
Since: 11
Value | Description |
---|---|
ASSET_TYPE_BOOL | Boolean. |
ASSET_TYPE_NUMBER | uint32_t. |
ASSET_TYPE_BYTES | bytes. |