b-open-io/better-auth-plugin/bitcoin-auth-diagnostics
Claude Code and agent skill by b-open-io/better-auth-plugin
- community
Checking that the SKILL.md file is still in the repository.
Diagnose and troubleshoot bitcoin-auth token generation and verification issues. This skill should be used when users encounter authentication failures, signature verification errors, or integration problems with the bitcoin-auth library.
Install
npx vskill@latest install b-open-io/better-auth-plugin/bitcoin-auth-diagnosticsSKILL.md
Bitcoin Auth Diagnostics
Overview
This skill enables comprehensive diagnosis of bitcoin-auth authentication issues across client and server implementations. Use this skill when encountering token generation failures, signature verification errors, or integration problems with the bitcoin-auth library.
When to Use This Skill
Use this skill when:
- Bitcoin auth token verification is failing
- Investigating "invalid signature" or "invalid token" errors
- Debugging integration with bitcoin-auth in APIs (especially Sigma Auth)
- Token generation produces unexpected results
- Time skew or timestamp-related authentication failures occur
- Body hash mismatches are suspected
- Scheme confusion between bsm and brc77 exists
Bitcoin Auth Token Format
All bitcoin-auth tokens follow this pipe-delimited format:
Components:
pubkey: Hex-encoded public key (66 characters)scheme: Eitherbsm(legacy) orbrc77(recommended)timestamp: ISO8601 format (e.g.,2025-01-15T14:30:00.000Z)requestPath: Full path including query parameters (e.g.,/api/endpoint?param=value)signature: Base64-encoded signature
Example valid token:
Diagnostic Workflow
Step 1: Token Structure Validation
First, validate the token structure before checking cryptographic validity:
Step 2: Component Validation
Validate each component individually:
Step 3: Signature Verification
If structure is valid, diagnose verification failures:
Step 4: Common Integration Issues
Check for common integration mistakes:
Server-side (verification):
Client-side (generation):
Common Error Patterns
"Invalid bitcoin-auth token format"
Cause: Token doesn't have exactly 5 pipe-delimited parts
Solutions:
- Check token isn't truncated or corrupted
- Verify no extra pipes in requestPath or signature
- Ensure token is properly URL-encoded if passed in query params
"Bitcoin signature verification failed"
Cause: Signature doesn't match the payload
Solutions:
- Verify request path matches exactly (including query params)
- Check timestamp isn't older than timePad (default 5 minutes)
- Ensure body hash matches (if body present)
- Confirm correct bodyEncoding (utf8, hex, base64)
- Verify scheme matches (bsm vs brc77)
"Invalid token: time skew"
Cause: Token timestamp too far from server time
Solutions:
- Increase timePad parameter (default 5 minutes)
- Check client/server clock synchronization
- Verify timestamp format is ISO8601
"Request path mismatch"
Cause: Token requestPath doesn't match verification path
Solutions:
- Include full path with query parameters
- Ensure query parameter order is consistent
- Don't include domain/protocol in requestPath
- Match case sensitivity
"Body hash mismatch"
Cause: Body used for signing doesn't match verification body
Solutions:
- Use exact same body string (not re-serialized JSON)
- Check bodyEncoding matches (utf8, hex, base64)
- Verify body isn't modified between signing and verification
- Ensure Content-Type header matches body encoding
Integration with Sigma Auth
When working with Sigma Auth (auth.sigmaidentity.com), common patterns:
Better Auth / Sigma Plugin issues (403 on token exchange, CSRF/trustedOrigins, callback URL mismatches) are covered in references/common-issues.md under "Better Auth / Sigma Plugin Issues".
Token verification endpoint:
Wallet connect flow:
Reference Documentation
For detailed API documentation and implementation examples, see:
references/bitcoin-auth-api.md- Complete API referencereferences/common-issues.md- Detailed troubleshooting guidereferences/identity-terminology.md- BAP ID vs BRC-31 identity key terminology matrix- Bitcoin Auth GitHub: https://github.com/b-open-io/bitcoin-auth
- BRC-77 Specification: https://github.com/bitcoin-sv/BRCs/blob/master/peer-to-peer/0077.md
Environment Requirements
- Node.js/Bun runtime with
@bsv/sdkpeer dependency - bitcoin-auth library installed:
bun add bitcoin-auth - For testing: Access to bitcoin-auth repository test suite
Security Considerations
Never log private keys or WIF strings - Only log public keys, tokens, and diagnostic information.
When diagnosing authentication issues:
- Use test/development keys for diagnostics
- Sanitize logs before sharing (remove signatures/private data)
- Verify token expiry (timePad) is appropriate for your use case
- Use BRC77 scheme (default) for new implementations
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/bitcoin-auth-diagnostics/SKILL.md
Popularity
- Repository npm downloads, 7 days
- 255
- 7-day trend score
- 15
Downloads are for the repository's npm package. Refreshed 17 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/b-open-io/better-auth-plugin/bitcoin-auth-diagnostics)