Skip to content

Commit 7e8d325

Browse files
committed
mobile: add OTA code-signing cert and enable signed production updates
1 parent 9c5939e commit 7e8d325

3 files changed

Lines changed: 31 additions & 4 deletions

File tree

app/mobile/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ yarn-error.*
3939
# macOS
4040
.DS_Store
4141
*.pem
42+
# but the OTA code-signing certificate (public) is committed; the private key is not
43+
!certs/certificate.pem
4244

4345
# local env files
4446
.env*.local

app/mobile/app.config.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,22 @@ const intentFilters = variant.linkHost
7979
// baked in and manifests are served unsigned over HTTPS.
8080
//
8181
// Staging points at our self-hosted OTA backend (cut 1: validating the Expo
82-
// Updates protocol + native<->backend transport, unsigned). Production has OTA
83-
// disabled until the self-hosted backend is proven on staging, then it points
84-
// here too.
82+
// Updates protocol + native<->backend transport, unsigned).
83+
//
84+
// Production requires a code-signed manifest: the tools/ publish lambda signs
85+
// each bundle with the private key, and this cert (its public half) lets the
86+
// device reject anything not signed by it. keyid/alg must match the lambda's
87+
// OTA_SIGNING_KEY_ID and rsa-v1_5-sha256.
8588
const updates =
8689
APP_VARIANT === "devtool"
8790
? { enabled: true }
8891
: APP_VARIANT === "staging"
8992
? { url: "https://dev-api.couchershq.org/native/ota/manifest" }
90-
: { enabled: false };
93+
: {
94+
url: "https://api.couchers.org/native/ota/manifest",
95+
codeSigningCertificate: "./certs/certificate.pem",
96+
codeSigningMetadata: { keyid: "main", alg: "rsa-v1_5-sha256" },
97+
};
9198

9299
export default {
93100
name: variant.name,

app/mobile/certs/certificate.pem

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIC3TCCAcWgAwIBAgIJXxmaYUSc1wmtMA0GCSqGSIb3DQEBCwUAMBcxFTATBgNV
3+
BAMTDENvdWNoZXJzLm9yZzAg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