Skip to content

Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.

Signing: the compiled-in key is real, and a release fails without one

LNPANDYdce3f4b97e54
diff --git a/.github/workflows/build-mac-app.yml b/.github/workflows/build-mac-app.yml
index 02a253c5..bedec58b 100644
--- a/.github/workflows/build-mac-app.yml
+++ b/.github/workflows/build-mac-app.yml
@@ -87,9 +87,15 @@ jobs:
env:
ENGINE_SIGNING_KEY: ${{ secrets.ENGINE_SIGNING_KEY }}
run: |
- # Warns when the secret is not set (the release then goes out unsigned). Fails when it is set and its public key is not the one in
- # frontend/engine-signing.pub, the value the launcher compiles in (EngineManifest.verify): a manifest signed with any other key
- # would be rejected by every installed app.
+ # Fails when the launcher's compiled-in key is empty (EngineManifest.publicKey): a release that ships without it accepts
+ # every manifest unsigned, silently. Fails too when the secret is set and its public key is not the one in
+ # frontend/engine-signing.pub: a manifest signed with any other key would be rejected by every installed app.
+ # With no secret yet the engine is published unsigned; signing becomes mandatory before any download source
+ # other than GitHub is added (LNPANDY/NX2Apple#268, Cloudflare R2).
+ grep -q 'static let publicKey = "PVCqIahW5HtyZPq76zTSFBa' frontend/Sources/NSPortBuilder/EngineManifest.swift || {
+ echo '::error title=Signing key::EngineManifest.publicKey is empty — generate a pair (python3 tools/release_manifest.py keygen), commit the public half and put the private half in the ENGINE_SIGNING_KEY secret'
+ exit 1
+ }
python tools/release_manifest.py check-key --pub frontend/engine-signing.pub
- name: Engine tree (tools/engine.py tree)
diff --git a/frontend/Sources/NSPortBuilder/EngineManifest.swift b/frontend/Sources/NSPortBuilder/EngineManifest.swift
index 75256e42..4d1423e5 100644
--- a/frontend/Sources/NSPortBuilder/EngineManifest.swift
+++ b/frontend/Sources/NSPortBuilder/EngineManifest.swift
@@ -114,9 +114,10 @@ enum EngineManifest {
// ---- Authenticity ----
/// The public half of the key that signs `latest.json`: base64 of the 32 raw Ed25519 bytes, the same line as
- /// `frontend/engine-signing.pub`. Empty until the key pair exists, and then every manifest is accepted unsigned
- /// (`.noKey`). Once it is set, only a manifest with a valid signature installs.
- static let publicKey = ""
+ /// `frontend/engine-signing.pub` (the private half is the repository secret ENGINE_SIGNING_KEY). Once it is set,
+ /// only a manifest with a valid signature installs; the release workflow fails a tag build whose constant is empty
+ /// (the launcher would otherwise accept every manifest unsigned, silently).
+ static let publicKey = "PVCqIahW5HtyZPq76zTSFBa+lK2bB2dKWScyb/4R3tY="
/// What we can say about a manifest's signature. Integrity (a SHA-256 that matches) only proves the
/// download is what the manifest lists — it says nothing when whoever served the manifest also served
diff --git a/frontend/engine-signing.pub b/frontend/engine-signing.pub
index fea65b21..c3b37597 100644
--- a/frontend/engine-signing.pub
+++ b/frontend/engine-signing.pub
@@ -1,4 +1,3 @@
-# The public half of the key that signs latest.json (Ed25519, base64 of the 32 raw bytes), one line below. Empty until the key exists.
-# The launcher (EngineManifest.verify's publicKey) compiles in the same value, and the release workflow fails when the repository
-# secret ENGINE_SIGNING_KEY is set and does not belong to it (tools/release_manifest.py check-key). Without the secret the engine is
-# published unsigned for now. Lines starting with # are comments.
+# The public half of the key that signs latest.json (Ed25519, base64 of the 32 raw bytes), one line
+# (the private half is the repository secret ENGINE_SIGNING_KEY; generated by tools/release_manifest.py keygen).
+PVCqIahW5HtyZPq76zTSFBa+lK2bB2dKWScyb/4R3tY=