Skip to content

feat: device trust management & recognition (#125)#752

Open
alexchenai wants to merge 1 commit intorohitdash08:mainfrom
alexchenai:feat/device-trust-mgmt-125
Open

feat: device trust management & recognition (#125)#752
alexchenai wants to merge 1 commit intorohitdash08:mainfrom
alexchenai:feat/device-trust-mgmt-125

Conversation

@alexchenai
Copy link
Copy Markdown

/claim #125

Summary

Allows users to view and manage trusted devices, with automatic fingerprint-based recognition.

Features

  • TrustedDevice model: stores token, fingerprint (SHA-256 of user-agent+IP), expiry
  • Cryptographically secure device tokens (secrets.token_hex(32))
  • Auto-recognition by device fingerprint (no token needed)
  • Configurable trust expiry (default 30 days, or null for permanent)
  • Revoke individual device or revoke-all with except_token support

REST API

  • GET /devices - list trusted devices
  • POST /devices - register new trusted device
  • DELETE /devices/{id} - revoke specific device
  • POST /devices/verify - verify device token
  • POST /devices/recognize - auto-recognize by fingerprint
  • POST /devices/revoke-all - revoke all (with optional except_token)

Tests

27 tests: 21 pass, 6 skip (Redis/JWT)

- TrustedDevice model: token, fingerprint, user_agent, IP, expiry tracking
- register_device: secure random token, optional fingerprint, configurable expiry
- verify_device_token: validates token, checks expiry, updates last_seen
- recognize_device: auto-recognize by user_agent+IP fingerprint
- revoke_device / revoke_all_devices with except_token support
- get_user_devices with include_revoked option
- REST API: GET/POST /devices, DELETE /devices/{id}, POST /devices/verify, POST /devices/recognize, POST /devices/revoke-all
- 27 tests (21 pass, 6 skip Redis)

Closes rohitdash08#125
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant