CLI command
skarbiec browser host
Answer the Skarbiec autofill extension over the browser's native-messaging channel.
Invocation#
skarbiec browser hostPurpose#
Answer the Skarbiec autofill extension over the browser's native-messaging channel.
Required inputs and options#
- Started by Chrome or Firefox from the manifest browser install writes, which names this binary; the browser passes its own origin (Chrome's chrome-extension:// address) or the manifest's path (Firefox) as the first argument, and that start is answered as browser host is. It reads length-prefixed JSON messages naming an action (with a domain, a text or an id) on stdin and the bearer from the owner-only token file that command wrote.
Output and state effects#
- Serves the exact login fields the browser host's grant allows through the local Skarbiec API and nothing else, one framed JSON answer per message. A list answers ok, logins and unreadable: a login the grant does not reach, because it was added after browser install minted the grant, is named there with the API's refusal rather than failing the whole list; the extension's popup and the badge on a password field name those logins and say to run browser cover (or Cover them in the app), which covers them without replacing the bearer, as maintain does on its next pass. When a site has several logins the popup opens with a filter box that narrows them by name or username, and each login has Copy username, from the list it already holds, and Copy code, which puts its current one-time code on the clipboard for a code page the fill cannot find, or says why it gives none. Under the logins, Change a password on <host> opens the site's well-known change-password address in a new tab, as `skarbiec sites` names it. In a page, Alt+Shift+L offers the site's logins at the password field the cursor is in, as the badge does, and a fill from the popup goes to that field, or else to the page's first password field. A sign-in that asks on pages of their own gets the badge on each: on the account page (a field marked username or email) a fill writes only the username, on the code page (a field marked one-time-code) only the current one-time code, and a login with no working seed says why there.
Refusals#
- Each failure is answered as a frame with ok false and the error: `action required`, `domain required`, `id required`, `text required: what the login's name, username or site holds`, `unknown action <name>`, `read browser-host grant (run `skarbiec browser install`)` when the token file is missing, and the API's own refusal (`skarbiec API <path>: <status>: <error>`) for a revoked grant or an item it may not read. A message that is not JSON is answered `native message is not JSON`.
Examples#
A search, {"action":"search","text":"<text>"}, answers as a list does, with every login whose display name, username or one of its sites holds the text, regardless of case and whatever site the tab is on. When the vault holds no login for the tab's host, the popup opens a Search every login box that sends it, for a login kept under another address of the same service; a found login fills and copies as any other. An offer, {"action":"offer","site":"<host>","username":"…","password":"…"}, sends a new login to POST /v1/offers: the server seals it to the vault owner's key and queues it in the donation inbox under <site>-<username>, from the browser host, where it waits until the owner accepts it with donation accept or in Desktop's Requests inbox; the answer is ok, status pending, donation_id and id, or ok false with the admission status when that id is already another writer's. The browser host's grant carries offer:logins for this, minted by browser install; an install made before offering existed is minted again by running it. The popup's Save a new login for <host> sends one and forgets it.