Skip to main content

Crate bevy_dlc

Crate bevy_dlc 

Source

Modules§

encrypt_key_registry
Registry for encrypt keys and DLC asset paths. This tracks which encrypt key is associated with which DLC id, and which asset paths are associated with which DLC id so that they can be reloaded when the DLC is unlocked.
prelude

Macros§

dlc_register_types
Calls App::register_dlc_type::<T>() for each given type on the provided Bevy App instance.
dlc_simple_asset
Defines a simple “text-like” asset type along with a loader and a Bevy plugin for it. The generated loader reads the file as UTF-8 and stores a String in the asset. The plugin registers the loader and the DLC type.
pack_items
Builds a Vec<PackItem> from a list of entries. Each entry specifies a path and its raw contents; optional query-style suffixes allow specifying an explicit original extension or a type path as well.

Structs§

BlockMetadata
V4 block metadata: stores information about a tar-gz block within the pack file
DlcId
Strongly-typed DLC identifier (string-backed).
DlcLoader
A loader for individual encrypted files inside a .dlcpack.
DlcPack
Represents a .dlcpack bundle (multiple encrypted entries).
DlcPackLoader
AssetLoader for .dlcpack bundles (contains multiple encrypted entries).
DlcPackLoaderSettings
Settings for DlcPackLoader that control asset registration behavior.
DlcPlugin
EncryptedAsset
Represents a single encrypted file inside a .dlcpack container, along with its metadata (DLC ID, original extension, optional type path). The ciphertext is not decrypted at this stage; decryption is performed on demand by DlcPackEntry::decrypt_bytes using the global encrypt key registry.
ManifestEntry
Representation of a single manifest entry inside a v2+ .dlcpack.
PackItem
Helper struct for building DLC pack entries with optional metadata. Provides a builder pattern for creating entries to pack into a .dlcpack container.
Product
Product: non-secret identifier wrapper (keeps same API surface)
PublicKey
PublicKey wrapper (32 bytes)
V4ManifestEntry
V4 manifest entry: binary-serializable format for faster parsing. Format: path_len(u32) + path(utf8) + ext_len(u8) + ext(utf8) + type_len(u16) + type(utf8) + block_id(u32) + block_offset(u32) + size(u32)

Enums§

CompressionLevel
Compression level for packing. Controls the trade-off between pack size and packing time. Higher levels produce smaller files but take longer to create.
DlcError
Parse a .dlcpack container and return product, embedded dlc_id, and a list of (path, EncryptedAsset) pairs. For v3 format, also validates the signature against the authorized product public key.
DlcKey
Client-side wrapper for Ed25519 key operations: verify tokens and (when private) create compact signed tokens.

Constants§

DEFAULT_BLOCK_SIZE
Default block size for v4 hybrid format (10 MB). Blocks are individually encrypted tar.gz chunks.
DLC_PACK_MAGIC
.dlcpack container magic header (4 bytes) used to identify encrypted pack containers.
DLC_PACK_VERSION_LATEST
Current supported .dlcpack format version. This is stored in the container header and used to determine how to parse the contents.

Traits§

AppExt

Functions§

extract_dlc_ids_from_license
Extract the DLC IDs from a signed license’s payload. Returns an empty vec if the token is malformed or contains no dlcs array.
extract_encrypt_key_from_license
Extract the embedded encryption key from a signed license’s payload (base64url-encoded). Returns None if the token is malformed or contains no encrypt_key.
extract_product_from_license
Extract the product field from a signed license’s payload. Returns None if the token is malformed or the field is missing.
is_data_executable
Simple heuristic used by the packer to detect executable payloads. It is intentionally forgiving; the goal is merely to catch obvious binaries when a user accidentally tries to pack them.
is_dlc_entry_loaded
A Bevy system condition that returns true when a specific DLC pack entry is loaded.
is_dlc_loaded
A Bevy system condition that returns true when a DLC pack has been loaded.
is_forbidden_extension
Return true if the extension (case‑insensitive) is in the forbidden list.
pack_encrypted_pack
Pack multiple entries into a single encrypted .dlcpack binary using the latest version format. This is the main entry point for pack creation and is used by the CLI tool; it can also be used by other tools that want to generate packs programmatically.
parse_encrypted
Parse the binary encrypted-asset format from a byte slice. This is used by the pack loader when parsing the pack metadata, and also by the DlcLoader when decrypting individual entries (since the entry metadata is stored in the same format as a standalone encrypted file).
parse_encrypted_pack
Returns: (product, dlc_id, version, entries)
register_encryption_key
Register an encryption key for a DLC ID in the global registry. This is used internally by the plugin and can be called by tools/CLI for key management.

Type Aliases§

EncryptionKey
PrivateKey
SignedLicense
A compact offline-signed token containing DLC ids and an optional embedded encrypt key. Treat as sensitive and do not leak raw secrets in logs. This