REST APIs
Space and Time (SXT Chain) operates on a decentralized network, so authenticating directly to that network allows developers the greatest amount of control, flexibility, and speed, without the need to trust any centralized intermediary. However, not all queries and data inserts for your app need to cryptographically tamperproof. MakeInfinite Labs offers comprehensive REST APIs to insert/query our ManagedDB. In addition, the REST APIs allow you to execute ZK-proven SQL queries (via [Proof of SQL LINK HERE]) against prover nodes hosted by MakeInfinite Labs.
There are two ways to interact with MakeInfinite Labs APIs:
- API Keys are simple and effective way to get started quickly, however cannot be used for every API endpoint. For more on using API Keys, check out the API Key page.
- Access Tokens are more complex and more secure authentication model, similar to signing a Web3 transaction. If you authenticate to Dreamspace, you can access your UI session's Access Token - see instructions on this page in the Dreamspace app.
Access Tokens are the core connection type - all other connection types are simply wrappers or abstractions around the Access Token workflow.
Authentication Workflow:
The decentralized authentication required to generate an Access Token is built on a traditional challenge / response model, whereby the user or application requests and signs a challenge token with the local private key. The network then attempts to validate the with the public key, an access token is issued. Below is a map of that call / challenge / response workflow, with the local cryptographic signature work in bold:
Local / Client | Decentralized Network |
---|---|
Request a challenge token for a particular UserID | |
Generates and returns a random challenge token for that UserID, which expires after 30 seconds | |
Sign the challenge token with the UserID's private key, and returns the signed challenge to the network | |
Authenticates the client's ownership of the UserID's private key by using the UserID's public key to validate the signed challenge, and returns an ACCESS_TOKEN (25 minute session), a REFRESH_TOKEN (30 minute time-out, for streamlined session refresh), and the epoch expiration time for both | |
Any time before the Refresh Token times out, can request a refreshed Access Token , which again comes with a new Refresh Token | |
Any session that has been active for 24 hours is terminated, forcing a full re-authentication |
Access Tokens ARE your session to the network. Never share or lose control of your Access Token, as it would allow others to issue commands to Space and Time network as you.
How to Terminate a Session
You can request the session be terminated at any time by calling the simple logout API, which will immediately log you out of all sessions.
Updated about 1 hour ago