native-update-capacitor 0.0.0-stage → 4.4.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/AI-INTEGRATION-GUIDE.md +578 -0
- package/LICENSE +25 -0
- package/NativeUpdate.podspec +19 -0
- package/README.md +574 -2
- package/android/build.gradle +125 -0
- package/android/consumer-rules.pro +9 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +8 -0
- package/android/gradle.properties +17 -0
- package/android/manifest-additions.xml +28 -0
- package/android/proguard-rules.pro +26 -0
- package/android/settings.gradle +2 -0
- package/android/src/main/AndroidManifest.xml +13 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/AppReviewPlugin.kt +159 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/AppUpdatePlugin.kt +314 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/BackgroundNotificationManager.kt +406 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/BackgroundUpdateManager.kt +48 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/BackgroundUpdatePlugin.kt +343 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/BackgroundUpdateWorker.kt +236 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/JsonOptional.kt +26 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/LiveUpdatePlugin.kt +1249 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/NativeUpdatePlugin.kt +404 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/NotificationActionReceiver.kt +107 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/SecurityManager.kt +240 -0
- package/android/variables.gradle +5 -0
- package/cli/commands/backend-create.js +623 -0
- package/cli/commands/bundle-create.js +145 -0
- package/cli/commands/bundle-sign.js +64 -0
- package/cli/commands/bundle-verify.js +58 -0
- package/cli/commands/flutter-patch.js +107 -0
- package/cli/commands/init.js +146 -0
- package/cli/commands/keys-generate.js +58 -0
- package/cli/commands/monitor.js +89 -0
- package/cli/commands/remote-shared.js +264 -0
- package/cli/commands/remote.js +634 -0
- package/cli/commands/server-start.js +96 -0
- package/cli/index.js +625 -0
- package/cli/package.json +21 -0
- package/dist/esm/app-review/app-review-manager.d.ts +24 -0
- package/dist/esm/app-review/app-review-manager.js +194 -0
- package/dist/esm/app-review/index.d.ts +5 -0
- package/dist/esm/app-review/index.js +5 -0
- package/dist/esm/app-review/platform-review-handler.d.ts +20 -0
- package/dist/esm/app-review/platform-review-handler.js +137 -0
- package/dist/esm/app-review/review-conditions-checker.d.ts +22 -0
- package/dist/esm/app-review/review-conditions-checker.js +154 -0
- package/dist/esm/app-review/review-rate-limiter.d.ts +23 -0
- package/dist/esm/app-review/review-rate-limiter.js +163 -0
- package/dist/esm/app-review/types.d.ts +41 -0
- package/dist/esm/app-review/types.js +1 -0
- package/dist/esm/app-update/app-update-checker.d.ts +58 -0
- package/dist/esm/app-update/app-update-checker.js +227 -0
- package/dist/esm/app-update/app-update-installer.d.ts +20 -0
- package/dist/esm/app-update/app-update-installer.js +134 -0
- package/dist/esm/app-update/app-update-manager.d.ts +28 -0
- package/dist/esm/app-update/app-update-manager.js +198 -0
- package/dist/esm/app-update/app-update-notifier.d.ts +14 -0
- package/dist/esm/app-update/app-update-notifier.js +99 -0
- package/dist/esm/app-update/index.d.ts +6 -0
- package/dist/esm/app-update/index.js +6 -0
- package/dist/esm/app-update/platform-app-update.d.ts +19 -0
- package/dist/esm/app-update/platform-app-update.js +138 -0
- package/dist/esm/app-update/types.d.ts +58 -0
- package/dist/esm/app-update/types.js +11 -0
- package/dist/esm/background-update/background-scheduler.d.ts +63 -0
- package/dist/esm/background-update/background-scheduler.js +332 -0
- package/dist/esm/background-update/index.d.ts +3 -0
- package/dist/esm/background-update/index.js +2 -0
- package/dist/esm/background-update/notification-manager.d.ts +29 -0
- package/dist/esm/background-update/notification-manager.js +88 -0
- package/dist/esm/config/support.d.ts +9 -0
- package/dist/esm/config/support.js +9 -0
- package/dist/esm/core/analytics.d.ts +83 -0
- package/dist/esm/core/analytics.js +151 -0
- package/dist/esm/core/cache-manager.d.ts +72 -0
- package/dist/esm/core/cache-manager.js +274 -0
- package/dist/esm/core/config.d.ts +69 -0
- package/dist/esm/core/config.js +107 -0
- package/dist/esm/core/errors.d.ts +56 -0
- package/dist/esm/core/errors.js +85 -0
- package/dist/esm/core/event-emitter.d.ts +30 -0
- package/dist/esm/core/event-emitter.js +80 -0
- package/dist/esm/core/logger.d.ts +21 -0
- package/dist/esm/core/logger.js +108 -0
- package/dist/esm/core/performance.d.ts +53 -0
- package/dist/esm/core/performance.js +153 -0
- package/dist/esm/core/plugin-manager.d.ts +88 -0
- package/dist/esm/core/plugin-manager.js +224 -0
- package/dist/esm/core/security.d.ts +123 -0
- package/dist/esm/core/security.js +361 -0
- package/dist/esm/core/update-check.d.ts +121 -0
- package/dist/esm/core/update-check.js +127 -0
- package/dist/esm/definitions.d.ts +872 -0
- package/dist/esm/definitions.js +104 -0
- package/dist/esm/index.d.ts +14 -0
- package/dist/esm/index.js +18 -0
- package/dist/esm/live-update/bundle-manager.d.ts +102 -0
- package/dist/esm/live-update/bundle-manager.js +344 -0
- package/dist/esm/live-update/certificate-pinning.d.ts +38 -0
- package/dist/esm/live-update/certificate-pinning.js +77 -0
- package/dist/esm/live-update/delta-processor.d.ts +84 -0
- package/dist/esm/live-update/delta-processor.js +257 -0
- package/dist/esm/live-update/download-manager.d.ts +106 -0
- package/dist/esm/live-update/download-manager.js +412 -0
- package/dist/esm/live-update/rollout-checker.d.ts +86 -0
- package/dist/esm/live-update/rollout-checker.js +304 -0
- package/dist/esm/live-update/update-manager.d.ts +63 -0
- package/dist/esm/live-update/update-manager.js +321 -0
- package/dist/esm/live-update/version-manager.d.ts +93 -0
- package/dist/esm/live-update/version-manager.js +390 -0
- package/dist/esm/plugin.d.ts +3 -0
- package/dist/esm/plugin.js +848 -0
- package/dist/esm/security/crypto.d.ts +88 -0
- package/dist/esm/security/crypto.js +228 -0
- package/dist/esm/security/validator.d.ts +60 -0
- package/dist/esm/security/validator.js +142 -0
- package/dist/esm/types/app-identity.d.ts +36 -0
- package/dist/esm/types/app-identity.js +1 -0
- package/dist/esm/types/rollout.d.ts +91 -0
- package/dist/esm/types/rollout.js +25 -0
- package/dist/esm/web.d.ts +130 -0
- package/dist/esm/web.js +981 -0
- package/dist/plugin.cjs +1 -0
- package/dist/plugin.esm.js +1 -0
- package/dist/plugin.js +2 -0
- package/docs/CHANGELOG.md +1016 -0
- package/docs/KNOWN_LIMITATIONS.md +240 -0
- package/docs/MIGRATION.md +391 -0
- package/docs/protocol/CLIENT-PROTOCOL.md +199 -0
- package/docs/server-requirements.md +211 -0
- package/ios/Plugin/AppReview/AppReviewPlugin.swift +158 -0
- package/ios/Plugin/AppUpdate/AppUpdatePlugin.swift +249 -0
- package/ios/Plugin/BackgroundUpdate/BackgroundNotificationManager.swift +333 -0
- package/ios/Plugin/BackgroundUpdate/BackgroundUpdatePlugin.swift +464 -0
- package/ios/Plugin/Info.plist +43 -0
- package/ios/Plugin/LiveUpdate/LiveUpdatePlugin.swift +1286 -0
- package/ios/Plugin/LiveUpdate/WebViewConfiguration.swift +45 -0
- package/ios/Plugin/NativeUpdatePlugin.m +53 -0
- package/ios/Plugin/NativeUpdatePlugin.swift +315 -0
- package/ios/Plugin/Security/SecurityManager.swift +289 -0
- package/package.json +133 -4
|
@@ -0,0 +1,872 @@
|
|
|
1
|
+
import type { AppIdentity } from './types/app-identity';
|
|
2
|
+
export type { AppIdentity } from './types/app-identity';
|
|
3
|
+
/**
|
|
4
|
+
* Live Update Plugin Interface
|
|
5
|
+
*/
|
|
6
|
+
export interface LiveUpdatePlugin {
|
|
7
|
+
/**
|
|
8
|
+
* Sync with update server and apply updates if available
|
|
9
|
+
*/
|
|
10
|
+
sync(options?: SyncOptions): Promise<SyncResult>;
|
|
11
|
+
/**
|
|
12
|
+
* Download a specific bundle version
|
|
13
|
+
*/
|
|
14
|
+
download(options: DownloadOptions): Promise<BundleInfo>;
|
|
15
|
+
/**
|
|
16
|
+
* Set the active bundle
|
|
17
|
+
*/
|
|
18
|
+
set(bundle: BundleInfo): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Reload the app with current bundle
|
|
21
|
+
*/
|
|
22
|
+
reload(): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Reset to original bundle
|
|
25
|
+
*/
|
|
26
|
+
reset(): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Get current bundle info
|
|
29
|
+
*/
|
|
30
|
+
current(): Promise<BundleInfo>;
|
|
31
|
+
/**
|
|
32
|
+
* List all downloaded bundles
|
|
33
|
+
*/
|
|
34
|
+
list(): Promise<BundleInfo[]>;
|
|
35
|
+
/**
|
|
36
|
+
* Delete bundles
|
|
37
|
+
*/
|
|
38
|
+
delete(options: DeleteOptions): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Notify app is ready after update
|
|
41
|
+
*/
|
|
42
|
+
notifyAppReady(): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Check for latest version
|
|
45
|
+
*/
|
|
46
|
+
getLatest(): Promise<LatestVersion>;
|
|
47
|
+
/**
|
|
48
|
+
* The app's client identity for API-key client restrictions (dashboard →
|
|
49
|
+
* API Keys → Restrictions). On Android it is the applicationId + signing-cert
|
|
50
|
+
* SHA-256/SHA-1; on iOS the bundle identifier; on web `{ platform: 'web' }`
|
|
51
|
+
* (browsers identify via the Origin header). Call this when performing your
|
|
52
|
+
* OWN update-check fetch and attach the matching `X-Android-*` / `X-Ios-*`
|
|
53
|
+
* headers; the plugin's native update-check attaches them automatically.
|
|
54
|
+
*
|
|
55
|
+
* Headers are client-attested (parity with Google API-key restrictions):
|
|
56
|
+
* they stop cross-site/casual key reuse, not a forged native client.
|
|
57
|
+
*/
|
|
58
|
+
getAppIdentity(): Promise<AppIdentity>;
|
|
59
|
+
/**
|
|
60
|
+
* Switch update channel
|
|
61
|
+
*/
|
|
62
|
+
setChannel(channel: string): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Set update server URL
|
|
65
|
+
*/
|
|
66
|
+
setUpdateUrl(url: string): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Validate an update bundle
|
|
69
|
+
*/
|
|
70
|
+
validateUpdate(options: ValidateOptions): Promise<ValidationResult>;
|
|
71
|
+
/**
|
|
72
|
+
* Check for available updates (alias for getLatest)
|
|
73
|
+
*/
|
|
74
|
+
checkForUpdate(): Promise<CheckForUpdateResult>;
|
|
75
|
+
/**
|
|
76
|
+
* Download the latest available update
|
|
77
|
+
*/
|
|
78
|
+
downloadUpdate(options?: DownloadUpdateOptions): Promise<BundleInfo>;
|
|
79
|
+
/**
|
|
80
|
+
* Apply a downloaded update and reload the app
|
|
81
|
+
*/
|
|
82
|
+
applyUpdate(bundleId?: string): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Cancel an active download
|
|
85
|
+
*/
|
|
86
|
+
cancelDownload(bundleId: string): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Cancel all active downloads
|
|
89
|
+
*/
|
|
90
|
+
cancelAllDownloads(): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Check if a download is currently active
|
|
93
|
+
*/
|
|
94
|
+
isDownloading(bundleId: string): Promise<boolean>;
|
|
95
|
+
/**
|
|
96
|
+
* Get the count of active downloads
|
|
97
|
+
*/
|
|
98
|
+
getActiveDownloadCount(): Promise<number>;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* App Update Plugin Interface
|
|
102
|
+
*/
|
|
103
|
+
export interface AppUpdatePlugin {
|
|
104
|
+
/**
|
|
105
|
+
* Get app update information
|
|
106
|
+
*/
|
|
107
|
+
getAppUpdateInfo(): Promise<AppUpdateInfo>;
|
|
108
|
+
/**
|
|
109
|
+
* Perform immediate update
|
|
110
|
+
*/
|
|
111
|
+
performImmediateUpdate(): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Start flexible update
|
|
114
|
+
*/
|
|
115
|
+
startFlexibleUpdate(): Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* Complete flexible update
|
|
118
|
+
*/
|
|
119
|
+
completeFlexibleUpdate(): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Open app store page
|
|
122
|
+
*/
|
|
123
|
+
openAppStore(options?: OpenAppStoreOptions): Promise<void>;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* App Review Plugin Interface
|
|
127
|
+
*/
|
|
128
|
+
export interface AppReviewPlugin {
|
|
129
|
+
/**
|
|
130
|
+
* Request in-app review
|
|
131
|
+
*/
|
|
132
|
+
requestReview(): Promise<ReviewResult>;
|
|
133
|
+
/**
|
|
134
|
+
* Check if review can be requested
|
|
135
|
+
*/
|
|
136
|
+
canRequestReview(): Promise<CanRequestReviewResult>;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Background Update Plugin Interface
|
|
140
|
+
*/
|
|
141
|
+
export interface BackgroundUpdatePlugin {
|
|
142
|
+
/**
|
|
143
|
+
* Enable background update checking
|
|
144
|
+
*/
|
|
145
|
+
enableBackgroundUpdates(config: BackgroundUpdateConfig): Promise<void>;
|
|
146
|
+
/**
|
|
147
|
+
* Disable background update checking
|
|
148
|
+
*/
|
|
149
|
+
disableBackgroundUpdates(): Promise<void>;
|
|
150
|
+
/**
|
|
151
|
+
* Get current background update status
|
|
152
|
+
*/
|
|
153
|
+
getBackgroundUpdateStatus(): Promise<BackgroundUpdateStatus>;
|
|
154
|
+
/**
|
|
155
|
+
* Schedule background update check with specific interval
|
|
156
|
+
*/
|
|
157
|
+
scheduleBackgroundCheck(interval: number): Promise<void>;
|
|
158
|
+
/**
|
|
159
|
+
* Manually trigger background update check
|
|
160
|
+
*/
|
|
161
|
+
triggerBackgroundCheck(): Promise<BackgroundCheckResult>;
|
|
162
|
+
/**
|
|
163
|
+
* Configure notification preferences
|
|
164
|
+
*/
|
|
165
|
+
setNotificationPreferences(preferences: NotificationPreferences): Promise<void>;
|
|
166
|
+
/**
|
|
167
|
+
* Get notification permissions status
|
|
168
|
+
*/
|
|
169
|
+
getNotificationPermissions(): Promise<NotificationPermissionStatus>;
|
|
170
|
+
/**
|
|
171
|
+
* Request notification permissions
|
|
172
|
+
*/
|
|
173
|
+
requestNotificationPermissions(): Promise<boolean>;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Combined plugin interface
|
|
177
|
+
*/
|
|
178
|
+
export interface NativeUpdateCombinedPlugin extends LiveUpdatePlugin, AppUpdatePlugin, AppReviewPlugin, BackgroundUpdatePlugin {
|
|
179
|
+
/**
|
|
180
|
+
* Configure the plugin with initial settings
|
|
181
|
+
*/
|
|
182
|
+
configure(config: UpdateConfig | {
|
|
183
|
+
config: PluginInitConfig;
|
|
184
|
+
}): Promise<void>;
|
|
185
|
+
/**
|
|
186
|
+
* Get current security configuration
|
|
187
|
+
*/
|
|
188
|
+
getSecurityInfo(): Promise<SecurityInfo>;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Configuration Types
|
|
192
|
+
*/
|
|
193
|
+
export interface PluginConfig {
|
|
194
|
+
serverUrl?: string;
|
|
195
|
+
channel?: string;
|
|
196
|
+
autoCheck?: boolean;
|
|
197
|
+
autoUpdate?: boolean;
|
|
198
|
+
updateStrategy?: UpdateStrategy;
|
|
199
|
+
publicKey?: string;
|
|
200
|
+
requireSignature?: boolean;
|
|
201
|
+
allowUnsignedDevelopmentUpdates?: boolean;
|
|
202
|
+
enableDeltaUpdates?: boolean;
|
|
203
|
+
maxBundleSize?: number;
|
|
204
|
+
maxUncompressedBundleSize?: number;
|
|
205
|
+
allowedHosts?: string[];
|
|
206
|
+
checksumAlgorithm?: ChecksumAlgorithm;
|
|
207
|
+
checkInterval?: number;
|
|
208
|
+
security?: SecurityConfig;
|
|
209
|
+
}
|
|
210
|
+
export interface UpdateConfig {
|
|
211
|
+
liveUpdate?: LiveUpdateConfig;
|
|
212
|
+
appUpdate?: AppUpdateConfig;
|
|
213
|
+
appReview?: AppReviewConfig;
|
|
214
|
+
backgroundUpdate?: BackgroundUpdateConfig;
|
|
215
|
+
security?: SecurityConfig;
|
|
216
|
+
}
|
|
217
|
+
export interface LiveUpdateConfig {
|
|
218
|
+
appId: string;
|
|
219
|
+
/**
|
|
220
|
+
* Base URL of the Native Update backend. OTA update checks are issued as
|
|
221
|
+
* `GET {serverUrl}/v1/updates/check` (API-key auth via `X-API-Key`); the
|
|
222
|
+
* self-host contract for that endpoint is in `docs/server-requirements.md`.
|
|
223
|
+
* Hosted backend value: `https://nativeupdatebe.aoneahsan.com/api`.
|
|
224
|
+
* Must be HTTPS in production (the plugin rejects non-HTTPS base URLs).
|
|
225
|
+
*/
|
|
226
|
+
serverUrl?: string;
|
|
227
|
+
/**
|
|
228
|
+
* App API key for the Native Update backend, sent as the `X-API-Key`
|
|
229
|
+
* header on every update check. Mint/rotate/copy keys in the dashboard
|
|
230
|
+
* (Apps → your app → API Keys). Added in v3.1.3 — earlier versions only
|
|
231
|
+
* accepted the key via the flat `initialize({ apiKey })` form.
|
|
232
|
+
*/
|
|
233
|
+
apiKey?: string;
|
|
234
|
+
channel?: string;
|
|
235
|
+
autoUpdate?: boolean;
|
|
236
|
+
updateStrategy?: UpdateStrategy;
|
|
237
|
+
publicKey?: string;
|
|
238
|
+
requireSignature?: boolean;
|
|
239
|
+
checksumAlgorithm?: ChecksumAlgorithm;
|
|
240
|
+
checkInterval?: number;
|
|
241
|
+
allowEmulator?: boolean;
|
|
242
|
+
mandatoryInstallMode?: InstallMode;
|
|
243
|
+
optionalInstallMode?: InstallMode;
|
|
244
|
+
maxBundleSize?: number;
|
|
245
|
+
/**
|
|
246
|
+
* Maximum total uncompressed size of an installed ZIP bundle in bytes.
|
|
247
|
+
* Native platforms default to 500 MiB and reject archives above the cap.
|
|
248
|
+
*/
|
|
249
|
+
maxUncompressedBundleSize?: number;
|
|
250
|
+
allowedHosts?: string[];
|
|
251
|
+
allowUnsignedDevelopmentUpdates?: boolean;
|
|
252
|
+
/** Use verified NUDELTA/1 patches when available (default: true). */
|
|
253
|
+
enableDeltaUpdates?: boolean;
|
|
254
|
+
}
|
|
255
|
+
export interface AppUpdateConfig {
|
|
256
|
+
minimumVersion?: string;
|
|
257
|
+
updatePriority?: number;
|
|
258
|
+
appStoreId?: string;
|
|
259
|
+
packageName?: string;
|
|
260
|
+
storeUrl?: {
|
|
261
|
+
android?: string;
|
|
262
|
+
ios?: string;
|
|
263
|
+
};
|
|
264
|
+
checkOnAppStart?: boolean;
|
|
265
|
+
allowDowngrade?: boolean;
|
|
266
|
+
}
|
|
267
|
+
export interface AppReviewConfig {
|
|
268
|
+
minimumDaysSinceInstall?: number;
|
|
269
|
+
minimumDaysSinceLastPrompt?: number;
|
|
270
|
+
minimumLaunchCount?: number;
|
|
271
|
+
customTriggers?: string[];
|
|
272
|
+
debugMode?: boolean;
|
|
273
|
+
webReviewUrl?: string;
|
|
274
|
+
}
|
|
275
|
+
export interface BackgroundUpdateConfig {
|
|
276
|
+
enabled: boolean;
|
|
277
|
+
checkInterval: number;
|
|
278
|
+
updateTypes: BackgroundUpdateType[];
|
|
279
|
+
autoInstall?: boolean;
|
|
280
|
+
notificationPreferences?: NotificationPreferences;
|
|
281
|
+
respectBatteryOptimization?: boolean;
|
|
282
|
+
allowMeteredConnection?: boolean;
|
|
283
|
+
minimumBatteryLevel?: number;
|
|
284
|
+
requireWifi?: boolean;
|
|
285
|
+
maxRetries?: number;
|
|
286
|
+
retryDelay?: number;
|
|
287
|
+
taskIdentifier?: string;
|
|
288
|
+
}
|
|
289
|
+
export interface SecurityConfig {
|
|
290
|
+
enforceHttps?: boolean;
|
|
291
|
+
certificatePinning?: CertificatePinning;
|
|
292
|
+
validateInputs?: boolean;
|
|
293
|
+
/**
|
|
294
|
+
* @deprecated since v2. Secure storage is always on. Android uses
|
|
295
|
+
* Android Keystore-backed AES-256-GCM, iOS uses Keychain,
|
|
296
|
+
* web does not persist sensitive config fields to localStorage.
|
|
297
|
+
* Setting this to `false` is ignored.
|
|
298
|
+
*/
|
|
299
|
+
secureStorage?: boolean;
|
|
300
|
+
logSecurityEvents?: boolean;
|
|
301
|
+
}
|
|
302
|
+
export interface CertificatePinning {
|
|
303
|
+
enabled: boolean;
|
|
304
|
+
pins: CertificatePin[];
|
|
305
|
+
}
|
|
306
|
+
export interface CertificatePin {
|
|
307
|
+
hostname: string;
|
|
308
|
+
sha256: string[];
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Live Update Types
|
|
312
|
+
*/
|
|
313
|
+
export interface SyncOptions {
|
|
314
|
+
channel?: string;
|
|
315
|
+
updateMode?: UpdateMode;
|
|
316
|
+
}
|
|
317
|
+
export interface SyncResult {
|
|
318
|
+
status: SyncStatus;
|
|
319
|
+
version?: string;
|
|
320
|
+
description?: string;
|
|
321
|
+
mandatory?: boolean;
|
|
322
|
+
error?: UpdateError;
|
|
323
|
+
}
|
|
324
|
+
export interface DownloadOptions {
|
|
325
|
+
url: string;
|
|
326
|
+
version: string;
|
|
327
|
+
checksum: string;
|
|
328
|
+
signature?: string;
|
|
329
|
+
signatureAlgorithm?: 'RSA-SHA256';
|
|
330
|
+
delta?: DeltaUpdateInfo;
|
|
331
|
+
maxRetries?: number;
|
|
332
|
+
timeout?: number;
|
|
333
|
+
}
|
|
334
|
+
export interface BundleInfo {
|
|
335
|
+
bundleId: string;
|
|
336
|
+
version: string;
|
|
337
|
+
path: string;
|
|
338
|
+
downloadTime: number;
|
|
339
|
+
size: number;
|
|
340
|
+
status: BundleStatus;
|
|
341
|
+
checksum: string;
|
|
342
|
+
signature?: string;
|
|
343
|
+
signatureAlgorithm?: 'RSA-SHA256';
|
|
344
|
+
verified: boolean;
|
|
345
|
+
metadata?: Record<string, unknown>;
|
|
346
|
+
}
|
|
347
|
+
export interface DeleteOptions {
|
|
348
|
+
bundleId?: string;
|
|
349
|
+
keepVersions?: number;
|
|
350
|
+
olderThan?: number;
|
|
351
|
+
}
|
|
352
|
+
export interface UpdateOptions {
|
|
353
|
+
cleanupOldBundles?: boolean;
|
|
354
|
+
keepBundleCount?: number;
|
|
355
|
+
}
|
|
356
|
+
export interface LatestVersion {
|
|
357
|
+
available: boolean;
|
|
358
|
+
version?: string;
|
|
359
|
+
url?: string;
|
|
360
|
+
mandatory?: boolean;
|
|
361
|
+
notes?: string;
|
|
362
|
+
size?: number;
|
|
363
|
+
checksum?: string;
|
|
364
|
+
signature?: string;
|
|
365
|
+
signatureAlgorithm?: 'RSA-SHA256';
|
|
366
|
+
delta?: DeltaUpdateInfo;
|
|
367
|
+
/**
|
|
368
|
+
* The hosted service has a newer release for this app, but delivery is paused because the app's
|
|
369
|
+
* developer account is over its plan limits for longer than the grace period. No bundle is offered
|
|
370
|
+
* (`available` stays `false`); show `heldMessage` to your users if you want them to know an update is
|
|
371
|
+
* waiting. Added in 4.2.0; absent on servers that do not send it.
|
|
372
|
+
*/
|
|
373
|
+
held?: boolean;
|
|
374
|
+
/** Human-readable reason sent with `held`, e.g. that delivery resumes once the developer renews. */
|
|
375
|
+
heldMessage?: string;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Result from checkForUpdate convenience method
|
|
379
|
+
*/
|
|
380
|
+
export interface CheckForUpdateResult {
|
|
381
|
+
available: boolean;
|
|
382
|
+
latestVersion?: string;
|
|
383
|
+
currentVersion: string;
|
|
384
|
+
url?: string;
|
|
385
|
+
mandatory?: boolean;
|
|
386
|
+
notes?: string;
|
|
387
|
+
size?: number;
|
|
388
|
+
checksum?: string;
|
|
389
|
+
signature?: string;
|
|
390
|
+
signatureAlgorithm?: 'RSA-SHA256';
|
|
391
|
+
delta?: DeltaUpdateInfo;
|
|
392
|
+
/**
|
|
393
|
+
* The hosted service has a newer release for this app, but delivery is paused because the app's
|
|
394
|
+
* developer account is over its plan limits for longer than the grace period. No bundle is offered
|
|
395
|
+
* (`available` stays `false`); show `heldMessage` to your users if you want them to know an update is
|
|
396
|
+
* waiting. Added in 4.2.0; absent on servers that do not send it.
|
|
397
|
+
*/
|
|
398
|
+
held?: boolean;
|
|
399
|
+
/** Human-readable reason sent with `held`, e.g. that delivery resumes once the developer renews. */
|
|
400
|
+
heldMessage?: string;
|
|
401
|
+
}
|
|
402
|
+
export interface DeltaUpdateInfo {
|
|
403
|
+
format: 'NUDELTA/1';
|
|
404
|
+
fromVersion: string;
|
|
405
|
+
patchUrl: string;
|
|
406
|
+
patchSize: number;
|
|
407
|
+
patchChecksum: string;
|
|
408
|
+
targetChecksum: string;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Options for downloadUpdate convenience method
|
|
412
|
+
*/
|
|
413
|
+
export interface DownloadUpdateOptions {
|
|
414
|
+
version?: string;
|
|
415
|
+
url?: string;
|
|
416
|
+
checksum?: string;
|
|
417
|
+
signature?: string;
|
|
418
|
+
signatureAlgorithm?: 'RSA-SHA256';
|
|
419
|
+
delta?: DeltaUpdateInfo;
|
|
420
|
+
onProgress?: (event: DownloadProgressEvent) => void;
|
|
421
|
+
}
|
|
422
|
+
export interface ValidateOptions {
|
|
423
|
+
bundlePath: string;
|
|
424
|
+
checksum: string;
|
|
425
|
+
signature?: string;
|
|
426
|
+
maxSize?: number;
|
|
427
|
+
}
|
|
428
|
+
export interface ValidationResult {
|
|
429
|
+
isValid: boolean;
|
|
430
|
+
error?: string;
|
|
431
|
+
details?: {
|
|
432
|
+
checksumValid?: boolean;
|
|
433
|
+
signatureValid?: boolean;
|
|
434
|
+
sizeValid?: boolean;
|
|
435
|
+
versionValid?: boolean;
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* App Update Types
|
|
440
|
+
*/
|
|
441
|
+
export interface AppUpdateInfo {
|
|
442
|
+
updateAvailable: boolean;
|
|
443
|
+
currentVersion: string;
|
|
444
|
+
availableVersion?: string;
|
|
445
|
+
updatePriority?: number;
|
|
446
|
+
immediateUpdateAllowed?: boolean;
|
|
447
|
+
flexibleUpdateAllowed?: boolean;
|
|
448
|
+
clientVersionStalenessDays?: number;
|
|
449
|
+
installStatus?: InstallStatus;
|
|
450
|
+
bytesDownloaded?: number;
|
|
451
|
+
totalBytesToDownload?: number;
|
|
452
|
+
}
|
|
453
|
+
export interface OpenAppStoreOptions {
|
|
454
|
+
appId?: string;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* App Review Types
|
|
458
|
+
*/
|
|
459
|
+
export interface ReviewResult {
|
|
460
|
+
displayed: boolean;
|
|
461
|
+
error?: string;
|
|
462
|
+
reason?: string;
|
|
463
|
+
}
|
|
464
|
+
export interface CanRequestReviewResult {
|
|
465
|
+
canRequest: boolean;
|
|
466
|
+
reason?: string;
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Background Update Types
|
|
470
|
+
*/
|
|
471
|
+
export interface BackgroundUpdateStatus {
|
|
472
|
+
enabled: boolean;
|
|
473
|
+
lastCheckTime?: number;
|
|
474
|
+
nextCheckTime?: number;
|
|
475
|
+
lastUpdateTime?: number;
|
|
476
|
+
currentTaskId?: string;
|
|
477
|
+
isRunning: boolean;
|
|
478
|
+
checkCount: number;
|
|
479
|
+
failureCount: number;
|
|
480
|
+
lastError?: UpdateError;
|
|
481
|
+
}
|
|
482
|
+
export interface BackgroundCheckResult {
|
|
483
|
+
success: boolean;
|
|
484
|
+
updatesFound: boolean;
|
|
485
|
+
appUpdate?: AppUpdateInfo;
|
|
486
|
+
liveUpdate?: LatestVersion;
|
|
487
|
+
notificationSent: boolean;
|
|
488
|
+
error?: UpdateError;
|
|
489
|
+
}
|
|
490
|
+
export interface NotificationPreferences {
|
|
491
|
+
title?: string;
|
|
492
|
+
description?: string;
|
|
493
|
+
iconName?: string;
|
|
494
|
+
soundEnabled?: boolean;
|
|
495
|
+
vibrationEnabled?: boolean;
|
|
496
|
+
showActions?: boolean;
|
|
497
|
+
actionLabels?: {
|
|
498
|
+
updateNow?: string;
|
|
499
|
+
updateLater?: string;
|
|
500
|
+
dismiss?: string;
|
|
501
|
+
};
|
|
502
|
+
channelId?: string;
|
|
503
|
+
channelName?: string;
|
|
504
|
+
priority?: NotificationPriority;
|
|
505
|
+
}
|
|
506
|
+
export interface NotificationPermissionStatus {
|
|
507
|
+
granted: boolean;
|
|
508
|
+
canRequest: boolean;
|
|
509
|
+
shouldShowRationale?: boolean;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Security Types
|
|
513
|
+
*/
|
|
514
|
+
export interface SecurityInfo {
|
|
515
|
+
enforceHttps: boolean;
|
|
516
|
+
certificatePinning: CertificatePinning;
|
|
517
|
+
validateInputs: boolean;
|
|
518
|
+
secureStorage: boolean;
|
|
519
|
+
signatureAlgorithm?: 'RSA-SHA256';
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Error Types
|
|
523
|
+
*/
|
|
524
|
+
export interface UpdateError {
|
|
525
|
+
code: UpdateErrorCode;
|
|
526
|
+
message: string;
|
|
527
|
+
details?: unknown;
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Enums
|
|
531
|
+
*/
|
|
532
|
+
export declare enum BackgroundUpdateType {
|
|
533
|
+
APP_UPDATE = "app_update",
|
|
534
|
+
LIVE_UPDATE = "live_update",
|
|
535
|
+
BOTH = "both"
|
|
536
|
+
}
|
|
537
|
+
export declare enum NotificationPriority {
|
|
538
|
+
MIN = "min",
|
|
539
|
+
LOW = "low",
|
|
540
|
+
DEFAULT = "default",
|
|
541
|
+
HIGH = "high",
|
|
542
|
+
MAX = "max"
|
|
543
|
+
}
|
|
544
|
+
export declare enum UpdateStrategy {
|
|
545
|
+
IMMEDIATE = "immediate",
|
|
546
|
+
BACKGROUND = "background",
|
|
547
|
+
MANUAL = "manual"
|
|
548
|
+
}
|
|
549
|
+
export declare enum UpdateMode {
|
|
550
|
+
IMMEDIATE = "immediate",
|
|
551
|
+
ON_NEXT_RESTART = "on_next_restart",
|
|
552
|
+
ON_NEXT_RESUME = "on_next_resume"
|
|
553
|
+
}
|
|
554
|
+
export declare enum InstallMode {
|
|
555
|
+
IMMEDIATE = "immediate",
|
|
556
|
+
ON_NEXT_RESTART = "on_next_restart",
|
|
557
|
+
ON_NEXT_RESUME = "on_next_resume"
|
|
558
|
+
}
|
|
559
|
+
export declare enum ChecksumAlgorithm {
|
|
560
|
+
SHA256 = "SHA-256",
|
|
561
|
+
SHA512 = "SHA-512"
|
|
562
|
+
}
|
|
563
|
+
export declare enum SyncStatus {
|
|
564
|
+
UP_TO_DATE = "UP_TO_DATE",
|
|
565
|
+
UPDATE_AVAILABLE = "UPDATE_AVAILABLE",
|
|
566
|
+
UPDATE_INSTALLED = "UPDATE_INSTALLED",
|
|
567
|
+
ERROR = "ERROR"
|
|
568
|
+
}
|
|
569
|
+
export declare enum BundleStatus {
|
|
570
|
+
PENDING = "PENDING",
|
|
571
|
+
DOWNLOADING = "DOWNLOADING",
|
|
572
|
+
READY = "READY",
|
|
573
|
+
ACTIVE = "ACTIVE",
|
|
574
|
+
FAILED = "FAILED"
|
|
575
|
+
}
|
|
576
|
+
export declare enum InstallStatus {
|
|
577
|
+
UNKNOWN = "UNKNOWN",
|
|
578
|
+
PENDING = "PENDING",
|
|
579
|
+
DOWNLOADING = "DOWNLOADING",
|
|
580
|
+
DOWNLOADED = "DOWNLOADED",
|
|
581
|
+
INSTALLING = "INSTALLING",
|
|
582
|
+
INSTALLED = "INSTALLED",
|
|
583
|
+
FAILED = "FAILED",
|
|
584
|
+
CANCELED = "CANCELED"
|
|
585
|
+
}
|
|
586
|
+
export declare enum UpdateErrorCode {
|
|
587
|
+
NETWORK_ERROR = "NETWORK_ERROR",
|
|
588
|
+
SERVER_ERROR = "SERVER_ERROR",
|
|
589
|
+
TIMEOUT_ERROR = "TIMEOUT_ERROR",
|
|
590
|
+
DOWNLOAD_ERROR = "DOWNLOAD_ERROR",
|
|
591
|
+
STORAGE_ERROR = "STORAGE_ERROR",
|
|
592
|
+
SIZE_LIMIT_EXCEEDED = "SIZE_LIMIT_EXCEEDED",
|
|
593
|
+
VERIFICATION_ERROR = "VERIFICATION_ERROR",
|
|
594
|
+
CHECKSUM_ERROR = "CHECKSUM_ERROR",
|
|
595
|
+
SIGNATURE_ERROR = "SIGNATURE_ERROR",
|
|
596
|
+
INSECURE_URL = "INSECURE_URL",
|
|
597
|
+
INVALID_CERTIFICATE = "INVALID_CERTIFICATE",
|
|
598
|
+
PATH_TRAVERSAL = "PATH_TRAVERSAL",
|
|
599
|
+
INSTALL_ERROR = "INSTALL_ERROR",
|
|
600
|
+
ROLLBACK_ERROR = "ROLLBACK_ERROR",
|
|
601
|
+
VERSION_MISMATCH = "VERSION_MISMATCH",
|
|
602
|
+
PERMISSION_DENIED = "PERMISSION_DENIED",
|
|
603
|
+
UPDATE_NOT_AVAILABLE = "UPDATE_NOT_AVAILABLE",
|
|
604
|
+
UPDATE_IN_PROGRESS = "UPDATE_IN_PROGRESS",
|
|
605
|
+
UPDATE_CANCELLED = "UPDATE_CANCELLED",
|
|
606
|
+
PLATFORM_NOT_SUPPORTED = "PLATFORM_NOT_SUPPORTED",
|
|
607
|
+
REVIEW_NOT_SUPPORTED = "REVIEW_NOT_SUPPORTED",
|
|
608
|
+
QUOTA_EXCEEDED = "QUOTA_EXCEEDED",
|
|
609
|
+
CONDITIONS_NOT_MET = "CONDITIONS_NOT_MET",
|
|
610
|
+
INVALID_CONFIG = "INVALID_CONFIG",
|
|
611
|
+
NOT_CONFIGURED = "NOT_CONFIGURED",
|
|
612
|
+
UNKNOWN_ERROR = "UNKNOWN_ERROR"
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Event Types
|
|
616
|
+
*/
|
|
617
|
+
export interface DownloadProgressEvent {
|
|
618
|
+
percent: number;
|
|
619
|
+
bytesDownloaded: number;
|
|
620
|
+
totalBytes: number;
|
|
621
|
+
bundleId: string;
|
|
622
|
+
}
|
|
623
|
+
export interface UpdateStateChangedEvent {
|
|
624
|
+
status: BundleStatus;
|
|
625
|
+
bundleId: string;
|
|
626
|
+
version: string;
|
|
627
|
+
}
|
|
628
|
+
export interface BackgroundUpdateProgressEvent {
|
|
629
|
+
type: BackgroundUpdateType;
|
|
630
|
+
status: 'checking' | 'downloading' | 'installing' | 'completed' | 'failed';
|
|
631
|
+
percent?: number;
|
|
632
|
+
error?: UpdateError;
|
|
633
|
+
}
|
|
634
|
+
export interface BackgroundUpdateNotificationEvent {
|
|
635
|
+
type: BackgroundUpdateType;
|
|
636
|
+
updateAvailable: boolean;
|
|
637
|
+
version?: string;
|
|
638
|
+
action?: 'shown' | 'tapped' | 'dismissed';
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* App Update Events
|
|
642
|
+
*/
|
|
643
|
+
export interface AppUpdateStateChangedEvent {
|
|
644
|
+
status: InstallStatus;
|
|
645
|
+
installErrorCode?: number;
|
|
646
|
+
}
|
|
647
|
+
export interface AppUpdateProgressEvent {
|
|
648
|
+
percent: number;
|
|
649
|
+
bytesDownloaded: number;
|
|
650
|
+
totalBytes: number;
|
|
651
|
+
}
|
|
652
|
+
export interface AppUpdateAvailableEvent {
|
|
653
|
+
currentVersion: string;
|
|
654
|
+
availableVersion: string;
|
|
655
|
+
updatePriority: number;
|
|
656
|
+
updateSize?: number;
|
|
657
|
+
releaseNotes?: string[];
|
|
658
|
+
storeUrl?: string;
|
|
659
|
+
}
|
|
660
|
+
export interface AppUpdateReadyEvent {
|
|
661
|
+
message: string;
|
|
662
|
+
}
|
|
663
|
+
export interface AppUpdateFailedEvent {
|
|
664
|
+
error: string;
|
|
665
|
+
code: string;
|
|
666
|
+
}
|
|
667
|
+
export interface AppUpdateNotificationClickedEvent {
|
|
668
|
+
}
|
|
669
|
+
export interface AppUpdateInstallClickedEvent {
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* Plugin Events
|
|
673
|
+
*/
|
|
674
|
+
export interface PluginListenerHandle {
|
|
675
|
+
remove: () => Promise<void>;
|
|
676
|
+
}
|
|
677
|
+
export interface NativeUpdateListeners {
|
|
678
|
+
/**
|
|
679
|
+
* Listen for download progress
|
|
680
|
+
*/
|
|
681
|
+
addListener(eventName: 'downloadProgress', listenerFunc: (event: DownloadProgressEvent) => void): Promise<PluginListenerHandle>;
|
|
682
|
+
/**
|
|
683
|
+
* Listen for update state changes
|
|
684
|
+
*/
|
|
685
|
+
addListener(eventName: 'updateStateChanged', listenerFunc: (event: UpdateStateChangedEvent) => void): Promise<PluginListenerHandle>;
|
|
686
|
+
/**
|
|
687
|
+
* Listen for background update progress
|
|
688
|
+
*/
|
|
689
|
+
addListener(eventName: 'backgroundUpdateProgress', listenerFunc: (event: BackgroundUpdateProgressEvent) => void): Promise<PluginListenerHandle>;
|
|
690
|
+
/**
|
|
691
|
+
* Listen for background update notifications
|
|
692
|
+
*/
|
|
693
|
+
addListener(eventName: 'backgroundUpdateNotification', listenerFunc: (event: BackgroundUpdateNotificationEvent) => void): Promise<PluginListenerHandle>;
|
|
694
|
+
/**
|
|
695
|
+
* Listen for app update state changes
|
|
696
|
+
*/
|
|
697
|
+
addListener(eventName: 'appUpdateStateChanged', listenerFunc: (event: AppUpdateStateChangedEvent) => void): Promise<PluginListenerHandle>;
|
|
698
|
+
/**
|
|
699
|
+
* Listen for app update progress
|
|
700
|
+
*/
|
|
701
|
+
addListener(eventName: 'appUpdateProgress', listenerFunc: (event: AppUpdateProgressEvent) => void): Promise<PluginListenerHandle>;
|
|
702
|
+
/**
|
|
703
|
+
* Listen for app update available
|
|
704
|
+
*/
|
|
705
|
+
addListener(eventName: 'appUpdateAvailable', listenerFunc: (event: AppUpdateAvailableEvent) => void): Promise<PluginListenerHandle>;
|
|
706
|
+
/**
|
|
707
|
+
* Listen for app update ready
|
|
708
|
+
*/
|
|
709
|
+
addListener(eventName: 'appUpdateReady', listenerFunc: (event: AppUpdateReadyEvent) => void): Promise<PluginListenerHandle>;
|
|
710
|
+
/**
|
|
711
|
+
* Listen for app update failed
|
|
712
|
+
*/
|
|
713
|
+
addListener(eventName: 'appUpdateFailed', listenerFunc: (event: AppUpdateFailedEvent) => void): Promise<PluginListenerHandle>;
|
|
714
|
+
/**
|
|
715
|
+
* Listen for app update notification clicked
|
|
716
|
+
*/
|
|
717
|
+
addListener(eventName: 'appUpdateNotificationClicked', listenerFunc: (event: AppUpdateNotificationClickedEvent) => void): Promise<PluginListenerHandle>;
|
|
718
|
+
/**
|
|
719
|
+
* Listen for app update install clicked
|
|
720
|
+
*/
|
|
721
|
+
addListener(eventName: 'appUpdateInstallClicked', listenerFunc: (event: AppUpdateInstallClickedEvent) => void): Promise<PluginListenerHandle>;
|
|
722
|
+
/**
|
|
723
|
+
* Remove all listeners
|
|
724
|
+
*/
|
|
725
|
+
removeAllListeners(): Promise<void>;
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* Plugin initialization configuration options
|
|
729
|
+
*/
|
|
730
|
+
export interface PluginInitConfig {
|
|
731
|
+
/**
|
|
732
|
+
* Capacitor Filesystem instance (required)
|
|
733
|
+
*/
|
|
734
|
+
filesystem?: typeof import('@capacitor/filesystem').Filesystem;
|
|
735
|
+
/**
|
|
736
|
+
* Capacitor Preferences instance (required)
|
|
737
|
+
*/
|
|
738
|
+
preferences?: typeof import('@capacitor/preferences').Preferences;
|
|
739
|
+
/**
|
|
740
|
+
* App identifier for update checks
|
|
741
|
+
*/
|
|
742
|
+
appId?: string;
|
|
743
|
+
/**
|
|
744
|
+
* Base URL for update server
|
|
745
|
+
*/
|
|
746
|
+
baseUrl?: string;
|
|
747
|
+
/**
|
|
748
|
+
* List of allowed hosts for security
|
|
749
|
+
*/
|
|
750
|
+
allowedHosts?: string[];
|
|
751
|
+
/** Explicit development-only escape hatch; native release builds ignore it. */
|
|
752
|
+
allowUnsignedDevelopmentUpdates?: boolean;
|
|
753
|
+
/**
|
|
754
|
+
* Maximum bundle size in bytes (default: 100MB)
|
|
755
|
+
*/
|
|
756
|
+
maxBundleSize?: number;
|
|
757
|
+
/**
|
|
758
|
+
* Maximum total uncompressed size of an installed ZIP bundle in bytes.
|
|
759
|
+
* Native platforms default to 500 MiB.
|
|
760
|
+
*/
|
|
761
|
+
maxUncompressedBundleSize?: number;
|
|
762
|
+
/**
|
|
763
|
+
* Download timeout in milliseconds (default: 30000)
|
|
764
|
+
*/
|
|
765
|
+
downloadTimeout?: number;
|
|
766
|
+
/**
|
|
767
|
+
* Number of retry attempts for failed downloads (default: 3)
|
|
768
|
+
*/
|
|
769
|
+
retryAttempts?: number;
|
|
770
|
+
/**
|
|
771
|
+
* Delay between retry attempts in milliseconds (default: 1000)
|
|
772
|
+
*/
|
|
773
|
+
retryDelay?: number;
|
|
774
|
+
/**
|
|
775
|
+
* Enable bundle signature validation (default: true)
|
|
776
|
+
*/
|
|
777
|
+
enableSignatureValidation?: boolean;
|
|
778
|
+
/**
|
|
779
|
+
* Public key for signature validation
|
|
780
|
+
*/
|
|
781
|
+
publicKey?: string;
|
|
782
|
+
/**
|
|
783
|
+
* Cache expiration time in milliseconds (default: 24 hours)
|
|
784
|
+
*/
|
|
785
|
+
cacheExpiration?: number;
|
|
786
|
+
/**
|
|
787
|
+
* Enable debug logging (default: false)
|
|
788
|
+
*/
|
|
789
|
+
enableLogging?: boolean;
|
|
790
|
+
/**
|
|
791
|
+
* Base URL of the Native Update backend for OTA update checks.
|
|
792
|
+
* The plugin appends the versioned path: `GET {serverUrl}/v1/updates/check`
|
|
793
|
+
* with `X-API-Key` / `X-Device-ID` / `X-Current-Version` / `X-Platform`
|
|
794
|
+
* headers. See `docs/server-requirements.md` for the full wire contract
|
|
795
|
+
* (and `core/update-check.ts`, the single implementation of it).
|
|
796
|
+
*/
|
|
797
|
+
serverUrl?: string;
|
|
798
|
+
/**
|
|
799
|
+
* API key bound to this app in the Native Update dashboard. Sent as
|
|
800
|
+
* the `X-API-Key` header on every request to the backend. As of v2
|
|
801
|
+
* the plugin does not persist this across sessions — the host app
|
|
802
|
+
* must pass it on every `initialize()` call.
|
|
803
|
+
*/
|
|
804
|
+
apiKey?: string;
|
|
805
|
+
/**
|
|
806
|
+
* Update channel
|
|
807
|
+
*/
|
|
808
|
+
channel?: string;
|
|
809
|
+
/**
|
|
810
|
+
* Enable automatic update checking
|
|
811
|
+
*/
|
|
812
|
+
autoCheck?: boolean;
|
|
813
|
+
/**
|
|
814
|
+
* Enable automatic updates
|
|
815
|
+
*/
|
|
816
|
+
autoUpdate?: boolean;
|
|
817
|
+
/** Use verified NUDELTA/1 patches when available (default: true). */
|
|
818
|
+
enableDeltaUpdates?: boolean;
|
|
819
|
+
/**
|
|
820
|
+
* Update strategy
|
|
821
|
+
*/
|
|
822
|
+
updateStrategy?: UpdateStrategy;
|
|
823
|
+
/**
|
|
824
|
+
* Require bundle signatures
|
|
825
|
+
*/
|
|
826
|
+
requireSignature?: boolean;
|
|
827
|
+
/**
|
|
828
|
+
* Checksum algorithm to use
|
|
829
|
+
*/
|
|
830
|
+
checksumAlgorithm?: ChecksumAlgorithm;
|
|
831
|
+
/**
|
|
832
|
+
* Update check interval in milliseconds
|
|
833
|
+
*/
|
|
834
|
+
checkInterval?: number;
|
|
835
|
+
/**
|
|
836
|
+
* Security configuration
|
|
837
|
+
*/
|
|
838
|
+
security?: SecurityConfig;
|
|
839
|
+
/**
|
|
840
|
+
* iOS App Store ID for native app update / review flows
|
|
841
|
+
*/
|
|
842
|
+
appStoreId?: string;
|
|
843
|
+
/**
|
|
844
|
+
* Android package name for native app update / review flows
|
|
845
|
+
*/
|
|
846
|
+
packageName?: string;
|
|
847
|
+
/**
|
|
848
|
+
* Review URL fallback for web platforms
|
|
849
|
+
*/
|
|
850
|
+
webReviewUrl?: string;
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Main plugin interface with initialization
|
|
854
|
+
*/
|
|
855
|
+
export interface NativeUpdatePlugin extends NativeUpdateCombinedPlugin, NativeUpdateListeners {
|
|
856
|
+
/**
|
|
857
|
+
* Initialize the plugin with configuration
|
|
858
|
+
*/
|
|
859
|
+
initialize(config: PluginInitConfig): Promise<void>;
|
|
860
|
+
/**
|
|
861
|
+
* Check if plugin is initialized
|
|
862
|
+
*/
|
|
863
|
+
isInitialized(): Promise<boolean>;
|
|
864
|
+
/**
|
|
865
|
+
* Reset plugin state
|
|
866
|
+
*/
|
|
867
|
+
reset(): Promise<void>;
|
|
868
|
+
/**
|
|
869
|
+
* Clean up resources
|
|
870
|
+
*/
|
|
871
|
+
cleanup(): Promise<void>;
|
|
872
|
+
}
|