-
Notifications
You must be signed in to change notification settings - Fork 1
feat: productize desktop and phone onboarding #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3577858
feat: productize desktop and phone onboarding
wolfiesch 0667d63
fix: keep QR card token native
wolfiesch 7fab7c2
fix: verify private phone route before QR
wolfiesch ddb7e9c
fix: harden onboarding release paths
wolfiesch 2df771a
Merge remote-tracking branch 'origin/main' into codex/production-onbo…
wolfiesch 5140fb2
chore: pin verified fast OMP runtime
wolfiesch 3b100cb
Merge remote-tracking branch 'origin/main' into codex/production-onbo…
wolfiesch 365e213
release: publish OMP 17.0.5 runtime
wolfiesch 7e9405c
test: update OMP 17.0.5 release assertions
wolfiesch 1071ed8
Merge remote-tracking branch 'origin/main' into codex/production-onbo…
wolfiesch fbea0a2
release: publish app-wire 0.6.1 provenance
wolfiesch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ target/ | |
| dist/ | ||
| dist-electron/ | ||
| /release/ | ||
| /.artifacts/ | ||
| .vite-plus/ | ||
| *.tsbuildinfo | ||
| /.worktrees/ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| <plist version="1.0"> | ||
| <dict> | ||
| <key>com.apple.security.cs.allow-jit</key> | ||
| <true/> | ||
| <key>com.apple.security.cs.allow-unsigned-executable-memory</key> | ||
| <true/> | ||
| </dict> | ||
| </plist> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| import { createHash, randomUUID } from "node:crypto"; | ||
| import { chmod, copyFile, mkdir, readFile, rename, stat, unlink } from "node:fs/promises"; | ||
| import { join } from "node:path"; | ||
|
|
||
| export interface BundledRuntimeManifest { | ||
| readonly version: 1; | ||
| readonly tag: string; | ||
| readonly platform: "darwin"; | ||
| readonly arch: "arm64"; | ||
| readonly executable: "omp"; | ||
| readonly size: number; | ||
| readonly sha256: string; | ||
| } | ||
|
|
||
| function decodeManifest(value: unknown): BundledRuntimeManifest { | ||
| const record = value as Partial<BundledRuntimeManifest> | null; | ||
| if ( | ||
| record?.version !== 1 || | ||
| record.platform !== "darwin" || | ||
| record.arch !== "arm64" || | ||
| record.executable !== "omp" || | ||
| typeof record.tag !== "string" || | ||
| !/^t4code-[0-9]+\.[0-9]+\.[0-9]+-appserver-[1-9][0-9]*$/u.test(record.tag) || | ||
| !Number.isSafeInteger(record.size) || | ||
| (record.size ?? 0) < 1 || | ||
| typeof record.sha256 !== "string" || | ||
| !/^[0-9a-f]{64}$/u.test(record.sha256) | ||
| ) throw new Error("bundled OMP runtime manifest is invalid"); | ||
| return record as BundledRuntimeManifest; | ||
| } | ||
|
|
||
| async function matches(path: string, manifest: BundledRuntimeManifest): Promise<boolean> { | ||
| try { | ||
| if ((await stat(path)).size !== manifest.size) return false; | ||
| const hash = createHash("sha256").update(await readFile(path)).digest("hex"); | ||
| return hash === manifest.sha256; | ||
| } catch { | ||
| return false; | ||
| } | ||
| } | ||
|
|
||
| export async function installBundledOmpRuntime(options: { | ||
| readonly resourcesPath: string; | ||
| readonly applicationSupportPath: string; | ||
| }): Promise<string> { | ||
| const sourceRoot = join(options.resourcesPath, "runtime"); | ||
| const manifest = decodeManifest(JSON.parse(await readFile(join(sourceRoot, "manifest.json"), "utf8"))); | ||
| const source = join(sourceRoot, manifest.executable); | ||
| if (!(await matches(source, manifest))) throw new Error("bundled OMP runtime failed its integrity check"); | ||
| const destinationRoot = join(options.applicationSupportPath, "runtime", manifest.tag); | ||
| const destination = join(destinationRoot, "omp"); | ||
| if (await matches(destination, manifest)) { | ||
| await chmod(destination, 0o755); | ||
| return destination; | ||
| } | ||
| await mkdir(destinationRoot, { recursive: true, mode: 0o700 }); | ||
| const temporary = join(destinationRoot, `.omp-${randomUUID()}.partial`); | ||
| try { | ||
| await copyFile(source, temporary); | ||
| await chmod(temporary, 0o755); | ||
| if (!(await matches(temporary, manifest))) throw new Error("installed OMP runtime failed its integrity check"); | ||
| await rename(temporary, destination); | ||
| } finally { | ||
| await unlink(temporary).catch(() => {}); | ||
| } | ||
| return destination; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.