pub struct EncryptedData {
pub key_version: u32,
pub salt: String,
pub iv: String,
pub data: String,
}Expand description
Encrypted data blob stored in the metagraph.
This is the stable wire format shared with alknet-storage. The fields are Base64-encoded strings for JSON serialization compatibility.
§Compatibility
The Rust EncryptedData is a superset of the TypeScript EncryptedDataSchema
from @alkdev/storage. Migration path: re-encrypt TypeScript-encrypted data
using the Rust vault with a new key version.
See OQ-20 for the compatibility tracking.
Fields§
§key_version: u32Key version for rotation support.
salt: StringBase64-encoded random salt (32 bytes).
Unused for key derivation in v2 (ADR-020). HD derivation at
m/74'/2'/0'/0' doesn’t need a salt — the path provides domain
separation. The salt is generated randomly and stored for wire-format
compatibility with the TypeScript EncryptedDataSchema; it plays no
cryptographic role. Key rotation uses version-indexed paths (ADR-021),
not a KDF over the salt. The field is retained because the wire format
is frozen (ADR-018). See encryption.md → “Salt field” for full
rationale.
iv: StringBase64-encoded initialization vector (12 bytes for AES-GCM).
data: StringBase64-encoded ciphertext (AES-256-GCM encrypted, includes auth tag).