Integrate BACKBEAT SDK and resolve KACHING license validation

Major integrations and fixes:
- Added BACKBEAT SDK integration for P2P operation timing
- Implemented beat-aware status tracking for distributed operations
- Added Docker secrets support for secure license management
- Resolved KACHING license validation via HTTPS/TLS
- Updated docker-compose configuration for clean stack deployment
- Disabled rollback policies to prevent deployment failures
- Added license credential storage (CHORUS-DEV-MULTI-001)

Technical improvements:
- BACKBEAT P2P operation tracking with phase management
- Enhanced configuration system with file-based secrets
- Improved error handling for license validation
- Clean separation of KACHING and CHORUS deployment stacks

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
anthonyrawlins
2025-09-06 07:56:26 +10:00
parent 543ab216f9
commit 9bdcbe0447
4730 changed files with 1480093 additions and 1916 deletions

View File

@@ -17,7 +17,7 @@ import (
"crypto/sha256"
)
// LibP2PDHT provides distributed hash table functionality for BZZZ peer discovery
// LibP2PDHT provides distributed hash table functionality for CHORUS peer discovery
type LibP2PDHT struct {
host host.Host
kdht *dht.IpfsDHT
@@ -42,7 +42,7 @@ type Config struct {
// Bootstrap nodes for initial DHT discovery
BootstrapPeers []multiaddr.Multiaddr
// Protocol prefix for BZZZ DHT
// Protocol prefix for CHORUS DHT
ProtocolPrefix string
// Bootstrap timeout
@@ -71,7 +71,7 @@ type PeerInfo struct {
// DefaultConfig returns a default DHT configuration
func DefaultConfig() *Config {
return &Config{
ProtocolPrefix: "/bzzz",
ProtocolPrefix: "/CHORUS",
BootstrapTimeout: 30 * time.Second,
DiscoveryInterval: 60 * time.Second,
Mode: dht.ModeAuto,
@@ -373,7 +373,7 @@ func (d *LibP2PDHT) FindPeersByRole(ctx context.Context, role string) ([]*PeerIn
d.peersMutex.RUnlock()
// Also search DHT for role-based keys
roleKey := fmt.Sprintf("bzzz:role:%s", role)
roleKey := fmt.Sprintf("CHORUS:role:%s", role)
providers, err := d.FindProviders(ctx, roleKey, 10)
if err != nil {
// Return local peers even if DHT search fails
@@ -408,13 +408,13 @@ func (d *LibP2PDHT) FindPeersByRole(ctx context.Context, role string) ([]*PeerIn
// AnnounceRole announces this peer's role to the DHT
func (d *LibP2PDHT) AnnounceRole(ctx context.Context, role string) error {
roleKey := fmt.Sprintf("bzzz:role:%s", role)
roleKey := fmt.Sprintf("CHORUS:role:%s", role)
return d.Provide(ctx, roleKey)
}
// AnnounceCapability announces a capability to the DHT
func (d *LibP2PDHT) AnnounceCapability(ctx context.Context, capability string) error {
capKey := fmt.Sprintf("bzzz:capability:%s", capability)
capKey := fmt.Sprintf("CHORUS:capability:%s", capability)
return d.Provide(ctx, capKey)
}
@@ -474,8 +474,8 @@ func (d *LibP2PDHT) performDiscovery() {
ctx, cancel := context.WithTimeout(d.ctx, 30*time.Second)
defer cancel()
// Look for general BZZZ peers
providers, err := d.FindProviders(ctx, "bzzz:peer", 10)
// Look for general CHORUS peers
providers, err := d.FindProviders(ctx, "CHORUS:peer", 10)
if err != nil {
return
}

View File

@@ -15,8 +15,8 @@ import (
func TestDefaultConfig(t *testing.T) {
config := DefaultConfig()
if config.ProtocolPrefix != "/bzzz" {
t.Errorf("expected protocol prefix '/bzzz', got %s", config.ProtocolPrefix)
if config.ProtocolPrefix != "/CHORUS" {
t.Errorf("expected protocol prefix '/CHORUS', got %s", config.ProtocolPrefix)
}
if config.BootstrapTimeout != 30*time.Second {
@@ -53,8 +53,8 @@ func TestNewDHT(t *testing.T) {
t.Error("host not set correctly")
}
if d.config.ProtocolPrefix != "/bzzz" {
t.Errorf("expected protocol prefix '/bzzz', got %s", d.config.ProtocolPrefix)
if d.config.ProtocolPrefix != "/CHORUS" {
t.Errorf("expected protocol prefix '/CHORUS', got %s", d.config.ProtocolPrefix)
}
}

View File

@@ -10,10 +10,10 @@ import (
"sync"
"time"
"chorus.services/bzzz/pkg/config"
"chorus.services/bzzz/pkg/crypto"
"chorus.services/bzzz/pkg/storage"
"chorus.services/bzzz/pkg/ucxl"
"chorus/pkg/config"
"chorus/pkg/crypto"
"chorus/pkg/storage"
"chorus/pkg/ucxl"
"github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p/core/peer"
)
@@ -404,7 +404,7 @@ type StorageEntry struct {
func (eds *EncryptedDHTStorage) generateDHTKey(ucxlAddress string) string {
// Use SHA256 hash of the UCXL address as DHT key
hash := sha256.Sum256([]byte(ucxlAddress))
return "/bzzz/ucxl/" + base64.URLEncoding.EncodeToString(hash[:])
return "/CHORUS/ucxl/" + base64.URLEncoding.EncodeToString(hash[:])
}
// getDecryptableRoles determines which roles can decrypt content from a creator
@@ -610,7 +610,7 @@ func (eds *EncryptedDHTStorage) AnnounceContent(ucxlAddress string) error {
}
// Announce via DHT
dhtKey := "/bzzz/announcements/" + eds.generateDHTKey(ucxlAddress)
dhtKey := "/CHORUS/announcements/" + eds.generateDHTKey(ucxlAddress)
err = eds.dht.PutValue(eds.ctx, dhtKey, announcementData)
// Audit the announce operation
@@ -627,7 +627,7 @@ func (eds *EncryptedDHTStorage) AnnounceContent(ucxlAddress string) error {
// DiscoverContentPeers discovers peers that have specific UCXL content
func (eds *EncryptedDHTStorage) DiscoverContentPeers(ucxlAddress string) ([]peer.ID, error) {
dhtKey := "/bzzz/announcements/" + eds.generateDHTKey(ucxlAddress)
dhtKey := "/CHORUS/announcements/" + eds.generateDHTKey(ucxlAddress)
// This is a simplified implementation
// In a real system, you'd query multiple announcement keys

View File

@@ -5,7 +5,7 @@ import (
"testing"
"time"
"chorus.services/bzzz/pkg/config"
"chorus/pkg/config"
)
// TestDHTSecurityPolicyEnforcement tests security policy enforcement in DHT operations

View File

@@ -6,7 +6,7 @@ import (
"sync"
"time"
"chorus.services/bzzz/pkg/config"
"chorus/pkg/config"
"github.com/libp2p/go-libp2p/core/peer"
)

View File

@@ -3,7 +3,7 @@ package dht
import (
"fmt"
"chorus.services/bzzz/pkg/config"
"chorus/pkg/config"
)
// NewRealDHT creates a new real DHT implementation