Replace shared bearer token with registered Ed25519 client keys.
This commit is contained in:
@@ -16,14 +16,9 @@ if (-not (Test-Path $CmdPath)) {
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $StateDir | Out-Null
|
||||
if (-not (Test-Path $TokenPath) -or -not (Get-Content -Raw $TokenPath).Trim()) {
|
||||
$bytes = New-Object byte[] 32
|
||||
[System.Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($bytes)
|
||||
$token = -join ($bytes | ForEach-Object { $_.ToString("x2") })
|
||||
[System.IO.File]::WriteAllText($TokenPath, $token)
|
||||
Write-Host "wrote $TokenPath"
|
||||
} else {
|
||||
Write-Host "kept existing token at $TokenPath"
|
||||
if (Test-Path $TokenPath) {
|
||||
Remove-Item -Force $TokenPath
|
||||
Write-Host "removed leftover shared token $TokenPath"
|
||||
}
|
||||
|
||||
$manifest = @{
|
||||
@@ -42,6 +37,6 @@ Set-ItemProperty -Path $regPath -Name "(default)" -Value $ManifestPath
|
||||
Write-Host "registered $regPath"
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Next: in Firefox open about:debugging#/runtime/this-firefox"
|
||||
Write-Host "Load Temporary Add-on and pick extension\manifest.json"
|
||||
Write-Host "Token is read from $TokenPath (Authorization: Bearer ...)"
|
||||
Write-Host "Register a client key for tooling (private key stays out of $StateDir):"
|
||||
Write-Host " python tools\register_client.py add --name cursor-agent --write-key `$HOME\.fab\cursor-agent.json"
|
||||
Write-Host "Then load the extension and set FAB_KEY_FILE to that path."
|
||||
|
||||
Reference in New Issue
Block a user