Auto-acquire Cashu tokens for NIP-46 bunker connections (v0.2.0)

- Add acquireTokenIfNeeded() in BunkerSigner to get CAT before connecting
- Check /cashu/info to detect CAT-enabled relays
- Request token via cashuTokenService with NIP-98 auth using ephemeral key
- Store and reuse tokens across sessions
- Pass token as query parameter on WebSocket connection

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
mleku
2025-12-28 19:33:19 +02:00
parent 2aa0a8c460
commit a268c63082
30 changed files with 1458 additions and 53 deletions

View File

@@ -98,7 +98,7 @@ export interface ISigner {
nip04Decrypt: (pubkey: string, cipherText: string) => Promise<string>
}
export type TSignerType = 'nsec' | 'nip-07' | 'browser-nsec' | 'ncryptsec' | 'npub'
export type TSignerType = 'nsec' | 'nip-07' | 'browser-nsec' | 'ncryptsec' | 'npub' | 'bunker'
export type TAccount = {
pubkey: string
@@ -106,6 +106,9 @@ export type TAccount = {
ncryptsec?: string
nsec?: string
npub?: string
bunkerPubkey?: string
bunkerRelays?: string[]
bunkerSecret?: string
}
export type TAccountPointer = Pick<TAccount, 'pubkey' | 'signerType'>