# nostr-id-tui

Boot-time terminal identity UI for n-OS-tr.

Current local implementation provides a functional ncurses flow:

- Main menu
- Enter existing mnemonic -> validate -> derive account 0 `npub`
- Generate new mnemonic -> derive account 0 `npub` -> show random confirmation positions

## Local host dev loop (fast iteration)

Use the wrapper script to auto-bootstrap `nostr_core_lib` (if missing), rebuild, and run in your current terminal:

```bash
./stack/nostr-id-tui/dev.sh
```

What it does:

1. If `includes/nostr_core_lib/libnostr_core_x64.a` is missing, builds it with `./build.sh x64`.
2. Configures `stack/nostr-id-tui/build-host` with CMake.
3. Rebuilds `nostr-id-tui` for host.
4. Runs it with `TERM=${TERM:-xterm-256color}`.

Manual equivalent (if preferred):

```bash
cmake -S stack/nostr-id-tui -B stack/nostr-id-tui/build-host
cmake --build stack/nostr-id-tui/build-host -j
TERM=xterm-256color ./stack/nostr-id-tui/build-host/nostr-id-tui
```

## Static Docker build (musl, reproducible)

This path now builds `nostr_core_lib` inside Alpine and links `nostr-id-tui` fully static against musl.

```bash
./stack/nostr-id-tui/build_static.sh
```

Output:

- `stack/nostr-id-tui/build/nostr-id-tui_static_x86_64`

## Notes

- Uses upstream helpers from `nostr_core_lib`:
  - `nostr_secure_memory`
  - `nostr_bip39_ui`
  - `nostr_generate_mnemonic_and_keys`
  - `nostr_derive_keys_from_mnemonic`
- Identity-agent IPC and systemd boot wiring are intentionally out of scope for this step.
