Overview - Add User API Key
API Key & Request Signing: Authentication Flow
Every request sent to the XD Ledger must be digitally signed by the actual sender of the request. This ensures request integrity and security. Below are the authentication and key management approaches supported by the XD Ledger.
Standard Flow – Direct Integration
For direct API integration:
- Each end user (or system user) must possess:
- An API Key
- A Key ID
- A Private Key
These credentials are required to digitally sign requests sent to XD Ledger.
Alternate Flow – Middleware Involvement
In cases where a Middleware Application is used to manage user authorization and lifecycle:
- The middleware obtains its own API Key & Key ID from XD Ledger.
- The middleware is responsible for:
- Creating end customers
- Creating customer accounts
For any money movement (transactional) requests, the end customer must still sign requests using their own keys.
Customer Key Registration – Two Approaches
Approach 1: Middleware Registers End Customer Key (No Email Validation)
This approach allows onboarding without validating the customer's email via OTP.
Mobile App (Client-Side):
- Generates a key pair (Public Key & Private Key).
- The Private Key is securely stored in the mobile app.
Middleware:
- Calls the
addUserKey
API with:- The email address of the end customer (used as the username).
- The Public Key generated from the mobile app.
- Signs the request using its own API credentials.
- Calls the
- XD Ledger:
- Responds with:
- An API Key
- A Key ID
- Responds with:
These are stored in the mobile app and used for all future signed requests by the end customer.
Refer - Add User API Key
Approach 2: Device Registration with Email OTP (Recommended)
This secure and preferred approach uses OTP validation for email verification.
Middleware calls
initiateDeviceRegistration
API:- Passes the end user's email address.
- XD Ledger sends an OTP to the email.
End Customer receives the OTP.
Middleware or Mobile App calls
completeDeviceRegistration
API with:- The OTP
- Public Key (generated on the mobile app)
XD Ledger returns:
- API Key
- Key ID
These are stored on the mobile device and used for subsequent signed requests.