Skip to content
pi-c Artifact [bdf4cd5e6e]
Login

Artifact [bdf4cd5e6e]

Artifact bdf4cd5e6e7a6538540fe41e162050ec8303c2f90c9d5f8ecc1ee506ba164de4:


/* pic remote (remote.c): remote control over a relay, docs/design/remote-protocol.md. A phone is
 * one more sender and one more observer of the journal: pic remote dials out to the relay, speaks
 * a Noise session to each paired phone, turns each command into a journal row before anything acts
 * on it (an inbox row, or a keyed admission), and rebuilds events from committed rows as pic
 * attach does. It holds no lease and listens on no socket. Pairing (pic remote pair, and /rc
 * through it) makes the keys and the mailbox on first use and adds a device row after a yes at
 * the terminal; the rows are sealed in ~/.pic/pic.sqlite under the credential store's key. */
#ifndef PIC_REMOTE_H
#define PIC_REMOTE_H

typedef struct {
    const char *self; /* this pic, for the children a prompt starts */
    /* Draws a QR code of TEXT on stdout (the composition root owns the drawing). */
    void (*show_qr)(const char *text);
} pic_remote_options;

/* pic remote [pair [--pipe] | devices | unpair ID | reset]: the process's exit status. */
int pic_remote_main(const pic_remote_options *o, int argc, char **argv);

/* 1 when a pic remote is running for this user (its lock is held), else 0. No passphrase. */
int pic_remote_running(void);

/* The phone page's address for the conversation SESSION of the journal JOURNAL in WORKSPACE (a
 * real path): RELAY/#s=JOURNAL/SESSION, as pic remote lists it, with &c=PHONE when one phone is
 * paired (the page's id for this computer); RELAY/ alone, or #c=PHONE, when SESSION is NULL or "".
 * The number of paired phones, or -1 when it does not fit in CAP. No passphrase. */
int pic_remote_link(const char *workspace, const char *journal, const char *session, char *out, size_t cap);

/* The relay a pairing names when the setting remote.relay is unset. */
#define PIC_REMOTE_RELAY "https://remote.zeitforge.app"

#endif