Po.et's API layer for publishers
- Node.js (see
.nvmrc
for the version to install) - Docker (with docker-compose)
- Frost API token (sign up at frost.po.et to create one)
To run Frost API, clone this repo, and make sure you have Docker and docker-compose installed.
Clone the repo:
git clone https://github.com/poetapp/frost-api.git
cd frost-api
To start the Frost API development environment, run:
docker-compose up --build
You only need to run docker-compose build
to create or update the Docker images, and docker-compose up -d
to start them. To shut everything down, it is recommended to use docker-compose down --volumes
to stop the running containers and clear any data. If you wish to keep data between invocations, use docker-compose down
.
You can also docker-compose exec mongo bash
to run the mongo shell.
Frost API depends on RabbitMQ, IPFS, Bitcoin Core, Po.et node and MongoDB.
These dependencies are setup automatically when you run docker-compose
.
We are using the OpenAPI specification to document the Frost API:
The purpose of the API is to:
- Facilitate the creation and maintenance of Frost accounts
- Enable Frost account holders to create and view their works on the Po.et Network
There are four types of tokens generated by Frost (see src/api/Tokens.ts). The two main ones used in the Frost API methods described below are:
- Login token - used to create and maintain the account
- API token - used for creating and viewing works, for both live (mainnet) and test (testnet) environments
There are two other tokens sent by email:
- Verify Account token - used when verifying an email address (see Verify account below)
- Forgot Password token - used when resetting a password (see Password change token below)
Returns a Login token.
When the user creates a new account the system automatically sends an email for the purpose of verifying the email address. This email contains a link with an embedded token, which the user only needs to click in order to verify the email address. Alternatively, the token can be passed programatically to the server:
Requires a Login token.
Authenticate with email address and password.
Returns a Login token.
Requires a Login token.
When the user forgets or loses the account password, a new one can be requested programatically.
An email is sent that contains a link with an embedded token, which the user can click in order to open the Frost website and set a new password.
Requires a Login token.
Requires a Forgot Password token.
Requires a Login token.
Returns a "test" or "live" API token.
Requires a Login token.
Requires a Login token.
Requires an API token.
Requires an API token.
Requires an API token.
vault server -config=config.hcl
ps ax | grep vault
kill -INT vault_pid
curl --header "X-Vault-Token: ..." --request LIST http://localhost:8200/v1/transit/keys
curl --header "X-Vault-Token: ..." --request POST http://localhost:8200/v1/transit/keys/my-key
curl --header "X-Vault-Token: ..." http://localhost:8200/v1/transit/keys/my-key
if you get an Error checking seal status
error, check the status with:
curl https://127.0.0.1:8200/v1/sys/seal-status
consul agent -server -bootstrap-expect 1 -data-dir /tmp/consul -bind 127.0.0.1
ps ax | grep consul
kill -INT consul_pid
WARNING: only use in development mode.
curl -X DELETE 'http://localhost:8500/v1/kv/vault?recurse'
Coverage is generated with Istanbul. A more complete report can be generated by running npm run coverage
, which will run npm run coverage:unit
and npm run coverage:integration
together. You may also execute these commands separately.
Note: We are using our own forks of nyc and istanbul-lib-instrument in order to add better support for TypeScript. We intend to contribute our forks back to nyc and istanbul-lib-instrument in order to make our solution available to the entire community. You can follow the issues in this PR, and check the new PRs for istanbul-lib-instrument.