feat: add wallet authentication layer with WebAuthn and PIN support - #531
Merged
Just-Bamford merged 1 commit intoAug 30, 2026
Merged
Conversation
Implements Sorokit#500 - Add WebAuthn-based authentication with biometric/security key support - Add PIN-based fallback authentication (4-8 digits, hashed storage) - Implement rate limiting for failed authentication attempts - Add session management with configurable timeouts - Support locked/unlocked/expired authentication states - Provide secure credential storage (never exposes private keys) - Include comprehensive tests for all authentication flows - Maintain backward compatibility with existing wallet connections - Add complete documentation and usage examples Acceptance Criteria: ✅ WebAuthn-based authentication is supported where available ✅ PIN setup, verification, change, and reset flows are defined ✅ Failed authentication attempts are rate-limited ✅ Authentication state has explicit locked/unlocked/expired states ✅ Credentials are stored without exposing private wallet material ✅ Unsupported browser capabilities fail gracefully ✅ Tests cover successful, failed, expired, and unsupported authentication flows ✅ Existing wallet connection behavior remains backward compatible
|
@lajay-faith Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #500
Adds an application-level authentication layer for wallet access control using WebAuthn (biometric/security key) where available, with PIN-based fallback.
Features
✅ WebAuthn authentication - Biometric and security key support where available
✅ PIN-based fallback - Works everywhere, never stores plaintext PINs
✅ Rate limiting - Protection against brute-force attacks (configurable)
✅ Session management - Configurable timeouts with automatic expiration
✅ Authentication states - Explicit locked/unlocked/expired states
✅ Secure storage - Never exposes private keys or raw biometric data
✅ Backward compatible - Existing wallet connections work without changes
✅ Comprehensive tests - Full coverage of all authentication flows
✅ Complete documentation - Usage guide and API reference
Implementation Details
Architecture
Components
Security
Acceptance Criteria
✅ WebAuthn-based authentication is supported where available
✅ PIN setup, verification, change, and reset flows are defined
✅ Failed authentication attempts are rate-limited
✅ Authentication state has explicit locked/unlocked/expired states
✅ Credentials are stored without exposing private wallet material
✅ Unsupported browser capabilities fail gracefully
✅ Tests cover successful, failed, expired, and unsupported authentication flows
✅ Existing wallet connection behavior remains backward compatible
Files Changed
New Files
src/wallet/authentication/types.ts- Type definitionssrc/wallet/authentication/capabilities.ts- Capability detectionsrc/wallet/authentication/pinAuth.ts- PIN authenticationsrc/wallet/authentication/webAuthnAuth.ts- WebAuthn authenticationsrc/wallet/authentication/storage.ts- Storage adapterssrc/wallet/authentication/authenticationManager.ts- Main coordinatorsrc/wallet/authentication/index.ts- Public APIsrc/wallet/authentication/README.md- Module documentationsrc/tests/walletAuthentication.test.ts- Comprehensive testsdocs/wallet-authentication.md- Complete documentationModified Files
src/wallet/index.ts- Export authentication moduleUsage Example
Testing
All tests pass:
npm test -- walletAuthentication.test.tsBrowser Compatibility
Documentation
Complete documentation added:
docs/wallet-authentication.md- Full usage guide and API referencesrc/wallet/authentication/README.md- Module overviewNotes for Reviewers
Closes #500