load cfg from file, encrypt for given peers
This commit is contained in:
@@ -47,10 +47,10 @@ func main() {
|
||||
fmt.Printf("AgeKey: %s\n", key.String())
|
||||
fmt.Printf("AgePublicKey: %s\n", key.Recipient().String())
|
||||
|
||||
cipher, err := age.Encrypt([]byte("Test Message"), []string{key.Recipient().String()})
|
||||
fmt.Printf("Encrypted: %s\n", cipher)
|
||||
decrypted, err := age.Decrypt(cipher, key)
|
||||
fmt.Printf("Decrypted: %s\n", decrypted)
|
||||
//cipher, err := age.Encrypt([]byte("Test Message"), []string{key.Recipient().String()})
|
||||
//fmt.Printf("Encrypted: %s\n", cipher)
|
||||
//decrypted, err := age.Decrypt(cipher, key)
|
||||
//fmt.Printf("Decrypted: %s\n", decrypted)
|
||||
|
||||
h, dht, err := storage.SetupLibp2pHost(ctx, *dbPath)
|
||||
|
||||
@@ -84,6 +84,12 @@ func main() {
|
||||
logger.Fatal(err)
|
||||
}
|
||||
|
||||
Cfg, err := storage.NewConfig(*dbPath + "/config.json")
|
||||
|
||||
if err != nil {
|
||||
logger.Fatal(err)
|
||||
}
|
||||
|
||||
storageHandler := storage.StorageHandler{
|
||||
Ctx: ctx ,
|
||||
Store: store,
|
||||
@@ -91,10 +97,9 @@ func main() {
|
||||
Ipfs: ipfs,
|
||||
PubSub: ps,
|
||||
Key: key,
|
||||
Config: Cfg,
|
||||
}
|
||||
|
||||
Cfg := storage.NewConfig()
|
||||
|
||||
Namespaces := make(map[string]*storage.Namespace)
|
||||
for _, nsCfg := range Cfg {
|
||||
ns1, err := storage.CreateNamespace(nsCfg.Id, storageHandler)
|
||||
@@ -254,7 +259,7 @@ Commands:
|
||||
continue
|
||||
}
|
||||
|
||||
encryptedPassword, err := age.Encrypt(data, []string{key.Recipient().String()})
|
||||
encryptedPassword, err := age.Encrypt(data, val.GetRecipients())
|
||||
if err != nil {
|
||||
printErr(err)
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user