mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
WebAuthn Integration Tests
Overview
This test suite provides comprehensive end-to-end testing for the WebAuthn implementation in the Sonr blockchain's DID module. The tests validate the complete WebAuthn registration, authentication, and key management workflows.
Test Coverage
The test suite covers the following scenarios:
-
Attestation Parsing
- Validates parsing of CBOR attestation objects
- Checks public key extraction
- Verifies algorithm and authenticator data detection
-
Registration Flow
- Complete WebAuthn credential registration
- Challenge verification
- Origin validation
- DID document creation with WebAuthn credentials
- Credential uniqueness enforcement
-
Signature Verification
- WebAuthn assertion verification
- User presence and verification flag checking
- Multi-algorithm signature support (ES256, RS256, EdDSA)
- Counter increment validation
-
Security Scenarios
- Challenge replay attack prevention
- Invalid origin rejection
- Oversized credential handling
- Credential ID reuse prevention
Test Methodology
- Uses Cosmos SDK testing framework
- Employs table-driven tests for multiple scenarios
- Mocks cryptographic keys and challenge responses
- Validates both positive and negative test cases
Running Tests
go test github.com/sonr-io/sonr/test/e2e/tests -v
Dependencies
- Cosmos SDK v0.50.14
- Internal WebAuthn libraries
- testify assertion library