Skip to main content

Crate quai_keystore

Crate quai_keystore 

Source
Expand description

Bounded legacy Web3 v3 / x-quais keystore interchange.

Native authenticated full-wallet backups belong to quai-wallet. This format only protects the private-key ciphertext with its legacy MAC. Optional mnemonic metadata is accepted only when its derived key matches the decrypted key. KDFs are synchronous CPU work: use a bounded worker, never an async executor/UI thread.

Modules§

derive
Standalone guarded key derivation, independent of encrypted document parsing. Standalone bounded PBKDF2/scrypt utilities with guarded derived output.

Structs§

EncryptedKeystore
Encrypted legacy JSON; diagnostics omit ciphertext, identifiers and metadata.
KdfLimits
Fixed hostile-input KDF limits; all checked before deriving or allocating work memory.
Keystore
Validated, encrypted document. Parsing does no KDF or entropy work.
KeystoreAccount
Decrypted key and optional mnemonic whose derivation was checked against it.
VerifiedMnemonic
Derivation-verified mnemonic. Legacy format cannot represent a BIP39 passphrase.

Enums§

KeystoreError
Sanitized failures never include passwords, keys or mnemonic metadata.
Password
Explicit text normalization versus exact password bytes, matching quais.js.

Functions§

encrypt
Export a single key using fresh OS/Web Crypto salt, IV and UUID and pinned-JS scrypt defaults. This synchronous operation uses about 128 MiB of scrypt working memory.
encrypt_with_mnemonic
Export a derivation-verified mnemonic with a legacy key. Only the empty BIP39 passphrase is representable; mismatched entropy/language/path fails before KDF. Metadata is not authenticated by this legacy format; import always rederives it.