()
| 601 | } |
| 602 | |
| 603 | async function signDesktopAppIfNeeded() { |
| 604 | if (!signDesktopApp || !desktopAppPath || process.platform !== "darwin") { |
| 605 | return; |
| 606 | } |
| 607 | |
| 608 | if (!fs.existsSync(desktopAppPath)) { |
| 609 | throw new Error(`Desktop app path does not exist: ${desktopAppPath}`); |
| 610 | } |
| 611 | |
| 612 | const signature = await runCommand( |
| 613 | "desktop-codesign-check", |
| 614 | "codesign", |
| 615 | ["-dv", "--verbose=4", desktopAppPath], |
| 616 | { allowFailure: true }, |
| 617 | ); |
| 618 | const verification = await runCommand( |
| 619 | "desktop-codesign-verify", |
| 620 | "codesign", |
| 621 | ["--verify", "--deep", "--strict", desktopAppPath], |
| 622 | { allowFailure: true }, |
| 623 | ); |
| 624 | if ( |
| 625 | signature.code === 0 && |
| 626 | verification.code === 0 && |
| 627 | signature.stderr.includes(`Identifier=${desktopBundleId}`) |
| 628 | ) { |
| 629 | return; |
| 630 | } |
| 631 | |
| 632 | if (!fs.existsSync(desktopEntitlementsPath)) { |
| 633 | throw new Error( |
| 634 | `Desktop entitlements path does not exist: ${desktopEntitlementsPath}`, |
| 635 | ); |
| 636 | } |
| 637 | |
| 638 | await runCommand("desktop-codesign", "codesign", [ |
| 639 | "--force", |
| 640 | "--deep", |
| 641 | "--sign", |
| 642 | "-", |
| 643 | "--identifier", |
| 644 | desktopBundleId, |
| 645 | "--entitlements", |
| 646 | desktopEntitlementsPath, |
| 647 | desktopAppPath, |
| 648 | ]); |
| 649 | } |
| 650 | |
| 651 | async function openDeepLink(name, action) { |
| 652 | const value = JSON.stringify(action); |
no test coverage detected