native-update 1.4.9 → 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.
Files changed (71) hide show
  1. package/Readme.md +13 -1
  2. package/android/src/main/java/com/aoneahsan/nativeupdate/BackgroundUpdatePlugin.kt +15 -0
  3. package/android/src/main/java/com/aoneahsan/nativeupdate/BackgroundUpdateWorker.kt +23 -7
  4. package/android/src/main/java/com/aoneahsan/nativeupdate/LiveUpdatePlugin.kt +152 -4
  5. package/android/src/main/java/com/aoneahsan/nativeupdate/NativeUpdatePlugin.kt +14 -1
  6. package/android/src/main/java/com/aoneahsan/nativeupdate/NotificationActionReceiver.kt +10 -1
  7. package/android/src/main/java/com/aoneahsan/nativeupdate/SecurityManager.kt +18 -18
  8. package/cli/AGENTS.md +29 -0
  9. package/cli/CLAUDE.md +51 -0
  10. package/dist/esm/__tests__/security-enforcement.test.d.ts +1 -0
  11. package/dist/esm/__tests__/security-enforcement.test.js +95 -0
  12. package/dist/esm/__tests__/security-enforcement.test.js.map +1 -0
  13. package/dist/esm/core/config.d.ts +6 -15
  14. package/dist/esm/core/config.js +1 -4
  15. package/dist/esm/core/config.js.map +1 -1
  16. package/dist/esm/core/security.d.ts +11 -3
  17. package/dist/esm/core/security.js +19 -6
  18. package/dist/esm/core/security.js.map +1 -1
  19. package/dist/esm/definitions.d.ts +13 -29
  20. package/dist/esm/definitions.js.map +1 -1
  21. package/dist/esm/index.d.ts +0 -2
  22. package/dist/esm/index.js +0 -2
  23. package/dist/esm/index.js.map +1 -1
  24. package/dist/esm/live-update/download-manager.d.ts +36 -5
  25. package/dist/esm/live-update/download-manager.js +61 -22
  26. package/dist/esm/live-update/download-manager.js.map +1 -1
  27. package/dist/esm/live-update/update-manager.d.ts +12 -1
  28. package/dist/esm/live-update/update-manager.js +38 -10
  29. package/dist/esm/live-update/update-manager.js.map +1 -1
  30. package/dist/esm/live-update/version-manager.d.ts +9 -0
  31. package/dist/esm/live-update/version-manager.js +40 -0
  32. package/dist/esm/live-update/version-manager.js.map +1 -1
  33. package/dist/esm/plugin.js +13 -46
  34. package/dist/esm/plugin.js.map +1 -1
  35. package/dist/esm/web.d.ts +18 -1
  36. package/dist/esm/web.js +69 -24
  37. package/dist/esm/web.js.map +1 -1
  38. package/dist/plugin.cjs.js +1 -1
  39. package/dist/plugin.cjs.js.map +1 -1
  40. package/dist/plugin.esm.js +1 -1
  41. package/dist/plugin.esm.js.map +1 -1
  42. package/dist/plugin.js +2 -2
  43. package/dist/plugin.js.map +1 -1
  44. package/docs/AGENTS.md +38 -0
  45. package/docs/CHANGELOG.md +151 -0
  46. package/docs/CLAUDE.md +101 -0
  47. package/docs/MIGRATION.md +87 -0
  48. package/docs/README.md +13 -2
  49. package/docs/deployment/HOSTINGER_DEPLOY.md +329 -0
  50. package/docs/features/laravel-nova-backend/ASSESSMENT-SUMMARY.md +96 -0
  51. package/docs/features/laravel-nova-backend/IMPLEMENTATION-PLAN.md +504 -0
  52. package/docs/features/laravel-nova-backend/credentials.ignore.md +34 -0
  53. package/docs/features/laravel-nova-backend/progress-tracker.json +184 -0
  54. package/docs/project-knowledge-base/01-system-overview.md +218 -0
  55. package/docs/project-knowledge-base/02-routes-pages-forms-users.md +346 -0
  56. package/docs/project-knowledge-base/03-tech-stack-modules-services.md +347 -0
  57. package/docs/project-knowledge-base/04-data-models-integrations.md +307 -0
  58. package/docs/project-knowledge-base/05-docs-corpus-inventory.md +193 -0
  59. package/docs/project-knowledge-base/06-operations-testing-legal-content.md +170 -0
  60. package/docs/project-knowledge-base/README.md +90 -0
  61. package/docs/project-profiles/native-update-capacitor-update-platform-project-profile-last-updated-2026-03-16.md +454 -0
  62. package/docs/project-profiles/native-update-capacitor-update-platform-project-profile-last-updated-2026-03-24.md +66 -0
  63. package/docs/project-profiles/native-update-capacitor-update-platform-project-profile-last-updated-2026-03-25.md +67 -0
  64. package/docs/seo-aeo-rules.json +3043 -0
  65. package/docs/tracking/seo-checklist-tracker.json +333 -0
  66. package/ios/Plugin/BackgroundUpdate/BackgroundUpdatePlugin.swift +50 -6
  67. package/ios/Plugin/LiveUpdate/LiveUpdatePlugin.swift +238 -8
  68. package/ios/Plugin/NativeUpdatePlugin.swift +8 -0
  69. package/ios/Plugin/Security/SecurityManager.swift +13 -14
  70. package/package.json +30 -31
  71. package/docs/play-console-rejection-rules.json +0 -428
@@ -0,0 +1,184 @@
1
+ {
2
+ "feature": "Laravel + Nova Backend for Native Update",
3
+ "created": "2026-03-28",
4
+ "lastUpdated": "2026-03-28",
5
+ "status": "in_progress",
6
+ "estimatedWeeks": 5,
7
+ "currentPhase": 3,
8
+ "phases": [
9
+ {
10
+ "id": 1,
11
+ "name": "Laravel Project Setup",
12
+ "status": "completed",
13
+ "completedAt": "2026-03-28",
14
+ "estimatedDays": 5,
15
+ "tasks": [
16
+ { "task": "Create Laravel 11 project", "status": "completed" },
17
+ { "task": "Install and configure Nova 5", "status": "completed" },
18
+ { "task": "Configure MySQL database", "status": "completed", "note": "Using SQLite for dev, MySQL for production" },
19
+ { "task": "Set up Firebase token validation middleware", "status": "completed" },
20
+ { "task": "Configure S3/Cloudflare R2 storage", "status": "partial", "note": "Config added, needs keys" },
21
+ { "task": "Set up development environment (.env)", "status": "completed" }
22
+ ]
23
+ },
24
+ {
25
+ "id": 2,
26
+ "name": "Database Schema & Models",
27
+ "status": "completed",
28
+ "completedAt": "2026-03-28",
29
+ "estimatedDays": 4,
30
+ "tasks": [
31
+ { "task": "Create users migration and model", "status": "completed" },
32
+ { "task": "Create apps migration and model", "status": "completed" },
33
+ { "task": "Create builds migration and model", "status": "completed" },
34
+ { "task": "Create api_keys migration and model", "status": "completed" },
35
+ { "task": "Create subscriptions migration and model", "status": "completed" },
36
+ { "task": "Create device_activities migration and model", "status": "completed" },
37
+ { "task": "Create signing_keys migration and model", "status": "completed" },
38
+ { "task": "Set up model relationships", "status": "completed" }
39
+ ]
40
+ },
41
+ {
42
+ "id": 3,
43
+ "name": "API Endpoints",
44
+ "status": "in_progress",
45
+ "estimatedDays": 5,
46
+ "tasks": [
47
+ { "task": "Create ValidateApiKey middleware", "status": "completed" },
48
+ { "task": "Create ValidateFirebaseToken middleware", "status": "completed" },
49
+ { "task": "Create UpdateController (check for updates)", "status": "completed" },
50
+ { "task": "Create BundleController (upload, download)", "status": "completed" },
51
+ { "task": "Create AnalyticsController (MAU ping)", "status": "completed" },
52
+ { "task": "Create AppController (dashboard CRUD)", "status": "pending" },
53
+ { "task": "Create ApiKeyController (key management)", "status": "pending" },
54
+ { "task": "Create SubscriptionController (billing)", "status": "pending" },
55
+ { "task": "Set up API routes", "status": "completed" },
56
+ { "task": "Add rate limiting", "status": "pending" }
57
+ ]
58
+ },
59
+ {
60
+ "id": 4,
61
+ "name": "Stripe Integration",
62
+ "status": "partial",
63
+ "estimatedDays": 4,
64
+ "tasks": [
65
+ { "task": "Install Laravel Cashier", "status": "completed" },
66
+ { "task": "Configure Stripe API keys", "status": "pending", "note": "Config added, needs keys" },
67
+ { "task": "Create pricing plans in Stripe", "status": "pending" },
68
+ { "task": "Implement checkout session creation", "status": "pending" },
69
+ { "task": "Implement customer portal redirect", "status": "pending" },
70
+ { "task": "Create webhook handler", "status": "pending" },
71
+ { "task": "Handle subscription lifecycle events", "status": "pending" },
72
+ { "task": "Implement MAU overage billing", "status": "pending" }
73
+ ]
74
+ },
75
+ {
76
+ "id": 5,
77
+ "name": "Bundle Signing & Security",
78
+ "status": "completed",
79
+ "completedAt": "2026-03-28",
80
+ "estimatedDays": 4,
81
+ "tasks": [
82
+ { "task": "Create BundleSigningService", "status": "completed", "note": "In SigningKey model" },
83
+ { "task": "Implement RSA key pair generation", "status": "completed" },
84
+ { "task": "Implement RSA-PSS signing", "status": "completed" },
85
+ { "task": "Create SignedUrlService", "status": "completed", "note": "Using Laravel's built-in signed URLs" },
86
+ { "task": "Implement time-limited download URLs", "status": "completed" },
87
+ { "task": "Add device binding to URLs", "status": "completed" },
88
+ { "task": "Implement one-time download tokens", "status": "pending" },
89
+ { "task": "Add request signature validation (replay protection)", "status": "pending" }
90
+ ]
91
+ },
92
+ {
93
+ "id": 6,
94
+ "name": "Nova Admin Panel",
95
+ "status": "pending",
96
+ "estimatedDays": 4,
97
+ "tasks": [
98
+ { "task": "Create User Nova resource", "status": "completed", "note": "Auto-generated by Nova install" },
99
+ { "task": "Create App Nova resource", "status": "pending" },
100
+ { "task": "Create Build Nova resource", "status": "pending" },
101
+ { "task": "Create Subscription Nova resource", "status": "pending" },
102
+ { "task": "Create ApiKey Nova resource", "status": "pending" },
103
+ { "task": "Create Main dashboard (revenue, usage)", "status": "pending" },
104
+ { "task": "Add admin actions (suspend, adjust plan)", "status": "pending" },
105
+ { "task": "Add metrics cards and charts", "status": "pending" }
106
+ ]
107
+ },
108
+ {
109
+ "id": 7,
110
+ "name": "Plugin Updates",
111
+ "status": "pending",
112
+ "estimatedDays": 3,
113
+ "tasks": [
114
+ { "task": "Add apiKey to PluginInitConfig in definitions.ts", "status": "pending" },
115
+ { "task": "Add X-API-Key header to HTTP requests in plugin.ts", "status": "pending" },
116
+ { "task": "Add MAU ping endpoint call", "status": "pending" },
117
+ { "task": "Update iOS SecureStorage for API key", "status": "pending" },
118
+ { "task": "Update Android SecureStorage for API key", "status": "pending" },
119
+ { "task": "Update documentation", "status": "pending" }
120
+ ]
121
+ },
122
+ {
123
+ "id": 8,
124
+ "name": "Migration & Testing",
125
+ "status": "pending",
126
+ "estimatedDays": 5,
127
+ "tasks": [
128
+ { "task": "Write unit tests for API key validation", "status": "pending" },
129
+ { "task": "Write unit tests for bundle signing", "status": "pending" },
130
+ { "task": "Write unit tests for MAU calculation", "status": "pending" },
131
+ { "task": "Write integration tests for upload flow", "status": "pending" },
132
+ { "task": "Write integration tests for download flow", "status": "pending" },
133
+ { "task": "Write integration tests for Stripe flow", "status": "pending" },
134
+ { "task": "Create Firebase user sync script", "status": "pending" },
135
+ { "task": "Deploy to staging environment", "status": "pending" },
136
+ { "task": "Perform end-to-end testing", "status": "pending" },
137
+ { "task": "Deploy to production", "status": "pending" },
138
+ { "task": "Monitor and fix issues", "status": "pending" }
139
+ ]
140
+ }
141
+ ],
142
+ "decisions": {
143
+ "keepFirebaseAuth": true,
144
+ "keepGoogleDrive": "optional-free-tier",
145
+ "primaryStorage": "s3-or-r2",
146
+ "adminPanel": "laravel-nova",
147
+ "paymentProcessor": "stripe",
148
+ "mauTracking": "device-hash-monthly"
149
+ },
150
+ "pricingTiers": [
151
+ { "name": "Free", "price": 0, "mauLimit": 1000, "appsLimit": 1 },
152
+ { "name": "Pro", "price": 29, "mauLimit": 10000, "appsLimit": 5 },
153
+ { "name": "Enterprise", "price": 199, "mauLimit": 100000, "appsLimit": -1 }
154
+ ],
155
+ "securityFeatures": [
156
+ "api-key-authentication",
157
+ "firebase-token-validation",
158
+ "rsa-pss-bundle-signing",
159
+ "signed-download-urls",
160
+ "device-binding",
161
+ "rate-limiting",
162
+ "replay-attack-prevention"
163
+ ],
164
+ "completedToday": [
165
+ "Laravel 11 + Nova 5 project created in /backend",
166
+ "All database migrations created and run",
167
+ "All models with relationships created",
168
+ "API key validation middleware created",
169
+ "Firebase token validation middleware created",
170
+ "Update check API endpoint created",
171
+ "Bundle download API with signed URLs created",
172
+ "Analytics/MAU tracking API created",
173
+ "RSA key generation and signing in SigningKey model",
174
+ "Laravel Cashier, Firebase SDK, AWS SDK installed"
175
+ ],
176
+ "blockers": [],
177
+ "notes": [
178
+ "Nova license configured globally",
179
+ "Stripe API keys needed",
180
+ "Firebase service account JSON needed",
181
+ "S3/R2 bucket and keys needed",
182
+ "Current plugin already supports HTTP backend - minimal changes needed"
183
+ ]
184
+ }
@@ -0,0 +1,218 @@
1
+ # Native Update System Overview
2
+
3
+ ## Metadata
4
+
5
+ - **Reference Date:** 2026-03-16
6
+ - **Last Updated:** 2026-03-16
7
+
8
+ ## Project Identity
9
+
10
+ - **Name:** Native Update
11
+ - **Package:** `native-update`
12
+ - **Type:** Open-source Capacitor plugin plus update management platform
13
+ - **Primary Creator:** Ahsan Mahmood
14
+ - **Primary Contact:** aoneahsan@gmail.com
15
+ - **License:** MIT
16
+
17
+ ## Core Mission
18
+
19
+ Native Update exists to reduce the operational complexity of shipping updates in Capacitor apps. It unifies OTA updates, native app update flows, in-app reviews, release manifests, rollout controls, and management tooling into one ecosystem.
20
+
21
+ ## Core Product Layers
22
+
23
+ ### 1. Plugin Layer
24
+
25
+ The plugin provides the runtime capabilities inside a Capacitor app:
26
+
27
+ - OTA/live update checks and bundle handling
28
+ - app update checks and prompts
29
+ - in-app review requests
30
+ - background update scheduling
31
+ - security validation logic
32
+ - Firestore-backed manifest reading support
33
+
34
+ ### 2. Dashboard Layer
35
+
36
+ The website provides a management surface for:
37
+
38
+ - user auth
39
+ - app creation and app management
40
+ - build uploads
41
+ - rollout visibility and control
42
+ - analytics review
43
+ - Google Drive connection and storage management
44
+ - configuration generation
45
+ - admin-only oversight pages
46
+
47
+ ### 3. Docs Layer
48
+
49
+ The docs explain:
50
+
51
+ - installation and setup
52
+ - features and APIs
53
+ - examples and advanced scenarios
54
+ - security, deployment, testing, and troubleshooting
55
+ - migration from other approaches
56
+ - planning, tracking, roadmap, audit, and report history
57
+
58
+ ### 4. Tooling Layer
59
+
60
+ The project includes:
61
+
62
+ - CLI commands
63
+ - bundle creation/signing/verification utilities
64
+ - backend templates and examples
65
+ - local development scripts
66
+
67
+ ## What The Product Solves
68
+
69
+ Capacitor teams often need several disconnected systems to handle:
70
+
71
+ - web asset updates
72
+ - store version upgrades
73
+ - review prompts
74
+ - release rollout control
75
+ - security verification
76
+ - app/build administration
77
+
78
+ Native Update consolidates those concerns into one project with a common mental model.
79
+
80
+ ## Main Feature Areas
81
+
82
+ ### Live / OTA Updates
83
+
84
+ - Deliver JavaScript, HTML, and CSS changes without app store review
85
+ - Support update channels
86
+ - Manage version checks and bundle downloads
87
+ - Support checksum and signature validation
88
+ - Enable rollback-aware update flows
89
+ - Support delta patch concepts and file manifests
90
+
91
+ ### Native App Updates
92
+
93
+ - Check for newer native binary versions
94
+ - Support immediate and flexible update strategies
95
+ - Integrate with Android and iOS update behavior
96
+
97
+ ### In-App Reviews
98
+
99
+ - Request native reviews
100
+ - respect timing/rate limiting logic
101
+ - support user-experience-aware prompting
102
+
103
+ ### Background Updates
104
+
105
+ - Schedule checks while app is not active
106
+ - support native notification behavior
107
+ - provide background configuration hooks
108
+
109
+ ### Security
110
+
111
+ - signing
112
+ - checksum verification
113
+ - HTTPS-first posture
114
+ - certificate pinning support
115
+ - validation helpers
116
+
117
+ ### Release Operations
118
+
119
+ - upload build ZIPs
120
+ - generate file manifests
121
+ - publish app-facing manifests
122
+ - configure rollout percentages
123
+ - manage app/channel/build metadata
124
+
125
+ ## Current Product Surfaces
126
+
127
+ ### Public Website
128
+
129
+ - `/`
130
+ - `/features`
131
+ - `/pricing`
132
+ - `/docs`
133
+ - `/docs/*`
134
+ - `/about`
135
+ - `/contact`
136
+ - `/privacy`
137
+ - `/terms`
138
+ - `/data-deletion`
139
+ - `/cookies`
140
+ - `/security`
141
+ - `/sitemap`
142
+ - `/feed`
143
+
144
+ ### Auth Pages
145
+
146
+ - `/login`
147
+ - `/signup`
148
+
149
+ ### Protected Dashboard
150
+
151
+ - `/dashboard`
152
+ - `/dashboard/apps`
153
+ - `/dashboard/apps/:appId`
154
+ - `/dashboard/builds`
155
+ - `/dashboard/builds/:buildId`
156
+ - `/dashboard/upload`
157
+ - `/dashboard/drive`
158
+ - `/dashboard/config`
159
+ - `/dashboard/settings`
160
+ - `/dashboard/rollouts`
161
+ - `/dashboard/analytics`
162
+
163
+ ### Admin Area
164
+
165
+ - `/admin`
166
+ - `/admin/users`
167
+ - `/admin/apps`
168
+ - `/admin/builds`
169
+
170
+ ## User Types
171
+
172
+ ### Public Visitor
173
+
174
+ Can browse marketing, docs, legal, contact, sitemap, and feed pages.
175
+
176
+ ### Authenticated User
177
+
178
+ Can access dashboard pages and manage their own apps, builds, Drive connection, settings, and release operations.
179
+
180
+ ### Admin User
181
+
182
+ An authenticated user whose Firestore user document has `isAdmin: true`. Admins can access `/admin` pages for broader oversight.
183
+
184
+ ### Mobile App Client
185
+
186
+ Not a dashboard user, but an app-side runtime consumer of manifests, update metadata, and plugin APIs.
187
+
188
+ ### Developer / Maintainer
189
+
190
+ Works in the codebase, docs, CLI, native code, example apps, and release infrastructure.
191
+
192
+ ## Access Model
193
+
194
+ - Public routes are open.
195
+ - Dashboard routes are wrapped by `ProtectedRoute`.
196
+ - Admin routes are wrapped by `AdminRoute`.
197
+ - Google sign-in is the primary auth flow.
198
+ - Admin is currently determined by email/user doc logic, including `aoneahsan@gmail.com`.
199
+
200
+ ## Product Positioning Notes
201
+
202
+ - The repo positions Native Update as more than a plugin; it is a platform direction.
203
+ - The website presents a complete update solution with dashboard and docs.
204
+ - The repo also contains older historical docs from pre-production phases. These should be treated as timeline artifacts, not always the newest truth.
205
+
206
+ ## Recommended Decision Assumptions For AI Tools
207
+
208
+ - Treat the project as a cross-platform mobile infrastructure product.
209
+ - Treat the website as both a marketing site and operations dashboard.
210
+ - Treat Google Drive + Firestore as the preferred no-cost production backend path for the website flow.
211
+ - Treat the dashboard as owner/operator tooling, not end-user mobile UI.
212
+ - Treat security, rollout control, and documentation quality as important project values.
213
+
214
+ ## Important Known Context
215
+
216
+ - The project contains current docs plus historical reports and planning files.
217
+ - Some documents disagree on production readiness because they were written at different times.
218
+ - For technical state, prefer current source code, route definitions, type definitions, package files, and newer roadmap/report files.