Sign in with a passkey
The web page of the daemon shows the agents and their transcripts, and sends messages. It needs a passkey: a key pair in an authenticator, such as the password manager of the browser, a security key, or a phone.
Important
The sign-in needs the command
ztcl::crypto verify. No release of ztcl has it yet (ztcl pull request 1327). With a ztcl that does not have it, the page says why it refuses each sign-in.
Add the first passkey
-
Start the daemon. It prints a one-time code:
one-time code for the first passkey: 78986f0ca2 -
Open http://localhost:7717/ in a browser on the same computer.
-
Type the code, and click Add a passkey. The browser asks the authenticator to make a key.
-
Click Sign in with a passkey.
The code allows one passkey and 5 tries. After 5 wrong codes, only a restart of the daemon makes a new code. A signed-in page can add one more passkey with no code.
A passkey on a phone
The browser on the computer can use a passkey on a phone through the "hybrid" sign-in of the browser: the browser shows a QR code, and the phone scans it. The phone and the computer need Bluetooth. The page stays on the computer: the daemon listens on 127.0.0.1 only, and a phone cannot open the page directly.
Note
The tests check the sign-in with the virtual authenticator of Chromium (tests/browser.mjs). The sign-in with a real phone is not tested yet.
Sign in with a shared secret
Use this way when a passkey does not work, for example when the phone refuses the passkey.
- Start the daemon with
jcode serve --secret-login, or set"secret_login": truein the config of the state folder. - The daemon makes a random secret and writes it to the file
web-secretof the state folder (mode 0600). Its log names the file, not the secret. - Run
jcode secretto see the path of the file. Copy the secret from the file. - On the sign-in page, put the secret in "Shared secret" and select "Sign in with the secret". A password manager can keep it.
A restart of the daemon keeps the same secret. jcode secret --new makes a new secret and ends each session of the page. Five wrong tries lock this way for 10 minutes.
The secret is weaker than a passkey: each copy of it can sign in. To turn it off, start the daemon with no --secret-login, and remove secret_login from the config. Then delete the file web-secret.
What the page checks
- The page opens at
http://localhost:PORT/. A request with anotherHostheader gets the status 421, and127.0.0.1gets a redirect tolocalhost. - The session cookie is
HttpOnlyandSameSite=Strict, for 12 hours. - Each POST needs the
Originof the daemon and the CSRF token of the session. - Text of an agent is text: the page puts it into the page with
textContent, and the page has a strict Content Security Policy.
Security has the full list.