π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add support for decrypting shared collectionKey
Neeraj Guptac5f978d32bb8
diff --git a/pkg/remote_sync.go b/pkg/remote_sync.goindex d2a24f1443..590155f61c 100644--- a/pkg/remote_sync.go+++ b/pkg/remote_sync.go@@ -58,10 +58,7 @@ func (c *ClICtrl) syncRemoteCollections(ctx context.Context, info model.Account)return fmt.Errorf("failed to get collections: %s", err)}for _, collection := range collections {- if collection.Owner.ID != info.UserID {- fmt.Printf("Skipping collection %d\n", collection.ID)- continue- }+collectionKey, err := c.getCollectionKey(ctx, collection)if err != nil {return err@@ -70,7 +67,12 @@ func (c *ClICtrl) syncRemoteCollections(ctx context.Context, info model.Account)if nameErr != nil {log.Fatalf("failed to decrypt collection name: %v", nameErr)}- fmt.Printf("Collection Name %s\n", string(name))+ if collection.Owner.ID != info.UserID {+ fmt.Printf("Shared Album %s\n", string(name))+ continue+ } else {+ fmt.Printf("Owned Name %s\n", string(name))+ }}return nil}@@ -88,6 +90,11 @@ func (c *ClICtrl) getCollectionKey(ctx context.Context, collection api.Collectio}return collKey, nil} else {- panic("not implemented")+ collKey, err := enteCrypto.SealedBoxOpen(encoding.DecodeBase64(collection.EncryptedKey),+ accSecretInfo.PublicKey, accSecretInfo.SecretKey)+ if err != nil {+ log.Fatalf("failed to decrypt collection key %s", err)+ }+ return collKey, nil}}