https://github.com/3box/3box-address-server
A server that associates an Ethereum address with its orbitdb address
https://github.com/3box/3box-address-server
Last synced: 6 months ago
JSON representation
A server that associates an Ethereum address with its orbitdb address
- Host: GitHub
- URL: https://github.com/3box/3box-address-server
- Owner: 3box
- License: mit
- Created: 2018-08-21T16:48:12.000Z (almost 7 years ago)
- Default Branch: develop
- Last Pushed: 2023-01-09T22:48:30.000Z (over 2 years ago)
- Last Synced: 2023-04-03T13:52:58.817Z (about 2 years ago)
- Language: JavaScript
- Homepage:
- Size: 3.17 MB
- Stars: 9
- Watchers: 8
- Forks: 9
- Open Issues: 36
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# ⚠️ ⚠️ Deprecated in favor of Ceramic ⚠️ ⚠️
> 3box.js and related tools built by 3Box Labs are deprecated and no loger supported. Developers are encurraged to build with https://ceramic.network which is a more secure and decentralized protocol for sovereign data.# 3Box Address Server
[](https://greenkeeper.io/)
`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:
}
```The `address_token` is a [DID signed jwt](https://github.com/uport-project/did-jwt.git) of the address to be published. The payload of the `address_token` is:
```
{
rootStoreAddress:
}
```#### 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`](https://labs.omniti.com/labs/jsend) standard.
#### Response data
```
{
status: 'success',
data: {
rootStoreAddress:
}
}
```### Link an ethereum address to a DID
`POST /link`
#### Body
```
{
consent_signature: ,
linked_did: ,
consent_msg: ,
type: ,
chainId: ,
address: ,
timestamp:
}
```The `consent_signature` is a [personal_sign signature](https://web3js.readthedocs.io/en/1.0/web3-eth-personal.html) 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`](https://labs.omniti.com/labs/jsend) standard.
#### Response data
```
{
status: 'success',
data: {
did: ,
address:
}
}
```### Delete a link between an ethereum address and a DID
`POST /linkdelete`
#### Body
```
{
delete_token:
}
```The `delete_token` is a [DID signed jwt](https://github.com/uport-project/did-jwt.git) 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`](https://labs.omniti.com/labs/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`](https://labs.omniti.com/labs/jsend) standard.
#### Response data
```
{
status: 'success',
data: {
rootStoreAddress:
}
}
```### 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:
}
```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`](https://labs.omniti.com/labs/jsend) standard.
#### Response data
```
{
status: 'success',
data: {
rootStoreAddresses: {
:
}
}
}
```## Maintainers
[@simonovic86](https://github.com/simonovic86)