@capgo/capacitor-updater 5.7.9 → 5.7.10

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.
@@ -1,3 +1,9 @@
1
+ /*
2
+ * This Source Code Form is subject to the terms of the Mozilla Public
3
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
+ */
6
+
1
7
  package ee.forgr.capacitor_updater;
2
8
 
3
9
  import com.getcapacitor.JSObject;
@@ -55,7 +55,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
55
55
  private static final String channelUrlDefault =
56
56
  "https://api.capgo.app/channel_self";
57
57
 
58
- private final String PLUGIN_VERSION = "5.7.9";
58
+ private final String PLUGIN_VERSION = "5.7.10";
59
59
  private static final String DELAY_CONDITION_PREFERENCES = "";
60
60
 
61
61
  private SharedPreferences.Editor editor;
@@ -43,8 +43,7 @@ public class CryptoCipher {
43
43
  PSource.PSpecified.DEFAULT
44
44
  );
45
45
  cipher.init(Cipher.DECRYPT_MODE, privateKey, oaepParams);
46
- byte[] decryptedBytes = cipher.doFinal(source);
47
- return decryptedBytes;
46
+ return cipher.doFinal(source);
48
47
  }
49
48
 
50
49
  public static byte[] decryptAES(byte[] cipherText, SecretKey key, byte[] iv) {
@@ -53,8 +52,7 @@ public class CryptoCipher {
53
52
  Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
54
53
  SecretKeySpec keySpec = new SecretKeySpec(key.getEncoded(), "AES");
55
54
  cipher.init(Cipher.DECRYPT_MODE, keySpec, ivParameterSpec);
56
- byte[] decryptedText = cipher.doFinal(cipherText);
57
- return decryptedText;
55
+ return cipher.doFinal(cipherText);
58
56
  } catch (Exception e) {
59
57
  e.printStackTrace();
60
58
  }
@@ -63,13 +61,7 @@ public class CryptoCipher {
63
61
 
64
62
  public static SecretKey byteToSessionKey(byte[] sessionKey) {
65
63
  // rebuild key using SecretKeySpec
66
- SecretKey originalKey = new SecretKeySpec(
67
- sessionKey,
68
- 0,
69
- sessionKey.length,
70
- "AES"
71
- );
72
- return originalKey;
64
+ return new SecretKeySpec(sessionKey, 0, sessionKey.length, "AES");
73
65
  }
74
66
 
75
67
  private static PrivateKey readPkcs8PrivateKey(byte[] pkcs8Bytes)
@@ -137,7 +129,7 @@ public class CryptoCipher {
137
129
  throws GeneralSecurityException {
138
130
  // Base64 decode the result
139
131
 
140
- String pkcs1Pem = private_key.toString();
132
+ String pkcs1Pem = private_key;
141
133
  pkcs1Pem = pkcs1Pem.replace("-----BEGIN RSA PRIVATE KEY-----", "");
142
134
  pkcs1Pem = pkcs1Pem.replace("-----END RSA PRIVATE KEY-----", "");
143
135
  pkcs1Pem = pkcs1Pem.replace("\\n", "");
@@ -6,6 +6,7 @@
6
6
 
7
7
  package ee.forgr.capacitor_updater;
8
8
 
9
+ import androidx.annotation.NonNull;
9
10
  import com.google.gson.annotations.SerializedName;
10
11
  import java.util.Objects;
11
12
 
@@ -41,8 +42,7 @@ public class DelayCondition {
41
42
  @Override
42
43
  public boolean equals(Object o) {
43
44
  if (this == o) return true;
44
- if (!(o instanceof DelayCondition)) return false;
45
- DelayCondition that = (DelayCondition) o;
45
+ if (!(o instanceof DelayCondition that)) return false;
46
46
  return (
47
47
  getKind() == that.getKind() && Objects.equals(getValue(), that.getValue())
48
48
  );
@@ -53,6 +53,7 @@ public class DelayCondition {
53
53
  return Objects.hash(getKind(), getValue());
54
54
  }
55
55
 
56
+ @NonNull
56
57
  @Override
57
58
  public String toString() {
58
59
  return (
@@ -14,6 +14,7 @@ import java.io.FileOutputStream;
14
14
  import java.io.InputStream;
15
15
  import java.net.URL;
16
16
  import java.net.URLConnection;
17
+ import java.util.Objects;
17
18
 
18
19
  public class DownloadService extends IntentService {
19
20
 
@@ -44,6 +45,7 @@ public class DownloadService extends IntentService {
44
45
  // Will be called asynchronously by OS.
45
46
  @Override
46
47
  protected void onHandleIntent(Intent intent) {
48
+ assert intent != null;
47
49
  String url = intent.getStringExtra(URL);
48
50
  String id = intent.getStringExtra(ID);
49
51
  String documentsDir = intent.getStringExtra(DOCDIR);
@@ -60,8 +62,9 @@ public class DownloadService extends IntentService {
60
62
  final InputStream is = u.openStream();
61
63
  final DataInputStream dis = new DataInputStream(is)
62
64
  ) {
65
+ assert dest != null;
63
66
  final File target = new File(documentsDir, dest);
64
- target.getParentFile().mkdirs();
67
+ Objects.requireNonNull(target.getParentFile()).mkdirs();
65
68
  target.createNewFile();
66
69
  try (final FileOutputStream fos = new FileOutputStream(target)) {
67
70
  final long totalLength = connection.getContentLength();
@@ -8,8 +8,8 @@ public class InternalUtils {
8
8
 
9
9
  public static String getPackageName(PackageManager pm, String packageName) {
10
10
  try {
11
- PackageInfo pinfo = getPackageInfoInternal(pm, packageName, 0);
12
- return (pinfo != null) ? pinfo.packageName : null;
11
+ PackageInfo pInfo = getPackageInfoInternal(pm, packageName, 0);
12
+ return (pInfo != null) ? pInfo.packageName : null;
13
13
  } catch (PackageManager.NameNotFoundException e) {
14
14
  // Exception is handled internally, and null is returned to indicate the package name could not be retrieved
15
15
  return null;
@@ -15,7 +15,7 @@ import Version
15
15
  @objc(CapacitorUpdaterPlugin)
16
16
  public class CapacitorUpdaterPlugin: CAPPlugin {
17
17
  public var implementation = CapacitorUpdater()
18
- private let PLUGIN_VERSION: String = "5.7.9"
18
+ private let PLUGIN_VERSION: String = "5.7.10"
19
19
  static let updateUrlDefault = "https://api.capgo.app/updates"
20
20
  static let statsUrlDefault = "https://api.capgo.app/stats"
21
21
  static let channelUrlDefault = "https://api.capgo.app/channel_self"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "5.7.9",
3
+ "version": "5.7.10",
4
4
  "packageManager": "pnpm@8.15.4",
5
5
  "license": "MPL-2.0",
6
6
  "description": "Live update for capacitor apps",