voided-core
voided-core is the direct Rust implementation of Voided. It is the
source-of-truth crate for the Node and WASM bindings, and it is also the right
entry point if you want to use Voided from Rust without going through the
JavaScript wrappers.
The crate is organized around three layers:
- primitive cryptography
- fused shell primitives for already-prepared bytes
- v3 whole-monolith protected artifacts for the normal product path
Contents
- What This Crate Is For
- Installation
- Core Concepts
- What Fused Means
- Command Map
- Public Modules
- Quick Start
- Choosing The Right Layer
- Fused Presets
- Feature Flags
- Build Targets
- Testing
- v1 Boundary
- License
What This Crate Is For
Use voided-core directly when you want:
- native Rust access to Voided's primitives and artifact formats
- the monolith-first Voided v3 model without a JavaScript wrapper
- one implementation that stays aligned across Rust, Node, and WASM
- direct control over whether you use raw primitives, fused shell, or the full monolith artifact flow
If you want the wrapper layers instead:
- use
@voideddev/enc-serverfor Node.js - use
@voideddev/e2ee-clientfor browser runtimes
Installation
Default backend-oriented build:
[]
= "0.2.2"
Browser-oriented build:
[]
= { = "0.2.2", = false, = ["browser"] }
The default feature set is backend.
Core Concepts
Primitive Cryptography
The primitive layer covers:
- AEAD encryption
- key generation and derivation
- hashing and HMAC
- compression
- utility helpers
Use this layer when you want Voided's cryptographic building blocks but prefer to define your own outer envelope or storage format.
Fused Shell
The fused shell is the outer-shell layer for already-prepared bytes. It gives you a stable shell envelope with preset-driven behavior.
Use this layer when:
- you already own the bytes being shelled
- you want to inspect shell metadata independently
- you want to apply or remove the shell without using the full artifact flow
Full-Flow Monolith Artifact
The full-flow helper layer is the normal Voided v3 path:
- optional compression
- authenticated encryption
- whole-monolith artifact shaping
The main functions are:
protectopeninspect_artifactrepack_artifact
Use this layer when you want the standard Voided v3 monolith artifact contract.
What Fused Means
The fused shell is the outer envelope primitive for bytes that are already ready
to store or transport. In the normal Voided v3 product flow, callers should use
the whole-monolith protect/open helpers instead of assembling the product
artifact by hand.
That means the standard pipeline is:
- optional compression
- authenticated encryption
- whole-monolith shell shaping
The shell is responsible for the outer artifact contract:
- versioned envelope structure
- preset selection
- chunk sizing and chunk counts
- shell metadata that can be inspected without opening the artifact
The shell does not replace encryption, and it does not ask the primitive layer to disappear. It gives the encrypted payload a stable outer form.
In practice:
- use shell helpers when the inner bytes are already in the shape you want
- use full-flow helpers when you want
voided-coreto own the complete standard artifact format
Command Map
The public shell commands break down like this:
fuse_bytes- wrap prepared bytes in the fused shell
unfuse_bytes- remove the fused shell and return the inner bytes
inspect_fused- inspect shell metadata without opening the inner payload
protect- compress, encrypt, and shape plaintext into a standard v3 monolith artifact
open- reverse the full
protectpipeline and return the original plaintext
- reverse the full
inspect_artifact- inspect a protected monolith artifact without opening it
repack_artifact- reopen and rewrite an artifact with different preset or pipeline options
That gives you three clean entry points:
- primitives when you only need crypto or compression
- shell helpers when you already own the inner bytes
- full-flow helpers when you want the standard Voided v3 monolith artifact contract
Public Modules
voided_core::encryption
Provides:
- AES-256-GCM and XChaCha20-Poly1305
- HKDF and PBKDF2
- X25519 key agreement helpers
- serialization helpers for encrypted payloads
voided_core::hash
Provides:
- SHA-256 and SHA-512
- HMAC helpers
- PBKDF2-based hash verification helpers
- fingerprints and safety-number formatting
voided_core::compression
Available with the compression feature.
Provides:
- Brotli
- Gzip
- compression result metadata
- helpers for compressed payload serialization
decompress_bounded, for streaming lossless decode under a caller-selected absolute output ceiling
decompress_bounded intentionally does not apply the legacy expansion-ratio
heuristic. Use it when the surrounding format authenticates or independently
validates an exact maximum size and highly compressible input is legitimate.
The caller ceiling is mandatory and may not exceed the crate's 512 MiB global
in-memory decompression limit.
voided_core::shell
Provides:
fuse_bytesunfuse_bytesinspect_fusedprotectopeninspect_artifactrepack_artifact- fused preset and options types
Command intent:
fuse_bytes/unfuse_bytes- direct shell-layer control
protect/open- standard full-flow artifact entry points
inspect_fused/inspect_artifact- metadata inspection without opening payloads
repack_artifact- rewrite artifacts without forcing callers to manually unpack and rebuild the shell pipeline
voided_core::util
Provides:
- random bytes
- secure wipe
- encoding helpers
- small shared utility helpers
voided_core::signing
Available with the signing feature.
Provides:
- Ed25519 helpers
- P-256 helpers
- standard PKCS#8 private and SPKI public PEM for Ed25519 and P-256
- RSA-PSS byte
0x03is reserved for wire compatibility and is not implemented
Quick Start
Example: Direct AEAD Encryption
Use the primitive encryption layer when you want direct ciphertext handling and you do not want Voided to own the outer artifact format.
use ;
let key = generate_key;
let plaintext = b"hello direct rust";
let encrypted = encrypt?;
let decrypted = decrypt?;
assert_eq!;
# Ok::
Example: Standard Monolith Artifact
Use protect/open when you want the normal Voided v3 monolith artifact shape.
use generate_key;
use ;
let key = generate_key;
let plaintext = b"hello monolith world";
let protected = protect?;
let info = inspect_artifact?;
let restored = open?;
assert_eq!;
assert_eq!;
# Ok::
Example: Shell-Only Envelope
Use fuse_bytes/unfuse_bytes when the bytes inside the shell are already in the
form you want.
use generate_key;
use ;
let key = generate_key;
let payload = b"already-prepared bytes";
let shell = fuse_bytes?;
let info = inspect_fused?;
let restored = unfuse_bytes?;
assert_eq!;
assert_eq!;
# Ok::
Choosing The Right Layer
- Use
encryptionwhen you need direct AEAD primitives and want to manage the outer format yourself. - Use
hashwhen you need fingerprints, HMACs, or verification helpers without touching the artifact flow. - Use
compressionwhen you want direct compression results and metadata. - Use
fuse_byteswhen you already have the bytes you want inside the shell. - Use
protectwhen you want the standard Voided v3 monolith artifact path. - Use
inspect_fusedorinspect_artifactwhen you want metadata without opening the payload. Their keyless metadata is unauthenticated and must not drive authorization, quota, billing, allocation, or algorithm-policy choices; only a successful open authenticates an artifact. - Use
repack_artifactwhen you want to move an artifact between monolith presets without changing the underlying plaintext.
Fused Presets
The stable fused presets are:
compactbalancedconcealed
Practical intent:
compact- lowest-overhead preset
balanced- default general-purpose preset
concealed- heavier preset with more shell variation
If you do not have a strong reason otherwise, start with balanced.
Feature Flags
backend
- enabled by default
- full server-oriented feature set
- includes
compression,signing, andstd
browser
- browser-oriented subset used by the WASM build
- meant for
voided-wasmand other browser-compatible targets
compression
- enables Brotli and Gzip helpers
- required for
shell::protect,shell::open, andshell::repack_artifact
signing
- enables Ed25519 and P-256 helpers; RSA-PSS remains a reserved identifier only
wasm
- internal support feature used by the WASM binding build
std
- enables the standard library path used by the backend build
Build Targets
Common target shapes:
- server/native Rust
- use default features
- browser/WASM-oriented builds
- disable default features and enable
browser
- disable default features and enable
The crate itself is the implementation authority for both wrapper bindings, so
behavior added here should be projected through voided-node and voided-wasm
rather than reimplemented elsewhere.
Testing
When changing this crate, the most important checks are:
- unit tests around the touched module
- monolith artifact stress and vector coverage
- deterministic shell behavior when nonce or chunk settings are fixed
From the workspace Rust root:
v1 Boundary
voided-core is the monolith-first Rust crate for the current library line.
Map-based obfuscation belongs to deprecated v1 and is not part of the current
crate surface.
That means:
- no map-shell module in the public current surface
- no map-first examples in this crate guide
- no new direct Rust development targeting the old map path
License
MIT