Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gnokey-pair

Signs on your computer a transaction sent from your phone. Gnokey Mobile holds only a session key; what only the identity can sign (creating or revoking sessions, or any call you choose to sign with the identity) goes to the desktop over an end-to-end encrypted magic-wormhole channel. gnokey-pair shows its own review and has the unmodified gnokey sign.

Design: docs/design.md (the channel and the protocol) and docs/desktop-design.md (this CLI).

Install

gnokey-pair is optional: Gnokey Mobile always offers the gnokey command to copy. It runs the gnokey that holds your keys, so you need that too.

gnokey-pair

Download the archive for your computer from the latest release:

Computer Archive
Mac with Apple silicon (M1 and later) gnokey-pair_<version>_darwin_arm64.tar.gz
Mac with an Intel processor gnokey-pair_<version>_darwin_amd64.tar.gz
Linux, x86-64 gnokey-pair_<version>_linux_amd64.tar.gz
Linux, ARM 64-bit gnokey-pair_<version>_linux_arm64.tar.gz
Windows, x86-64 gnokey-pair_<version>_windows_amd64.zip

Then put the binary on your PATH, for example on a Mac:

tar -xzf gnokey-pair_*_darwin_arm64.tar.gz
sudo mv gnokey-pair /usr/local/bin/
gnokey-pair -version

The macOS binaries are signed and notarized. checksums.txt in the release lists every archive's SHA-256: shasum -a 256 -c checksums.txt --ignore-missing.

From source, with Go: git clone https://github.com/berty/gnokey-pair && cd gnokey-pair && make install (into $(go env GOPATH)/bin). go install github.com/berty/gnokey-pair@latest does not work yet: go.mod replaces gno with a fork, for the reason below.

gnokey

Any gnokey signs transactions. Proving an identity when a web app asks you to sign in needs gnokey sign-data, which is not in a gno release yet (gnolang/gno#6322). Until then, build it from a clone of this repository: make install.gnokey.

Use

gnokey-pair -remote https://rpc.gno.land:443

It prints a code and a QR. In Gnokey Mobile, choose "Send to my computer" and scan it, then check that both screens show the same two check words. Review the request, type y, and gnokey asks for your password (or your Ledger). With sendtx gnokey-pair broadcasts the transaction; with signtx it hands the signed bytes back to the phone.

flag default
-remote ask node for the request's chain; without it, the phone's suggestion is used only if you agree
-relay wss://gnokey-pair.berty.io/v1 mailbox server, the same as the phone's (see Running your own relay)
-gnokey $PATH gnokey binary; its path and version are printed first
-home gnokey's passed to gnokey
-timeout 10m wait for the phone
-linger 10m after answering, wait for the phone to confirm it read the answer
-manual off print the gnokey command instead of running gnokey (see below)

Signing by hand

With -manual, approving the review prints the gnokey command instead of running gnokey, for you to run in another terminal. For sendtx it signs, dry-runs and broadcasts, and the phone watches the chain; gnokey-pair removes the transaction file when you press Enter. For signtx it only signs: gnokey-pair waits for the signed file, checks it is what you approved, and sends it to the phone.

Signing offline

On a computer without internet, on the same local network as the phone, run a relay there (below) and start gnokey-pair -relay ws://<lan address>:4000/v1. The phone asks for a signature only (signtx marked offline, with the account number and sequence): gnokey-pair contacts no node, says so in the review, and the phone broadcasts. A request without that marker still needs a node.

Running your own relay

Both ends meet on the default relay. To use another one, such as a private relay or one on your machine for development, run the reference magic-wormhole mailbox server, unmodified, at the version the tests pin. With Docker, from the repository root (relay/Dockerfile also locks its dependencies, runs it as a non-root user, and keeps no usage records):

docker build -t gnokey-pair-relay relay
docker run -d -p 4000:4000 gnokey-pair-relay

or docker compose up -d in relay/, which builds the same image and adds a restart policy, a health check, and a volume that keeps pairings in progress.

Or in a Python venv:

python3 -m venv wormhole-relay
wormhole-relay/bin/pip install magic-wormhole-mailbox-server==0.8.0
wormhole-relay/bin/twist wormhole-mailbox --port tcp:4000 --channel-db relay.sqlite --blur-usage=3600

Either serves ws://<host>:4000/v1; put it behind a TLS proxy for wss://. Then start gnokey-pair -relay ws://<host>:4000/v1, and in Gnokey Mobile set Settings → Send to my computer → Relay to the same URL. A scanned QR carries the relay, so only a typed code needs the setting.

Packages

  • wormhole: the magic-wormhole channel, with reconnection; gnokey-mobile imports it too.
  • protocol: the request and result messages, the QR's gnopair: URI and the default relay.
  • relaytest: runs the reference mailbox server for tests, here and in requesters such as gnokey-mobile.

Tests

The tests that need a relay run the Python reference mailbox server, pinned in relaytest/requirements.txt: the wormhole tests and the end-to-end test (an in-memory node, the real gnokey, a password typed through a pty).

make test-deps   # python3 -m venv .venv, then pip install the pinned versions
make test        # or test-relay: with -race, and fails without the venv

Without the venv, those tests skip, as in the repository's make test; .github/workflows/gnokey-pair-relay.yml runs them. WORMHOLE_RELAY_LOG=<file> keeps the server's log. With -v, the end-to-end test prints what it saw on the terminal.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages