openharmony 鸿蒙 capi-asset-type-h

2026-08-25 浏览 (1)

asset_type.h

Overview

Defines the enums, structs, and error codes used in the asset store service.

File to include: <asset/asset_type.h>

Library: libasset_ndk.z.so

System capability: SystemCapability.Security.Asset

Since: 11

Related module: AssetType

Summary

Structs

Nametypedef KeywordDescription
Asset_BlobAsset_BlobDefines a binary array, that is, an array of bytes with variable length.
Asset_ValueAsset_ValueDefines the value of the asset attribute.
Asset_AttrAsset_AttrRepresents an asset attribute in the form of a key-value (KV) pair.
Asset_ResultAsset_ResultRepresents the query result of an asset.
Asset_ResultSetAsset_ResultSetRepresents the query result of multiple assets.
Asset_SyncResultAsset_SyncResultRepresents the sync result of an asset.

Enums

Nametypedef KeywordDescription
Asset_TagTypeAsset_TagTypeEnumerates the types of the keys of asset attributes.
Asset_TagAsset_TagEnumerates the keys of asset attributes.
Asset_ResultCodeAsset_ResultCodeEnumerates the result codes used in the ASSET APIs.
Asset_AccessibilityAsset_AccessibilityEnumerates the types of the access control based on the lock screen status.
Asset_AuthTypeAsset_AuthTypeEnumerates the user authentication types supported by assets.
Asset_SyncTypeAsset_SyncTypeEnumerates the asset sync types.
Asset_WrapTypeAsset_WrapTypeEncrypted import/export type supported by the asset.
Asset_ConflictResolutionAsset_ConflictResolutionEnumerates the policies for resolving the conflict (for example, a duplicate alias).
Asset_ReturnTypeAsset_ReturnTypeEnumerates the types of the asset query result to return.
Asset_OperationTypeAsset_OperationTypeEnumerates the additional asset operation types.

Macros

NameDescription
ASSET_TAG_TYPE_MASK (0xF << 28)Defines the mask used to obtain the key type of an asset attribute.
Since: 11

Enum Description

Asset_TagType

enum Asset_TagType

Description

Enumerates the types of the keys of asset attributes.

Since: 11

EnumDescription
ASSET_TYPE_BOOL = 0x1 << 28Boolean.
ASSET_TYPE_NUMBER = 0x2 << 28uint32_t.
ASSET_TYPE_BYTES = 0x3 << 28Bytes.

Asset_Tag

enum Asset_Tag

Description

Enumerates the keys of asset attributes.

Since: 11

EnumDescription
ASSET_TAG_SECRET = ASSET_TYPE_BYTES |0x01Sensitive user data in the form of bytes, such as passwords and tokens.
ASSET_TAG_ALIAS = ASSET_TYPE_BYTES |0x02Asset alias (identifier) in the form of bytes.
ASSET_TAG_ACCESSIBILITY = ASSET_TYPE_NUMBER |0x03Access control based on the lock screen status. The value is of the uint32_t type.
ASSET_TAG_REQUIRE_PASSWORD_SET = ASSET_TYPE_BOOL |0x04A Boolean value indicating whether the asset is available only with a lock screen password.
ASSET_TAG_AUTH_TYPE = ASSET_TYPE_NUMBER |0x05User authentication type for the asset. The value is of the uint32_t type.
ASSET_TAG_AUTH_VALIDITY_PERIOD = ASSET_TYPE_NUMBER |0x06Validity period of the user authentication, in seconds. The value is of the uint32_t type, in seconds.
ASSET_TAG_AUTH_CHALLENGE = ASSET_TYPE_BYTES |0x07Challenge value, in the form of bytes, used for anti-replay during the authentication.
ASSET_TAG_AUTH_TOKEN = ASSET_TYPE_BYTES |0x08Authentication token, in the form of bytes, obtained after a successful user authentication.
ASSET_TAG_SYNC_TYPE = ASSET_TYPE_NUMBER |0x10Asset sync type. The value is of the uint32_t type.
ASSET_TAG_IS_PERSISTENT = ASSET_TYPE_BOOL |0x11Whether the asset needs to be stored persistently.
Verification of ohos.permission.STORE_PERSISTENT_DATA is required if OH_Asset_Add is called with this tag passed in.
ASSET_TAG_DATA_LABEL_CRITICAL_1 = ASSET_TYPE_BYTES |0x20Custom data, which is of the bytes type and cannot be changed.
ASSET_TAG_DATA_LABEL_CRITICAL_2 = ASSET_TYPE_BYTES |0x21Custom data, which is of the bytes type and cannot be changed.
ASSET_TAG_DATA_LABEL_CRITICAL_3 = ASSET_TYPE_BYTES |0x22Custom data, which is of the bytes type and cannot be changed.
ASSET_TAG_DATA_LABEL_CRITICAL_4 = ASSET_TYPE_BYTES |0x23Custom data, which is of the bytes type and cannot be changed.
ASSET_TAG_DATA_LABEL_NORMAL_1 = ASSET_TYPE_BYTES |0x30Custom data, which is of the bytes type and can be changed.
ASSET_TAG_DATA_LABEL_NORMAL_2 = ASSET_TYPE_BYTES |0x31Custom data, which is of the bytes type and can be changed.
ASSET_TAG_DATA_LABEL_NORMAL_3 = ASSET_TYPE_BYTES |0x32Custom data, which is of the bytes type and can be changed.
ASSET_TAG_DATA_LABEL_NORMAL_4 = ASSET_TYPE_BYTES |0x33Custom data, which is of the bytes type and can be changed.
ASSET_TAG_DATA_LABEL_NORMAL_LOCAL_1 = ASSET_TYPE_BYTES |0x34Custom data, which is of the bytes type, can be changed, but cannot be synced.
Since: 12
ASSET_TAG_DATA_LABEL_NORMAL_LOCAL_2 = ASSET_TYPE_BYTES |0x35Custom data, which is of the bytes type, can be changed, but cannot be synced.
Since: 12
ASSET_TAG_DATA_LABEL_NORMAL_LOCAL_3 = ASSET_TYPE_BYTES |0x36Custom data, which is of the bytes type, can be changed, but cannot be synced.
Since: 12
ASSET_TAG_DATA_LABEL_NORMAL_LOCAL_4 = ASSET_TYPE_BYTES |0x37Custom data, which is of the bytes type, can be changed, but cannot be synced.
Since: 12
ASSET_TAG_RETURN_TYPE = ASSET_TYPE_NUMBER |0x40Type of asset information to return. The value is of the uint32_t type.
ASSET_TAG_RETURN_LIMIT = ASSET_TYPE_NUMBER |0x41Maximum number of assets that can be returned in a query operation. The value is of the uint32_t type.
ASSET_TAG_RETURN_OFFSET = ASSET_TYPE_NUMBER |0x42Offset of the returned assets in a batch query. The value is of the uint32_t type.
ASSET_TAG_RETURN_ORDERED_BY = ASSET_TYPE_NUMBER |0x43Sorting order of the assets in the query result. The value is of the uint32_t type.
ASSET_TAG_CONFLICT_RESOLUTION = ASSET_TYPE_NUMBER |0x44Policy for resolving the conflict when an asset is added. The value is of the uint32_t type.
ASSET_TAG_UPDATE_TIME = ASSET_TYPE_BYTES |0x45Asset update time, in timestamp format. The value is of the bytes type.
Since: 12
ASSET_TAG_OPERATION_TYPE = ASSET_TYPE_NUMBER |0x46Additional operation type. The value is of the uint32_t type.
Since: 12
ASSET_TAG_REQUIRE_ATTR_ENCRYPTED = ASSET_TYPE_BOOL |0x47Whether to encrypt the additional information customized by the service. The value is of the Boolean type.
Since: 14
ASSET_TAG_GROUP_ID = ASSET_TYPE_BYTES |0x48Group to which the asset belongs. The value is of the bytes type.
Since: 18
ASSET_TAG_WRAP_TYPE = ASSET_TYPE_NUMBER |0x49Encrypted import/export type supported by the asset. The value is of the uint32_t type.
Since: 18

Asset_ResultCode

enum Asset_ResultCode

Description

Enumerates the result codes used in the ASSET APIs.

Since: 11

EnumDescription
ASSET_SUCCESS = 0The operation is successful.
ASSET_PERMISSION_DENIED = 201The caller does not have the required permission.
ASSET_INVALID_ARGUMENT = 401The parameter is invalid.
ASSET_SERVICE_UNAVAILABLE = 24000001The asset store service is unavailable.
ASSET_NOT_FOUND = 24000002The asset is not found.
ASSET_DUPLICATED = 24000003The asset already exists.
ASSET_ACCESS_DENIED = 24000004The access to the asset is denied.
ASSET_STATUS_MISMATCH = 24000005The lock screen status does not match.
ASSET_OUT_OF_MEMORY = 24000006The system memory is insufficient.
ASSET_DATA_CORRUPTED = 24000007The asset is corrupted.
ASSET_DATABASE_ERROR = 24000008The database operation failed.
ASSET_CRYPTO_ERROR = 24000009The cryptographic operation failed.
ASSET_IPC_ERROR = 24000010The IPC failed.
ASSET_BMS_ERROR = 24000011The Bundle Manager service is abnormal.
ASSET_ACCOUNT_ERROR = 24000012The Account service is abnormal.
ASSET_ACCESS_TOKEN_ERROR = 24000013The Access Token service is abnormal.
ASSET_FILE_OPERATION_ERROR = 24000014The file operation failed.
ASSET_GET_SYSTEM_TIME_ERROR = 24000015Failed to obtain the system time.
ASSET_LIMIT_EXCEEDED = 24000016The number of cached assets exceeds the limit.
ASSET_UNSUPPORTED = 24000017The function is not supported.
ASSET_PARAM_VERIFICATION_FAILED = 24000018The parameter verification fails.
Since: 20

Asset_Accessibility

enum Asset_Accessibility

Description

Enumerates the types of the access control based on the lock screen status.

Since: 11

EnumDescription
ASSET_ACCESSIBILITY_DEVICE_POWERED_ON = 0The asset can be accessed after the device is powered on.
ASSET_ACCESSIBILITY_DEVICE_FIRST_UNLOCKED = 1The asset can be accessed only after the device is unlocked for the first time.
ASSET_ACCESSIBILITY_DEVICE_UNLOCKED = 2The 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

EnumDescription
ASSET_AUTH_TYPE_NONE = 0x00No user authentication is required before the asset is accessed.
ASSET_AUTH_TYPE_ANY = 0xFFThe asset can be accessed if any user authentication (such as PIN, facial, or fingerprint authentication) is successful.

Asset_SyncType

enum Asset_SyncType

Description

Asset sync type.

Since: 11

EnumDescription
ASSET_SYNC_TYPE_NEVER = 0Asset sync is not allowed.
ASSET_SYNC_TYPE_THIS_DEVICE = 1 << 0Asset sync is allowed only on the local device, for example, in data restore on the local device.
ASSET_SYNC_TYPE_TRUSTED_DEVICE = 1 << 1Asset sync is allowed only between trusted devices, for example, in the case of cloning.
ASSET_SYNC_TYPE_TRUSTED_ACCOUNT = 1 << 2Asset sync is allowed only between the devices that are logged in with trusted accounts, for example, in cloud sync scenarios.
Since: 12

Asset_WrapType

enum Asset_WrapType

Description

Encrypted import/export type supported by the asset.

Since: 18

EnumDescription
ASSET_WRAP_TYPE_NEVER = 0Encrypted import/export is not allowed for the asset.
ASSET_WRAP_TYPE_TRUSTED_ACCOUNT = 1Encrypted import/export is allowed for the asset only on devices where a trusted account is logged in.

Asset_ConflictResolution

enum Asset_ConflictResolution

Description

Policy for resolving the conflict (for example, a duplicate alias).

Since: 11

EnumDescription
ASSET_CONFLICT_OVERWRITE = 0Overwrite the original asset.
ASSET_CONFLICT_THROW_ERROR = 1Throw an exception for the service to perform subsequent processing.

Asset_ReturnType

enum Asset_ReturnType

Description

Type of the asset query result to return.

Since: 11

EnumDescription
ASSET_RETURN_ALL = 0The query result contains the asset plaintext and its attributes.
ASSET_RETURN_ATTRIBUTES = 1The query result contains only the asset attributes.

Asset_OperationType

enum Asset_OperationType

Description

Enumerates the additional asset operation types.

Since: 12

EnumDescription
ASSET_NEED_SYNC = 0Sync.
ASSET_NEED_LOGOUT = 1Logout.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 capi-assettype-asset-attr

openharmony 鸿蒙 capi-assettype-asset-blob

openharmony 鸿蒙 capi-assettype-asset-value

openharmony 鸿蒙 capi-assettype-asset-syncresult

openharmony 鸿蒙 Readme-EN

openharmony 鸿蒙 capi-assettype-asset-resultset

openharmony 鸿蒙 capi-assettype

openharmony 鸿蒙 errorcode-asset

openharmony 鸿蒙 capi-asset-api-h

openharmony 鸿蒙 capi-assettype-asset-result

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/RVTV6lhC