Skip to content

Commit 3f8e6d8

Browse files
feat(electron): add passkey support (#8850)
Co-authored-by: wobsoriano <sorianorobertc@gmail.com>
1 parent 71f06ee commit 3f8e6d8

53 files changed

Lines changed: 5208 additions & 16 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Electron Passkeys Native Build
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths:
7+
- 'packages/electron-passkeys/**'
8+
- '.github/workflows/electron-passkeys.yml'
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
build:
16+
name: Build ${{ matrix.settings.target }}
17+
runs-on: ${{ matrix.settings.host }}
18+
timeout-minutes: 30
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
settings:
23+
- host: macos-14
24+
target: aarch64-apple-darwin
25+
- host: macos-14
26+
target: x86_64-apple-darwin
27+
- host: windows-latest
28+
target: x86_64-pc-windows-msvc
29+
- host: windows-latest
30+
target: aarch64-pc-windows-msvc
31+
defaults:
32+
run:
33+
working-directory: packages/electron-passkeys
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- uses: actions/setup-node@v4
38+
with:
39+
node-version: 24
40+
41+
- uses: pnpm/action-setup@v4
42+
43+
- uses: dtolnay/rust-toolchain@stable
44+
with:
45+
targets: ${{ matrix.settings.target }}
46+
47+
- uses: Swatinem/rust-cache@v2
48+
with:
49+
workspaces: packages/electron-passkeys
50+
51+
- name: Install dependencies
52+
run: pnpm install --filter @clerk/electron-passkeys... --frozen-lockfile --ignore-scripts
53+
working-directory: .
54+
55+
- name: Build native module
56+
run: pnpm build --target ${{ matrix.settings.target }}
57+
58+
- name: Smoke test (host-native targets only)
59+
if: matrix.settings.target == 'aarch64-apple-darwin' || matrix.settings.target == 'x86_64-pc-windows-msvc'
60+
run: node -e "const m = require('./index.js'); console.log('isAvailable:', m.isAvailable(), 'capabilities:', JSON.stringify(m.capabilities())); if (!m.isAvailable()) throw new Error('the loader did not find the freshly built native binary');"
61+
62+
- uses: actions/upload-artifact@v4
63+
with:
64+
name: bindings-${{ matrix.settings.target }}
65+
path: packages/electron-passkeys/electron-passkeys.*.node
66+
if-no-files-found: error
67+
68+
package:
69+
name: Assemble platform packages
70+
needs: build
71+
runs-on: ubuntu-latest
72+
timeout-minutes: 10
73+
defaults:
74+
run:
75+
working-directory: packages/electron-passkeys
76+
steps:
77+
- uses: actions/checkout@v4
78+
79+
- uses: actions/setup-node@v4
80+
with:
81+
node-version: 24
82+
83+
- uses: pnpm/action-setup@v4
84+
85+
- name: Install dependencies
86+
run: pnpm install --filter @clerk/electron-passkeys... --frozen-lockfile --ignore-scripts
87+
working-directory: .
88+
89+
- uses: actions/download-artifact@v4
90+
with:
91+
path: packages/electron-passkeys/artifacts
92+
93+
- name: Move binaries into per-platform npm packages
94+
run: pnpm artifacts
95+
96+
- name: Verify every platform package contains its binary
97+
run: |
98+
for dir in npm/*/; do
99+
count=$(find "$dir" -name '*.node' | wc -l)
100+
if [ "$count" -ne 1 ]; then
101+
echo "::error::$dir is missing its .node binary — publishing it would ship an empty package"
102+
exit 1
103+
fi
104+
(cd "$dir" && npm pack --dry-run)
105+
done
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
target/
2+
*.node
3+
artifacts/
4+
# napi-generated type defs for the raw native binding (the public surface is
5+
# the hand-written index.js/index.d.ts loader)
6+
native.d.ts

0 commit comments

Comments
 (0)