@otakit/capacitor-updater 2.1.2 → 2.3.0

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.
@@ -34,6 +34,9 @@ final class ManifestVerifier {
34
34
  String sha256,
35
35
  int size,
36
36
  String runtimeVersion,
37
+ String strategy,
38
+ boolean forceImmediate,
39
+ ManifestClient.ManifestEncryption encryption,
37
40
  ManifestClient.ManifestSignature signature,
38
41
  List<KeyEntry> trustedKeys
39
42
  ) throws Exception {
@@ -44,6 +47,9 @@ final class ManifestVerifier {
44
47
  sha256,
45
48
  size,
46
49
  runtimeVersion,
50
+ strategy,
51
+ forceImmediate,
52
+ encryption,
47
53
  signature.kid,
48
54
  signature.iat,
49
55
  signature.exp
@@ -91,6 +97,31 @@ final class ManifestVerifier {
91
97
  }
92
98
  }
93
99
 
100
+ /**
101
+ * Encode the encryption block for the canonical payload.
102
+ * Must match the server's encodeEncryptionForPayload exactly.
103
+ */
104
+ private static String encodeEncryptionForPayload(ManifestClient.ManifestEncryption encryption) {
105
+ if (encryption == null) {
106
+ return "null";
107
+ }
108
+ return (
109
+ encryption.alg +
110
+ "|" +
111
+ encryption.kid +
112
+ "|" +
113
+ encryption.wrapNonce +
114
+ "|" +
115
+ encryption.wrappedDek +
116
+ "|" +
117
+ encryption.nonce
118
+ );
119
+ }
120
+
121
+ /**
122
+ * Canonical payload v2 — must match the server's buildCanonicalPayload
123
+ * (console/lib/manifest-signing.ts) and the iOS mirror byte-for-byte.
124
+ */
94
125
  private static String buildCanonicalPayload(
95
126
  String appId,
96
127
  String channel,
@@ -98,6 +129,9 @@ final class ManifestVerifier {
98
129
  String sha256,
99
130
  int size,
100
131
  String runtimeVersion,
132
+ String strategy,
133
+ boolean forceImmediate,
134
+ ManifestClient.ManifestEncryption encryption,
101
135
  String kid,
102
136
  int iat,
103
137
  int exp
@@ -122,6 +156,15 @@ final class ManifestVerifier {
122
156
  "runtimeVersion:" +
123
157
  (runtimeVersion != null ? runtimeVersion : "null") +
124
158
  "\n" +
159
+ "strategy:" +
160
+ strategy +
161
+ "\n" +
162
+ "forceImmediate:" +
163
+ (forceImmediate ? "true" : "false") +
164
+ "\n" +
165
+ "encryption:" +
166
+ encodeEncryptionForPayload(encryption) +
167
+ "\n" +
125
168
  "kid:" +
126
169
  kid +
127
170
  "\n" +