Giter Site home page Giter Site logo

3box-address-server's Introduction

3Box Address Server

Greenkeeper badge

3box-address-server is a server utilizing a REST-API that is used to associate an Ethereum address with its root OrbitDB address. This is what must be looked up to sync the user's data.

API Endpoint

https://beta.3box.io/address-server/

API Description

Set

POST /odbAddress

Body

{
    address_token: <jwt token containing the orbitDB root store address>
}

The address_token is a DID signed jwt of the address to be published. The payload of the address_token is:

{
    rootStoreAddress: <orbitdb root store address>
}

Response

Status Message
200 Ok. rootStoreAddress stored
401 Invalid JWT Posted token is invalid (signature, expired, etc)
403 Missing data no rootStoreAddress in address_token
500 Internal Error Internal Error

The response data follows the jsend standard.

Response data

{
  status: 'success',
  data: {
    rootStoreAddress: <the orbitDB root store address that was accepted>
  }
}

Link an ethereum address to a DID

POST /link

Body

{
    consent_signature: <signature>,
    linked_did: <DID>,
    consent_msg: <string-message>
}

The consent_signature is a personal_sign signature of a consent message and the DID to be linked. The data(text) of the signature is:

Create a new 3Box profile

-
Your unique profile ID is did:muport:Qmsd89f7hg0w845hsdd

The ethereum address to be linked is recovered from the signature.

Response

Status Message
200 Ok. Link created and stored
400 Bad request No did on the message or dids does not match
401 Invalid consent Posted signature is invalid (wrong DID, etc)
403 Missing data no consent_signature or linked_did
500 Internal Error Internal Error

The response data follows the jsend standard.

Response data

{
  status: 'success',
  data: {
    did: <the did that was linked>,
    address: <the ethereum address that was linked>
  }
}

Delete a link between an ethereum address and a DID

POST /linkdelete

Body

{
  delete_token: <jwt token>
}

The delete_token is a DID signed jwt with a 1 hour expiry, of the address to be deleted. The payload of the delete_token is:

{
  "address": "0x19bd82476fa8799e0eb7bbb03ee2a67678c01cdc",
  "type": "delete-address-link"
}

Response

Status Message
200 Ok. Link deleted
401 Invalid consent delete token failed verification
403 Missing data no delete_token
500 Internal Error Internal Error

The response data follows the jsend standard.

Response data

{
  status: 'success',
  data: 'address of link deleted'
}

Get orbitDB root store address for given identity

GET /odbAddress/{identity}

Here the ìdentity is either a DID or an ethereum address.

Response

Status Message
200 Ok. An orbitDB address is returned
404 Not found The DID or ethereum address was not found
500 Internal Error Internal Error

The response data follows the jsend standard.

Response data

{
  status: 'success',
  data: {
    rootStoreAddress: <the orbitDB root store address associated with the identity>
  }
}

Get multiple orbitDB root store addresses for given identities

Post /odbAddresses

Returns multiple root store addresses from multiple identities. If some identities are present but not all, the response will only contain the ones that do have root store addresses associated with them.

Body

{
    identities: <an array containing identities as strings>
}

Here the ìdentity is either a DID or an ethereum address.

Response

Status Message
200 Ok. All or some of the orbitDB addresses are returned
400 Bad request No identities found in request
404 Not found No matching orbitDB addresses where found
500 Internal Error Internal Error

The response data follows the jsend standard.

Response data

{
  status: 'success',
  data: {
    rootStoreAddresses: {
      <identity>: <the orbitDB root store address associated with the identity, or null if no match for this identity>
    }
  }
}

3box-address-server's People

Contributors

oed avatar michaelsena avatar zachferland avatar c-castillo avatar greenkeeper[bot] avatar kuhnchris avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.