V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
join
V2EX  ›  Electron

electron mac store 应用签名上架求助

  •  
  •   join ·
    leyafo · 98 天前 · 855 次点击
    这是一个创建于 98 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我这几天一直在和签名相关的问题搏斗,能做的事情已经全都做了。现在应用一直卡在 testflight 安装后报错。 报错的原因是我们用了 better-sqlite3 这个库,以下是报错信息。

    A JavaScript error occurred in the main process  
    Uncaught Exception:  
    Error: dlopen(/Users/sergey/Library/Containers/com.slippod.dev1/Data/tmp/.DN5KWP78X9.com.slippod.dev1.3r1lqH, 0x0001): tried: '/Users/sergey/Library/Containers/com.slippod.dev1/Data/tmp/.DN5KWP78X9.com.slippod.dev1.3r1lqH' (code signature invalid in <B7BF9AE3-92D4-3E60-9D1F-E80E213B4689> '/Users/sergey/Library/Containers/com.slippod.dev1/Data/tmp/.DN5KWP78X9.com.slippod.dev1.3r1lqH' (errno=1)  
    slice Offset=0x00204000, codeBlob Offset=0x001D3B50, codeBlobSize=0x0000AD80),  
    '/System/Volumes/Preboot/Cryptexes/OS/Users/sergey/Library/Containers/com.slippod.dev1/Data/tmp/.DN5KWP78X9.com.slippod.dev1.3r1lqH' (no such file), '/Users/sergey/Library/Containers/com.slippod.dev1/Data/tmp/.DN5KWP78X9.com.slippod.dev1.3r1lqH' (code signature invalid in <B7BF9AE3-92D4-3E60-9D1F-E80E213B4689> '/Users/sergey/Library/Containers/com.slippod.dev1/Data/tmp/.DN5KWP78X9.com.slippod.dev1.3r1lqH' (errno=1)  
    slice Offset=0x00204000, code Blob Offset=0x001D3B50, codeBlobSize=0x0000AD80)  
    at process.func [as dlopen] (node:electron/js2c/asar_bundle:2:1869)  
    at Module._extensions..node (node:internal/modules/cjs/loader: 1326:18)  
    at Object.func [as .node] (node: electron/js2c/asar_bundle:2:2096)  
    at Module.load (node:internal/modules/cjs/loader: 1096:32)  
    at Module._load (node:internal/modules/cjs/loader: 937:12)  
    at f._load (node: electron/js2c/asar_bundle:2:13377)  
    at Module.require (node:internal/modules/cjs/loader: 1120:19)  
    at require (node:internal/modules/cjs/helpers:103:18)  
    at bindings (/Applications/slippod-1.localized/slippod.app/Contents/Resources/app.asar/node_modules/bindings/bindings.js:112:48)  
    at new Database (/Applications/slippod-1.localized/slippod.app/Contents/Resources/app.asar/node_modules/better-sqlite3/lib/database.js:48:64)  
    

    我在网上看到有人遇到了类似的问题,他说把 native module 的 .node 文件单独签名就好了。

    https://github.com/WiseLibs/better-sqlite3/issues/1110

    我自己在构建脚本里面甚至单独的把 asar 解开,然后单独签名,再 asar pack 打包回去都没用。我在 testflight 应用的安装机器里面检查了签名,发现签名是对的。以下是签名用的命令:

    xcrun codesign --entitlements ./build/entitlements.mas.plist --sign $identity --timestamp --options runtime --force tmp_app/node_modules/better-sqlite3/build/Release/better_sqlite3.node
    

    以下是目标安装机器获得的签名信息:

    codesign -dv --verbose=4 /tmp/1/node_modules/better-sqlite3/build/Release/better_sqlite3.node 
    Executable=/private/tmp/1/node_modules/better-sqlite3/build/Release/better_sqlite3.node
    Identifier=better_sqlite3
    Format=Mach-O universal (x86_64 arm64)
    CodeDirectory v=20500 size=15258 flags=0x10000(runtime) hashes=468+5 location=embedded
    VersionPlatform=1
    VersionMin=720896
    VersionSDK=852224
    Hash type=sha256 size=32
    CandidateCDHash sha1=3b6b239e386494b89e02e410599007bc5fadbe86
    CandidateCDHashFull sha1=3b6b239e386494b89e02e410599007bc5fadbe86
    CandidateCDHash sha256=ede31015cf4d6a33deec42f8e2f96d68ad761b80
    CandidateCDHashFull sha256=ede31015cf4d6a33deec42f8e2f96d68ad761b8096973c8dc0e7cf238ae1b542
    Hash choices=sha1,sha256
    CMSDigest=cc4210ec569d3604c006be3785bf02944ba0e250ce30933be60ab71b09ed851d
    CMSDigestType=2
    Executable Segment base=0
    Executable Segment limit=1753088
    Executable Segment flags=0x0
    Page size=4096
    CDHash=ede31015cf4d6a33deec42f8e2f96d68ad761b80
    Signature size=9234
    Authority=Apple Distribution: Company TECHNOLOGY CO., LTD (*****)
    Authority=Apple Worldwide Developer Relations Certification Authority
    Authority=Apple Root CA
    Timestamp=Aug 15, 2024 at 11:06:17
    Info.plist=not bound
    TeamIdentifier=DN5KWP78X9
    Runtime Version=13.1.0
    Sealed Resources=none
    Internal requirements count=1 size=208
    
    

    几乎能用的办法都用过了。 应用是用的 electrion-builder 打包的,本来用它自带的签名工具,但一直有问题。后来换了 osx-sign 也同样有问题。 以下是我用的包信息:

            "better-sqlite3": "^8.6.0",
            "@electron/osx-sign": "^1.3.1",
            "electron": "^24.2.0",
            "electron-builder": "25.0.3",
    

    我看这里有 electron 社区的开发人员, @BlackHole1 能否抽空帮忙看下?

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5154 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 09:30 · PVG 17:30 · LAX 01:30 · JFK 04:30
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.