Authentication
This article explains how to authenticate your API requests to the WaaS service using Openweb3 Auth.
{
"X-Api-Key": {YOUR_API_KEY},
"X-Request-time": {timestamp},
"X-Signature": {YOUR_API_SIGNATURE}.base64(),
}
- X-Api-Key: The key you generate in Generate an API key
- X-Request-time: the current time in Unix timestamp format, measured in milliseconds.
- X-Signature: The API signature. To learn how to calculate an API signature, see Calculate API Signature.
Calculate API Signature
- First, concatenate a string based on your request as follows:
str_to_sign = {BODY}{URI}{TIMESTAMP}
Field | Description | Required | Example |
---|---|---|---|
BODY | The raw request body in string format. | false |
{ "name":"Default", "type":"custodial" } |
URI | The API path, with query | true | /api/v1/transactions/transfer |
TIMESTAMP | The current time in Unix timestamp format, measured in milliseconds. This value must be the same as the x-request-time in the request header. | true | 1707476227132 |
- Perform SHA-256 hashing on the string as follows:
import (
"crypto/sha256"
)
contentHash := sha256.Sum256(data)
- Use the private key of your API key to sign the string as follows:
sk := ed25519.PrivateKey(privateKeyBytes)
signature := ed25519.Sign(sk, contentHash[:])
Now you’ve calculated an API signature.
Updated 7 months ago