main.go
 1  package main
 2  
 3  import (
 4  	"context"
 5  	"fmt"
 6  	"log"
 7  
 8  	"keepSync/internal/providers"
 9  )
10  
11  func main() {
12  	fmt.Println("🔍 Testing metadata decryption...")
13  
14  	// Create quantum provider
15  	config := providers.QuantumS3Config{
16  		Bucket:    "storage-a01",
17  		Region:    "us-east-1",
18  		Endpoint:  "https://s3.filebase.com",
19  		AccessKey: "EF4A740258F43842F16E",
20  		SecretKey: "ZUXkT90Fg8LTdC8QzrEnMSSubldd7eKsRyylukRD",
21  		KeyName:   "s3-quantum-key",
22  	}
23  
24  	provider, err := providers.NewQuantumS3Provider(config)
25  	if err != nil {
26  		log.Fatalf("Failed to create provider: %v", err)
27  	}
28  	defer provider.Close()
29  
30  	// Try to download and decrypt the metadata file directly
31  	metadataPath := "75d728e94787412e.metadata.json"
32  	fmt.Printf("📋 Downloading metadata file: %s\n", metadataPath)
33  
34  	// Use the internal method to download the metadata
35  	ctx := context.Background()
36  
37  	// We need to access the internal method, so let's create a simple test
38  	// that tries to extract the original filename
39  	standardizedPath := "75d728e94787412e"
40  
41  	fmt.Printf("📋 Attempting to extract original filename for: %s\n", standardizedPath)
42  
43  	// This will internally try to download and decrypt the metadata
44  	files, err := provider.List(ctx, "")
45  	if err != nil {
46  		log.Fatalf("Failed to list files: %v", err)
47  	}
48  
49  	fmt.Printf("📁 Found %d files:\n", len(files))
50  	for i, file := range files {
51  		fmt.Printf("  %d. %s\n", i+1, file)
52  	}
53  }