native-update-capacitor 0.0.0-stage → 4.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/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/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 +262 -0
- package/cli/commands/remote.js +622 -0
- package/cli/commands/server-start.js +96 -0
- package/cli/index.js +605 -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 +993 -0
- package/docs/KNOWN_LIMITATIONS.md +235 -0
- package/docs/MIGRATION.md +391 -0
- package/docs/protocol/CLIENT-PROTOCOL.md +178 -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 +135 -4
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import type { NativeUpdateCombinedPlugin, SecurityInfo, SyncOptions, SyncResult, DownloadOptions, BundleInfo, DeleteOptions, LatestVersion, ValidateOptions, ValidationResult, AppUpdateInfo, OpenAppStoreOptions, ReviewResult, CanRequestReviewResult, BackgroundUpdateConfig, BackgroundUpdateStatus, BackgroundCheckResult, NotificationPreferences, NotificationPermissionStatus, CheckForUpdateResult, DownloadUpdateOptions, AppIdentity } from './definitions';
|
|
3
|
+
import type { PluginInitConfig } from './definitions';
|
|
4
|
+
export declare class NativeUpdateWeb extends WebPlugin implements NativeUpdateCombinedPlugin {
|
|
5
|
+
private config;
|
|
6
|
+
private currentBundle;
|
|
7
|
+
private bundles;
|
|
8
|
+
private lastReviewRequest;
|
|
9
|
+
private launchCount;
|
|
10
|
+
private backgroundUpdateStatus;
|
|
11
|
+
private backgroundCheckInterval;
|
|
12
|
+
private configManager;
|
|
13
|
+
private isConfigured;
|
|
14
|
+
private downloadedBundleBytes;
|
|
15
|
+
constructor();
|
|
16
|
+
/**
|
|
17
|
+
* Configuration and Core Methods
|
|
18
|
+
*/
|
|
19
|
+
configure(options: {
|
|
20
|
+
config: PluginInitConfig;
|
|
21
|
+
}): Promise<void>;
|
|
22
|
+
getSecurityInfo(): Promise<SecurityInfo>;
|
|
23
|
+
/**
|
|
24
|
+
* Live Update Methods
|
|
25
|
+
*/
|
|
26
|
+
sync(_options?: SyncOptions): Promise<SyncResult>;
|
|
27
|
+
download(options: DownloadOptions): Promise<BundleInfo>;
|
|
28
|
+
set(bundle: BundleInfo): Promise<void>;
|
|
29
|
+
reload(): Promise<void>;
|
|
30
|
+
reset(): Promise<void>;
|
|
31
|
+
current(): Promise<BundleInfo>;
|
|
32
|
+
list(): Promise<BundleInfo[]>;
|
|
33
|
+
delete(options: DeleteOptions): Promise<void>;
|
|
34
|
+
notifyAppReady(): Promise<void>;
|
|
35
|
+
getLatest(): Promise<LatestVersion>;
|
|
36
|
+
getAppIdentity(): Promise<AppIdentity>;
|
|
37
|
+
setChannel(channel: string): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated since v2. See NativeUpdatePluginWeb.setUpdateUrl in plugin.ts.
|
|
40
|
+
* Update URL is locked after initialize(); this method is a no-op.
|
|
41
|
+
*/
|
|
42
|
+
setUpdateUrl(url: string): Promise<void>;
|
|
43
|
+
validateUpdate(options: ValidateOptions): Promise<ValidationResult>;
|
|
44
|
+
/**
|
|
45
|
+
* Convenience Methods
|
|
46
|
+
*/
|
|
47
|
+
checkForUpdate(): Promise<CheckForUpdateResult>;
|
|
48
|
+
downloadUpdate(options?: DownloadUpdateOptions): Promise<BundleInfo>;
|
|
49
|
+
applyUpdate(bundleId?: string): Promise<void>;
|
|
50
|
+
cancelDownload(bundleId: string): Promise<void>;
|
|
51
|
+
cancelAllDownloads(): Promise<void>;
|
|
52
|
+
isDownloading(bundleId: string): Promise<boolean>;
|
|
53
|
+
getActiveDownloadCount(): Promise<number>;
|
|
54
|
+
/**
|
|
55
|
+
* App Update Methods
|
|
56
|
+
*/
|
|
57
|
+
getAppUpdateInfo(): Promise<AppUpdateInfo>;
|
|
58
|
+
performImmediateUpdate(): Promise<void>;
|
|
59
|
+
startFlexibleUpdate(): Promise<void>;
|
|
60
|
+
completeFlexibleUpdate(): Promise<void>;
|
|
61
|
+
openAppStore(_options?: OpenAppStoreOptions): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* App Review Methods
|
|
64
|
+
*/
|
|
65
|
+
requestReview(): Promise<ReviewResult>;
|
|
66
|
+
canRequestReview(): Promise<CanRequestReviewResult>;
|
|
67
|
+
/**
|
|
68
|
+
* Background Update Methods
|
|
69
|
+
*/
|
|
70
|
+
enableBackgroundUpdates(config: BackgroundUpdateConfig): Promise<void>;
|
|
71
|
+
disableBackgroundUpdates(): Promise<void>;
|
|
72
|
+
getBackgroundUpdateStatus(): Promise<BackgroundUpdateStatus>;
|
|
73
|
+
scheduleBackgroundCheck(interval: number): Promise<void>;
|
|
74
|
+
triggerBackgroundCheck(): Promise<BackgroundCheckResult>;
|
|
75
|
+
setNotificationPreferences(preferences: NotificationPreferences): Promise<void>;
|
|
76
|
+
getNotificationPermissions(): Promise<NotificationPermissionStatus>;
|
|
77
|
+
requestNotificationPermissions(): Promise<boolean>;
|
|
78
|
+
private sendWebNotification;
|
|
79
|
+
/**
|
|
80
|
+
* Helper Methods
|
|
81
|
+
*/
|
|
82
|
+
private createError;
|
|
83
|
+
private createDefaultBundle;
|
|
84
|
+
/**
|
|
85
|
+
* Validate checksum using SHA-256
|
|
86
|
+
* @param data - The data to validate (as string path or ArrayBuffer)
|
|
87
|
+
* @param expectedChecksum - Expected SHA-256 hash (hex string)
|
|
88
|
+
*/
|
|
89
|
+
private validateChecksum;
|
|
90
|
+
/**
|
|
91
|
+
* Validate the backend's RSA-SHA256 (PKCS#1 v1.5) signature.
|
|
92
|
+
*
|
|
93
|
+
* Fails closed: if the host app configured a public key or
|
|
94
|
+
* requireSignature, a missing signature throws. Silent-pass was a P0 gap.
|
|
95
|
+
*
|
|
96
|
+
* @param data - The data that was signed (as string path or ArrayBuffer)
|
|
97
|
+
* @param signature - The signature to verify (base64 encoded)
|
|
98
|
+
*/
|
|
99
|
+
private validateSignature;
|
|
100
|
+
/**
|
|
101
|
+
* Import RSA public key from PEM format
|
|
102
|
+
*/
|
|
103
|
+
private importPublicKey;
|
|
104
|
+
/**
|
|
105
|
+
* Safe localStorage accessor. Returns `null` in environments where
|
|
106
|
+
* `localStorage` isn't available — SSR, Node-only test runners that
|
|
107
|
+
* stub `window` without storage, or sandboxed iframes. All callers
|
|
108
|
+
* MUST tolerate a `null` return and skip persistence.
|
|
109
|
+
*/
|
|
110
|
+
private getLocalStorage;
|
|
111
|
+
private loadStoredData;
|
|
112
|
+
private saveStoredData;
|
|
113
|
+
/**
|
|
114
|
+
* Strip secrets before persisting config to localStorage. A browser's
|
|
115
|
+
* localStorage is accessible to any script running in the page (XSS,
|
|
116
|
+
* compromised deps) — an `apiKey` or `publicKey` sitting there is a
|
|
117
|
+
* ready-to-use credential. Host apps must pass these on every
|
|
118
|
+
* `initialize()` call; they are never cached cross-session.
|
|
119
|
+
*/
|
|
120
|
+
private static readonly SENSITIVE_CONFIG_PATHS;
|
|
121
|
+
private sanitizeConfigForPersistence;
|
|
122
|
+
private saveConfiguration;
|
|
123
|
+
private getInstallDate;
|
|
124
|
+
private incrementLaunchCount;
|
|
125
|
+
/**
|
|
126
|
+
* Get configured review URL from plugin config
|
|
127
|
+
* Returns Play Store, App Store, or custom web review URL based on platform/config
|
|
128
|
+
*/
|
|
129
|
+
private getConfiguredReviewUrl;
|
|
130
|
+
}
|