Feature: Generate QR code on daemon start for operator to scan #7

Closed
opened 2026-02-20 15:23:49 +00:00 by Hermes · 0 comments

Problem

Currently avault daemon start just attempts to connect without showing the operator how to approve the connection. The CLI says "operator scans QR or approves in Amber" but never generates a QR code.

Proposed Solution

On daemon start, display a QR code (and text URI) for the operator to scan in Amber.

Important: Use nostrconnect:// format for QR

Amber expects nostrconnect:// URIs for scanning (client requesting approval), NOT bunker://.

QR code should contain:

nostrconnect://<AGENT_PUBKEY_HEX>?relay=wss://relay.damus.io&metadata={"name":"<AGENT_NAME>"}

Internal code still uses:

bunker://<SIGNER_PUBKEY_HEX>?relay=wss://relay.damus.io

Example Implementation

import qrcode
import urllib.parse
import json

def show_connection_qr(agent_pubkey_hex, relay, agent_name="avault"):
    metadata = json.dumps({"name": agent_name})
    uri = f"nostrconnect://{agent_pubkey_hex}?relay={relay}&metadata={urllib.parse.quote(metadata)}"
    
    print(f"Scan this QR in Amber to approve connection:")
    print()
    
    # Terminal QR
    qr = qrcode.QRCode(border=1)
    qr.add_data(uri)
    qr.make()
    qr.print_ascii(invert=True)
    
    print()
    print(f"Or paste: {uri}")

Expected Output

$ avault daemon start

Scan this QR in Amber to approve connection:

█▀▀▀▀▀█ ▄▄▄▄▄ █▀▀▀▀▀█
█ ███ █ █▄▄▄█ █ ███ █
...

Or paste: nostrconnect://f9fa1b...?relay=wss://relay.damus.io&metadata={"name":"Hermes"}

⏳ Waiting for Amber approval (120s)...
✅ Connected!

Benefit

The metadata.name field makes Amber display a friendly name (e.g., "Hermes") instead of the hex pubkey prefix.


Discovered during testing by Hermes 🪽

## Problem Currently `avault daemon start` just attempts to connect without showing the operator how to approve the connection. The CLI says "operator scans QR or approves in Amber" but never generates a QR code. ## Proposed Solution On `daemon start`, display a QR code (and text URI) for the operator to scan in Amber. ### Important: Use nostrconnect:// format for QR Amber expects `nostrconnect://` URIs for scanning (client requesting approval), NOT `bunker://`. **QR code should contain:** ``` nostrconnect://<AGENT_PUBKEY_HEX>?relay=wss://relay.damus.io&metadata={"name":"<AGENT_NAME>"} ``` **Internal code still uses:** ``` bunker://<SIGNER_PUBKEY_HEX>?relay=wss://relay.damus.io ``` ## Example Implementation ```python import qrcode import urllib.parse import json def show_connection_qr(agent_pubkey_hex, relay, agent_name="avault"): metadata = json.dumps({"name": agent_name}) uri = f"nostrconnect://{agent_pubkey_hex}?relay={relay}&metadata={urllib.parse.quote(metadata)}" print(f"Scan this QR in Amber to approve connection:") print() # Terminal QR qr = qrcode.QRCode(border=1) qr.add_data(uri) qr.make() qr.print_ascii(invert=True) print() print(f"Or paste: {uri}") ``` ## Expected Output ``` $ avault daemon start Scan this QR in Amber to approve connection: █▀▀▀▀▀█ ▄▄▄▄▄ █▀▀▀▀▀█ █ ███ █ █▄▄▄█ █ ███ █ ... Or paste: nostrconnect://f9fa1b...?relay=wss://relay.damus.io&metadata={"name":"Hermes"} ⏳ Waiting for Amber approval (120s)... ✅ Connected! ``` ## Benefit The `metadata.name` field makes Amber display a friendly name (e.g., "Hermes") instead of the hex pubkey prefix. --- *Discovered during testing by Hermes 🪽*
nazim closed this issue 2026-02-20 15:35:25 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nazim/avault#7
No description provided.