xbr._wallet¶
Functions¶
|
Expand |
|
|
|
Compute argon2id based secret from user email and password only. This uses Argon2id |
Module Contents¶
- expand_argon2_secret(pkm: bytes, context: bytes, salt: bytes | None = None) bytes[source]¶
Expand
pkmandcontextinto a key of lengthbytesusing HKDF’s expand function based on HMAC SHA-512). See the HKDF draft RFC and paper for usage notes.- Parameters:
pkm
context
salt
- Returns:
- pkm_from_argon2_secret(email: str, password: str, context: str, salt: bytes | None = None) bytes[source]¶
- Parameters:
email
password
context
salt
- Returns:
- stretch_argon2_secret(email: str, password: str, salt: bytes | None = None) bytes[source]¶
Compute argon2id based secret from user email and password only. This uses Argon2id for stretching a potentially weak user password/PIN and subsequent HKDF based key extending to derive private key material (PKM) for different usage contexts.
The Argon2 parameters used are the following:
kdf
argon2id-13time cost
4096memory cost
512parallelism
1
See draft-irtf-cfrg-argon2 and argon2-cffi.
- Parameters:
email – User email.
password – User password.
salt – Optional salt to use (must be 16 bytes long). If none is given, compute salt from email as
salt = SHA256(email)[:16].
- Returns:
The computed private key material (256b, 32 octets).