Add GeoIP lookup support and update device fingerprints to base58

- Add maxmind library for GeoIP database lookups when not behind Cloudflare
- Extract client IP from multiple header sources (CF, X-Real-IP, X-Forwarded-For, etc.)
- Change device fingerprints from UUID to base58 with device_ prefix
- Add isValidDeviceFingerprint() that accepts both new and legacy formats
- Colocate unit tests with source files, remove __tests__/unit directory
- Add test coverage reporting to test script

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
RevIQ
2026-01-10 16:41:21 +08:00
parent 93abba044a
commit 575ca83300
6 changed files with 405 additions and 26 deletions

View File

@@ -10,7 +10,7 @@
"lint": "eslint . --cache",
"clean": "rm -rf dist .eslintcache",
"test:e2e": "bun test src/__tests__/e2e --no-parallel",
"test:unit": "bun test src/__tests__/unit"
"test": "bun test --coverage src/utils"
},
"dependencies": {
"@formatjs/intl-durationformat": "^0.9.2",
@@ -25,6 +25,7 @@
"@simplewebauthn/server": "^13.2.2",
"@simplewebauthn/types": "^12.0.0",
"kysely": "^0.28.2",
"maxmind": "^5.0.3",
"pino": "^10.1.0",
"postmark": "^4.0.5",
"zxcvbn": "^4.4.2"