@capgo/capacitor-updater 8.41.2 → 8.41.3
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/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +1 -1
- package/android/src/main/java/ee/forgr/capacitor_updater/CryptoCipher.java +13 -1
- package/ios/Sources/CapacitorUpdaterPlugin/CapacitorUpdaterPlugin.swift +1 -1
- package/ios/Sources/CapacitorUpdaterPlugin/CryptoCipher.swift +9 -1
- package/package.json +1 -1
|
@@ -85,7 +85,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
85
85
|
private static final String[] BREAKING_EVENT_NAMES = { "breakingAvailable", "majorAvailable" };
|
|
86
86
|
private static final String LAST_FAILED_BUNDLE_PREF_KEY = "CapacitorUpdater.lastFailedBundle";
|
|
87
87
|
|
|
88
|
-
private final String pluginVersion = "8.41.
|
|
88
|
+
private final String pluginVersion = "8.41.3";
|
|
89
89
|
private static final String DELAY_CONDITION_PREFERENCES = "";
|
|
90
90
|
|
|
91
91
|
private SharedPreferences.Editor editor;
|
|
@@ -210,7 +210,7 @@ public class CryptoCipher {
|
|
|
210
210
|
detectedFormat = "base64";
|
|
211
211
|
}
|
|
212
212
|
logger.debug(
|
|
213
|
-
"Received
|
|
213
|
+
"Received checksum format: " +
|
|
214
214
|
detectedFormat +
|
|
215
215
|
" (length: " +
|
|
216
216
|
checksum.length() +
|
|
@@ -218,6 +218,18 @@ public class CryptoCipher {
|
|
|
218
218
|
checksumBytes.length +
|
|
219
219
|
" bytes)"
|
|
220
220
|
);
|
|
221
|
+
|
|
222
|
+
// RSA-2048 encrypted data must be exactly 256 bytes
|
|
223
|
+
// If the checksum is not 256 bytes, the bundle was not encrypted properly
|
|
224
|
+
if (checksumBytes.length != 256) {
|
|
225
|
+
logger.error(
|
|
226
|
+
"Checksum is not RSA encrypted (size: " +
|
|
227
|
+
checksumBytes.length +
|
|
228
|
+
" bytes, expected 256 for RSA-2048). Bundle must be uploaded with encryption when public key is configured."
|
|
229
|
+
);
|
|
230
|
+
throw new IOException("Bundle checksum is not encrypted. Upload bundle with --key flag when encryption is configured.");
|
|
231
|
+
}
|
|
232
|
+
|
|
221
233
|
PublicKey pKey = CryptoCipher.stringToPublicKey(publicKey);
|
|
222
234
|
byte[] decryptedChecksum = CryptoCipher.decryptRSA(checksumBytes, pKey);
|
|
223
235
|
// Return as hex string to match calcChecksum output format
|
|
@@ -60,7 +60,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
60
60
|
CAPPluginMethod(name: "completeFlexibleUpdate", returnType: CAPPluginReturnPromise)
|
|
61
61
|
]
|
|
62
62
|
public var implementation = CapgoUpdater()
|
|
63
|
-
private let pluginVersion: String = "8.41.
|
|
63
|
+
private let pluginVersion: String = "8.41.3"
|
|
64
64
|
static let updateUrlDefault = "https://plugin.capgo.app/updates"
|
|
65
65
|
static let statsUrlDefault = "https://plugin.capgo.app/stats"
|
|
66
66
|
static let channelUrlDefault = "https://plugin.capgo.app/channel_self"
|
|
@@ -63,13 +63,21 @@ public struct CryptoCipher {
|
|
|
63
63
|
detectedFormat = "base64"
|
|
64
64
|
}
|
|
65
65
|
// swiftlint:disable:next line_length
|
|
66
|
-
logger.debug("Received
|
|
66
|
+
logger.debug("Received checksum format: \(detectedFormat) (length: \(checksum.count) chars, \(checksumBytes.count) bytes)")
|
|
67
67
|
|
|
68
68
|
if checksumBytes.isEmpty {
|
|
69
69
|
logger.error("Decoded checksum is empty")
|
|
70
70
|
throw CustomError.cannotDecode
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
// RSA-2048 encrypted data must be exactly 256 bytes
|
|
74
|
+
// If the checksum is not 256 bytes, the bundle was not encrypted properly
|
|
75
|
+
if checksumBytes.count != 256 {
|
|
76
|
+
// swiftlint:disable:next line_length
|
|
77
|
+
logger.error("Checksum is not RSA encrypted (size: \(checksumBytes.count) bytes, expected 256 for RSA-2048). Bundle must be uploaded with encryption when public key is configured.")
|
|
78
|
+
throw CustomError.cannotDecode
|
|
79
|
+
}
|
|
80
|
+
|
|
73
81
|
guard let rsaPublicKey = RSAPublicKey.load(rsaPublicKey: publicKey) else {
|
|
74
82
|
logger.error("The public key is not a valid RSA Public key")
|
|
75
83
|
throw CustomError.cannotDecode
|