Authentication
The Zide client API employs digital signature authentication to ensure that the requests are genuine and have not been tampered with during transmission. Clients must use their private keys to sign the requests, the Zide api server verifies these signatures using the corresponding public keys.
Ensure your Zide private key used for signing requests is stored securely and is never shared or transmitted. The Zide client api will never ask for your private key.
- Steps to create the headers needed for Zide client api authentication
- Create a Nonce: A nonce is a random string that should be unique for each request to prevent replay attacks.
- Get the current timestamp: It helps in ensuring that the request is only valid for a specific time period to prevent replay attacks.
- Create the data string: Combine the request’s URL, timestamp, and nonce to form a data string.
- Sign the data string: Use your private key to sign the data string. The signing should be done using the RSA-SHA256 algorithm.
- Encode the Signature: Base64 encode the signature.
Include the following headers in the HTTP request:
- X-CLIENT-ID: Your client’s ID from the Zide dashboard.
- X-SIGNATURE: The base64 encoded signature.
- X-TIMESTAMP: The timestamp.
- X-NONCE: The nonce.
Here is a sample code snippet that demonstrates how a client can create such a request. This is just an example, and you should adapt it according to your actual needs and environment.
Replace “your-client-id” with the actual client ID, “your-private-key-in-pem-format” with the actual private key gotten from your Zide dashboard in PEM format, and “/client/v1/transfer” with the actual URL path the client wants to access.