From 48c6739d25d71941708a9c1c770642d93b69aa42 Mon Sep 17 00:00:00 2001 From: woikos Date: Mon, 29 Dec 2025 14:01:54 +0100 Subject: [PATCH] Enable Cashu access tokens automatically when ACL is active (v0.44.2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add automatic Cashu issuer/verifier initialization when ACL mode is not 'none' - Use memory store for keyset management with proper TTL configuration - Import cashuiface package for AllowAllChecker implementation - ACL handles authorization; CAT provides token-based authentication Files modified: - app/main.go: Add Cashu system initialization when ACL active - pkg/version/version: Bump to v0.44.2 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- app/main.go | 25 +++++++++++++++++++++++++ pkg/version/version | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/app/main.go b/app/main.go index bc18f14..d2acc52 100644 --- a/app/main.go +++ b/app/main.go @@ -23,6 +23,10 @@ import ( "next.orly.dev/pkg/protocol/nip43" "next.orly.dev/pkg/protocol/publish" "next.orly.dev/pkg/bunker" + "next.orly.dev/pkg/cashu/issuer" + "next.orly.dev/pkg/cashu/keyset" + "next.orly.dev/pkg/cashu/verifier" + cashuiface "next.orly.dev/pkg/interfaces/cashu" "next.orly.dev/pkg/ratelimit" "next.orly.dev/pkg/spider" dsync "next.orly.dev/pkg/sync" @@ -162,6 +166,27 @@ func Run( } } + // Initialize Cashu access token system when ACL is active + if cfg.ACLMode != "none" { + // Create keyset manager with memory store (keys are regenerated each restart) + keysetStore := keyset.NewMemoryStore() + keysetManager := keyset.NewManager(keysetStore, keyset.DefaultActiveWindow, keyset.DefaultVerifyWindow) + + // Initialize keyset manager (creates initial keyset) + if err := keysetManager.Init(); err != nil { + log.E.F("failed to initialize Cashu keyset manager: %v", err) + } else { + // Create issuer with permissive checker (ACL handles authorization) + issuerCfg := issuer.DefaultConfig() + l.CashuIssuer = issuer.New(keysetManager, cashuiface.AllowAllChecker{}, issuerCfg) + + // Create verifier for validating tokens + l.CashuVerifier = verifier.New(keysetManager, cashuiface.AllowAllChecker{}, verifier.DefaultConfig()) + + log.I.F("Cashu access token system enabled (ACL mode: %s)", cfg.ACLMode) + } + } + // Initialize spider manager based on mode (only for Badger backend) if badgerDB, ok := db.(*database.D); ok && cfg.SpiderMode != "none" { if l.spiderManager, err = spider.New(ctx, badgerDB, l.publishers, cfg.SpiderMode); chk.E(err) { diff --git a/pkg/version/version b/pkg/version/version index f79cde7..5814ebc 100644 --- a/pkg/version/version +++ b/pkg/version/version @@ -1 +1 @@ -v0.44.1 +v0.44.2