✔️ Validate incoming data
Learn how to use a shared secret so we can validate the sensor data sent to a sensor endpoint. If the data strategy selected for a sensor is Endpoint, Nexudus waits for data to be sent to that endpoint. To validate this data actually originates from a trusted source, a shared secret is used to sign the request. A shared secret is automatically created for you when you register a new sensor. You can view and rotate this secret if needed within the details of each sensor.How signature validation works
To validate the signature of a request, we serialise the payload of the request and calculate a HMACSHA256 signature using the shared secret. We will compare that signature with the value of the HTTP headerX-Nexudus-Hook-Signature and only accept the request if there is an exact match.
Both the payload and shared secrets are converted to a byte array assuming UTF-8 encoding. You may need to take this into consideration when
computing the signature on your server in order to set the HTTP header.