native-update 3.1.2 → 3.1.4
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 +15 -10
- package/Readme.md +35 -35
- package/android/src/main/java/com/aoneahsan/nativeupdate/LiveUpdatePlugin.kt +88 -12
- package/android/src/main/java/com/aoneahsan/nativeupdate/NativeUpdatePlugin.kt +45 -18
- package/cli/AGENTS.md +1 -1
- package/cli/CLAUDE.md +1 -1
- package/cli/commands/bundle-create.js +2 -2
- package/cli/index.js +11 -0
- package/dist/esm/definitions.d.ts +8 -0
- package/dist/esm/plugin.js +16 -2
- package/dist/plugin.cjs.js +1 -1
- package/dist/plugin.esm.js +1 -1
- package/dist/plugin.js +2 -2
- package/docs/CHANGELOG.md +90 -0
- package/docs/KNOWN_LIMITATIONS.md +2 -2
- package/docs/MIGRATION.md +1 -1
- package/ios/Plugin/LiveUpdate/LiveUpdatePlugin.swift +64 -8
- package/ios/Plugin/NativeUpdatePlugin.swift +39 -13
- package/package.json +8 -3
- package/docs/AGENTS.md +0 -47
- package/docs/APP_REVIEW_GUIDE.md +0 -768
- package/docs/BUNDLE_SIGNING.md +0 -277
- package/docs/CLAUDE.md +0 -110
- package/docs/COMPREHENSIVE_AUDIT_REPORT.md +0 -526
- package/docs/DEPLOY_NOTES.md +0 -116
- package/docs/EXAMPLE_APPS_SIMPLIFICATION_PLAN.md +0 -384
- package/docs/EXAMPLE_APPS_SIMPLIFICATION_TRACKER.md +0 -390
- package/docs/LIVE_UPDATES_GUIDE.md +0 -675
- package/docs/MANUAL-TASKS.md +0 -30
- package/docs/MARKETING_WEBSITE_TRACKER.md +0 -677
- package/docs/NATIVE_UPDATES_GUIDE.md +0 -695
- package/docs/PACKAGES.md +0 -167
- package/docs/PERFORMANCE.md +0 -110
- package/docs/PROJECT_COMPLETION_TRACKER.md +0 -411
- package/docs/QUICK_START.md +0 -595
- package/docs/README.md +0 -130
- package/docs/REMAINING_FEATURES.md +0 -192
- package/docs/ROADMAP.md +0 -295
- package/docs/SECURITY-IF-REPO-PUBLIC.md +0 -232
- package/docs/SECURITY.md +0 -356
- package/docs/TESTING_REQUIREMENTS.md +0 -201
- package/docs/ai-knowledge-base/00-project-profile.md +0 -38
- package/docs/ai-knowledge-base/01-features.md +0 -46
- package/docs/ai-knowledge-base/02-routes.md +0 -72
- package/docs/ai-knowledge-base/03-tech-stack.md +0 -57
- package/docs/ai-knowledge-base/README.md +0 -23
- package/docs/analytics-tracking.md +0 -37
- package/docs/api/API.md +0 -558
- package/docs/api/FEATURES.md +0 -414
- package/docs/api/app-review-api.md +0 -239
- package/docs/api/app-update-api.md +0 -154
- package/docs/api/background-update-api.md +0 -170
- package/docs/api/events-api.md +0 -323
- package/docs/api/live-update-api.md +0 -258
- package/docs/archive/MARKETING_WEBSITE_PLAN.md +0 -659
- package/docs/background-updates.md +0 -392
- package/docs/capacitor-official-plugins.md +0 -46
- package/docs/capawesome-plugins.md +0 -29
- package/docs/cli-reference.md +0 -321
- package/docs/deployment/HOSTINGER_DEPLOY.md +0 -370
- package/docs/deployment/PRODUCTION-DEPLOY-CHECKLIST.md +0 -184
- package/docs/docs-site/plan.md +0 -201
- package/docs/docs-site/scope.md +0 -127
- package/docs/docs-site/tracker.json +0 -235
- package/docs/error-handling-tracking.md +0 -37
- package/docs/examples/advanced-scenarios.md +0 -394
- package/docs/examples/android-manifest-example.xml +0 -77
- package/docs/examples/basic-usage.md +0 -206
- package/docs/examples/node-express-backend-example.md +0 -28
- package/docs/examples/react-capacitor-example.md +0 -29
- package/docs/features/app-reviews.md +0 -975
- package/docs/features/app-updates.md +0 -785
- package/docs/features/e2e-full-verification/00-overview.md +0 -99
- package/docs/features/e2e-full-verification/00-tracker.json +0 -284
- package/docs/features/e2e-full-verification/phase01-backend-schema-fixes.md +0 -183
- package/docs/features/e2e-full-verification/phase02-test-auth.md +0 -176
- package/docs/features/e2e-full-verification/phase03-api-test-coverage.md +0 -63
- package/docs/features/e2e-full-verification/phase04-frontend-package-contract-audit.md +0 -73
- package/docs/features/e2e-full-verification/phase05-browser-e2e-matrix.md +0 -69
- package/docs/features/e2e-full-verification/phase06-deploy-prod-smoke.md +0 -51
- package/docs/features/e2e-full-verification/results/phase01-drift-report.md +0 -50
- package/docs/features/e2e-full-verification/results/phase03-coverage-matrix.md +0 -215
- package/docs/features/e2e-full-verification/results/phase04-frontend-contract.md +0 -139
- package/docs/features/e2e-full-verification/results/phase05-e2e-results.md +0 -99
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-01-dashboard.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-02-signup.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-03-settings-persisted.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-04a-app-created.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-04b-duplicate-bundle-422.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-05-plan-limit-403.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-08a-upload-graceful-fail.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-08b-builds-list.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-10-rollout-25pct.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-11-analytics.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-12-drive-disconnected.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-13-pricing.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-14-isolation-403.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-15a-admin-overview.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-15b-regular-user-admin-redirect.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-16a-delete-dialog.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-17-mobile-375.png +0 -0
- package/docs/features/e2e-full-verification/results/route-list.json +0 -1
- package/docs/features/laravel-nova-backend/ASSESSMENT-SUMMARY.md +0 -96
- package/docs/features/laravel-nova-backend/IMPLEMENTATION-PLAN.md +0 -504
- package/docs/features/laravel-nova-backend/progress-tracker.json +0 -184
- package/docs/features/live-updates.md +0 -642
- package/docs/features/queues-and-emails/00-overview.md +0 -41
- package/docs/features/queues-and-emails/00-tracker.json +0 -99
- package/docs/features/queues-and-emails/phase01-foundation.md +0 -15
- package/docs/features/queues-and-emails/phase02-queued-jobs.md +0 -19
- package/docs/features/queues-and-emails/phase03-transactional-emails.md +0 -16
- package/docs/features/queues-and-emails/phase04-quota-ops.md +0 -17
- package/docs/features/queues-and-emails/phase05-async-build-processing-DECISION.md +0 -16
- package/docs/features/queues-and-emails/phase06-verify-deploy.md +0 -17
- package/docs/getting-started/configuration.md +0 -469
- package/docs/getting-started/installation.md +0 -300
- package/docs/getting-started/quick-start.md +0 -430
- package/docs/guides/BACKEND_TEMPLATES_GUIDE.md +0 -183
- package/docs/guides/admin-panel.md +0 -268
- package/docs/guides/channel-management.md +0 -343
- package/docs/guides/dashboard-guide.md +0 -365
- package/docs/guides/deployment-guide.md +0 -335
- package/docs/guides/end-to-end-workflow.md +0 -491
- package/docs/guides/key-management.md +0 -284
- package/docs/guides/migration-from-codepush.md +0 -145
- package/docs/guides/security-best-practices.md +0 -1057
- package/docs/guides/testing-guide.md +0 -346
- package/docs/guides/troubleshooting.md +0 -482
- package/docs/package-audit.md +0 -41
- package/docs/plans/PLANNING_COMPLETE_SUMMARY.md +0 -361
- package/docs/plans/TASK_1_ANDROID_EXAMPLE_APP.md +0 -401
- package/docs/plans/TASK_2_API_ENDPOINTS.md +0 -856
- package/docs/plans/TASK_2_DASHBOARD_UI_UX.md +0 -820
- package/docs/plans/TASK_2_DATABASE_SCHEMA.md +0 -704
- package/docs/plans/TASK_2_GOOGLE_DRIVE_INTEGRATION.md +0 -646
- package/docs/plans/TASK_2_SAAS_ARCHITECTURE.md +0 -587
- package/docs/plans/TASK_2_USER_AUTHENTICATION.md +0 -600
- package/docs/play-store/ASO-METADATA.md +0 -5
- package/docs/play-store/DATA-SAFETY.md +0 -5
- package/docs/play-store/DECLARATIONS.md +0 -5
- package/docs/play-store/README.md +0 -27
- package/docs/play-store/RELEASE-NOTES.md +0 -99
- package/docs/play-store/RELEASE-STEPS.md +0 -6
- package/docs/play-store/STORE-LISTING.md +0 -7
- package/docs/play-store/SUBMISSION-CHECKLIST.md +0 -5
- package/docs/production-readiness.md +0 -475
- package/docs/project-audit/2026-05-16/00-FINALIZATION-PLAN.md +0 -123
- package/docs/project-audit/2026-05-16/01-BATCH-PLAN.md +0 -227
- package/docs/project-audit/2026-05-16/02-AUDIT-FINDINGS.md +0 -144
- package/docs/project-audit/2026-05-16/sessions/batch-01.md +0 -42
- package/docs/project-audit/2026-05-16/sessions/batch-02.md +0 -74
- package/docs/project-audit/2026-05-16/sessions/batch-03.md +0 -71
- package/docs/project-audit/2026-05-16/sessions/batch-04.md +0 -88
- package/docs/project-audit/2026-05-16/sessions/batch-05.md +0 -63
- package/docs/project-audit/2026-05-16/sessions/batch-06.md +0 -103
- package/docs/project-audit/2026-05-16/sessions/batch-07.md +0 -61
- package/docs/project-audit/2026-05-16/sessions/batch-08.md +0 -101
- package/docs/project-audit/2026-05-16/sessions/batch-09.md +0 -105
- package/docs/project-audit/2026-05-16/sessions/batch-10.md +0 -102
- package/docs/project-audit/AUDIT-HISTORY.md +0 -74
- package/docs/project-audit/BATCH-PLAN.md +0 -168
- package/docs/project-audit/MARKETING-WEBSITE-FINDINGS-2026-05-11.md +0 -73
- package/docs/project-audit/PRODUCTION-READINESS-AUDIT-2026-05-08.md +0 -275
- package/docs/project-finalization/00-tracker.json +0 -60
- package/docs/project-knowledge-base/01-system-overview.md +0 -227
- package/docs/project-knowledge-base/02-routes-pages-forms-users.md +0 -352
- package/docs/project-knowledge-base/03-tech-stack-modules-services.md +0 -379
- package/docs/project-knowledge-base/04-data-models-integrations.md +0 -244
- package/docs/project-knowledge-base/05-docs-corpus-inventory.md +0 -256
- package/docs/project-knowledge-base/06-operations-testing-legal-content.md +0 -208
- package/docs/project-knowledge-base/README.md +0 -103
- package/docs/project-profiles/native-update-capacitor-update-platform-project-profile-last-updated-2026-05-19.md +0 -81
- package/docs/reports/AUDIT_SUMMARY_2025-12-26.md +0 -203
- package/docs/reports/CLAUDE-CODE-COMPLETION-PROMPT.md +0 -403
- package/docs/reports/CLAUDE_CODE_PROMPT.md +0 -29
- package/docs/reports/CODEBASE_STATUS_REPORT.md +0 -272
- package/docs/reports/COMPLETE_VERIFICATION.md +0 -106
- package/docs/reports/COMPREHENSIVE-PROJECT-AUDIT-2026-02-24.md +0 -747
- package/docs/reports/EVENT_FLOW_VERIFICATION.md +0 -80
- package/docs/reports/EXAMPLE_APPS_SIMPLIFICATION_COMPLETE.md +0 -369
- package/docs/reports/FINAL_STATUS.md +0 -122
- package/docs/reports/FINAL_VERIFICATION_CHECKLIST.md +0 -425
- package/docs/reports/MARKETING_WEBSITE_COMPLETE.md +0 -466
- package/docs/reports/PACKAGE_COMPLETENESS_REPORT.md +0 -130
- package/docs/reports/PRODUCTION_STATUS.md +0 -115
- package/docs/reports/PROJECT_RESTRUCTURE_2025-12-27.md +0 -287
- package/docs/reports/PROJECT_RESTRUCTURE_FINAL_SUMMARY.md +0 -464
- package/docs/reports/PUBLISHING_VERIFICATION.md +0 -144
- package/docs/reports/RELEASE_READY_SUMMARY.md +0 -99
- package/docs/reports/claude-completion.json +0 -241
- package/docs/rules-tracker.md +0 -102
- package/docs/security/PRE-LAUNCH-PENTEST-CHECKLIST.md +0 -116
- package/docs/security/certificate-pinning.md +0 -122
- package/docs/seo-aeo-rules.json +0 -3043
- package/docs/social-media-marketing/README.md +0 -81
- package/docs/social-media-marketing/posts-batch-01.md +0 -613
- package/docs/social-media-marketing/posts-batch-02.md +0 -528
- package/docs/social-media-marketing/whatsapp-messages-batch-01.md +0 -458
- package/docs/social-media-marketing/whatsapp-status-batch-01.md +0 -355
- package/docs/tracking/IMPLEMENTATION_TRACKER.md +0 -303
- package/docs/tracking/capacitor-rollout-note-2026-03-01.md +0 -21
- package/docs/tracking/completion-tracker-2026-02-24.json +0 -174
- package/docs/tracking/finalization-2026-05-16-tracker.json +0 -346
- package/docs/tracking/full-audit-tracker.json +0 -121
- package/docs/tracking/production-readiness-audit-tracker.json +0 -429
- package/docs/tracking/seo-checklist-tracker.json +0 -333
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
# Key Management Guide
|
|
2
|
-
|
|
3
|
-
This guide explains how to generate, manage, and use cryptographic keys for bundle signing in the Native Update plugin.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
The Native Update plugin uses public key cryptography to ensure the security and integrity of update bundles. This system prevents tampering and ensures updates come from trusted sources.
|
|
8
|
-
|
|
9
|
-
### Why Use Cryptographic Signing?
|
|
10
|
-
|
|
11
|
-
1. **Integrity**: Ensures bundles haven't been modified during transmission
|
|
12
|
-
2. **Authenticity**: Verifies bundles come from your trusted server
|
|
13
|
-
3. **Non-repudiation**: Proves the origin of updates
|
|
14
|
-
4. **Security**: Prevents man-in-the-middle attacks and bundle injection
|
|
15
|
-
|
|
16
|
-
## Key Generation
|
|
17
|
-
|
|
18
|
-
### Using the CLI Tool (Recommended)
|
|
19
|
-
|
|
20
|
-
The easiest way to generate keys is using our CLI tool:
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
# Generate RSA 4096-bit keys (recommended for production)
|
|
24
|
-
npx native-update keys generate --type rsa --size 4096
|
|
25
|
-
|
|
26
|
-
# Generate RSA 2048-bit keys (faster, still secure)
|
|
27
|
-
npx native-update keys generate --type rsa --size 2048
|
|
28
|
-
|
|
29
|
-
# Generate EC keys (smaller signatures, modern)
|
|
30
|
-
npx native-update keys generate --type ec --size 256
|
|
31
|
-
|
|
32
|
-
# Specify output directory
|
|
33
|
-
npx native-update keys generate --output ./my-keys
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
This will create:
|
|
37
|
-
- `private-{timestamp}.pem` - Keep this SECRET on your server
|
|
38
|
-
- `public-{timestamp}.pem` - Include this in your app
|
|
39
|
-
|
|
40
|
-
### Manual Key Generation
|
|
41
|
-
|
|
42
|
-
If you prefer to generate keys manually, you can use OpenSSL:
|
|
43
|
-
|
|
44
|
-
#### RSA Keys
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
# Generate 4096-bit RSA private key
|
|
48
|
-
openssl genrsa -out private.pem 4096
|
|
49
|
-
|
|
50
|
-
# Extract public key from private key
|
|
51
|
-
openssl rsa -in private.pem -pubout -out public.pem
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
#### Elliptic Curve Keys
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
# Generate EC private key (P-256 curve)
|
|
58
|
-
openssl ecparam -genkey -name prime256v1 -out private-ec.pem
|
|
59
|
-
|
|
60
|
-
# Extract public key
|
|
61
|
-
openssl ec -in private-ec.pem -pubout -out public-ec.pem
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## Key Usage
|
|
65
|
-
|
|
66
|
-
### 1. Store Private Key Securely
|
|
67
|
-
|
|
68
|
-
The private key must be kept secure on your server:
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
# Set restrictive permissions
|
|
72
|
-
chmod 600 private-*.pem
|
|
73
|
-
|
|
74
|
-
# Store in secure location
|
|
75
|
-
sudo mv private-*.pem /secure/keys/
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
**Security Tips:**
|
|
79
|
-
- Never commit private keys to version control
|
|
80
|
-
- Use environment variables or key management services
|
|
81
|
-
- Rotate keys periodically
|
|
82
|
-
- Keep backup copies in secure storage
|
|
83
|
-
|
|
84
|
-
### 2. Configure Public Key in App
|
|
85
|
-
|
|
86
|
-
Add the public key to your Capacitor configuration:
|
|
87
|
-
|
|
88
|
-
```typescript
|
|
89
|
-
// capacitor.config.ts
|
|
90
|
-
import { CapacitorConfig } from '@capacitor/cli';
|
|
91
|
-
|
|
92
|
-
const config: CapacitorConfig = {
|
|
93
|
-
plugins: {
|
|
94
|
-
NativeUpdate: {
|
|
95
|
-
publicKey: 'YOUR_BASE64_PUBLIC_KEY_HERE',
|
|
96
|
-
// ... other config
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
export default config;
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
To get the base64 version of your public key:
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
# Convert public key to base64
|
|
108
|
-
cat public-*.pem | base64 -w 0 > public-key.b64
|
|
109
|
-
|
|
110
|
-
# On macOS
|
|
111
|
-
cat public-*.pem | base64 > public-key.b64
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
### 3. Sign Bundles
|
|
115
|
-
|
|
116
|
-
Use the private key to sign update bundles:
|
|
117
|
-
|
|
118
|
-
```bash
|
|
119
|
-
# Sign a bundle
|
|
120
|
-
npx native-update bundle sign ./bundle.zip --key /secure/keys/private.pem
|
|
121
|
-
|
|
122
|
-
# This creates a signature file alongside the bundle
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### 4. Verify Signatures
|
|
126
|
-
|
|
127
|
-
The plugin automatically verifies signatures using the configured public key. You can manually verify:
|
|
128
|
-
|
|
129
|
-
```bash
|
|
130
|
-
# Verify a signed bundle
|
|
131
|
-
npx native-update bundle verify ./bundle.zip --key ./public.pem
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
## Security Best Practices
|
|
135
|
-
|
|
136
|
-
### Key Storage
|
|
137
|
-
|
|
138
|
-
1. **Server Side (Private Key)**:
|
|
139
|
-
- Store in hardware security module (HSM) if possible
|
|
140
|
-
- Use encrypted storage
|
|
141
|
-
- Implement access controls
|
|
142
|
-
- Never expose via API or logs
|
|
143
|
-
|
|
144
|
-
2. **Client Side (Public Key)**:
|
|
145
|
-
- Embed in app configuration
|
|
146
|
-
- Can be safely distributed
|
|
147
|
-
- Consider certificate pinning for extra security
|
|
148
|
-
|
|
149
|
-
### Key Rotation
|
|
150
|
-
|
|
151
|
-
Implement a key rotation strategy:
|
|
152
|
-
|
|
153
|
-
1. Generate new key pair
|
|
154
|
-
2. Start signing new bundles with new key
|
|
155
|
-
3. Update app with both old and new public keys
|
|
156
|
-
4. Phase out old key after all users update
|
|
157
|
-
5. Remove old public key in future release
|
|
158
|
-
|
|
159
|
-
### Environment-Specific Keys
|
|
160
|
-
|
|
161
|
-
Use different keys for different environments:
|
|
162
|
-
|
|
163
|
-
```typescript
|
|
164
|
-
const config: CapacitorConfig = {
|
|
165
|
-
plugins: {
|
|
166
|
-
NativeUpdate: {
|
|
167
|
-
publicKey: process.env.NODE_ENV === 'production'
|
|
168
|
-
? 'PRODUCTION_PUBLIC_KEY_BASE64'
|
|
169
|
-
: 'STAGING_PUBLIC_KEY_BASE64',
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
## Implementation Details
|
|
176
|
-
|
|
177
|
-
### How Signing Works
|
|
178
|
-
|
|
179
|
-
1. **Bundle Creation**: Your web assets are packaged into a ZIP file
|
|
180
|
-
2. **Hash Generation**: SHA-256 hash of the bundle is calculated
|
|
181
|
-
3. **Signing**: Hash is signed with your private key using RSA-SHA256
|
|
182
|
-
4. **Distribution**: Bundle + signature are uploaded to your server
|
|
183
|
-
|
|
184
|
-
### How Verification Works
|
|
185
|
-
|
|
186
|
-
1. **Download**: App downloads bundle and signature
|
|
187
|
-
2. **Hash Calculation**: App calculates SHA-256 hash of downloaded bundle
|
|
188
|
-
3. **Signature Verification**: App uses public key to verify signature matches hash
|
|
189
|
-
4. **Installation**: Bundle is only installed if verification succeeds
|
|
190
|
-
|
|
191
|
-
### Signature Format
|
|
192
|
-
|
|
193
|
-
Signatures are base64-encoded for transport:
|
|
194
|
-
|
|
195
|
-
```json
|
|
196
|
-
{
|
|
197
|
-
"bundle": "bundle-1.0.1.zip",
|
|
198
|
-
"signature": "MEUCIQDp3...base64...==",
|
|
199
|
-
"algorithm": "RSA-SHA256",
|
|
200
|
-
"timestamp": "2024-01-20T10:30:00Z"
|
|
201
|
-
}
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
## Troubleshooting
|
|
205
|
-
|
|
206
|
-
### Common Issues
|
|
207
|
-
|
|
208
|
-
1. **"Signature verification failed"**
|
|
209
|
-
- Ensure public key in app matches private key used for signing
|
|
210
|
-
- Check bundle hasn't been modified after signing
|
|
211
|
-
- Verify base64 encoding is correct
|
|
212
|
-
|
|
213
|
-
2. **"Invalid key format"**
|
|
214
|
-
- Keys must be in PEM format
|
|
215
|
-
- Check for proper headers/footers in key files
|
|
216
|
-
- Ensure no extra whitespace or characters
|
|
217
|
-
|
|
218
|
-
3. **"Permission denied" when accessing keys**
|
|
219
|
-
- Set proper file permissions: `chmod 600 private-*.pem`
|
|
220
|
-
- Store in accessible location for your server process
|
|
221
|
-
|
|
222
|
-
### Testing Key Pairs
|
|
223
|
-
|
|
224
|
-
Test your keys are properly paired:
|
|
225
|
-
|
|
226
|
-
```bash
|
|
227
|
-
# Create test message
|
|
228
|
-
echo "test message" > test.txt
|
|
229
|
-
|
|
230
|
-
# Sign with private key
|
|
231
|
-
openssl dgst -sha256 -sign private.pem -out test.sig test.txt
|
|
232
|
-
|
|
233
|
-
# Verify with public key
|
|
234
|
-
openssl dgst -sha256 -verify public.pem -signature test.sig test.txt
|
|
235
|
-
# Should output: "Verified OK"
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
## Advanced Topics
|
|
239
|
-
|
|
240
|
-
### Hardware Security Modules (HSM)
|
|
241
|
-
|
|
242
|
-
For maximum security, use HSM for key storage:
|
|
243
|
-
|
|
244
|
-
```javascript
|
|
245
|
-
// Example using AWS KMS
|
|
246
|
-
const AWS = require('aws-sdk');
|
|
247
|
-
const kms = new AWS.KMS();
|
|
248
|
-
|
|
249
|
-
async function signWithHSM(data) {
|
|
250
|
-
const params = {
|
|
251
|
-
KeyId: 'arn:aws:kms:...',
|
|
252
|
-
Message: data,
|
|
253
|
-
SigningAlgorithm: 'RSASSA_PKCS1_V1_5_SHA_256'
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
const result = await kms.sign(params).promise();
|
|
257
|
-
return result.Signature;
|
|
258
|
-
}
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
### Certificate Chains
|
|
262
|
-
|
|
263
|
-
For enterprise deployments, use certificate chains:
|
|
264
|
-
|
|
265
|
-
```bash
|
|
266
|
-
# Create certificate chain
|
|
267
|
-
cat intermediate.crt root.crt > chain.pem
|
|
268
|
-
|
|
269
|
-
# Configure in app
|
|
270
|
-
{
|
|
271
|
-
"certificateChain": "base64_encoded_chain",
|
|
272
|
-
"publicKey": "base64_encoded_public_key"
|
|
273
|
-
}
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
## Next Steps
|
|
277
|
-
|
|
278
|
-
- Review [Security Best Practices](https://nativeupdate.aoneahsan.com/docs/guides/security-best-practices)
|
|
279
|
-
- Implement [Bundle Signing](https://nativeupdate.aoneahsan.com/docs/BUNDLE_SIGNING)
|
|
280
|
-
- Set up [Deployment Guide](https://nativeupdate.aoneahsan.com/docs/guides/deployment-guide) for production deployment
|
|
281
|
-
|
|
282
|
-
---
|
|
283
|
-
|
|
284
|
-
Made with ❤️ by Ahsan Mahmood
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
# Migration Guide: From CodePush to Capacitor Native Update
|
|
2
|
-
|
|
3
|
-
This guide helps you migrate from Microsoft CodePush to Capacitor Native Update.
|
|
4
|
-
|
|
5
|
-
## Key Differences
|
|
6
|
-
|
|
7
|
-
### Architecture
|
|
8
|
-
- **CodePush**: Centralized Microsoft-hosted service
|
|
9
|
-
- **Capacitor Native Update**: Self-hosted solution (you control the infrastructure)
|
|
10
|
-
|
|
11
|
-
### Features
|
|
12
|
-
- **CodePush**: OTA updates only
|
|
13
|
-
- **Capacitor Native Update**: OTA + native app updates + app reviews
|
|
14
|
-
|
|
15
|
-
### Security
|
|
16
|
-
- **CodePush**: Microsoft-managed security
|
|
17
|
-
- **Capacitor Native Update**: Your own security implementation
|
|
18
|
-
|
|
19
|
-
## Migration Steps
|
|
20
|
-
|
|
21
|
-
### 1. Backend Setup
|
|
22
|
-
|
|
23
|
-
First, you need to set up your own update server:
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
# Create a backend using our templates
|
|
27
|
-
npx native-update backend create express --with-admin
|
|
28
|
-
# or for Firebase
|
|
29
|
-
npx native-update backend create firebase --with-monitoring
|
|
30
|
-
|
|
31
|
-
cd native-update-backend
|
|
32
|
-
yarn install
|
|
33
|
-
yarn dev
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### 2. Update Your App Code
|
|
37
|
-
|
|
38
|
-
Replace CodePush imports:
|
|
39
|
-
|
|
40
|
-
```typescript
|
|
41
|
-
// Old (CodePush)
|
|
42
|
-
import codePush from 'react-native-code-push';
|
|
43
|
-
|
|
44
|
-
// New (Capacitor Native Update)
|
|
45
|
-
import { NativeUpdate } from 'native-update';
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### 3. Configure Plugin
|
|
49
|
-
|
|
50
|
-
Replace CodePush configuration:
|
|
51
|
-
|
|
52
|
-
```typescript
|
|
53
|
-
// Old (CodePush)
|
|
54
|
-
const codePushOptions = {
|
|
55
|
-
checkFrequency: codePush.CheckFrequency.ON_APP_START,
|
|
56
|
-
deploymentKey: 'YOUR_DEPLOYMENT_KEY',
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
// New (Capacitor Native Update)
|
|
60
|
-
await NativeUpdate.configure({
|
|
61
|
-
serverUrl: 'https://your-update-server.com',
|
|
62
|
-
channel: 'production',
|
|
63
|
-
autoCheck: true,
|
|
64
|
-
publicKey: 'YOUR_PUBLIC_KEY',
|
|
65
|
-
});
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### 4. Update Check Logic
|
|
69
|
-
|
|
70
|
-
Replace update checking:
|
|
71
|
-
|
|
72
|
-
```typescript
|
|
73
|
-
// Old (CodePush)
|
|
74
|
-
codePush.sync({
|
|
75
|
-
updateDialog: true,
|
|
76
|
-
installMode: codePush.InstallMode.IMMEDIATE,
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
// New (Capacitor Native Update)
|
|
80
|
-
const result = await NativeUpdate.sync({
|
|
81
|
-
installMode: 'IMMEDIATE'
|
|
82
|
-
});
|
|
83
|
-
// Sync handles check, download, and apply automatically
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
### 5. Bundle Creation
|
|
87
|
-
|
|
88
|
-
Replace release process:
|
|
89
|
-
|
|
90
|
-
```bash
|
|
91
|
-
# Old (CodePush)
|
|
92
|
-
code-push release-react MyApp ios -d Production
|
|
93
|
-
|
|
94
|
-
# New (Capacitor Native Update)
|
|
95
|
-
npx native-update bundle create ./www
|
|
96
|
-
npx native-update bundle sign bundle.zip --key private-key.pem
|
|
97
|
-
# Upload to your server
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## Feature Mapping
|
|
101
|
-
|
|
102
|
-
| CodePush Feature | Capacitor Native Update |
|
|
103
|
-
|-----------------|------------------------|
|
|
104
|
-
| sync() | sync() |
|
|
105
|
-
| getUpdateMetadata() | current() |
|
|
106
|
-
| notifyAppReady() | notifyAppReady() |
|
|
107
|
-
| restartApp() | reload() |
|
|
108
|
-
| clearUpdates() | reset() |
|
|
109
|
-
|
|
110
|
-
## Migration Checklist
|
|
111
|
-
|
|
112
|
-
- [ ] Set up update server infrastructure
|
|
113
|
-
- [ ] Generate RSA key pair for signing
|
|
114
|
-
- [ ] Update app dependencies
|
|
115
|
-
- [ ] Replace CodePush API calls
|
|
116
|
-
- [ ] Update CI/CD pipeline
|
|
117
|
-
- [ ] Test update flow
|
|
118
|
-
- [ ] Implement rollback strategy
|
|
119
|
-
- [ ] Add monitoring
|
|
120
|
-
|
|
121
|
-
## Benefits After Migration
|
|
122
|
-
|
|
123
|
-
1. **Full Control**: Own your update infrastructure
|
|
124
|
-
2. **No Vendor Lock-in**: Not dependent on Microsoft
|
|
125
|
-
3. **Additional Features**: Native updates and app reviews
|
|
126
|
-
4. **Custom Analytics**: Implement your own tracking
|
|
127
|
-
5. **Flexible Deployment**: Use any CDN or server
|
|
128
|
-
|
|
129
|
-
## Common Issues
|
|
130
|
-
|
|
131
|
-
### Issue: Updates Not Downloading
|
|
132
|
-
- Check server URL is HTTPS
|
|
133
|
-
- Verify CORS configuration
|
|
134
|
-
- Ensure bundle is signed correctly
|
|
135
|
-
|
|
136
|
-
### Issue: Signature Verification Failed
|
|
137
|
-
- Verify public key matches private key
|
|
138
|
-
- Check bundle hasn't been modified
|
|
139
|
-
- Ensure base64 encoding is correct
|
|
140
|
-
|
|
141
|
-
## Need Help?
|
|
142
|
-
|
|
143
|
-
- See [Testing Guide](https://nativeupdate.aoneahsan.com/docs/guides/testing-guide)
|
|
144
|
-
- Check [Server Requirements](https://nativeupdate.aoneahsan.com/docs/server-requirements)
|
|
145
|
-
- Review [Security Best Practices](https://nativeupdate.aoneahsan.com/docs/guides/security-best-practices)
|