Overview
Adds connection signing keys for a specified app.
You can submit multiple sign_keys in one request. The server retains up to three keys, with the most recently added keys listed first.
API Reference
- Method
POST - Path
/apigateway/apps/connectsignkeys/add
Request
Authentication: This API validates request headers. See Authentication.
Request Headers
| Parameter | Data Type | Required | Description | |
|---|---|---|---|---|
| x-appkey | string | Yes | Application appkey. | |
| x-nonce | string | Yes | Random string. Use a unique value for each request. | |
| x-timestamp | string | Yes | Timestamp in milliseconds, represented as a string and used to calculate the signature. | |
| x-signature | string | Yes | Signature value. See the signature calculation pseudocode below. | |
| Content-Type | string | Yes | Must be application/json. | |
| x-request-id | string | No | Unique request ID. If omitted, the server generates one automatically. |
Signature Calculation Pseudocode
input:
signKey
nonce
timestamp
payload = nonce + timestamp + signKey
signature = hex_encode(HMAC_SHA256(payload, key=signKey))
To integrate a client, calculate the signature using a single
signKey:signature = hex(HMAC-SHA256(nonce + timestamp + signKey, signKey)).
Request Parameters
| Parameter | Data Type | Required | Description | |
|---|---|---|---|---|
| sign_keys | array\<string> | Yes | Signing keys to add. Multiple keys can be submitted in one request. The server retains up to three keys, and the serialized configuration can contain up to 2,048 characters. |
Request Example
POST /apigateway/apps/connectsignkeys/add HTTP/1.1
x-appkey: appkey
x-signature: 2e639ae3600a4sdff61fb88b76f485b
x-nonce: nonce
x-timestamp: 1672568121910
Content-Type: application/json
{
"sign_keys": [
"sign_key_1",
"sign_key_2"
]
}
Response Example
{
"code": 0
}