Making a Custom Client
Any Excalibur server exposes a common API for clients to connect to. The documentation for this API is available at the /api/docs endpoint for any Excalibur server.
Data Flow
To communicate with an Excalibur server, the following steps should be performed.
- Check if server is alive.
- Check version compatibility.
- Check if the requested user is registered on the server.
- If not, get the SRP group size.
- Then add the user on the server.
- Authenticate.
- The description of the authentication protocol can be found here.
- The result of this should be a JSON Web Token (JWT) containing a communication UUID.
- Get user's encrypted vault key.
- This request needs to be authenticated with the JWT and a Proof-of-Possession (PoP). Again, more details on the authentication protocol can be found at the link above.
Once this is complete, your client is free to request any other data from the server, provided that authentication is performed. Do note that all encrypted data will be stored in / sent as the Excalibur Encryption Format (ExEF).
Example
Here's how the official Excalibur client performs the above steps:
- Send a
GETrequest to/api/well-known/version. - Send a
GETrequest to/api/well-known/compatiblewith the app's version as a query parameter. - Send a
HEADrequest to/api/users/check/[USERNAME]to check if the user is registered on the server.- If
404 Not Foundis received, send aGETrequest to/api/auth/group-size. - Then send a
POSTrequest to/api/users/addwith the user's details.
- If
- Authenticate.
- Send a
GETrequest to/api/users/vault/[USERNAME].
Key Management
The process above requires us to (a) authenticate and (b) decrypt the user's vault key. It is not advisable to use the same key to do both these things. Use one key to authenticate (the "SRP key") and another key to unlock the vault (the "Account Unlock Key (AUK)"). Read more in the key generation process.