PROTOCOL.md: Send default settings only for "configure" request, rename field "response" to "data" (#8)

This commit is contained in:
Maxim Baz
2018-04-14 11:12:33 +02:00
committed by GitHub
parent ca706e7699
commit 72a0f239ad

View File

@@ -1,4 +1,5 @@
# Browserpass Communication Protocol # Browserpass Communication Protocol
This document describes the protocol used for communication between the browser extension, This document describes the protocol used for communication between the browser extension,
and the native host application. and the native host application.
@@ -6,16 +7,16 @@ and the native host application.
### OK ### 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. may be of any type.
The app version is an integer, calculated by `(MAJOR * 1000000) + (MINOR * 1000) + PATCH`. The app version is an integer, calculated by `(MAJOR * 1000000) + (MINOR * 1000) + PATCH`.
``` ```
{ {
   “status: ok, "status": "ok",
   “version: <int> "version": <int>,
   “response”: <any type> "data": <any type>
} }
``` ```
@@ -26,11 +27,12 @@ object that provides any parameters that should accompany the error.
``` ```
{ {
   “status: error, "status": "error",
   “code: <int> "code": <int>,
   “params”: { "version": <int>,
      “<paramN>”: <valueN> "params": {
   } "<paramN>": <valueN>
}
} }
``` ```
@@ -56,23 +58,22 @@ and via parameters in individual `*.gpg` files.
Settings are applied using the following priority, highest first: Settings are applied using the following priority, highest first:
1. Configured by the user in specific `*.gpg` files (e.g. autosubmit: true) 1. Configured by the user in specific `*.gpg` files (e.g. autosubmit: true)
2. Configured by the user via the extension options 2. Configured by the user via the extension options
3. Configured by the user in each stores `.browserpass.json` file 3. Configured by the user in each stores `.browserpass.json` file
4. Defaults shipped with the browser extension 4. Defaults shipped with the browser extension
### Global Settings ### Global Settings
| Setting | Description | Default | | Setting | Description | Default |
| ------------ | ---------------------------------------------------- | ------- | | ------- | ---------------------------------------------------- | ------- |
| gpgPath | Optional path to gpg binary | `null` | | gpgPath | Optional path to gpg binary | `null` |
| defaultStore | Store-specific settings for default store | `{}` |
| stores | List of password stores with store-specific settings | `{}` | | stores | List of password stores with store-specific settings | `{}` |
### Store-specific Settings ### Store-specific Settings
| Setting | Description | Default | | Setting | Description | Default |
| ------------ | ---------------------------------------------------- | ------- | | ------- | ------------------------------------ | ------- |
| name | Store name (same as the store key) | <key> | | name | Store name (same as the store key) | <key> |
| path | Path to the password store directory | `""` | | path | Path to the password store directory | `""` |
@@ -87,8 +88,9 @@ is alive, determine the version at startup, and provide per-store defaults.
``` ```
{ {
   “settings: <settings object>, "settings": <settings object>,
   “action”: “configure” "defaultStoreSettings": <store-specific settings for default store>,
"action": "configure"
} }
``` ```
@@ -97,29 +99,31 @@ is alive, determine the version at startup, and provide per-store defaults.
``` ```
{ {
   “status: ok, "status": "ok",
   “version: <int> "version": <int>,
   “response”: { "data": {
"defaultPath": "/path/to/default/store", "defaultStore": {
"defaultSettings": <raw contents of $defaultPath/.browserpass.json>, "path": "/path/to/default/store",
       “storeSettings: { "defaultSettings": "<raw contents of $defaultPath/.browserpass.json>",
           “storeName”: <raw contents of storePath/.browserpass.json> },
       } “storeSettings”: {
   } “storeName”: "<raw contents of storePath/.browserpass.json>"
}
}
} }
``` ```
### List ### List
Get a list of all `*.gpg` files for each of a provided array of directory paths. The `storeN` 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 #### Request
``` ```
{ {
   “settings: <settings object>, "settings": <settings object>,
   “action: list "action": "list"
} }
``` ```
@@ -127,14 +131,14 @@ is the name of a password store, the key in `“settings.stores”` object.
``` ```
{ {
   “status: ok, "status": "ok",
   “version: <int>, "version": <int>,
   “response”: { "data": {
       “files: { "files": {
           “storeN: [<storeNPath/file1.gpg>, <...>], "storeN": ["<storeNPath/file1.gpg>", "<...>"],
           “storeN+1: [<storeN+1Path/file1.gpg>, <...>] "storeN+1": ["<storeN+1Path/file1.gpg>", "<...>"]
       } }
   } }
} }
``` ```
@@ -146,10 +150,10 @@ Get the decrypted contents of a specific file.
``` ```
{ {
   “settings: <settings object>, "settings": <settings object>,
   “action: fetch, "action": "fetch",
   “store: <storeName> "store": "<storeName>",
   “file: relative/path/to/file.gpg "file": "relative/path/to/file.gpg"
} }
``` ```
@@ -157,10 +161,10 @@ Get the decrypted contents of a specific file.
``` ```
{ {
   “status: ok, "status": "ok",
   “version: <int>, "version": <int>,
   “response”: { "data": {
       “data: <decrypted file contents> "data": "<decrypted file contents>"
   } }
} }
``` ```