[core] TOTP, Wi-Fi QR payloads, device key wrap (v0.2.0) #3
Reference in New Issue
Block a user
Delete Branch "feature/totp-qr"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Phase B core: 2FA codes, QR payloads, and the key wrap Windows Hello unlock needs. v0.2.0.
What
custos-totp(new): RFC 4226 HOTP and RFC 6238 TOTP on RustCryptohmac+sha1/sha2(SHA-1/256/512, 6–8 digits, any period);
Totp::parsereadsotpauth://totp/…URIs (label, issuer,algorithm, digits, period) or a bare base32 secret (case, spaces,
=tolerated);to_uri,seconds_left. HOTP URIs are refused (not supported). Secret zeroized,[redacted]inDebug.custos-qr(new):wifi_payload(ssid, password, security, hidden)→WIFI:T:<WPA|WEP|nopass>;S:…;P:…;H:<true|false>;;with\ ; , : "escaped (noP:for open networks);secret_payload. Payload strings only; the app renders.custos-vault:Vault::wrap_for_device(material)/Vault::open_with_device(bytes, blob, material):the vault key wrapped with HKDF-SHA256(material, random salt) → XChaCha20-Poly1305, as a 108-byte blob the
app keeps on the device (never in the vault file). New error
DeviceKeyRejected. Documented indocs/FORMAT.md("Device key wrap") anddocs/THREAT_MODEL.md.Tests (
cargo test --workspace --release, written first)custos-totp: 5 passed — RFC 6238 Appendix B: all 18 vectors exact (6 times × SHA1/256/512, 8 digits,seeds as in the RFC's reference code), RFC 4226 Appendix D: all 10 HOTP values exact, otpauth parsing
incl. defaults and 7 malformed URIs refused, URI round trip + countdown, secret redacted. Vectors copied
from rfc-editor.org, not from memory.
custos-qr: 5 passed — every special character escaped; an SSID and a password containing all of\ ; , : "survive a reader's unescaping exactly; WEP/open/hidden variants; Unicode SSID.custos-vault: 11 passed (one new: device wrap round trip, wrong material →DeviceKeyRejected, everyblob byte flipped refused, a blob from another vault refused).
custos-gen: 15 passed. Doctests: 2. Total 38 passed, 0 failed.Self-review
that is a TPM-held RSA key behind PIN/biometrics. The core does not and cannot check that.
Totp::parsedecodes percent-escapes withdecode_utf8_lossy; a malformed label becomes U+FFFD rather thanan error. Only the secret matters for the code.