diff --git a/docs/README.md b/docs/README.md index 191f5d6..039783e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -4,11 +4,10 @@ Some API endpoints require an Authorization HTTP header. The token for this can be aquired using the `/account/authenticate` endpoint. ## Implementation Status -| Status | Explanation | -|--------|-------------------------------------| -| [X] | Implemented and documented. | -| [ ] | Documented but not implemented yet. | -| (ND) | Not documented yet. | +Legend: + - [X] -> Implemented. + - [ ] -> Designed but not implemented yet. + - (ND) -> Not designed yet. - `/account` - [X] `/register` @@ -32,8 +31,9 @@ The token for this can be aquired using the `/account/authenticate` endpoint. - [ ] `/info` - [ ] `/join` - `/vault` - - [ ] `/info` (ND) - - [ ] `/key` (ND) + - [ ] `/info` + - [ ] `/init` + - [ ] `/key` - `/fs` - [ ] `/create` (ND) - [ ] `/read` (ND) diff --git a/docs/vault/info.md b/docs/vault/info.md new file mode 100644 index 0000000..b091f16 --- /dev/null +++ b/docs/vault/info.md @@ -0,0 +1,25 @@ +# `/vault/info` - GET +Returns status information about the vault. + +## HTTP Headers +| Header | Content | +|---------------|--------------------| +| Authorization | `Bearer {token}` | + +## Responses +### 200 - Success +__Content - JSON:__ +| Field | Description | +|--------------|--------------------------------------------| +| max_storage | The maximum amount of space in the vault. | +| free_storage | The amount of free space in the vault. | + +### 400 - Error: Bad Request +The request was malformed. +### 401 - Error: Unauthorized +The provided auth token doesn't allow you to perform this operation. +### 403 - Error: Forbidden +Blocked for security reasons. +### 404 - Error: Not Found +The authorized user has no vault. +This can be fixed with a `/vault/init` call. diff --git a/docs/vault/init.md b/docs/vault/init.md new file mode 100644 index 0000000..3aefc20 --- /dev/null +++ b/docs/vault/init.md @@ -0,0 +1,28 @@ +# `/vault/init` - POST +Sets up a vault for the authenticated user. + + +## HTTP Headers +| Header | Content | +|---------------|--------------------| +| Authorization | `Bearer {token}` | +| Content-Type | `application/json` | + + +## Content - JSON +| Field | Description | +|-------|-----------------------------------------| +| key | The encrypted ContentKey for the vault. | + + +## Responses +### 200 - Success +Successfully set up the vault. +### 208 - Already Reported +The authenticated user already has a vault. +### 400 - Error: Bad Request +The request was malformed. +### 401 - Error: Unauthorized +The provided auth token doesn't allow you to perform this operation. +### 403 - Error: Forbidden +Blocked for security reasons. diff --git a/docs/vault/key.md b/docs/vault/key.md new file mode 100644 index 0000000..9e825a4 --- /dev/null +++ b/docs/vault/key.md @@ -0,0 +1,51 @@ +# `/vault/key` - GET +Returns the encrypted ContentKey of the vault. + +## HTTP Headers +| Header | Content | +|---------------|--------------------| +| Authorization | `Bearer {token}` | + +## Responses +### 200 - Success +__Content - JSON:__ +| Field | Description | +|-------|----------------------------------| +| key | The vaults encrypted ContentKey. | +### 401 - Error: Unauthorized +The provided auth token doesn't allow you to perform this operation. +### 403 - Error: Forbidden +Blocked for security reasons. +### 404 - Error: Not Found +The authorized user has no vault. +This can be fixed with a `/vault/init` call. + + +# `/vault/key` - PUSH +Uploads a new encrypted ContentKey and with this replacing the old one. +This should __never__ change the ContentKey itself but only the encryption layer around it. +This is intended to be used for password changing only! + +## HTTP Headers +| Header | Content | +|---------------|--------------------| +| Authorization | `Bearer {token}` | +| Content-Type | `application/json` | + +## Content - JSON +| Field | Description | +|-------|----------------------------------| +| key | The vaults encrypted ContentKey. | + +## Responses +### 200 - Success +Changed the encrypted ContentKey successfully. +### 400 - Error: Bad Request +The request was malformed. +### 401 - Error: Unauthorized +The provided auth token doesn't allow you to perform this operation. +### 403 - Error: Forbidden +Blocked for security reasons. +### 404 - Error: Not Found +The authorized user has no vault. +This can be fixed with a `/vault/init` call.