π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob] Add method to join public collection
Neeraj Guptac38947c14c73
diff --git a/mobile/lib/services/collections_service.dart b/mobile/lib/services/collections_service.dartindex 38b54af8f0..0943e477cc 100644--- a/mobile/lib/services/collections_service.dart+++ b/mobile/lib/services/collections_service.dart@@ -1139,6 +1139,42 @@ class CollectionsService {}}+ Future<void> joinPublicCollection(+ BuildContext context,+ int collectionID,+ ) async {+ try {+ final authToken = await getSharedPublicAlbumToken(collectionID);+ final jwtToken = await getSharedPublicAlbumTokenJWT(collectionID);+ final key = await getSharedPublicAlbumKey(collectionID);+ if (key.isEmpty) {+ throw Exception("Collection key not found");+ }+ final encryptedKey = CryptoUtil.sealSync(+ getCollectionKey(collectionID),+ CryptoUtil.base642bin(+ Configuration.instance.getKeyAttributes()!.publicKey,+ ),+ );+ await _enteDio.post(+ "/collections/join-link",+ data: {+ "collectionID": collectionID,+ "encryptedKey": CryptoUtil.bin2base64(encryptedKey),+ },+ options: Options(+ headers: {+ "X-Auth-Access-Token": authToken,+ "X-Auth-JWT-Token": jwtToken,+ },+ ),+ );+ } catch (e) {+ _logger.warning("Failed to join public collection $e");+ await showGenericErrorDialog(context: context, error: e);+ }+ }+Future<String> getSharedPublicAlbumKey(int collectionID) async {if (_cachedPublicAlbumKey.containsKey(collectionID)) {return _cachedPublicAlbumKey[collectionID]!;