Hi Stacks community,
I’m working on implementing a non-custodial wallet using WebAuthn (passkeys/biometric authentication). However, I’ve hit a fundamental compatibility issue:
Current Problem:
- WebAuthn uses P-256 (secp256r1) for signatures
- Clarity only supports secp256k1 verification
- This forces complex workarounds that reduce security
Current Workarounds:
- Store an encrypted secp256k1 key in browser storage
- Use WebAuthn to decrypt it
- Sign with secp256k1
- Verify with
secp256k1-verify
This adds unnecessary complexity and attack surfaces compared to using WebAuthn’s secure enclave directly.
Proposed Solution:
Add P-256 signature verification to Clarity, enabling:
- WebAuthn key stays in secure enclave
- Public key stored in contract
- Direct signing from secure enclave
- Contract verifies P-256 signature
Questions:
- Is adding P-256 verification to Clarity feasible?
- If yes, could someone point me to relevant code (like the secp256k1 implementation) that I could learn from to potentially contribute this feature?
- What would be the process for proposing/implementing such an addition?
This would enable truly secure, non-custodial wallets using native device security without compromising the security model with additional key storage.
Let me add that important use case to the post:
Real World Impact & Mass Adoption:
The ability to use WebAuthn natively would enable a powerful user experience for mainstream adoption:
- User buys sBTC/asset with credit card
- Assets are sent to a smart contract wallet
- User can access/control their assets using just their device’s biometrics (Face ID/Touch ID)
- No seed phrases to manage
- No complex key management
- Security backed by device hardware
This creates a familiar authentication flow that mainstream users already trust (similar to Apple Pay or banking apps), while maintaining the non-custodial nature of crypto. It bridges the UX gap between traditional finance and web3 without compromising on decentralization.
This could be a significant step toward making Stacks more accessible to mainstream users who are comfortable with biometric authentication but hesitant about seed phrase management.
Looking forward to your thoughts!