Resolve import cycles and migrate to chorus.services module path

This comprehensive refactoring addresses critical architectural issues:

IMPORT CYCLE RESOLUTION:
• pkg/crypto ↔ pkg/slurp/roles: Created pkg/security/access_levels.go
• pkg/ucxl → pkg/dht: Created pkg/storage/interfaces.go
• pkg/slurp/leader → pkg/election → pkg/slurp/storage: Moved types to pkg/election/interfaces.go

MODULE PATH MIGRATION:
• Changed from github.com/anthonyrawlins/bzzz to chorus.services/bzzz
• Updated all import statements across 115+ files
• Maintains compatibility while removing personal GitHub account dependency

TYPE SYSTEM IMPROVEMENTS:
• Resolved duplicate type declarations in crypto package
• Added missing type definitions (RoleStatus, TimeRestrictions, KeyStatus, KeyRotationResult)
• Proper interface segregation to prevent future cycles

ARCHITECTURAL BENEFITS:
• Build now progresses past structural issues to normal dependency resolution
• Cleaner separation of concerns between packages
• Eliminates circular dependencies that prevented compilation
• Establishes foundation for scalable codebase growth

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
anthonyrawlins
2025-08-17 10:04:25 +10:00
parent e9252ccddc
commit d96c931a29
115 changed files with 1010 additions and 534 deletions

View File

@@ -32,7 +32,7 @@ import (
"time"
"golang.org/x/crypto/pbkdf2"
"github.com/anthonyrawlins/bzzz/pkg/config"
"chorus.services/bzzz/pkg/config"
)
// KeyManager handles sophisticated key management for role-based encryption
@@ -98,6 +98,49 @@ type KeyUsageStats struct {
SuspiciousActivity bool `json:"suspicious_activity"`
}
// KeyStatus represents the status of a cryptographic key
type KeyStatus string
const (
KeyStatusActive KeyStatus = "active" // Key is active and can be used
KeyStatusInactive KeyStatus = "inactive" // Key is inactive
KeyStatusExpired KeyStatus = "expired" // Key has expired
KeyStatusRevoked KeyStatus = "revoked" // Key has been revoked
KeyStatusSuspended KeyStatus = "suspended" // Key is temporarily suspended
KeyStatusPending KeyStatus = "pending" // Key is pending activation
)
// RoleKey represents a cryptographic key associated with a role
type RoleKey struct {
KeyID string `json:"key_id"`
RoleID string `json:"role_id"`
KeyType string `json:"key_type"`
Version int `json:"version"`
CreatedAt time.Time `json:"created_at"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
Status KeyStatus `json:"status"`
KeyData []byte `json:"key_data,omitempty"`
}
// KeyRotationResult represents the result of a key rotation operation
type KeyRotationResult struct {
Success bool `json:"success"`
OldKeyID string `json:"old_key_id"`
NewKeyID string `json:"new_key_id"`
RotatedAt time.Time `json:"rotated_at"`
RollbackKeyID string `json:"rollback_key_id,omitempty"`
Error string `json:"error,omitempty"`
RotationDuration time.Duration `json:"rotation_duration"`
AffectedSystems []string `json:"affected_systems"`
Metadata map[string]interface{} `json:"metadata"`
// Additional fields used in the code
RotatedRoles []string `json:"rotated_roles"`
NewKeys map[string]*RoleKey `json:"new_keys"`
RevokedKeys map[string]*RoleKey `json:"revoked_keys"`
RotationTime time.Duration `json:"rotation_time"`
}
// KeyFilter represents criteria for filtering keys
type KeyFilter struct {
RoleID string `json:"role_id,omitempty"`