// firmware/src/hmac.h #pragma once #include #ifdef NATIVE_TEST #include using HString = std::string; #else #include using HString = String; #endif // Returns lowercase hex-encoded HMAC-SHA256 signature. // Message signed: method + "\n" + path + "\n" + timestamp_str + "\n" + hex(sha256(body)) // Matches server verify_device_hmac format: POST\n{path}\n{timestamp}\n{sha256(body)} HString hmac_sign(const HString& secret_hex, const HString& method, const HString& path, uint32_t timestamp, const HString& body);