Skip to content

Commit c8191b4

Browse files
jbromaandrewworld
andauthored
feat: code signing support (#43)
### Summary - Added code-signing support for all of the mini-apps. - Added public keys for validating the bundles to the host app - Changed location of news bundle in catalog-server Co-authored-by: andrewworld <andandalex@gmail.com>
1 parent 6f41472 commit c8191b4

9 files changed

Lines changed: 78 additions & 25 deletions

File tree

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@ node_modules
1010

1111
/*.tgz
1212

13-
build/
13+
build/
14+
15+
# Code Signing
16+
code-signing.pem
17+
code-signing.pem.pub

packages/auth/webpack.config.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,10 @@ export default env => {
270270
},
271271
},
272272
}),
273+
new Repack.plugins.CodeSigningPlugin({
274+
privateKeyPath: path.join('..', '..', './code-signing.pem'),
275+
outputPath: path.join('build', 'outputs', platform, 'remotes'),
276+
}),
273277
],
274278
};
275279
};

packages/booking/webpack.config.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as Repack from '@callstack/repack';
22
import path from 'path';
33
import TerserPlugin from 'terser-webpack-plugin';
4-
import { deps } from '../../shared/dependencies.mjs';
4+
import {deps} from '../../shared/dependencies.mjs';
55

66
/**
77
* More documentation, installation, usage, motivation and differences with Metro is available at:
@@ -253,6 +253,10 @@ export default env => {
253253
*/
254254
shared: deps,
255255
}),
256+
new Repack.plugins.CodeSigningPlugin({
257+
privateKeyPath: path.join('..', '..', './code-signing.pem'),
258+
outputPath: path.join('build', 'outputs', platform, 'remotes'),
259+
}),
256260
],
257261
};
258262
};
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
2-
"ios": {
3-
"0.0.1": {
4-
"booking": "http://localhost:9000/[name][ext]",
5-
"shopping": "http://localhost:9001/[name][ext]",
6-
"news": "https://raw.githubusercontent.com/callstack/news-mini-app-showcase/main/build/generated/ios/[name][ext]",
7-
"dashboard": "http://localhost:9002/[name][ext]",
8-
"auth": "http://localhost:9003/[name][ext]"
9-
}
10-
},
11-
"android": {
12-
"0.0.1": {
13-
"booking": "http://localhost:9000/[name][ext]",
14-
"shopping": "http://localhost:9001/[name][ext]",
15-
"news": "https://raw.githubusercontent.com/callstack/news-mini-app-showcase/main/build/generated/android/[name][ext]",
16-
"dashboard": "http://localhost:9002/[name][ext]",
17-
"auth": "http://localhost:9003/[name][ext]"
18-
}
2+
"ios": {
3+
"0.0.1": {
4+
"booking": "http://localhost:9000/[name][ext]",
5+
"shopping": "http://localhost:9001/[name][ext]",
6+
"news": "https://raw.githubusercontent.com/callstack/news-mini-app-showcase/main/build/outputs/ios/remotes/[name][ext]",
7+
"dashboard": "http://localhost:9002/[name][ext]",
8+
"auth": "http://localhost:9003/[name][ext]"
199
}
20-
}
10+
},
11+
"android": {
12+
"0.0.1": {
13+
"booking": "http://localhost:9000/[name][ext]",
14+
"shopping": "http://localhost:9001/[name][ext]",
15+
"news": "https://raw.githubusercontent.com/callstack/news-mini-app-showcase/main/build/outputs/android/remotes/[name][ext]",
16+
"dashboard": "http://localhost:9002/[name][ext]",
17+
"auth": "http://localhost:9003/[name][ext]"
18+
}
19+
}
20+
}

packages/dashboard/webpack.config.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@ export default env => {
258258
*/
259259
shared: deps,
260260
}),
261+
new Repack.plugins.CodeSigningPlugin({
262+
privateKeyPath: path.join('..', '..', './code-signing.pem'),
263+
outputPath: path.join('build', 'outputs', platform, 'remotes'),
264+
}),
261265
],
262266
};
263267
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
11
<resources>
22
<string name="app_name">host</string>
3+
<string name="RepackPublicKey">
4+
-----BEGIN PUBLIC KEY-----
5+
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAvR2JseYMjDTie9MYo/Tw
6+
4xGQKSBKJ15GcrwcP+eX96WWCkbTH+Oa7oUwuM2l6KyTBZsuWiTbajldnUslyfLu
7+
uLmAfOjmgVMgWqihRIkvBIzxG2G/wrUGMLOrXWn01enqHORami0N9O7/WayC3UO1
8+
KwN7c+Rmhkk7pwxQUDcsLofkPAjCAbo5SRDv04y0jjvjyXnufepVamSBcVdclEui
9+
d6nrDR9vWMhvNrSW6op4/NaJM0tMqvyzwNM5p081GkqSrkS59vPkkwaFOEf2/Awg
10+
yNsK+Efo4WDPEcZjay6S/wwhD1vw/29w/Or5KXfusIHsJu1iMC7xi5sYb9Z+pUZH
11+
zLqv9xPF0Q040NBOSgY1dpuPm1WE3/Yd1zG1vfWFCQJ606+DVFjVODj/uTlKldxY
12+
+vTvrfL5mZohGiYMvO4h4DLXKDlsuI0MAbCYEO9wvm/vGEP3HTpb/O85VarT4CU/
13+
wsPsZn01/gGJmqS+2v/0428SHra0r1JOXhgOrJDn/SpWkfhcYPti61gq9qKmjylq
14+
549qj7P7TNS0hdk8gaItciTkN6oNdvLUi3xHWjFauq2nvGq7DrNGis9agb91h6qp
15+
cY5Xs2ruzayYogugDiaALCPvJpQFCj83AIbWft26fl7VCphxPKaFpeDHseVi6tMi
16+
1+opwSqunAaqo5rsLlHIw0MCAwEAAQ==
17+
-----END PUBLIC KEY-----
18+
</string>
319
</resources>

packages/host/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ ScriptManager.shared.addResolver(async (scriptId, caller) => {
1515
platform: Platform.OS,
1616
appName,
1717
});
18-
const response = await fetch(containersURL);
1918

20-
const containers = await response.json();
19+
const containersResponse = await fetch(containersURL);
20+
21+
const containers = await containersResponse.json();
2122

2223
const resolveURL = Federated.createURLResolver({
2324
containers,
@@ -37,9 +38,8 @@ ScriptManager.shared.addResolver(async (scriptId, caller) => {
3738
return {
3839
url,
3940
cache: false, // For development
40-
query: {
41-
platform: Platform.OS,
42-
},
41+
query: {platform: Platform.OS},
42+
verifyScriptSignature: 'strict',
4343
};
4444
});
4545

packages/host/ios/host/Info.plist

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,22 @@
7070
</array>
7171
<key>UIViewControllerBasedStatusBarAppearance</key>
7272
<false/>
73+
<key>RepackPublicKey</key>
74+
<string>
75+
-----BEGIN PUBLIC KEY-----
76+
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAvR2JseYMjDTie9MYo/Tw
77+
4xGQKSBKJ15GcrwcP+eX96WWCkbTH+Oa7oUwuM2l6KyTBZsuWiTbajldnUslyfLu
78+
uLmAfOjmgVMgWqihRIkvBIzxG2G/wrUGMLOrXWn01enqHORami0N9O7/WayC3UO1
79+
KwN7c+Rmhkk7pwxQUDcsLofkPAjCAbo5SRDv04y0jjvjyXnufepVamSBcVdclEui
80+
d6nrDR9vWMhvNrSW6op4/NaJM0tMqvyzwNM5p081GkqSrkS59vPkkwaFOEf2/Awg
81+
yNsK+Efo4WDPEcZjay6S/wwhD1vw/29w/Or5KXfusIHsJu1iMC7xi5sYb9Z+pUZH
82+
zLqv9xPF0Q040NBOSgY1dpuPm1WE3/Yd1zG1vfWFCQJ606+DVFjVODj/uTlKldxY
83+
+vTvrfL5mZohGiYMvO4h4DLXKDlsuI0MAbCYEO9wvm/vGEP3HTpb/O85VarT4CU/
84+
wsPsZn01/gGJmqS+2v/0428SHra0r1JOXhgOrJDn/SpWkfhcYPti61gq9qKmjylq
85+
549qj7P7TNS0hdk8gaItciTkN6oNdvLUi3xHWjFauq2nvGq7DrNGis9agb91h6qp
86+
cY5Xs2ruzayYogugDiaALCPvJpQFCj83AIbWft26fl7VCphxPKaFpeDHseVi6tMi
87+
1+opwSqunAaqo5rsLlHIw0MCAwEAAQ==
88+
-----END PUBLIC KEY-----
89+
</string>
7390
</dict>
7491
</plist>

packages/shopping/webpack.config.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ export default env => {
238238
},
239239
shared: deps,
240240
}),
241+
new Repack.plugins.CodeSigningPlugin({
242+
privateKeyPath: path.join('..', '..', './code-signing.pem'),
243+
outputPath: path.join('build', 'outputs', platform, 'remotes'),
244+
}),
241245
],
242246
};
243247
};

0 commit comments

Comments
 (0)