native-update 1.4.8 → 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 (77) 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 +38 -24
  20. package/dist/esm/definitions.js.map +1 -1
  21. package/dist/esm/firestore/firestore-client.js +4 -0
  22. package/dist/esm/firestore/firestore-client.js.map +1 -1
  23. package/dist/esm/firestore/schema.d.ts +2 -0
  24. package/dist/esm/firestore/schema.js.map +1 -1
  25. package/dist/esm/index.d.ts +1 -2
  26. package/dist/esm/index.js +0 -2
  27. package/dist/esm/index.js.map +1 -1
  28. package/dist/esm/live-update/download-manager.d.ts +36 -5
  29. package/dist/esm/live-update/download-manager.js +61 -22
  30. package/dist/esm/live-update/download-manager.js.map +1 -1
  31. package/dist/esm/live-update/update-manager.d.ts +12 -1
  32. package/dist/esm/live-update/update-manager.js +38 -10
  33. package/dist/esm/live-update/update-manager.js.map +1 -1
  34. package/dist/esm/live-update/version-manager.d.ts +9 -0
  35. package/dist/esm/live-update/version-manager.js +40 -0
  36. package/dist/esm/live-update/version-manager.js.map +1 -1
  37. package/dist/esm/plugin.js +95 -175
  38. package/dist/esm/plugin.js.map +1 -1
  39. package/dist/esm/web.d.ts +18 -1
  40. package/dist/esm/web.js +69 -24
  41. package/dist/esm/web.js.map +1 -1
  42. package/dist/plugin.cjs.js +1 -1
  43. package/dist/plugin.cjs.js.map +1 -1
  44. package/dist/plugin.esm.js +1 -1
  45. package/dist/plugin.esm.js.map +1 -1
  46. package/dist/plugin.js +2 -2
  47. package/dist/plugin.js.map +1 -1
  48. package/docs/AGENTS.md +38 -0
  49. package/docs/CHANGELOG.md +167 -0
  50. package/docs/CLAUDE.md +101 -0
  51. package/docs/MIGRATION.md +87 -0
  52. package/docs/README.md +13 -2
  53. package/docs/deployment/HOSTINGER_DEPLOY.md +329 -0
  54. package/docs/features/laravel-nova-backend/ASSESSMENT-SUMMARY.md +96 -0
  55. package/docs/features/laravel-nova-backend/IMPLEMENTATION-PLAN.md +504 -0
  56. package/docs/features/laravel-nova-backend/credentials.ignore.md +34 -0
  57. package/docs/features/laravel-nova-backend/progress-tracker.json +184 -0
  58. package/docs/guides/no-cost-backend-implementation-plan.md +77 -0
  59. package/docs/guides/no-cost-firestore-google-drive-backend.md +60 -0
  60. package/docs/project-knowledge-base/01-system-overview.md +218 -0
  61. package/docs/project-knowledge-base/02-routes-pages-forms-users.md +346 -0
  62. package/docs/project-knowledge-base/03-tech-stack-modules-services.md +347 -0
  63. package/docs/project-knowledge-base/04-data-models-integrations.md +307 -0
  64. package/docs/project-knowledge-base/05-docs-corpus-inventory.md +193 -0
  65. package/docs/project-knowledge-base/06-operations-testing-legal-content.md +170 -0
  66. package/docs/project-knowledge-base/README.md +90 -0
  67. package/docs/project-profiles/native-update-capacitor-update-platform-project-profile-last-updated-2026-03-16.md +454 -0
  68. package/docs/project-profiles/native-update-capacitor-update-platform-project-profile-last-updated-2026-03-24.md +66 -0
  69. package/docs/project-profiles/native-update-capacitor-update-platform-project-profile-last-updated-2026-03-25.md +67 -0
  70. package/docs/seo-aeo-rules.json +3043 -0
  71. package/docs/tracking/seo-checklist-tracker.json +333 -0
  72. package/ios/Plugin/BackgroundUpdate/BackgroundUpdatePlugin.swift +50 -6
  73. package/ios/Plugin/LiveUpdate/LiveUpdatePlugin.swift +238 -8
  74. package/ios/Plugin/NativeUpdatePlugin.swift +8 -0
  75. package/ios/Plugin/Security/SecurityManager.swift +13 -14
  76. package/package.json +31 -32
  77. package/docs/play-console-rejection-rules.json +0 -428
@@ -0,0 +1,329 @@
1
+ # Hostinger Deployment Guide
2
+
3
+ Step-by-step deploy of the Laravel + Nova backend to Hostinger Business
4
+ (shared hosting, SSH-enabled). Target URL:
5
+ **https://nativeupdatebe.aoneahsan.com**.
6
+
7
+ Tested against Hostinger hPanel, shared Business plan, PHP 8.2, MySQL.
8
+
9
+ ---
10
+
11
+ ## 0. What you need before starting
12
+
13
+ | Item | Where to get it |
14
+ |---|---|
15
+ | Hostinger SSH access | hPanel → Advanced → SSH Access → "Enable" |
16
+ | MySQL database | hPanel → Databases → MySQL Databases → Create |
17
+ | Nova license key | nova.laravel.com (account → licenses) |
18
+ | PayPal Live credentials | developer.paypal.com → My Apps & Credentials → Live |
19
+ | PayPal subscription plans | PayPal Dashboard → Subscriptions → Plans (create Pro + Enterprise, copy the `P-...` IDs) |
20
+ | PayPal webhook ID | Set up in step 4, skip for now |
21
+ | FilesHub API key | fileshub.zaions.com admin |
22
+ | Firebase service account JSON | console.firebase.google.com → Project settings → Service accounts → Generate private key |
23
+ | Google OAuth client | console.cloud.google.com → APIs & Services → Credentials |
24
+
25
+ ---
26
+
27
+ ## 1. Build the production zip (local machine)
28
+
29
+ Already built by the maintainer. Current artifact lives at:
30
+
31
+ ```
32
+ production-deploy/nu-backend-YYYYMMDD-HHMMSS.zip
33
+ ```
34
+
35
+ If you need to rebuild:
36
+
37
+ ```bash
38
+ cd /home/ahsan/Documents/01-code/projects/native-update/backend
39
+
40
+ # Ensure Nova + PayPal deps resolve
41
+ composer install
42
+ composer update --no-interaction
43
+
44
+ # Production-only deps + Vite build
45
+ php artisan optimize:clear
46
+ composer install --no-dev --optimize-autoloader --classmap-authoritative
47
+ npm run build
48
+
49
+ # Produce the zip
50
+ mkdir -p ../production-deploy
51
+ zip -qr "../production-deploy/nu-backend-$(date +%Y%m%d-%H%M%S).zip" . \
52
+ -x "node_modules/*" ".git/*" "tests/*" ".env" ".env.*" \
53
+ "storage/logs/*.log" "storage/framework/cache/data/*" \
54
+ "storage/framework/sessions/*" "storage/framework/views/*.php" \
55
+ "*.sqlite" ".phpunit.result.cache" "*.DS_Store"
56
+
57
+ # Restore dev deps locally
58
+ composer install
59
+ ```
60
+
61
+ The zip is ~67 MB. Upload it to Hostinger via SFTP to `~/uploads/`.
62
+
63
+ ---
64
+
65
+ ## 2. Hostinger hPanel one-time setup
66
+
67
+ 1. **Subdomain**. hPanel → Domains → Subdomains → Create:
68
+ - Subdomain: `nativeupdatebe`
69
+ - Domain: `aoneahsan.com`
70
+ - Document root: leave as Hostinger's default for now; we'll symlink
71
+ it to Laravel's `public/` in step 3.
72
+
73
+ 2. **Database**. hPanel → Databases → MySQL Databases → Create:
74
+ - DB name: `nativeupdate_backend` (Hostinger will prefix with your user)
75
+ - User: `nativeupdate_user`
76
+ - Password: generate a strong one; save it.
77
+
78
+ 3. **SSH**. hPanel → Advanced → SSH Access → Enable (if not already).
79
+ Note the port (usually 65002) and username.
80
+
81
+ 4. **Upload secrets** via hPanel File Manager (or SFTP):
82
+ - Upload `firebase-credentials.json` to `~/` (not public_html). We'll
83
+ move it in step 3.
84
+
85
+ ---
86
+
87
+ ## 3. SSH deploy (first time)
88
+
89
+ SSH in:
90
+
91
+ ```bash
92
+ ssh -p 65002 <USER>@<HOST>
93
+ ```
94
+
95
+ Create the app directory one level above `public_html` and extract:
96
+
97
+ ```bash
98
+ cd ~/domains/nativeupdatebe.aoneahsan.com
99
+ mkdir -p app && cd app
100
+ unzip -q ~/uploads/nu-backend-*.zip -d .
101
+ ```
102
+
103
+ Point `public_html` at Laravel's `public/`:
104
+
105
+ ```bash
106
+ cd ~/domains/nativeupdatebe.aoneahsan.com
107
+ rm -rf public_html
108
+ ln -s app/public public_html
109
+ ```
110
+
111
+ Drop in the Firebase credentials file:
112
+
113
+ ```bash
114
+ mkdir -p ~/domains/nativeupdatebe.aoneahsan.com/app/storage
115
+ mv ~/firebase-credentials.json ~/domains/nativeupdatebe.aoneahsan.com/app/storage/
116
+ chmod 600 ~/domains/nativeupdatebe.aoneahsan.com/app/storage/firebase-credentials.json
117
+ ```
118
+
119
+ Configure the environment:
120
+
121
+ ```bash
122
+ cd ~/domains/nativeupdatebe.aoneahsan.com/app
123
+ cp .env.example .env
124
+ nano .env
125
+ ```
126
+
127
+ Fill in the following (paste real values for each `_________` placeholder):
128
+
129
+ ```dotenv
130
+ APP_NAME="Native Update"
131
+ APP_ENV=production
132
+ APP_KEY= # php artisan key:generate runs next
133
+ APP_DEBUG=false
134
+ APP_TIMEZONE=UTC
135
+ APP_URL=https://nativeupdatebe.aoneahsan.com
136
+
137
+ LOG_CHANNEL=daily
138
+ LOG_LEVEL=warning
139
+
140
+ # MySQL from step 2
141
+ DB_CONNECTION=mysql
142
+ DB_HOST=127.0.0.1
143
+ DB_PORT=3306
144
+ DB_DATABASE=_________
145
+ DB_USERNAME=_________
146
+ DB_PASSWORD=_________
147
+
148
+ # FilesHub
149
+ FILESHUB_BASE_URL=https://fileshub.zaions.com
150
+ FILESHUB_API_KEY=_________
151
+ FILESHUB_APP_ID=native-update
152
+
153
+ # Firebase
154
+ FIREBASE_PROJECT_ID=_________
155
+ FIREBASE_CREDENTIALS_PATH=storage/firebase-credentials.json
156
+
157
+ # Google OAuth (for Google Drive integration in dashboard)
158
+ GOOGLE_CLIENT_ID=_________
159
+ GOOGLE_CLIENT_SECRET=_________
160
+ GOOGLE_REDIRECT_URI=${APP_URL}/api/dashboard/google-drive/callback
161
+
162
+ # PayPal (live)
163
+ PAYPAL_MODE=live
164
+ PAYPAL_LIVE_CLIENT_ID=_________
165
+ PAYPAL_LIVE_CLIENT_SECRET=_________
166
+ PAYPAL_PLAN_PRO=P-_________
167
+ PAYPAL_PLAN_ENTERPRISE=P-_________
168
+ PAYPAL_WEBHOOK_ID= # fill in step 4
169
+
170
+ # Nova
171
+ NOVA_LICENSE_KEY=_________
172
+
173
+ # Admin
174
+ ADMIN_EMAILS=aoneahsan@gmail.com
175
+ ```
176
+
177
+ Generate APP_KEY and lock down permissions:
178
+
179
+ ```bash
180
+ php artisan key:generate --force
181
+
182
+ find . -type d -exec chmod 755 {} \;
183
+ find . -type f -exec chmod 644 {} \;
184
+ chmod -R 775 storage bootstrap/cache
185
+ chmod 600 .env storage/firebase-credentials.json
186
+ ```
187
+
188
+ Run migrations and cache config for production:
189
+
190
+ ```bash
191
+ php artisan migrate --force
192
+ php artisan storage:link
193
+ php artisan config:cache
194
+ php artisan route:cache
195
+ php artisan view:cache
196
+ php artisan nova:publish
197
+ ```
198
+
199
+ Smoke-test:
200
+
201
+ ```bash
202
+ curl -sS https://nativeupdatebe.aoneahsan.com/api/health
203
+ # Expected: {"status":"ok","app":"Native Update","env":"production","time":"..."}
204
+ ```
205
+
206
+ Log in to Nova at `https://nativeupdatebe.aoneahsan.com/nova` with an
207
+ email listed in `ADMIN_EMAILS` (Firebase-authenticated via the website
208
+ dashboard) and verify the Apps / Builds / ApiKeys / SigningKeys /
209
+ Subscriptions resources render.
210
+
211
+ ---
212
+
213
+ ## 4. Register the PayPal webhook
214
+
215
+ In PayPal Dashboard → Webhooks → Add Webhook:
216
+
217
+ - URL: `https://nativeupdatebe.aoneahsan.com/api/webhooks/paypal`
218
+ - Events (minimum):
219
+ - `BILLING.SUBSCRIPTION.ACTIVATED`
220
+ - `BILLING.SUBSCRIPTION.CANCELLED`
221
+ - `BILLING.SUBSCRIPTION.SUSPENDED`
222
+ - `BILLING.SUBSCRIPTION.EXPIRED`
223
+ - `BILLING.SUBSCRIPTION.PAYMENT.FAILED`
224
+ - `PAYMENT.SALE.COMPLETED`
225
+
226
+ Copy the webhook ID PayPal assigns (starts with `WH-`). SSH back in:
227
+
228
+ ```bash
229
+ cd ~/domains/nativeupdatebe.aoneahsan.com/app
230
+ sed -i 's|^PAYPAL_WEBHOOK_ID=.*|PAYPAL_WEBHOOK_ID=WH-xxxxxxxxxxxx|' .env
231
+ php artisan config:cache
232
+ ```
233
+
234
+ Run PayPal's Webhook Simulator from the dashboard to fire a
235
+ `BILLING.SUBSCRIPTION.ACTIVATED` event. Expected response: `200 ok`.
236
+ Check the logs:
237
+
238
+ ```bash
239
+ tail -n 100 ~/domains/nativeupdatebe.aoneahsan.com/app/storage/logs/laravel-*.log
240
+ ```
241
+
242
+ Should contain `PayPal webhook received` or `PayPal subscription activated`.
243
+
244
+ ---
245
+
246
+ ## 5. (Optional) Cron for scheduled tasks
247
+
248
+ The current backend has no scheduled jobs. Add a cron only if/when
249
+ `app/Console/Kernel.php` grows `$schedule` entries.
250
+
251
+ hPanel → Advanced → Cron Jobs → Add:
252
+
253
+ ```
254
+ * * * * * cd ~/domains/nativeupdatebe.aoneahsan.com/app && php artisan schedule:run >/dev/null 2>&1
255
+ ```
256
+
257
+ ---
258
+
259
+ ## 6. Re-deploys
260
+
261
+ For each subsequent release:
262
+
263
+ 1. Rebuild the zip locally (see step 1).
264
+ 2. SFTP it to `~/uploads/nu-backend-NEW.zip`.
265
+ 3. SSH in and atomic-swap:
266
+
267
+ ```bash
268
+ cd ~/domains/nativeupdatebe.aoneahsan.com
269
+ mv app app.old
270
+ mkdir app && cd app
271
+ unzip -q ~/uploads/nu-backend-NEW.zip -d .
272
+
273
+ # Carry over secrets + credentials
274
+ cp ../app.old/.env .env
275
+ cp ../app.old/storage/firebase-credentials.json storage/firebase-credentials.json
276
+ cp -a ../app.old/storage/app storage/ 2>/dev/null || true
277
+
278
+ # Fix perms
279
+ find . -type d -exec chmod 755 {} \;
280
+ find . -type f -exec chmod 644 {} \;
281
+ chmod -R 775 storage bootstrap/cache
282
+ chmod 600 .env storage/firebase-credentials.json
283
+
284
+ # Rebuild caches + apply migrations
285
+ php artisan migrate --force
286
+ php artisan config:cache
287
+ php artisan route:cache
288
+ php artisan view:cache
289
+
290
+ # Re-point public_html (only needed if symlink was lost)
291
+ cd ..
292
+ rm -rf public_html && ln -s app/public public_html
293
+
294
+ # Smoke-test then clean up old release
295
+ curl -sS https://nativeupdatebe.aoneahsan.com/api/health
296
+ rm -rf app.old
297
+ ```
298
+
299
+ ---
300
+
301
+ ## 7. Rollback
302
+
303
+ If a deploy breaks things and you didn't delete `app.old` yet:
304
+
305
+ ```bash
306
+ cd ~/domains/nativeupdatebe.aoneahsan.com
307
+ rm -rf app
308
+ mv app.old app
309
+ rm -rf public_html && ln -s app/public public_html
310
+ php artisan config:cache
311
+ curl -sS https://nativeupdatebe.aoneahsan.com/api/health
312
+ ```
313
+
314
+ Migrations that were applied on the new release may need a manual
315
+ `php artisan migrate:rollback --step=N` depending on what they changed.
316
+
317
+ ---
318
+
319
+ ## 8. Known Hostinger constraints
320
+
321
+ - **No persistent queue workers.** The backend uses `QUEUE_CONNECTION=database`
322
+ and currently dispatches nothing async. If that changes, add a 1-minute
323
+ cron running `php artisan queue:work --stop-when-empty`.
324
+ - **No Redis.** Cache + sessions use the MySQL `CACHE_STORE=database` driver.
325
+ - **PHP 8.2 is the stable default.** PHP 8.3 is available but untested.
326
+ - **Node/npm are not available via SSH on all plans.** The Vite build step
327
+ runs locally; the zip ships pre-built `public/build/` assets.
328
+ - **Nova admin assets** are served from `public/vendor/nova/...` after
329
+ `php artisan nova:publish` — re-run after every deploy.
@@ -0,0 +1,96 @@
1
+ # Native Update - Assessment Summary
2
+
3
+ **Date:** 2026-03-28
4
+ **Assessed By:** Claude Code
5
+
6
+ ---
7
+
8
+ ## Plugin Assessment: PRODUCTION READY
9
+
10
+ ### TypeScript/Web Core
11
+ | Area | Rating | Notes |
12
+ |------|--------|-------|
13
+ | Security | 5/5 | SHA-256 checksums, RSA-PSS signatures, AES-256-GCM encryption |
14
+ | Architecture | 5/5 | Well-structured, modular, clean separation |
15
+ | Error Handling | 5/5 | Comprehensive error types, proper propagation |
16
+ | Testing | 4/5 | 81 tests passing |
17
+ | Rollback | 5/5 | Atomic updates with backup/restore |
18
+
19
+ ### Android Native
20
+ | Area | Rating | Notes |
21
+ |------|--------|-------|
22
+ | Security | 4/5 | EncryptedSharedPreferences, certificate pinning |
23
+ | Implementation | 5/5 | Full feature parity |
24
+ | Minor Issues | - | Timestamp bundle IDs (should use UUID) |
25
+
26
+ ### iOS Native
27
+ | Area | Rating | Notes |
28
+ |------|--------|-------|
29
+ | Security | 4/5 | Keychain storage, TLS 1.2+ enforcement |
30
+ | Implementation | 5/5 | Full feature parity |
31
+ | Minor Issues | - | In-memory file loading for large checksums |
32
+
33
+ ---
34
+
35
+ ## Current Architecture Assessment: WORKING WELL
36
+
37
+ The no-cost architecture (Firebase + Firestore + Google Drive) works correctly but lacks:
38
+ - Server-side key validation (licensing)
39
+ - Payment processing (Stripe)
40
+ - Secure authenticated downloads
41
+ - Server-held signing keys
42
+ - MAU-based billing
43
+
44
+ ---
45
+
46
+ ## Laravel + Nova: REQUIRED
47
+
48
+ ### Why Backend Is Needed
49
+
50
+ | Requirement | Why Server Needed |
51
+ |-------------|-------------------|
52
+ | **Licensing** | API keys must be validated server-side |
53
+ | **Stripe Payments** | Webhooks require server endpoint |
54
+ | **Secure Downloads** | Signed URLs need server generation |
55
+ | **Bundle Signing** | Private RSA keys must stay server-side |
56
+ | **MAU Billing** | Server aggregates device activity |
57
+ | **Rate Limiting** | Must be enforced server-side |
58
+
59
+ ### Architecture Decision
60
+
61
+ - **Keep:** Firebase Auth (working), React frontend
62
+ - **Add:** Laravel API, MySQL, S3/R2 storage
63
+ - **Nova:** Admin panel for user/subscription management
64
+
65
+ ---
66
+
67
+ ## Implementation Estimate
68
+
69
+ | Phase | Duration |
70
+ |-------|----------|
71
+ | Laravel Setup | 1 week |
72
+ | APIs + Stripe | 1.5 weeks |
73
+ | Security + Signing | 1 week |
74
+ | Nova Admin | 1 week |
75
+ | Testing + Migration | 0.5 week |
76
+ | **Total** | **5 weeks** |
77
+
78
+ ---
79
+
80
+ ## Files Created
81
+
82
+ 1. `/docs/features/laravel-nova-backend/IMPLEMENTATION-PLAN.md` - Full plan
83
+ 2. `/docs/features/laravel-nova-backend/progress-tracker.json` - Task tracker
84
+ 3. `/docs/features/laravel-nova-backend/ASSESSMENT-SUMMARY.md` - This file
85
+
86
+ ---
87
+
88
+ ## Ready to Proceed
89
+
90
+ The native-update plugin is production-ready. The Laravel + Nova backend will enable:
91
+
92
+ 1. Paid SaaS model (like Ionic AppFlow)
93
+ 2. API key-based licensing
94
+ 3. Stripe subscriptions with MAU billing
95
+ 4. Secure bundle distribution
96
+ 5. Full admin panel for management