Skip to content
auroraxoPublic

About

Scoped signing daemon for Solana — the ssh-agent pattern for keys. The key lives once in a local daemon; processes hold grants, never secrets. v0 prototype, not a reviewed wallet.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

signerd

Give your scripts permission to sign, not your private key.

signerd is a small local signing daemon for Solana, modelled on ssh-agent. Your key lives once, encrypted, inside the daemon. Bots and scripts get a grant instead: "send up to 0.5 SOL to this address within 24 hours". The daemon checks every request against that grant before it signs, and refuses anything it cannot verify from the transaction bytes alone.

Status: early prototype (v0). It has had adversarial review by its own author, but no independent security audit. Do not use it with funds you cannot afford to lose. It is a reviewed idea with a tested implementation, not a reviewed wallet.

Why

Today most Solana scripts load the full keypair (id.json, an env var, a secret in CI). Whatever runs next to that key can spend everything in it. With signerd:

  • the key is stored once, encrypted, behind a local Unix socket
  • each process holds a scoped grant, never the secret
  • a prompt-injected or buggy script can only do what its grant allows
  • revoking a grant takes effect on the next request, without a restart

Install

npm install signerd

That installs it into the current project. The examples below call signerd directly, so either prefix them with npx, or install it globally:

npm install -g signerd

The same tree from a release tag:

npm install github:auroraxo/signerd#v0.2.42

You need Node.js and a C compiler (cc) once: the daemon builds a small kernel-lease helper from the shipped tools/leasecheck.c. If it is missing, signerd says so and names the repair.

cc -O2 -o node_modules/signerd/tools/leasecheck node_modules/signerd/tools/leasecheck.c

Try it in five steps

# 1. an encrypted key and a passphrase file (owner-only on purpose)
umask 077
mkdir -p ~/.config/signerd
printf 'your passphrase\n' > ~/.config/signerd/pass
chmod 600 ~/.config/signerd/pass
signerd keygen --keystore ~/.config/signerd/ops.key --passphrase-file ~/.config/signerd/pass

# 2. a grant: what this scope may do
signerd grant-add --grants ~/.config/signerd/grants.json --name ops-24h \
            --keystore ~/.config/signerd/ops.key \
            --destination So11111111111111111111111111111111111111112 \
            --max-lamports 500000000 --window-max-lamports 500000000 \
            --window-seconds 3600 --expires 2030-01-01T00:00:00Z
# a second scope is a second grant in the same file, added with --append
signerd grant-add --grants ~/.config/signerd/grants.json --name ops-payroll --append \
            --keystore ~/.config/signerd/ops.key \
            --destination Vote111111111111111111111111111111111111111 \
            --max-lamports 1000000 --window-max-lamports 1000000 \
            --window-seconds 60 --expires 2030-01-01T00:00:00Z

# 3. start the daemon
signerd run --keystore ~/.config/signerd/ops.key --passphrase-file ~/.config/signerd/pass \
            --grants ~/.config/signerd/grants.json \
            --ledger ~/.local/share/signerd/journal.jsonl \
            --socket ~/.local/share/signerd/signerd.sock

Then clients ask the daemon to sign with signerd sign or signerd sign-message, giving a grant name and the transaction bytes, never a key. Add --dry to see the decision without signing or spending any budget. To revoke a scope:

signerd grant-remove --grants ~/.config/signerd/grants.json --name ops-24h

For a transfer that could actually land, the blockhash has to be fresh. The package ships @solana/web3.js, and current versions return the hash directly:

BLOCKHASH=$(node -e "new (require('@solana/web3.js').Connection)('https://api.mainnet-beta.solana.com').getLatestBlockhash('finalized').then(r=>console.log(r.blockhash))")
signerd build-tx --keystore ~/.config/signerd/ops.key \
            --to So11111111111111111111111111111111111111112 \
            --lamports 42 --out tx.bin --blockhash "$BLOCKHASH"
signerd sign --socket ~/.local/share/signerd/signerd.sock --grant ops-24h --tx tx.bin

The default blockhash is only a placeholder for exercising the daemon. It will not confirm on chain, and the fee payer still needs SOL. signerd itself stays offline: that fetch runs in your shell.

From Node, the client that ships today is signViaDaemon. A refusal comes back as data, not an exception:

const { buildTransferWire, signViaDaemon } = require('signerd/src/client.js');

const wire = buildTransferWire({
  fromPubkey,     // the fee payer's PUBLIC key — no secret crosses this line
  toPubkey,
  lamports: 42,
  blockhash,
});
const answer = await signViaDaemon({ socketPath, grant: 'ops-24h', wire });
if (answer.ok) {
  const signedWire = Buffer.from(answer.signed, 'base64');
} else {
  console.log(answer.error);   // e.g. 'version_or_alt', 'window_cap'
}

The CLI verifies that answer before it writes anything: the returned wire must carry the same message that was sent, and its signature must verify under the fee payer's public key (verifySignedWire from signerd/src/client-verify.js, which the CLI and the example client both call). A server at the socket path that answers for a different transaction, or with a signature that verifies under nothing, is refused by name and no file is written.

Already have a key? signerd import encrypts an existing id.json and leaves the original untouched. To replace a keystore on purpose, add --overwrite (the old key is gone afterwards). The complete walkthrough, including signing and the refusal ladder, is in docs/GUIDE.md.

Sealed mode (optional)

# optional (opt-in, fail-closed): seal the grant file and the journal against
# content written by anyone who could write them before the daemon looks. After
# this, the daemon refuses unsealed or altered files instead of trusting mode
# checks alone.
#
# ORDER MATTERS, and the order is the one the tools need:
#   1. seal the GRANT file (it exists already);
#   2. the JOURNAL is created by the daemon on its first append - the `sign`
#      line above is that append - so `seal-journal` comes AFTER it;
#   3. STOP the daemon (it holds the journal lock while it serves; a live
#      lock is refused with `ledger_locked: pid <n>` - that refusal is the
#      daemon's protection, not a bug), then run the two seal commands;
#   4. restart the daemon in sealed mode (the command below).
# The flags below are the tools' own: `seal-grants` reads
# --seal-passphrase-file, `seal-journal` reads --journal for the path.
signerd seal-grants --grants ~/.config/signerd/grants.json \
            --seal-passphrase-file ~/.config/signerd/seal.pass
signerd seal-journal --journal ~/.local/share/signerd/journal.jsonl \
            --journal-seal-passphrase-file ~/.config/signerd/seal.pass

# now restart the daemon in SEALED mode: the same command as above, plus the
# two seal passphrases. A sealed daemon refuses an unsealed, altered or
# shortened grant file or journal (grant_file_unsealed / grant_file_seal_mismatch
# / ledger_sealed / ledger_mac_short).
signerd run --keystore ~/.config/signerd/ops.key --passphrase-file ~/.config/signerd/pass \
            --grants ~/.config/signerd/grants.json \
            --ledger ~/.local/share/signerd/journal.jsonl \
            --socket ~/.local/share/signerd/signerd.sock \
            --grant-seal-passphrase-file ~/.config/signerd/seal.pass \
            --journal-seal-passphrase-file ~/.config/signerd/seal.pass

A sealed grant file is also unreadable without its passphrase: any command that loads it keylessly refuses grant_file_sealed and names --grant-seal-passphrase-file (status no longer answers {"ok":true, "sealed":false} for a file it could not verify). The one deliberate exception is seal-grants itself — re-sealing after a hand edit judges the payload without checking the stale seal. A sealed grant file is rewritten only by the CLI: grant-add --append and grant-remove re-seal it as part of the act (they need --seal-passphrase-file). Hand-editing a sealed file breaks its seal and the daemon then refuses the file (grant_file_seal_mismatch).

What it will and will not sign

signerd signs only what it can fully decide offline, and refuses everything else with a machine-readable reason ({refused: "version_or_alt", ...}).

Signs (v0) Refuses
ONE legacy System transfer: a single instruction, three keys, one signer (the fee payer) Every other instruction: Memo, ComputeBudget, SPL Token Transfer / TransferChecked, authority changes (Approve, SetAuthority, CloseAccount, ...)
Within per-transaction (maxLamports) and rolling-window caps Address lookup tables (all v0/v1 versioned wire) and programs that can call other programs (Whirlpool, Jupiter, ...)
A receipt body from a message grant (openreceipts/v1) Token-2022, and any transaction it cannot verify from the bytes alone

Measured on 2,835 finalized mainnet transactions, the current envelope covers roughly 7 in 100 of them. That is a deliberate trade: it signs a narrow set with certainty instead of a wide set with guesses.

Good to know

  • Everything is local: a Unix socket, an encrypted keystore (scrypt + AES-256-GCM), an append-only journal. No network service.
  • The client checks what the daemon handed back before it writes it: the returned wire must carry the very message that was asked to be signed, and its signature must verify under the fee payer's public key. A server at the socket path that answers with something else is refused by name (signed_message_mismatch, signed_signature_invalid) and nothing is written.
  • The answer frame itself is bounded: a daemon that streams without ever finishing its line is refused by name (response_too_large, 8192 bytes — a real sign answers about 716), and a frame that is not JSON or carries no ok verdict is refused as response_invalid. Every one of these refusals reaches stderr with a fix: line, and nothing is relayed to stdout on somebody else's behalf.
  • A socket that cannot be reached is reported as a STATE, never as a raw errno: socket_missing (nothing was ever bound there), socket_stale (the file exists, nobody listens — a daemon that died without cleaning up), socket_state_unknown (the state cannot be proven, so it is refused rather than guessed). signerd status --socket <path> is the diagnostic every one of these refusals names, and it answers live on stdout with exit 0 when the daemon is up.
  • Grant files are checked on load: owner, mode, schema, seal. A grant that could never sign (past expiry, cap below the base fee) is refused at creation.
  • One grant file holds ONE key. signerd signs with a single key, and the daemon refuses the whole file when one grant names another key — so a write that would poison the file is refused at write time, before a byte lands (grant_file_key_mismatch, with grant-remove named as the repair for a file that is already broken). The surfaces that answer whether a file is usable — status, verify-grants and seal-grants — judge the same rule: a file no daemon can run is refused there too, instead of being reported ok:true or sealed into an authenticated file that will never sign.
  • Refusals name the flag and the fix instead of failing silently. That holds for a flag you simply forgot too: an absent required flag answers missing_flag: --<flag> with a fix: line naming the flag and the flags the command actually takes (it used to answer bare prose), exit 2, nothing run. That holds for the journal too: a tampered chain, a torn tail, a truncated journal, a live lock or a format-1 history is refused by name with the repair (ledger_tampered → restore from backup; ledger_torn_tail → start the daemon once and it repairs the tail; legacy_wire_required → --wires or --discard-legacy), on stderr, without changing the exit code. It holds for the values you pass as well: a mistyped --to or --blockhash is refused by build-tx itself (invalid_key_argument, the flag named, the shape stated) instead of surfacing web3.js's prose with a fix line that echoed it.
  • Exit codes are part of the contract, including "signed but could not deliver".

Prior art

The npm name @zanii/signerd already exists, and it is a different product. Measured with node tools/measure-prior-art-delta.mjs (report: research/prior-art-delta-2026-11-03.json): the other package matches 0/6 terms, 0 occurrences of this project's signing-domain vocabulary, while this package has 132 occurrences of it. The other package had 269 downloads last week. Verdict: prior-art-distinct-domain. Sharing a name is not sharing a design.

Learn more

Issues and questions are welcome.

License

MIT, see LICENSE.

About

Scoped signing daemon for Solana — the ssh-agent pattern for keys. The key lives once in a local daemon; processes hold grants, never secrets. v0 prototype, not a reviewed wallet.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages