feat: validate 1fichier premium accounts
Merged
MP
4mo ago+407+407+012345678901234567890123456789-44-44-01234567890123456789
Summary
- add real premium-account validation through the authenticated 1fichier user API
- read the selected credential only through Vortex's dedicated host function
- preserve typed authentication, expiry, cooldown, and quota failures for host-side rotation
- resolve premium tokens with traffic metadata and fail closed when traffic is exhausted
Verification
- cargo fmt --all -- --check
- cargo clippy --all-targets -- -D warnings
- cargo test --all-targets: 64 unit tests, 10 fixtures, 8 WASM smoke tests
- cargo build --target wasm32-wasip1 --release
- cargo audit
Release artifact checksums from this HEAD:
- WASM: 4ece1695b8a9d990323846a4cf11eca911c0e011936922dfacfe8ed5d7810a9f
- plugin.toml: bcf3ba595c323d2d0a4ea680e4c6354285153020e07d1efe05c856d5e281dd6d
Delivery ordering
After merge, publish immutable v1.1.0 assets before updating Vortex's registry. The app PR intentionally keeps the registry on the currently published v1.0.0 entry.
Linear: https://linear.app/mpiton/issue/MAT-132/lot-2-brancher-les-comptes-premium-de-bout-en-bout
Summary by cubic
Adds strict premium account validation and typed account errors to vortex-mod-1fichier. Premium mode now fails closed on auth/expiry/cooldown/quota; free mode is used only when no credential is selected, meeting MAT-132.
-
New Features
- New
validate_accountexport: callsuser/info.cgiwith Bearer auth, accepts paid offers (1–3), rejects free/expired; classifies HTTP 401/403/402/429/509; returns{"valid": true}. - Premium token path detects exhausted traffic (via
traffic_used >= traffic_totalor KO messages) and surfacesQuotaExceededwith codeACCOUNT_QUOTA_EXCEEDED. - Selected credential failures return typed errors (
ACCOUNT_INVALID_CREDENTIALS,ACCOUNT_EXPIRED,ACCOUNT_COOLDOWN,ACCOUNT_QUOTA_EXCEEDED); no silent fallback. Free metadata is returned only when no credential is selected. - Version bumped to 1.1.0; README updated to reflect validation and fail-closed behavior.
- New
-
Migration
- Call
validate_accounton add/update to set account state; store secrets only in the host keyring. - On premium downloads, rotate accounts on
ACCOUNT_*codes; use free mode only when no credential is selected. - Publish
v1.1.0assets, then update Vortex’s registry with the new checksums.
- Call
Summary by CodeRabbit
- New Features
- Added a premium account validation step (now exposes
{"valid": true}when successful). - Strengthened premium quota/traffic detection and error-to-code reporting.
- Added a premium account validation step (now exposes
- Bug Fixes
- Premium-mode fallback no longer switches to free mode when premium validation fails for invalid/expired credentials—typed errors are surfaced instead.
- Improved handling of HTTP status and API error responses (invalid credentials, expired accounts, rate limits, quota exceeded).
- Documentation
- Clarified free-mode behavior and added guidance for premium validation and stable error codes.
- Tests
- Expanded WASM smoke coverage for validation and premium error mapping.