feat(machine): seed + bunker-binding IPC bridge
get-atm-secrets now returns { spireSeed, bunkerBinding } instead of the raw
nsec (one-shot semantics kept). Adds IPC handlers + preload bindings for
saveBunkerBinding / clearBunkerBinding / resetBootstrapGate so the renderer
can persist a pairing and re-arm the cassette-state hello on re-pair (#56).
resetBootstrapGate added to state-store. Types mirrored in electron.d.ts.
Part of Phase C, aiolabs/bitspire#52.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
40239aa075
commit
209e4c3e20
4 changed files with 75 additions and 8 deletions
|
|
@ -42,13 +42,25 @@ export interface BrandingConfig {
|
|||
logoDarkDataUrl: string | null
|
||||
}
|
||||
|
||||
/**
|
||||
* Persisted NIP-46 bunker binding (mirror of state-store's StoredBunkerBinding).
|
||||
*/
|
||||
export interface BunkerBindingRecord {
|
||||
clientSecretHex: string
|
||||
spirePubkey: string
|
||||
bunkerUrl: string
|
||||
seedFingerprint: string
|
||||
pairedAt: number
|
||||
}
|
||||
|
||||
/**
|
||||
* ATM secrets — returned once by getAtmSecrets(), then empty on subsequent calls.
|
||||
* The spire pairing seed (carries the one-shot connect token) plus the persisted
|
||||
* bunker binding; the renderer resolves these into a signer.
|
||||
*/
|
||||
export interface AtmSecrets {
|
||||
atmPrivateKey: string
|
||||
/** Legacy LP admin token — retained until 3d removes the LP backend. */
|
||||
adminToken?: string
|
||||
spireSeed: string
|
||||
bunkerBinding: BunkerBindingRecord | null
|
||||
}
|
||||
|
||||
// Expose protected methods to renderer
|
||||
|
|
@ -100,6 +112,13 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
|||
ipcRenderer.invoke('state:get-bootstrap-published-at'),
|
||||
markBootstrapPublished: (unixTimestamp: number): Promise<void> =>
|
||||
ipcRenderer.invoke('state:mark-bootstrap-published', unixTimestamp),
|
||||
|
||||
// Bunker binding persistence (aiolabs/bitspire#52)
|
||||
saveBunkerBinding: (binding: BunkerBindingRecord): Promise<void> =>
|
||||
ipcRenderer.invoke('state:save-bunker-binding', binding),
|
||||
clearBunkerBinding: (): Promise<void> => ipcRenderer.invoke('state:clear-bunker-binding'),
|
||||
resetBootstrapGate: (): Promise<void> => ipcRenderer.invoke('state:reset-bootstrap-gate'),
|
||||
|
||||
applyOperatorCassettesConfig: (
|
||||
payload: {
|
||||
positions: Record<string, { denomination: number; count: number }>
|
||||
|
|
@ -212,6 +231,9 @@ declare global {
|
|||
getLastKnownConfigCreatedAt: () => Promise<number>
|
||||
getBootstrapPublishedAt: () => Promise<number | null>
|
||||
markBootstrapPublished: (unixTimestamp: number) => Promise<void>
|
||||
saveBunkerBinding: (binding: BunkerBindingRecord) => Promise<void>
|
||||
clearBunkerBinding: () => Promise<void>
|
||||
resetBootstrapGate: () => Promise<void>
|
||||
applyOperatorCassettesConfig: (
|
||||
payload: { positions: Record<string, { denomination: number; count: number }> },
|
||||
eventCreatedAt: number
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue