Motivation
Everyone migrating from geth/ethers/foundry has keys in encrypted JSON keystore files (Web3 Secret Storage v3). eth.zig currently only accepts raw private keys and BIP-39 mnemonics — a hard stop for users with existing operational key management.
Scope
New src/keystore.zig:
decrypt(allocator, json, password) ![32]u8 — scrypt and pbkdf2-hmac-sha256 KDFs, aes-128-ctr cipher, keccak MAC check
encrypt(allocator, key, password, opts) ![]u8 — v3 JSON output, scrypt default
- Constant-time MAC comparison; zero key material on free (see
utils/constants.zig secure-zero helper)
Pointers
std.crypto provides scrypt, pbkdf2, aes; MAC = keccak256(derived_key[16..32] ++ ciphertext) per spec. Test vectors: the canonical ones from the Web3 Secret Storage definition (myetherwallet/geth fixtures).
Motivation
Everyone migrating from geth/ethers/foundry has keys in encrypted JSON keystore files (Web3 Secret Storage v3). eth.zig currently only accepts raw private keys and BIP-39 mnemonics — a hard stop for users with existing operational key management.
Scope
New
src/keystore.zig:decrypt(allocator, json, password) ![32]u8— scrypt and pbkdf2-hmac-sha256 KDFs, aes-128-ctr cipher, keccak MAC checkencrypt(allocator, key, password, opts) ![]u8— v3 JSON output, scrypt defaultutils/constants.zigsecure-zero helper)Pointers
std.cryptoprovides scrypt, pbkdf2, aes; MAC = keccak256(derived_key[16..32] ++ ciphertext) per spec. Test vectors: the canonical ones from the Web3 Secret Storage definition (myetherwallet/geth fixtures).