@capgo/capacitor-updater 6.0.51-beta.0 → 6.0.51-beta.1
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.
|
@@ -41,7 +41,6 @@ import java.io.UnsupportedEncodingException;
|
|
|
41
41
|
import java.net.URL;
|
|
42
42
|
import java.net.URLConnection;
|
|
43
43
|
import java.security.GeneralSecurityException;
|
|
44
|
-
import java.security.PrivateKey;
|
|
45
44
|
import java.security.PublicKey;
|
|
46
45
|
import java.security.SecureRandom;
|
|
47
46
|
import java.util.ArrayList;
|
|
@@ -515,15 +514,15 @@ public class CapacitorUpdater {
|
|
|
515
514
|
return checksum;
|
|
516
515
|
}
|
|
517
516
|
try {
|
|
518
|
-
byte[] checksumBytes = Base64.decode(checksum
|
|
517
|
+
byte[] checksumBytes = Base64.decode(checksum, Base64.DEFAULT);
|
|
519
518
|
PublicKey pKey = CryptoCipher.stringToPublicKey(this.publicKey);
|
|
520
519
|
byte[] decryptedChecksum = CryptoCipher.decryptRSA(checksumBytes, pKey);
|
|
521
|
-
|
|
520
|
+
// Match Swift's base64 encoding of the decrypted result
|
|
521
|
+
return Base64.encodeToString(decryptedChecksum, Base64.NO_WRAP);
|
|
522
522
|
} catch (GeneralSecurityException e) {
|
|
523
|
-
Log.i(TAG, "decryptChecksum fail");
|
|
523
|
+
Log.i(TAG, "decryptChecksum fail", e);
|
|
524
524
|
this.sendStats("decrypt_fail", version);
|
|
525
|
-
e
|
|
526
|
-
throw new IOException("GeneralSecurityException");
|
|
525
|
+
throw new IOException("GeneralSecurityException", e);
|
|
527
526
|
}
|
|
528
527
|
}
|
|
529
528
|
|
|
@@ -379,9 +379,9 @@ extension CustomError: LocalizedError {
|
|
|
379
379
|
do {
|
|
380
380
|
let checksumBytes: Data = Data(base64Encoded: checksum)!
|
|
381
381
|
guard let rsaPublicKey: RSAPublicKey = .load(rsaPublicKey: self.publicKey!) else {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
382
|
+
print("cannot decode publicKey", self.publicKey!)
|
|
383
|
+
throw CustomError.cannotDecode
|
|
384
|
+
}
|
|
385
385
|
guard let decryptedChecksum = try? rsaPublicKey.decrypt(data: checksumBytes) else {
|
|
386
386
|
throw NSError(domain: "Failed to decrypt session key data", code: 2, userInfo: nil)
|
|
387
387
|
}
|
|
@@ -529,15 +529,13 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
529
529
|
if !killed {
|
|
530
530
|
self._cancelDelay(source: "background check")
|
|
531
531
|
}
|
|
532
|
-
|
|
533
|
-
case "kill":
|
|
532
|
+
case "kill":
|
|
534
533
|
if killed {
|
|
535
534
|
self._cancelDelay(source: "kill check")
|
|
536
535
|
// instant install for kill action
|
|
537
536
|
self.installNext()
|
|
538
537
|
}
|
|
539
|
-
|
|
540
|
-
case "date":
|
|
538
|
+
case "date":
|
|
541
539
|
if value != nil && value != "" {
|
|
542
540
|
let dateFormatter = ISO8601DateFormatter()
|
|
543
541
|
dateFormatter.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
|
|
@@ -551,8 +549,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
551
549
|
} else {
|
|
552
550
|
self._cancelDelay(source: "delayVal absent")
|
|
553
551
|
}
|
|
554
|
-
|
|
555
|
-
case "nativeVersion":
|
|
552
|
+
case "nativeVersion":
|
|
556
553
|
if value != nil && value != "" {
|
|
557
554
|
do {
|
|
558
555
|
let versionLimit = try Version(value!)
|
|
@@ -565,7 +562,6 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
565
562
|
} else {
|
|
566
563
|
self._cancelDelay(source: "delayVal absent")
|
|
567
564
|
}
|
|
568
|
-
break
|
|
569
565
|
case .none:
|
|
570
566
|
print("\(self.implementation.TAG) _checkCancelDelay switch case none error")
|
|
571
567
|
case .some:
|