@capgo/capacitor-updater 7.0.27 → 7.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Package.swift CHANGED
@@ -10,7 +10,7 @@ let package = Package(
10
10
  targets: ["CapacitorUpdaterPlugin"])
11
11
  ],
12
12
  dependencies: [
13
- .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.1"),
13
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.1.0"),
14
14
  .package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMajor(from: "5.10.2")),
15
15
  .package(url: "https://github.com/ZipArchive/ZipArchive.git", exact: "2.4.3"),
16
16
  .package(url: "https://github.com/mrackwitz/Version.git", exact: "0.8.0")
@@ -57,7 +57,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
57
57
  private static final String statsUrlDefault = "https://plugin.capgo.app/stats";
58
58
  private static final String channelUrlDefault = "https://plugin.capgo.app/channel_self";
59
59
 
60
- private final String PLUGIN_VERSION = "7.0.27";
60
+ private final String PLUGIN_VERSION = "7.0.29";
61
61
  private static final String DELAY_CONDITION_PREFERENCES = "";
62
62
 
63
63
  private SharedPreferences.Editor editor;
@@ -194,7 +194,7 @@ public class DownloadService extends Worker {
194
194
  copyFile(cacheFile, targetFile);
195
195
  Log.d(TAG, "already cached " + fileName);
196
196
  } else {
197
- downloadAndVerify(downloadUrl, targetFile, cacheFile, finalFileHash);
197
+ downloadAndVerify(downloadUrl, targetFile, cacheFile, finalFileHash, sessionKey, publicKey);
198
198
  }
199
199
 
200
200
  long completed = completedFiles.incrementAndGet();
@@ -365,7 +365,14 @@ public class DownloadService extends Worker {
365
365
  }
366
366
  }
367
367
 
368
- private void downloadAndVerify(String downloadUrl, File targetFile, File cacheFile, String expectedHash) throws Exception {
368
+ private void downloadAndVerify(
369
+ String downloadUrl,
370
+ File targetFile,
371
+ File cacheFile,
372
+ String expectedHash,
373
+ String sessionKey,
374
+ String publicKey
375
+ ) throws Exception {
369
376
  Log.d(TAG, "downloadAndVerify " + downloadUrl);
370
377
 
371
378
  Request request = new Request.Builder().url(downloadUrl).build();
@@ -393,6 +400,11 @@ public class DownloadService extends Worker {
393
400
  }
394
401
  }
395
402
 
403
+ if (!publicKey.isEmpty() && sessionKey != null && !sessionKey.isEmpty()) {
404
+ Log.d(CapacitorUpdater.TAG + " DLSrv", "Decrypting file " + targetFile.getName());
405
+ CryptoCipherV2.decryptFile(compressedFile, publicKey, sessionKey);
406
+ }
407
+
396
408
  // Use new decompression method
397
409
  byte[] compressedData = Files.readAllBytes(compressedFile.toPath());
398
410
  byte[] decompressedData = decompressBrotli(compressedData, targetFile.getName());
@@ -45,7 +45,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
45
45
  CAPPluginMethod(name: "getNextBundle", returnType: CAPPluginReturnPromise)
46
46
  ]
47
47
  public var implementation = CapacitorUpdater()
48
- private let PLUGIN_VERSION: String = "7.0.27"
48
+ private let PLUGIN_VERSION: String = "7.0.29"
49
49
  static let updateUrlDefault = "https://plugin.capgo.app/updates"
50
50
  static let statsUrlDefault = "https://plugin.capgo.app/stats"
51
51
  static let channelUrlDefault = "https://plugin.capgo.app/channel_self"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "7.0.27",
3
+ "version": "7.0.29",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Live update for capacitor apps",
6
6
  "main": "dist/plugin.cjs.js",