You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/docs/cli/migrations/encryption.md
+42-33Lines changed: 42 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,73 +5,82 @@ sidebar:
5
5
order: 5
6
6
---
7
7
8
-
This documentation will explain how to encrypt your data with the new encryption system and remove the old one.
8
+
This documentation explains how to migrate to the new encryption system. Learn more about the new encryption system in the [blog post](/blog/introducing-end-to-end-security-to-capacitor-updater-with-code-signing).
9
9
10
-
Learn more about the new encryption system in the [blog post](/blog/introducing-end-to-end-security-to-capacitor-updater-with-code-signing).
11
-
12
-
---
13
-
14
-
First, create a new key pair with the following command:
10
+
## 1. Create Key Pair
15
11
16
12
```bash
17
13
npx @capgo/cli key create
18
14
```
19
15
20
-
This command will create a new key pair in your app; it is imperative to store the private key in a safe place. One must never commit the private key to source control nor share it with an untrusted party.
21
-
22
-
This command will also remove the old key from your Capacitor config, but it will not remove the old key files. The CLI keeps them to allow you to continue sending live updates for the apps that haven't received an app store update and are still using the old plugin. This facilitates the migration.
23
-
24
-
When you are asked by the migration, "Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?", please agree. It will add a new "defaultChannel" option to your Capacitor config. This will make your app use the channel "encryption_v2". This will ensure that the new encryption is used only by apps that support it. Apps that have not received an app store update will continue using the previous default channel.
16
+
:::warning
17
+
Store the private key securely. Never commit it to source control or share it with untrusted parties.
18
+
:::
25
19
26
-
---
20
+
This command:
21
+
- Creates a new key pair in your app
22
+
- Removes the old key from your Capacitor config
23
+
- Keeps old key files for backward compatibility
27
24
28
-
Now, you need to build your JS bundle and upload it to the new channel. Please run the following command:
25
+
## 2. Update Capacitor Config
29
26
27
+
When prompted "Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?", select yes. This adds a new `defaultChannel` option to your Capacitor config.
description: "How to handle breaking changes with versioned channels"
4
+
sidebar:
5
+
order: 6
6
+
---
7
+
8
+
This documentation explains how to handle breaking changes in your app using versioned channels. This approach allows you to maintain different versions of your app while ensuring users receive compatible updates.
9
+
10
+
## Example Scenario
11
+
12
+
Let's say you have:
13
+
- App version 1.2.3 (old version) - uses production channel
14
+
- App version 2.0.0 (new version with breaking changes) - uses v2 channel
15
+
- Live update 1.2.4 (compatible with 1.2.3)
16
+
- Live update 2.0.1 (compatible with 2.0.0)
17
+
18
+
## 1. Create Channel for New Version
19
+
20
+
```bash
21
+
# Create channel for version 2.x
22
+
npx @capgo/cli channel create v2
23
+
```
24
+
25
+
## 2. Update Capacitor Config
26
+
27
+
```ts
28
+
// capacitor.config.ts
29
+
import { CapacitorConfig } from'@capacitor/cli';
30
+
31
+
const config:CapacitorConfig= {
32
+
appId: 'com.example.app',
33
+
appName: 'Example App',
34
+
plugins: {
35
+
CapacitorUpdater: {
36
+
// ... other options
37
+
defaultChannel: 'v2'// New apps will use v2 channel
38
+
}
39
+
}
40
+
};
41
+
42
+
exportdefaultconfig;
43
+
```
44
+
45
+
## 3. Upload Bundles to Respective Channels
46
+
47
+
```bash
48
+
# Upload 1.2.4 to production channel (for 1.2.3 users)
49
+
npx @capgo/cli bundle upload --channel production
50
+
51
+
# Upload 2.0.1 to v2 channel (for 2.0.0 users)
52
+
npx @capgo/cli bundle upload --channel v2
53
+
```
54
+
55
+
## 4. Enable Self-Assignment
56
+
57
+
```bash
58
+
# Allow apps to self-assign to v2 channel
59
+
npx @capgo/cli channel set v2 --self-assign
60
+
```
61
+
62
+
## 5. Update App Code
63
+
64
+
Add version check in your app to assign users to the correct channel:
1. Remove `defaultChannel` from your Capacitor config
87
+
2. Delete the v2 channel:
88
+
89
+
```bash
90
+
npx @capgo/cli channel delete v2
91
+
```
92
+
93
+
:::tip
94
+
This approach ensures users only receive updates compatible with their app version
95
+
:::
96
+
97
+
:::warning
98
+
Always test updates thoroughly in each channel before deployment
99
+
:::
100
+
101
+
:::note
102
+
You can safely delete the v2 channel in Capgo even if some users still have the channel override. They will automatically receive updates from the production channel instead.
103
+
:::
104
+
105
+
## Maintaining Version 1.x Updates
106
+
107
+
To send updates compatible with version 1.x:
108
+
109
+
1. Create a git tag for version 1.x:
110
+
```bash
111
+
git tag v1.2.4
112
+
git push origin v1.2.4
113
+
```
114
+
115
+
2. Switch to the tag:
116
+
```bash
117
+
git checkout v1.2.4
118
+
```
119
+
120
+
3. Build and upload to production channel:
121
+
```bash
122
+
npx @capgo/cli bundle upload --channel production
123
+
```
124
+
125
+
:::tip
126
+
Your main branch can continue targeting the latest version (2.x) while you maintain 1.x updates through git tags
0 commit comments