v0.1.17 - Changed role menu option 2 to NIP-06 compatible Nostr range m/44'/1237'/*'/0/0
This commit is contained in:
@@ -500,7 +500,7 @@ The wizard presents a **preset menu** of 10 options covering the common role typ
|
|||||||
```
|
```
|
||||||
Wizard preset menu:
|
Wizard preset menu:
|
||||||
1. Standard Nostr (NIP-06): secp256k1, m/44'/1237'/0'/0/0
|
1. Standard Nostr (NIP-06): secp256k1, m/44'/1237'/0'/0/0
|
||||||
2. Standard Nostr hardened range: secp256k1, m/44'/1237'/*'/0'/0'
|
2. Standard Nostr range: secp256k1, m/44'/1237'/*'/0/0
|
||||||
3. Nostr agent range (hardened): secp256k1, m/44'/1237'/*'/1'/0'
|
3. Nostr agent range (hardened): secp256k1, m/44'/1237'/*'/1'/0'
|
||||||
4. SSH role: ed25519, m/44'/102001'/0'/0'/0'
|
4. SSH role: ed25519, m/44'/102001'/0'/0'/0'
|
||||||
5. Age/x25519 role: x25519, m/44'/102002'/0'/0'/0'
|
5. Age/x25519 role: x25519, m/44'/102002'/0'/0'/0'
|
||||||
|
|||||||
@@ -126,6 +126,10 @@ if [ "$ARCH" != "$HOST_ARCH" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[1/3] Building builder stage from project root context"
|
echo "[1/3] Building builder stage from project root context"
|
||||||
|
# Remove previous builder image to avoid dangling <none> images piling up
|
||||||
|
# across repeated builds (each rebuild untagges the old image, leaving ~422MB
|
||||||
|
# of garbage per build otherwise).
|
||||||
|
docker rmi "$IMAGE_TAG" >/dev/null 2>&1 || true
|
||||||
docker buildx build \
|
docker buildx build \
|
||||||
--platform "$PLATFORM" \
|
--platform "$PLATFORM" \
|
||||||
--target builder \
|
--target builder \
|
||||||
@@ -168,3 +172,7 @@ echo ""
|
|||||||
echo "Build complete:"
|
echo "Build complete:"
|
||||||
echo " $BUILD_DIR/$OUTPUT_NAME"
|
echo " $BUILD_DIR/$OUTPUT_NAME"
|
||||||
echo " $BUILD_DIR/$CLIENT_NAME"
|
echo " $BUILD_DIR/$CLIENT_NAME"
|
||||||
|
|
||||||
|
# Prune stale build cache older than 24h to prevent unbounded cache growth
|
||||||
|
# from repeated buildx builds. Recent layers are kept for fast rebuilds.
|
||||||
|
docker builder prune -af --filter "until=24h" >/dev/null 2>&1 || true
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ Default is E; you can also paste full mnemonic here.
|
|||||||
```
|
```
|
||||||
Define a role:
|
Define a role:
|
||||||
1. Standard Nostr (NIP-06): secp256k1, m/44'/1237'/0'/0/0
|
1. Standard Nostr (NIP-06): secp256k1, m/44'/1237'/0'/0/0
|
||||||
2. Standard Nostr hardened range: secp256k1, m/44'/1237'/*'/0'/0'
|
2. Standard Nostr range: secp256k1, m/44'/1237'/*'/0/0
|
||||||
3. Nostr agent range (hardened): secp256k1, m/44'/1237'/*'/1'/0'
|
3. Nostr agent range (hardened): secp256k1, m/44'/1237'/*'/1'/0'
|
||||||
4. SSH role: ed25519, m/44'/102001'/0'/0'/0'
|
4. SSH role: ed25519, m/44'/102001'/0'/0'/0'
|
||||||
5. Age/x25519 role: x25519, m/44'/102002'/0'/0'/0'
|
5. Age/x25519 role: x25519, m/44'/102002'/0'/0'/0'
|
||||||
@@ -70,7 +70,7 @@ Define a role:
|
|||||||
| Choice | Default name | Default path | Curve | Purpose |
|
| Choice | Default name | Default path | Curve | Purpose |
|
||||||
|--------|-------------|-------------|-------|---------|
|
|--------|-------------|-------------|-------|---------|
|
||||||
| 1 | `main` | `m/44'/1237'/0'/0/0` | secp256k1 | nostr |
|
| 1 | `main` | `m/44'/1237'/0'/0/0` | secp256k1 | nostr |
|
||||||
| 2 | `nostr_hardened` | `m/44'/1237'/*'/0'/0'` | secp256k1 | nostr |
|
| 2 | `nostr_range` | `m/44'/1237'/*'/0/0` | secp256k1 | nostr |
|
||||||
| 3 | `nostr_agent` | `m/44'/1237'/*'/1'/0'` | secp256k1 | nostr |
|
| 3 | `nostr_agent` | `m/44'/1237'/*'/1'/0'` | secp256k1 | nostr |
|
||||||
| 4 | `ssh` | `m/44'/102001'/0'/0'/0'` | ed25519 | ssh |
|
| 4 | `ssh` | `m/44'/102001'/0'/0'/0'` | ed25519 | ssh |
|
||||||
| 5 | `age` | `m/44'/102002'/0'/0'/0'` | x25519 | age |
|
| 5 | `age` | `m/44'/102002'/0'/0'/0'` | x25519 | age |
|
||||||
|
|||||||
+37
-16
@@ -813,8 +813,8 @@ int socket_name_random(char *out, size_t out_len);
|
|||||||
/* Version information (auto-updated by build/version tooling) */
|
/* Version information (auto-updated by build/version tooling) */
|
||||||
#define NSIGNER_VERSION_MAJOR 0
|
#define NSIGNER_VERSION_MAJOR 0
|
||||||
#define NSIGNER_VERSION_MINOR 1
|
#define NSIGNER_VERSION_MINOR 1
|
||||||
#define NSIGNER_VERSION_PATCH 16
|
#define NSIGNER_VERSION_PATCH 17
|
||||||
#define NSIGNER_VERSION "v0.1.16"
|
#define NSIGNER_VERSION "v0.1.17"
|
||||||
|
|
||||||
|
|
||||||
/* NSIGNER_HEADERLESS_DECLS_END */
|
/* NSIGNER_HEADERLESS_DECLS_END */
|
||||||
@@ -989,11 +989,17 @@ static int read_line_stdin(char *buf, size_t buf_sz) {
|
|||||||
*
|
*
|
||||||
* Only works when stdin is a TTY. Falls back to read_line_stdin if not a TTY
|
* Only works when stdin is a TTY. Falls back to read_line_stdin if not a TTY
|
||||||
* (in which case prefill is ignored).
|
* (in which case prefill is ignored).
|
||||||
|
*
|
||||||
|
* `prompt` is the label text printed before the editable field (e.g.
|
||||||
|
* " Role name [main]: "). It is reprinted on every redraw so that the
|
||||||
|
* prompt does not disappear when the user starts editing.
|
||||||
*/
|
*/
|
||||||
static int read_line_editable(char *buf, size_t buf_sz, const char *prefill) {
|
static int read_line_editable(char *buf, size_t buf_sz, const char *prefill,
|
||||||
|
const char *prompt) {
|
||||||
struct termios old_term, new_term;
|
struct termios old_term, new_term;
|
||||||
size_t len = 0; /* current text length */
|
size_t len = 0; /* current text length */
|
||||||
size_t pos = 0; /* cursor position (0..len) */
|
size_t pos = 0; /* cursor position (0..len) */
|
||||||
|
size_t prompt_len = 0;/* length of prompt string (for cursor math) */
|
||||||
int fd = STDIN_FILENO;
|
int fd = STDIN_FILENO;
|
||||||
int was_raw = 0;
|
int was_raw = 0;
|
||||||
|
|
||||||
@@ -1001,6 +1007,10 @@ static int read_line_editable(char *buf, size_t buf_sz, const char *prefill) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (prompt != NULL) {
|
||||||
|
prompt_len = strlen(prompt);
|
||||||
|
}
|
||||||
|
|
||||||
/* If not a TTY, fall back to plain fgets */
|
/* If not a TTY, fall back to plain fgets */
|
||||||
if (!isatty(fd)) {
|
if (!isatty(fd)) {
|
||||||
return read_line_stdin(buf, buf_sz);
|
return read_line_stdin(buf, buf_sz);
|
||||||
@@ -1028,11 +1038,14 @@ static int read_line_editable(char *buf, size_t buf_sz, const char *prefill) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw the initial pre-filled text */
|
/* Draw the initial prompt + pre-filled text */
|
||||||
|
if (prompt != NULL) {
|
||||||
|
fputs(prompt, stdout);
|
||||||
|
}
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
fputs(buf, stdout);
|
fputs(buf, stdout);
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
char ch;
|
char ch;
|
||||||
@@ -1060,6 +1073,7 @@ static int read_line_editable(char *buf, size_t buf_sz, const char *prefill) {
|
|||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
/* Redraw: move to start of field, clear line, redraw, reposition */
|
/* Redraw: move to start of field, clear line, redraw, reposition */
|
||||||
fputs("\r\033[K", stdout); /* CR + clear to end of line */
|
fputs("\r\033[K", stdout); /* CR + clear to end of line */
|
||||||
|
if (prompt != NULL) fputs(prompt, stdout);
|
||||||
fputs(buf, stdout);
|
fputs(buf, stdout);
|
||||||
if (pos < len) {
|
if (pos < len) {
|
||||||
/* Move cursor left to pos */
|
/* Move cursor left to pos */
|
||||||
@@ -1115,6 +1129,7 @@ static int read_line_editable(char *buf, size_t buf_sz, const char *prefill) {
|
|||||||
len--;
|
len--;
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
fputs("\r\033[K", stdout);
|
fputs("\r\033[K", stdout);
|
||||||
|
if (prompt != NULL) fputs(prompt, stdout);
|
||||||
fputs(buf, stdout);
|
fputs(buf, stdout);
|
||||||
if (pos < len) {
|
if (pos < len) {
|
||||||
printf("\033[%zuD", len - pos);
|
printf("\033[%zuD", len - pos);
|
||||||
@@ -1141,6 +1156,7 @@ static int read_line_editable(char *buf, size_t buf_sz, const char *prefill) {
|
|||||||
/* Ctrl-U — clear entire line */
|
/* Ctrl-U — clear entire line */
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
fputs("\r\033[K", stdout);
|
fputs("\r\033[K", stdout);
|
||||||
|
if (prompt != NULL) fputs(prompt, stdout);
|
||||||
len = 0;
|
len = 0;
|
||||||
pos = 0;
|
pos = 0;
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
@@ -1159,6 +1175,7 @@ static int read_line_editable(char *buf, size_t buf_sz, const char *prefill) {
|
|||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
/* Redraw from cursor position */
|
/* Redraw from cursor position */
|
||||||
fputs("\r\033[K", stdout);
|
fputs("\r\033[K", stdout);
|
||||||
|
if (prompt != NULL) fputs(prompt, stdout);
|
||||||
fputs(buf, stdout);
|
fputs(buf, stdout);
|
||||||
pos++;
|
pos++;
|
||||||
if (pos < len) {
|
if (pos < len) {
|
||||||
@@ -2014,7 +2031,7 @@ static int prompt_named_path_roles(role_table_t *role_table) {
|
|||||||
tui_render_content_screen(NULL, "Define a role — bind a role name to a derivation path template");
|
tui_render_content_screen(NULL, "Define a role — bind a role name to a derivation path template");
|
||||||
printf("Define a role:\n");
|
printf("Define a role:\n");
|
||||||
printf(" 1. Standard Nostr (NIP-06): secp256k1, m/44'/1237'/0'/0/0\n");
|
printf(" 1. Standard Nostr (NIP-06): secp256k1, m/44'/1237'/0'/0/0\n");
|
||||||
printf(" 2. Standard Nostr hardened range: secp256k1, m/44'/1237'/*'/0'/0'\n");
|
printf(" 2. Standard Nostr range: secp256k1, m/44'/1237'/*'/0/0\n");
|
||||||
printf(" 3. Nostr agent range (hardened): secp256k1, m/44'/1237'/*'/1'/0'\n");
|
printf(" 3. Nostr agent range (hardened): secp256k1, m/44'/1237'/*'/1'/0'\n");
|
||||||
printf(" 4. SSH role: ed25519, m/44'/102001'/0'/0'/0'\n");
|
printf(" 4. SSH role: ed25519, m/44'/102001'/0'/0'/0'\n");
|
||||||
printf(" 5. Age/x25519 role: x25519, m/44'/102002'/0'/0'/0'\n");
|
printf(" 5. Age/x25519 role: x25519, m/44'/102002'/0'/0'/0'\n");
|
||||||
@@ -2050,8 +2067,8 @@ static int prompt_named_path_roles(role_table_t *role_table) {
|
|||||||
|
|
||||||
switch (choice) {
|
switch (choice) {
|
||||||
case 2:
|
case 2:
|
||||||
default_name = "nostr_hardened";
|
default_name = "nostr_range";
|
||||||
default_path = "m/44'/1237'/*'/0'/0'";
|
default_path = "m/44'/1237'/*'/0/0";
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
default_name = "nostr_agent";
|
default_name = "nostr_agent";
|
||||||
@@ -2107,10 +2124,12 @@ static int prompt_named_path_roles(role_table_t *role_table) {
|
|||||||
|
|
||||||
/* Role name */
|
/* Role name */
|
||||||
char role_name[ROLE_NAME_MAX];
|
char role_name[ROLE_NAME_MAX];
|
||||||
printf(" Role name [%s]: ", default_name);
|
{
|
||||||
fflush(stdout);
|
char prompt_buf[128];
|
||||||
if (read_line_editable(role_name, sizeof(role_name), default_name) != 0) {
|
snprintf(prompt_buf, sizeof(prompt_buf), " Role name [%s]: ", default_name);
|
||||||
return (roles_created > 0) ? 0 : -1;
|
if (read_line_editable(role_name, sizeof(role_name), default_name, prompt_buf) != 0) {
|
||||||
|
return (roles_created > 0) ? 0 : -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
size_t len = strlen(role_name);
|
size_t len = strlen(role_name);
|
||||||
@@ -2288,10 +2307,12 @@ static int prompt_named_path_roles(role_table_t *role_table) {
|
|||||||
/* Path template — only prompt for custom path; presets use the default */
|
/* Path template — only prompt for custom path; presets use the default */
|
||||||
char path_token[ROLE_PATH_MAX];
|
char path_token[ROLE_PATH_MAX];
|
||||||
if (choice == 10) {
|
if (choice == 10) {
|
||||||
printf(" Path template [%s]:\n ", default_path);
|
{
|
||||||
fflush(stdout);
|
char prompt_buf[256];
|
||||||
if (read_line_editable(path_token, sizeof(path_token), default_path) != 0) {
|
snprintf(prompt_buf, sizeof(prompt_buf), " Path template [%s]: ", default_path);
|
||||||
return (roles_created > 0) ? 0 : -1;
|
if (read_line_editable(path_token, sizeof(path_token), default_path, prompt_buf) != 0) {
|
||||||
|
return (roles_created > 0) ? 0 : -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
size_t len = strlen(path_token);
|
size_t len = strlen(path_token);
|
||||||
|
|||||||
Reference in New Issue
Block a user