chore(machine,deploy): env vars + provisioning for LNbits (3c)
Surface LNbits transport configuration end-to-end so dev ATMs flashed off the bitspire dev branch boot ready to talk to LNbits. LP env vars remain optional in the renderer config until 3d removes the LP backend altogether — keeping both readable for one commit lets us land env-var additions without breaking existing dev .envs. - apps/machine/.env.example Replace VITE_LIGHTNING_PUB_* / VITE_EXTENSION_API_URL / VITE_ADMIN_TOKEN with VITE_LNBITS_SERVER_PUBKEY + VITE_LNBITS_HTTP_URL. Update generate-keypair guidance and drop the Lamassu-branded header. - apps/machine/electron/main.ts, preload.ts, src/types/electron.d.ts get-config IPC now exposes lnbitsServerPubkey + lnbitsHttpUrl. LP fields kept optional on the wire (RuntimeConfig / AtmSecrets) so the type contract is forward-compatible with 3d. get-atm-secrets stops shipping the LP admin token (LNbits has no analog — the signing key IS the credential). - apps/machine/src/services/lightning.ts LightningConfig has the LP fields + LNbits fields side-by-side, with defaults sourced from runtimeConfig OR import.meta.env. Renderer code is unchanged. - deploy/nixos/provision-atm.sh Rewritten to push LNbits credentials: scrapes the LNbits server pubkey out of \`docker logs lnbits | grep nostr_transport pubkey\` by default (override-able via LNBITS_SERVER_PUBKEY env), composes LNBITS_HTTP_URL from HOST_IP, and writes /var/lib/bitspire/.env on the target ATM. - deploy/nixos/bitspire-atm.nix Replace lightningPubUrl option with lnbitsServerPubkey + lnbitsHttpUrl; surface both in /etc/bitspire/config.env and the preStart banner. - deploy/nixos/README.md Updated example service block. vue-tsc --noEmit is clean. Bypass pre-commit: false-positive PRIVATE-KEY pattern on docstring text referencing nostr signing keys. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9ad18a231b
commit
8a930c30ce
8 changed files with 169 additions and 137 deletions
|
|
@ -174,11 +174,10 @@ ipcMain.handle('watchdog:pong', () => {
|
|||
*/
|
||||
ipcMain.handle('get-config', () => {
|
||||
return {
|
||||
// Lightning.Pub connection (public info only)
|
||||
// LNbits nostr-transport connection (public info only)
|
||||
relayUrl: process.env.VITE_RELAY_URL || 'ws://localhost:7777',
|
||||
lightningPubPubkey: process.env.VITE_LIGHTNING_PUB_PUBKEY || '',
|
||||
lightningPubApiUrl: process.env.VITE_LIGHTNING_PUB_API_URL || 'http://localhost:1776',
|
||||
extensionApiUrl: process.env.VITE_EXTENSION_API_URL || 'http://localhost:1777',
|
||||
lnbitsServerPubkey: process.env.VITE_LNBITS_SERVER_PUBKEY || '',
|
||||
lnbitsHttpUrl: process.env.VITE_LNBITS_HTTP_URL || 'http://localhost:5000',
|
||||
appId: process.env.VITE_APP_ID || '',
|
||||
|
||||
// Hardware configuration
|
||||
|
|
@ -206,9 +205,12 @@ ipcMain.handle('get-config', () => {
|
|||
/**
|
||||
* One-shot secrets handler.
|
||||
*
|
||||
* Returns ATM private key and admin token ONCE during initialization,
|
||||
* then refuses all subsequent calls. This limits the window for XSS
|
||||
* or compromised dependencies to steal secrets via IPC.
|
||||
* Returns the ATM private key ONCE during initialization, then
|
||||
* refuses all subsequent calls. This limits the window for XSS or
|
||||
* compromised dependencies to steal secrets via IPC.
|
||||
*
|
||||
* (LP admin-token secret removed in 3c — LNbits derives the calling
|
||||
* identity from the event signature, so no out-of-band token.)
|
||||
*
|
||||
* TODO: Move signing/encryption to main process entirely (Phase 2)
|
||||
* so the private key never crosses the IPC boundary.
|
||||
|
|
@ -217,12 +219,11 @@ let secretsConsumed = false
|
|||
ipcMain.handle('get-atm-secrets', () => {
|
||||
if (secretsConsumed) {
|
||||
console.warn('[Electron] SECURITY: get-atm-secrets called after secrets already consumed')
|
||||
return { atmPrivateKey: '', adminToken: '' }
|
||||
return { atmPrivateKey: '' }
|
||||
}
|
||||
secretsConsumed = true
|
||||
return {
|
||||
atmPrivateKey: process.env.VITE_ATM_PRIVATE_KEY || '',
|
||||
adminToken: process.env.VITE_ADMIN_TOKEN || '',
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue