SUD

Callback signature verification

Your application server can verify the source and integrity of SUD callbacks using their signatures. This page defines the protocol. For language-specific implementations and usage, see the SDKs and sample projects.

Signature parameters

Use the application's app_secret as the HMAC key and read the following request headers:

Header Description
Sud-AppId Application ID
Sud-Timestamp Callback timestamp; preserve the original header value when computing the signature
Sud-Nonce Random string
Sud-Signature Lowercase hexadecimal HMAC-SHA1 signature

Signature string format

Concatenate the application ID, timestamp, nonce, and original request body in this order, separating each part with a newline and appending a final newline:

app_id + "\n" + timestamp + "\n" + nonce + "\n" + raw_body + "\n"

Read app_id, timestamp, and nonce from their corresponding headers. raw_body contains the original request body bytes. Use LF line endings, including the final newline. Preserve any line endings within the request body.

Verification procedure

  1. Read the signature headers and original request body. Check that the application ID matches the configured application.
  2. Construct the signature string as specified above.
  3. Compute the HMAC-SHA1 digest using app_secret.
  4. Convert the digest to lowercase hexadecimal and compare it with Sud-Signature. A constant-time comparison is recommended.
  5. Parse the JSON body and process the request only after verification succeeds. Reject requests that fail verification.

Implementation requirements

  • Use the original application secret without padding, truncating, or transforming it.
  • Do not reserialize JSON, reorder fields, remove whitespace, or convert line endings before verification. Semantically equivalent JSON can have different byte sequences and signatures.
  • Verify callback signatures separately from Code and SSToken validation. Neither replaces the other.
  • Signature verification alone does not prevent replay. Implement any request age limits or duplicate request controls separately in your application server.

SDKs and sample projects

Refer to each SDK repository README for verification support, method signatures, and version requirements. Demos illustrate reading HTTP headers, handling raw request bodies, and routing requests. See the server integration guide for repository links.

results matching ""

    No results matching ""