3.0 KiB
id, name, status, depends_on, scope, risk, impact, level
| id | name | status | depends_on | scope | risk | impact | level | |
|---|---|---|---|---|---|---|---|---|
| encryption-salt-kdf | Document EncryptedData salt as reserved for future KDF-based key derivation | completed |
|
narrow | low | component | implementation |
Description
The EncryptedData struct has a salt field that is generated randomly during encryption but not used in the key derivation process. The current encryption flow is:
- Derive key from seed at path
m/74'/2'/0'/0' - Use first 32 bytes of derived private key as AES-256-GCM key
- Generate random 12-byte IV
- Generate random 32-byte salt (stored but NOT used in key derivation)
- Encrypt with AES-256-GCM using the derived key + random IV
- Store
{key_version, salt, iv, data}asEncryptedData
The salt is stored but serves no purpose. The spec update (spec-update-secret-service) resolves this by documenting the salt as reserved for future KDF-based key rotation. In v1, the encryption key is derived directly from the seed at path m/74'/2'/0'/0' without a salt-based KDF. HKDF-based key derivation is deferred to Phase B.
Decision: Option B — Document salt as reserved. The spec update has already made this decision. This task implements Option B only.
Implementation (Option B only)
- Add documentation to
encryption.rsexplaining that thesaltfield inEncryptedDatais reserved for future KDF-based key derivation (Phase B). In v1, the encryption key is derived directly from the seed at pathm/74'/2'/0'/0'without using the salt. - Add a doc comment on the
EncryptedData.saltfield explaining its reserved purpose and that it is not used in v1 key derivation. - Add a
// TODO(Phase B): Use salt in HKDF-based key derivationcomment on the salt generation inencrypt(). - No code behavior changes — existing tests must pass unchanged.
Acceptance Criteria
encryption.rsmodule-level documentation explains that the salt field is reserved for future KDF-based key derivationEncryptedDatastruct has doc comment onsaltfield explaining reserved purpose and that it is not used in v1 key derivation// TODO(Phase B)comment on salt generation inencrypt()- No behavior changes — all existing tests pass unchanged
References
- docs/architecture/secret-service.md — Encryption section (after spec update, which specifies "salt is reserved for future KDF-based key rotation")
- crates/alknet-secret/src/encryption.rs — Current encrypt/decrypt implementation
Notes
The spec update task already decided on Option B. HKDF-based key derivation is deferred to Phase B. This task only documents the salt as reserved and adds TODO comments.
The architect's message specifically called out: "The EncryptedData struct has a salt field but the encryption function generates a random salt per encryption without using it for key derivation. Either the salt should be used in a KDF, or the field should be documented as reserved." The spec update chose "document as reserved" for v1.
Summary
To be filled on completion