1.8.0-alpha6 • Published 6 years ago

@tanker/server-httpd v1.8.0-alpha6

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
6 years ago

Tanker HTTP Server

HTTP server to interact with Tanker Server as a microservice.

Cli API

tanker-server-httpd [options]

General options:

-c, --config <path>             Path to a config file containg Server and/or Tanker options
-h, --help                      Display usage information
--version                       Display the version of tanker-server-httpd

When a config file is given with -c/--config, all options below override values from the config file.

Server options:

--bearer-token  <bearerToken>   The HTTP Bearer token to protect access to the HTTP endpoints
--server-port   <serverPort>    The port on which the HTTP server is listening connections
--writable-path <writablePath>  The folder in which to persist the server data (defaults to current directory)

Tanker options:

--server-id     <serverId>      The Tanker server identifier
--server-token  <serverToken>   The Tanker server token for that user
--trustchain-id <trustchainId>  The Tanker trustchain id

HTTP API specification

TypeRouteDescription
POST/v1/encryptTake data and return it encrypted
POST/v1/decryptTake encrypted data and return clear data
POST/v1/shareShare resources to new users and groups
GET/healthzPing

Errors

If an error occurred, the response will contain:

  • An appropriate 4xx, or 5xx HTTP status code,
  • A Content-Type: application/json header,
  • A JSON body in the following format:

    {
      code: str,
      message: str
    }
  • Error codes are described below:

    CodeHTTP Status CodeMessage
    invalid_auth_token401 UnauthorizedYou did not provide the correct token in the Authorization HTTP header
    invalid_content_type400 Bad RequestYou did not provide the Content-Type Content-Type HTTP header
    invalid_body400 Bad RequestYou did not provide the number of bytes specified by the Content-Length HTTP header
    missing_recipients400 Bad RequestYou did not provide the shareWith field in the HTTP body
    missing_resources400 Bad RequestYou did not provide the resourcesIds field in the HTTP body
    invalid_encrypted_data400 Bad RequestThe provided encrypted data is invalid
    internal_server_error500 Internal Server ErrorWe encountered an internal error. Please try again.
    resource_key_not_found404 Not FoundThe ressource key to decrypt the body is not available
    recipient_not_found404 Not FoundOne of the recipients you tried to share with does not exist
    resource_not_found404 Not FoundOne of the resources you tried to share does not exist

Further Documentation

More detailed documentation about the HTTP API is available at https://tanker.io/docs/latest/.