From 72a0f239ad862d29d858a94a3a33ce0e95953b01 Mon Sep 17 00:00:00 2001 From: Maxim Baz Date: Sat, 14 Apr 2018 11:12:33 +0200 Subject: [PATCH] PROTOCOL.md: Send default settings only for "configure" request, rename field "response" to "data" (#8) --- PROTOCOL.md | 110 +++++++++++++++++++++++++++------------------------- 1 file changed, 57 insertions(+), 53 deletions(-) diff --git a/PROTOCOL.md b/PROTOCOL.md index 5734429..d857841 100644 --- a/PROTOCOL.md +++ b/PROTOCOL.md @@ -1,4 +1,5 @@ # Browserpass Communication Protocol + This document describes the protocol used for communication between the browser extension, and the native host application. @@ -6,16 +7,16 @@ and the native host application. ### OK -Consists solely of an `ok` status, an integer app version, and a `response` field. The response +Consists solely of an `ok` status, an integer app version, and a `data` field which may be of any type. The app version is an integer, calculated by `(MAJOR * 1000000) + (MINOR * 1000) + PATCH`. ``` { -    “status”: “ok”, -    “version”: -    “response”: + "status": "ok", + "version": , + "data": } ``` @@ -26,11 +27,12 @@ object that provides any parameters that should accompany the error. ``` { -    “status”: “error”, -    “code”: -    “params”: { -       “”: -    } + "status": "error", + "code": , + "version": , + "params": { + "": + } } ``` @@ -56,25 +58,24 @@ and via parameters in individual `*.gpg` files. Settings are applied using the following priority, highest first: - 1. Configured by the user in specific `*.gpg` files (e.g. autosubmit: true) - 2. Configured by the user via the extension options - 3. Configured by the user in each store’s `.browserpass.json` file - 4. Defaults shipped with the browser extension +1. Configured by the user in specific `*.gpg` files (e.g. autosubmit: true) +2. Configured by the user via the extension options +3. Configured by the user in each store’s `.browserpass.json` file +4. Defaults shipped with the browser extension ### Global Settings -| Setting | Description | Default | -| ------------ | ---------------------------------------------------- | ------- | -| gpgPath | Optional path to gpg binary | `null` | -| defaultStore | Store-specific settings for default store | `{}` | -| stores | List of password stores with store-specific settings | `{}` | +| Setting | Description | Default | +| ------- | ---------------------------------------------------- | ------- | +| gpgPath | Optional path to gpg binary | `null` | +| stores | List of password stores with store-specific settings | `{}` | ### Store-specific Settings -| Setting | Description | Default | -| ------------ | ---------------------------------------------------- | ------- | -| name | Store name (same as the store key) | | -| path | Path to the password store directory | `""` | +| Setting | Description | Default | +| ------- | ------------------------------------ | ------- | +| name | Store name (same as the store key) | | +| path | Path to the password store directory | `""` | ## Actions @@ -87,8 +88,9 @@ is alive, determine the version at startup, and provide per-store defaults. ``` { -    “settings”: , -    “action”: “configure” + "settings": , + "defaultStoreSettings": , + "action": "configure" } ``` @@ -97,29 +99,31 @@ is alive, determine the version at startup, and provide per-store defaults. ``` { -    “status”: “ok”, -    “version”: -    “response”: { - "defaultPath": "/path/to/default/store", - "defaultSettings": , -        “storeSettings”: { -            “storeName”: -        } -    } + "status": "ok", + "version": , + "data": { + "defaultStore": { + "path": "/path/to/default/store", + "defaultSettings": "", + }, + “storeSettings”: { + “storeName”: "" + } + } } ``` ### List Get a list of all `*.gpg` files for each of a provided array of directory paths. The `storeN` -is the name of a password store, the key in `“settings.stores”` object. +is the name of a password store, the key in `"settings.stores"` object. #### Request ``` { -    “settings”: , -    “action”: “list” + "settings": , + "action": "list" } ``` @@ -127,14 +131,14 @@ is the name of a password store, the key in `“settings.stores”` object. ``` { -    “status”: “ok”, -    “version”: , -    “response”: { -        “files”: { -            “storeN”: [, <...>], -            “storeN+1”: [, <...>] -        } -    } + "status": "ok", + "version": , + "data": { + "files": { + "storeN": ["", "<...>"], + "storeN+1": ["", "<...>"] + } + } } ``` @@ -146,10 +150,10 @@ Get the decrypted contents of a specific file. ``` { -    “settings”: , -    “action”: “fetch”, -    “store”: -    “file”: “relative/path/to/file.gpg” + "settings": , + "action": "fetch", + "store": "", + "file": "relative/path/to/file.gpg" } ``` @@ -157,10 +161,10 @@ Get the decrypted contents of a specific file. ``` { -    “status”: “ok”, -    “version”: , -    “response”: { -        “data”: -    } + "status": "ok", + "version": , + "data": { + "data": "" + } } ```