Skip to content

Latest commit

 

History

History
118 lines (88 loc) · 3.34 KB

README.md

File metadata and controls

118 lines (88 loc) · 3.34 KB

kepler header

Kepler

Kepler is self-sovereign storage. It is architected as a decentralized storage system that uses smart contracts to define Orbits, where your data live and who has access.

For a high-level project overview, see the Product Requirements Document.

Configuration

All configuration variables are documented in kepler.toml. You can either modify them in this file, or specify them through environment variable using the prefix KEPLER_.

API

Kepler exposes a basic HTTP API with POST and GET requests for putting and reading stored entries.

Read

Request

GET request format:

GET https://<host-url>/<orbit-id>/<cid>
Authorization: <auth-method-token>

The Authorization header value format depends on the authorization policy defined by the Orbit identified by the orbit-id. Example Read request using no authorization:

GET http://localhost:8000/uAYAEHiDoN2Q6QgzD6zqWuvgFoUj130OydcuzWRl8b5q5TpWuIg/uAYAEHiB_A0nLzANfXNkW5WCju51Td_INJ6UacFK7qY6zejzKoA

Response

Successful requests will result in a 200 response containing the fetched content. Example:

{
  "hello": "there"
}
// GET http://localhost:8000/uAYAEHiB_A0nLzANfXNkW5WCju51Td_INJ6UacFK7qY6zejzKoA
// HTTP/1.1 200 OK
// Server: Rocket
// Date: Fri, 26 Mar 2021 13:11:34 GMT
// Transfer-Encoding: chunked
// Request duration: 0.059868s

Write

Writing supports the following content types:

  • None: corrosponds to the Raw multicodec
  • application/octet-stream: corrosponds to the Raw multicodec
  • application/json: corrosponds to the Json multicodec
  • application/msgpack: corrosponds to the MsgPack multicodec

Request

POST request format:

POST https://<host-url>/<orbit-id>/
Content-Type: <content-type | none>

<content>

Example:

POST http://localhost:8000/uAYAEHiDoN2Q6QgzD6zqWuvgFoUj130OydcuzWRl8b5q5TpWuIg
Content-Type: application/json

{
    "hello": "hey"
}

Writing can also be batched using content-type multipart/form-data, like so:

POST http://localhost:8000/uAYAEHiDoN2Q6QgzD6zqWuvgFoUj130OydcuzWRl8b5q5TpWuIg
Content-Type: multipart/form-data; boundary=---------------------------735323031399963166993862150
Content-Length: 100

---------------------------735323031399963166993862150
Content-Disposition: form-data;
Content-Type: application/json
{
    "hello": "hey"
}

---------------------------735323031399963166993862150
Content-Disposition: form-data;
Content-Type: application/json
{
    "hello": "hey again"
}

Response

Successful requests will result in a 200 response containing the CID of the stored content. Example:

uAYAEHiDoN2Q6QgzD6zqWuvgFoUj130OydcuzWRl8b5q5TpWuIg
POST http://localhost:8000/
HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Server: Rocket
Content-Length: 51
Date: Fri, 26 Mar 2021 13:12:41 GMT
Request duration: 0.058104s

For a batch write, the response will be a newline-delimited list of CIDs, the order of which corrosponds to the order of the multipart form-data elements. An empty line indicates a failure to write the content of that index.