Skip to content

Commit c06834f

Browse files
committed
worked on new signing key for updater plugin
1 parent cb5beb7 commit c06834f

10 files changed

Lines changed: 51 additions & 89 deletions

File tree

.github/workflows/release.yml

Lines changed: 25 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ on:
1414
env:
1515
PYTHON_VERSION: '3.11'
1616
NODE_VERSION: '18'
17-
# Tauri updater signing key (set in GitHub Secrets)
18-
# TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
19-
# TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
17+
# Password is passed directly (can be empty)
18+
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
2019

2120
jobs:
2221
build-windows:
@@ -76,92 +75,37 @@ jobs:
7675
run: |
7776
copy backend\dist\backend_server-x86_64-pc-windows-msvc.exe frontend\src-tauri\
7877
79-
# Build the final application with signing enabled
80-
- name: Build Tauri application
81-
env:
82-
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
83-
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
78+
# Decode the secret and set the environment variable for the next step
79+
- name: Setup Signing Key
8480
run: |
85-
cd frontend
86-
87-
Write-Output "=== Debugging Signing Key Setup ==="
88-
89-
# Check Password
90-
if ($env:TAURI_SIGNING_PRIVATE_KEY_PASSWORD) {
91-
Write-Output "Password env var is set (length: $($env:TAURI_SIGNING_PRIVATE_KEY_PASSWORD.Length))"
92-
} else {
93-
Write-Warning "Password env var is EMPTY"
94-
}
95-
96-
# Decode Base64 directly to bytes and write to file (avoids BOM/encoding issues)
97-
try {
98-
# Try to decode as Base64 first (in case user encoded the key file)
99-
$bytes = [System.Convert]::FromBase64String($env:TAURI_SIGNING_PRIVATE_KEY)
100-
[System.IO.File]::WriteAllBytes("$PWD/tauri.key", $bytes)
101-
Write-Output "Successfully decoded Base64 key to tauri.key"
102-
} catch {
103-
# If Base64 decoding fails, assume it's the raw text content of the key
104-
Write-Output "Secret is not Base64, assuming raw key content."
105-
# Explicitly use UTF-8 NO BOM and Trim whitespace
106-
$keyContent = $env:TAURI_SIGNING_PRIVATE_KEY.Trim()
107-
$encoding = New-Object System.Text.UTF8Encoding $false
108-
[System.IO.File]::WriteAllText("$PWD/tauri.key", $keyContent, $encoding)
109-
Write-Output "Saved raw key content to tauri.key"
110-
}
81+
# 1. Get the Base64 secret
82+
$encoded = "${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}"
11183
112-
# Debug: Check file content (Hex dump start)
113-
if (Test-Path "tauri.key") {
114-
$len = (Get-Item 'tauri.key').Length
115-
Write-Output "Key file created. Size: $len bytes"
84+
if ($encoded) {
85+
# 2. Decode Base64 to text
86+
$bytes = [System.Convert]::FromBase64String($encoded)
87+
$decodedKey = [System.Text.Encoding]::UTF8.GetString($bytes)
11688
117-
# Hex dump first 16 bytes to check for BOM or corruption
118-
# Using Format-Hex which is available in PS 5.1 and Core
119-
try {
120-
$hex = Format-Hex -Path "tauri.key" -Count 16 | Out-String
121-
Write-Output "File Head (Hex):`n$hex"
122-
} catch {
123-
Write-Warning "Could not run Format-Hex: $_"
124-
}
89+
# 3. Write to a temporary file (frontend/tauri.key)
90+
$keyPath = Join-Path (Get-Location) "frontend/tauri.key"
91+
[System.IO.File]::WriteAllText($keyPath, $decodedKey)
12592
126-
# Verify header text
127-
$firstLine = Get-Content "tauri.key" -TotalCount 1
128-
Write-Output "First line text: $firstLine"
93+
# 4. Set the environment variable to the FILE PATH
94+
# This is the equivalent of 'export' but for GitHub Actions Windows runners
95+
echo "TAURI_SIGNING_PRIVATE_KEY=$keyPath" >> $env:GITHUB_ENV
12996
130-
if ($firstLine -notmatch "^untrusted comment:") {
131-
Write-Warning "Key file does not start with 'untrusted comment:'"
132-
}
97+
Write-Host "Success: Signing key decoded and saved to $keyPath"
98+
} else {
99+
Write-Warning "TAURI_SIGNING_PRIVATE_KEY secret is missing!"
133100
}
134-
135-
# Strategy: Pass the content to Tauri
136-
# We reload it from the file to ensure we use the clean version we just wrote
137-
$env:TAURI_SIGNING_PRIVATE_KEY = [System.IO.File]::ReadAllText("$PWD/tauri.key")
138-
Write-Output "Setting TAURI_SIGNING_PRIVATE_KEY to clean key content (length: $($env:TAURI_SIGNING_PRIVATE_KEY.Length))"
139-
140-
npm run tauri build
141101
142-
# Debug: List all files in bundle directory to see if .sig files were created
143-
- name: Debug - List bundle files
102+
# Build the final application
103+
- name: Build Tauri application
144104
run: |
145-
Write-Output "=== Checking if signing key is set ==="
146-
if ($env:TAURI_SIGNING_PRIVATE_KEY) {
147-
Write-Output "TAURI_SIGNING_PRIVATE_KEY is SET (length: $($env:TAURI_SIGNING_PRIVATE_KEY.Length))"
148-
} else {
149-
Write-Output "WARNING: TAURI_SIGNING_PRIVATE_KEY is NOT SET - signatures will be empty!"
150-
}
151-
152-
Write-Output "`n=== Files in msi folder ==="
153-
Get-ChildItem -Path "frontend\src-tauri\target\release\bundle\msi" -Recurse | ForEach-Object { Write-Output $_.FullName }
154-
155-
Write-Output "`n=== Files in nsis folder (if exists) ==="
156-
if (Test-Path "frontend\src-tauri\target\release\bundle\nsis") {
157-
Get-ChildItem -Path "frontend\src-tauri\target\release\bundle\nsis" -Recurse | ForEach-Object { Write-Output $_.FullName }
158-
}
159-
160-
Write-Output "`n=== Looking for .sig files ==="
161-
Get-ChildItem -Path "frontend\src-tauri\target\release\bundle" -Recurse -Filter "*.sig" | ForEach-Object {
162-
Write-Output "Found signature: $($_.FullName)"
163-
Write-Output "Content: $(Get-Content $_.FullName -Raw)"
164-
}
105+
cd frontend
106+
npm run tauri build
107+
108+
165109
166110
# Generate checksums for verification
167111
- name: Generate checksums

frontend/.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,6 @@ coverage
3333

3434
# Tauri secret files
3535
tauri-*.key
36-
tauri-*.key.pub
36+
tauri-*.key.pub
37+
38+
.tauri

frontend/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/src-tauri/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ tokio = { version = "1.46.0", features = ["time"] }
2828
tauri-plugin-updater = "2.9.0"
2929
tauri-plugin-process = "2.3.1"
3030

31+
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
32+
tauri-plugin-updater = "2"
33+

frontend/src-tauri/capabilities/default.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"updater:allow-download",
1616
"updater:allow-install",
1717
"process:allow-restart",
18-
"process:allow-exit"
18+
"process:allow-exit",
19+
"updater:allow-download-and-install"
1920
]
2021
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"identifier": "desktop-capability",
3+
"platforms": [
4+
"macOS",
5+
"windows",
6+
"linux"
7+
],
8+
"windows": [
9+
"main"
10+
],
11+
"permissions": [
12+
"updater:default"
13+
]
14+
}

frontend/src-tauri/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::sync::{Arc, Mutex};
22
use std::time::Duration;
33
use tauri::{Emitter, Manager, State, WindowEvent};
44
use tauri_plugin_shell::{process::{CommandChild, CommandEvent}, ShellExt};
5+
use tauri_plugin_updater::UpdaterExt;
56

67
#[derive(Default)]
78
struct BackendInfo {

frontend/src-tauri/tauri.conf.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
"endpoints": [
4242
"https://github.com/ashesbloom/LocalLens/releases/latest/download/latest.json"
4343
],
44-
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDdGQkFFNkRDRUQ1REQ5QzAKUldUQTJWM3QzT2E2ZjhCck5mV2hhY1VKc05xMDVUa0Q0TUh4cUZSTnFDMHN2VVRuVkVkaW1laXYK"
45-
}
44+
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEFFOTI4RDBEODlBNTFERjUKUldUMUhhV0pEWTJTcnUreGZtb2pSYkl5ejAyYWdNa2Fhalc1c212S2pvWlpYYUtOMXRzcndhZmUK"
4645
}
4746
}

test_bom.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

test_nobom.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)