react-native-bspatch 1.1.3 → 2.0.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 +47 -52
- package/android/src/main/java/vn/reactnativebspatch/BsPatchModule.kt +15 -102
- package/android/src/main/java/vn/reactnativebspatch/OtaBundleResolver.kt +21 -1
- package/cpp/bsdiff/bspatch.c +1 -0
- package/ios/OtaBundleResolver.swift +16 -1
- package/ios/RNBsPatch.mm +61 -154
- package/lib/commonjs/NativeBsPatch.js.map +1 -1
- package/lib/commonjs/index.js +4 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ota/OtaProvider.js +26 -22
- package/lib/commonjs/ota/OtaProvider.js.map +1 -1
- package/lib/commonjs/ota/otaAssetResolver.js +8 -2
- package/lib/commonjs/ota/otaAssetResolver.js.map +1 -1
- package/lib/commonjs/ota/otaCore.js +89 -141
- package/lib/commonjs/ota/otaCore.js.map +1 -1
- package/lib/commonjs/ota/otaLogger.js +0 -2
- package/lib/commonjs/ota/otaLogger.js.map +1 -1
- package/lib/commonjs/ota/otaMetadata.js +18 -7
- package/lib/commonjs/ota/otaMetadata.js.map +1 -1
- package/lib/commonjs/ota/storage/GitHubRawStorage.js +3 -1
- package/lib/commonjs/ota/storage/GitHubRawStorage.js.map +1 -1
- package/lib/commonjs/ota/types.js +1 -10
- package/lib/commonjs/ota/types.js.map +1 -1
- package/lib/module/NativeBsPatch.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/ota/OtaProvider.js +26 -22
- package/lib/module/ota/OtaProvider.js.map +1 -1
- package/lib/module/ota/otaAssetResolver.js +8 -2
- package/lib/module/ota/otaAssetResolver.js.map +1 -1
- package/lib/module/ota/otaCore.js +88 -139
- package/lib/module/ota/otaCore.js.map +1 -1
- package/lib/module/ota/otaLogger.js +0 -2
- package/lib/module/ota/otaLogger.js.map +1 -1
- package/lib/module/ota/otaMetadata.js +18 -7
- package/lib/module/ota/otaMetadata.js.map +1 -1
- package/lib/module/ota/storage/GitHubRawStorage.js +3 -1
- package/lib/module/ota/storage/GitHubRawStorage.js.map +1 -1
- package/lib/module/ota/types.js +0 -9
- package/lib/module/ota/types.js.map +1 -1
- package/lib/typescript/NativeBsPatch.d.ts +3 -15
- package/lib/typescript/NativeBsPatch.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/ota/OtaProvider.d.ts.map +1 -1
- package/lib/typescript/ota/otaAssetResolver.d.ts.map +1 -1
- package/lib/typescript/ota/otaCore.d.ts +5 -42
- package/lib/typescript/ota/otaCore.d.ts.map +1 -1
- package/lib/typescript/ota/otaLogger.d.ts +1 -3
- package/lib/typescript/ota/otaLogger.d.ts.map +1 -1
- package/lib/typescript/ota/otaMetadata.d.ts +2 -2
- package/lib/typescript/ota/otaMetadata.d.ts.map +1 -1
- package/lib/typescript/ota/types.d.ts +18 -54
- package/lib/typescript/ota/types.d.ts.map +1 -1
- package/package.json +3 -6
- package/react-native-bspatch.podspec +0 -1
- package/src/NativeBsPatch.ts +3 -16
- package/src/index.ts +1 -1
- package/src/ota/OtaProvider.tsx +24 -23
- package/src/ota/otaAssetResolver.ts +5 -2
- package/src/ota/otaCore.ts +118 -176
- package/src/ota/otaLogger.ts +0 -2
- package/src/ota/otaMetadata.ts +18 -8
- package/src/ota/storage/GitHubRawStorage.ts +1 -1
- package/src/ota/types.ts +18 -57
- package/tools/build_ota.sh +356 -177
- package/tools/setup_project.js +95 -11
- package/tools/update_registry.js +24 -28
- package/tools/{upload_ota_custom.sh → upload_ota.sh} +33 -114
- package/lib/commonjs/crypto-js.d.js +0 -2
- package/lib/commonjs/crypto-js.d.js.map +0 -1
- package/lib/commonjs/ota/storage/CustomStorage.js +0 -160
- package/lib/commonjs/ota/storage/CustomStorage.js.map +0 -1
- package/lib/commonjs/ota/storage/GitHubReleaseStorage.js +0 -99
- package/lib/commonjs/ota/storage/GitHubReleaseStorage.js.map +0 -1
- package/lib/module/crypto-js.d.js +0 -2
- package/lib/module/crypto-js.d.js.map +0 -1
- package/lib/module/ota/storage/CustomStorage.js +0 -154
- package/lib/module/ota/storage/CustomStorage.js.map +0 -1
- package/lib/module/ota/storage/GitHubReleaseStorage.js +0 -93
- package/lib/module/ota/storage/GitHubReleaseStorage.js.map +0 -1
- package/lib/typescript/ota/storage/CustomStorage.d.ts +0 -12
- package/lib/typescript/ota/storage/CustomStorage.d.ts.map +0 -1
- package/lib/typescript/ota/storage/GitHubReleaseStorage.d.ts +0 -20
- package/lib/typescript/ota/storage/GitHubReleaseStorage.d.ts.map +0 -1
- package/src/crypto-js.d.ts +0 -1
- package/src/ota/storage/CustomStorage.ts +0 -166
- package/src/ota/storage/GitHubReleaseStorage.ts +0 -103
- package/tools/bsdiff +0 -0
package/src/ota/types.ts
CHANGED
|
@@ -28,15 +28,6 @@ export enum OtaUpdateMode {
|
|
|
28
28
|
BACKGROUND_DOWNLOAD = 'BACKGROUND_DOWNLOAD',
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export enum OtaStorageType {
|
|
32
|
-
/** Custom storage server (primary) */
|
|
33
|
-
CUSTOM = 'CUSTOM',
|
|
34
|
-
/** GitHub Releases — public or token-authenticated */
|
|
35
|
-
GITHUB = 'GITHUB',
|
|
36
|
-
/** GitHub Raw repository storage */
|
|
37
|
-
GITHUB_RAW = 'GITHUB_RAW',
|
|
38
|
-
}
|
|
39
|
-
|
|
40
31
|
export type OtaPatch = {
|
|
41
32
|
/** Unique ID: `v{from}-to-v{to}` */
|
|
42
33
|
id: string;
|
|
@@ -60,10 +51,10 @@ export type OtaPatch = {
|
|
|
60
51
|
minAppVersion?: string;
|
|
61
52
|
/** URL for full bundle download (fallback when patch fails) */
|
|
62
53
|
fullBundleUrl?: string;
|
|
63
|
-
/**
|
|
64
|
-
compressed?: boolean;
|
|
65
|
-
/** HMAC-SHA256 signature for security verification */
|
|
54
|
+
/** RSA/ECDSA SHA-256 signature (base64) of the patch file */
|
|
66
55
|
signature?: string;
|
|
56
|
+
/** RSA/ECDSA SHA-256 signature (base64) of the resulting bundle */
|
|
57
|
+
bundleSignature?: string;
|
|
67
58
|
/** Whether this update is mandatory */
|
|
68
59
|
mandatory?: boolean;
|
|
69
60
|
/** URL to the asset manifest JSON for this version */
|
|
@@ -100,6 +91,10 @@ export type OtaMetadata = {
|
|
|
100
91
|
previousVersions: number[];
|
|
101
92
|
rollbackCount: number;
|
|
102
93
|
lastLaunchSuccessful: boolean;
|
|
94
|
+
/** Native app version the OTA bundles were built for; native resolver drops OTA state when it changes */
|
|
95
|
+
appVersion?: string;
|
|
96
|
+
/** Versions that crashed on boot and were rolled back; never re-applied */
|
|
97
|
+
failedVersions?: number[];
|
|
103
98
|
};
|
|
104
99
|
|
|
105
100
|
export type OtaMetrics = {
|
|
@@ -136,59 +131,25 @@ export type OtaConfig = {
|
|
|
136
131
|
|
|
137
132
|
/** Telemetry: structured event callback for analytics */
|
|
138
133
|
onEvent?: OtaEventCallback;
|
|
139
|
-
/**
|
|
134
|
+
/**
|
|
135
|
+
* SPKI public key (PEM or base64) for RSA/ECDSA signature verification.
|
|
136
|
+
* When set, patches and bundles without a valid signature are rejected.
|
|
137
|
+
*/
|
|
140
138
|
publicKey?: string;
|
|
141
|
-
/** Base URL for the shared hashed asset store (e.g. a GitHub release URL) */
|
|
142
|
-
assetBaseUrl?: string;
|
|
143
|
-
|
|
144
|
-
/** Storage strategy */
|
|
145
|
-
storageType?: OtaStorageType;
|
|
146
|
-
|
|
147
|
-
/** GitHub Releases configuration (used when storageType === GITHUB) */
|
|
148
|
-
githubRelease?: {
|
|
149
|
-
/** Owner / repo in the format "owner/repo" */
|
|
150
|
-
repo: string;
|
|
151
|
-
/** Tag name of the release to fetch updates from */
|
|
152
|
-
tag: string;
|
|
153
|
-
/**
|
|
154
|
-
* Path inside the release where ota_registry.json lives.
|
|
155
|
-
* If your release contains the file at root, set to "ota_registry.json".
|
|
156
|
-
* If it's inside a folder "ota/", set to "ota/ota_registry.json".
|
|
157
|
-
*/
|
|
158
|
-
registryPath?: string;
|
|
159
|
-
/**
|
|
160
|
-
* Optional GitHub personal access token for private repos or higher rate limits.
|
|
161
|
-
* For public repos this is optional.
|
|
162
|
-
*/
|
|
163
|
-
token?: string;
|
|
164
|
-
/**
|
|
165
|
-
* Asset base URL for content-addressed assets.
|
|
166
|
-
* Supports CDN URLs (jsDelivr, GitHub raw) or a custom base.
|
|
167
|
-
* Example: "https://cdn.jsdelivr.net/gh/owner/repo@tag/assets"
|
|
168
|
-
*/
|
|
169
|
-
assetBaseUrl?: string;
|
|
170
|
-
};
|
|
171
139
|
|
|
172
|
-
/**
|
|
140
|
+
/**
|
|
141
|
+
* Static storage layout read by the default provider: `${baseUrl}/${baseFolder}/...`.
|
|
142
|
+
* Any static host/CDN serving the same layout works (e.g. a public bucket).
|
|
143
|
+
* Read-only and public: never put upload credentials here, they ship inside the app.
|
|
144
|
+
*/
|
|
173
145
|
customServer?: {
|
|
146
|
+
/** e.g. https://raw.githubusercontent.com/<owner>/<repo>/<branch> */
|
|
174
147
|
baseUrl: string;
|
|
175
|
-
username: string;
|
|
176
|
-
password: string;
|
|
177
148
|
channel: string;
|
|
178
149
|
baseFolder?: string;
|
|
179
|
-
useMinio?: boolean;
|
|
180
|
-
/** Override default API endpoints for non-standard servers */
|
|
181
|
-
endpoints?: {
|
|
182
|
-
/** Auth login endpoint (default: /public/authen/login) */
|
|
183
|
-
login?: string;
|
|
184
|
-
/** Generate download link endpoint (default: /api/minio/gen-download-link) */
|
|
185
|
-
genDownloadLink?: string;
|
|
186
|
-
/** Direct file download endpoint (default: /files/downloadStreamFile) */
|
|
187
|
-
downloadFile?: string;
|
|
188
|
-
};
|
|
189
150
|
};
|
|
190
151
|
|
|
191
|
-
/** Storage provider instance (optional, defaults to
|
|
152
|
+
/** Storage provider instance (optional, defaults to GitHubRawStorageProvider) */
|
|
192
153
|
storage?: OtaStorageProvider;
|
|
193
154
|
};
|
|
194
155
|
|