@capgo/capacitor-updater 9.0.1 → 9.0.4
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/README.md +106 -81
- package/android/build.gradle +1 -3
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +521 -21
- package/android/src/main/java/ee/forgr/capacitor_updater/CapgoUpdater.java +675 -34
- package/android/src/main/java/ee/forgr/capacitor_updater/CryptoCipher.java +10 -2
- package/android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java +82 -10
- package/android/src/main/java/ee/forgr/capacitor_updater/DownloadWorkerManager.java +23 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/HeadlessUpdateWorker.java +188 -4
- package/android/src/main/java/ee/forgr/capacitor_updater/Http3.java +81 -1
- package/android/src/main/java/ee/forgr/capacitor_updater/HttpEngineTransport.java +72 -21
- package/android/src/main/java/ee/forgr/capacitor_updater/InternalUtils.java +5 -2
- package/android/src/main/java/ee/forgr/capacitor_updater/ShakeMenu.java +5 -1
- package/dist/docs.json +13 -13
- package/dist/esm/definitions.d.ts +57 -23
- package/dist/esm/definitions.js.map +1 -1
- package/ios/Sources/CapacitorUpdaterPlugin/CapacitorUpdaterPlugin.swift +1278 -107
- package/ios/Sources/CapacitorUpdaterPlugin/CapgoSemanticVersion.swift +38 -0
- package/ios/Sources/CapacitorUpdaterPlugin/CapgoUpdater.swift +583 -56
- package/ios/Sources/CapacitorUpdaterPlugin/CryptoCipher.swift +8 -1
- package/ios/Sources/CapacitorUpdaterPlugin/ShakeMenu.swift +6 -1
- package/ios/Tests/CapacitorUpdaterPluginTests/CapacitorUpdaterPluginTests.swift +2718 -77
- package/ios/Tests/CapacitorUpdaterPluginTests/ChecksumRequiredTests.swift +9 -4
- package/ios/Tests/CapacitorUpdaterPluginTests/CliCryptoFixtureTests.swift +67 -2
- package/ios/Tests/CapacitorUpdaterPluginTests/HttpsOnlyBuiltinMinimumTests.swift +130 -5
- package/ios/Tests/CapacitorUpdaterPluginTests/NetworkTransportTests.swift +259 -119
- package/ios/Tests/CapacitorUpdaterPluginTests/SessionKeyRequiredTests.swift +4 -0
- package/ios/Tests/CapacitorUpdaterPluginTests/UpdateLifecycleTests.swift +19 -3
- package/package.json +2 -2
|
@@ -234,10 +234,17 @@ public struct CryptoCipher {
|
|
|
234
234
|
return sessionKeyParts.count == 2 && !sessionKeyParts[0].isEmpty && !sessionKeyParts[1].isEmpty
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
+
static func validateDecryptionKey(publicKey: String, sessionKey: String) throws {
|
|
238
|
+
guard !publicKey.isEmpty else {
|
|
239
|
+
return
|
|
240
|
+
}
|
|
241
|
+
_ = try prepareDecryptionKey(publicKey: publicKey, sessionKey: sessionKey)
|
|
242
|
+
}
|
|
243
|
+
|
|
237
244
|
/// Decrypts `filePath` in place. `expectedCiphertextSha256` is `BundleChecksum.ciphertext`: the file is hashed
|
|
238
245
|
/// and rejected before any AES work when it does not match.
|
|
239
246
|
public static func decryptFile(
|
|
240
|
-
filePath: URL, publicKey: String, sessionKey: String, version: String, expectedCiphertextSha256: String?
|
|
247
|
+
filePath: URL, publicKey: String, sessionKey: String, version _: String, expectedCiphertextSha256: String?
|
|
241
248
|
) throws {
|
|
242
249
|
if publicKey.isEmpty || !isValidSessionKey(sessionKey) {
|
|
243
250
|
logger.info("Encryption not set, no public key or session, ignored")
|
|
@@ -358,7 +358,12 @@ extension UIWindow {
|
|
|
358
358
|
}
|
|
359
359
|
if !next.isBuiltin() {
|
|
360
360
|
plugin.logger.info("Resetting to: \(next.toString())")
|
|
361
|
-
|
|
361
|
+
// A pending bundle below the native version floor is rejected: never load it, fall back to builtin.
|
|
362
|
+
guard updater.set(bundle: next) else {
|
|
363
|
+
plugin.logger.warn("Cannot activate \(next.toString()), resetting to builtin")
|
|
364
|
+
resetBuiltin()
|
|
365
|
+
return
|
|
366
|
+
}
|
|
362
367
|
guard let destHot = try? updater.getBundleDirectory(id: next.getId()) else {
|
|
363
368
|
resetBuiltin()
|
|
364
369
|
return
|