@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.
- package/README.md +142 -4
- package/android/src/main/java/com/otakit/updater/BundleCrypto.java +81 -0
- package/android/src/main/java/com/otakit/updater/BundleStore.java +26 -0
- package/android/src/main/java/com/otakit/updater/DeltaAssembler.java +416 -0
- package/android/src/main/java/com/otakit/updater/HashUtils.java +16 -0
- package/android/src/main/java/com/otakit/updater/ManifestClient.java +136 -4
- package/android/src/main/java/com/otakit/updater/ManifestVerifier.java +43 -0
- package/android/src/main/java/com/otakit/updater/UpdaterPlugin.java +457 -20
- package/dist/esm/definitions.d.ts +104 -4
- package/dist/esm/definitions.d.ts.map +1 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +7 -1
- package/dist/esm/web.d.ts.map +1 -1
- package/dist/esm/web.js +25 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +31 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +31 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/UpdaterPlugin/BundleCrypto.swift +91 -0
- package/ios/Sources/UpdaterPlugin/BundleStore.swift +30 -0
- package/ios/Sources/UpdaterPlugin/DeltaAssembler.swift +316 -0
- package/ios/Sources/UpdaterPlugin/ManifestClient.swift +98 -6
- package/ios/Sources/UpdaterPlugin/ManifestVerifier.swift +29 -0
- package/ios/Sources/UpdaterPlugin/UpdaterPlugin.swift +422 -21
- package/package.json +1 -1
|
@@ -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" +
|