@@ -106,16 +106,16 @@ impl LdkServerClient {
106106
107107 /// Computes the HMAC-SHA256 authentication header value.
108108 /// Format: "HMAC <timestamp>:<hmac_hex>"
109- /// Uses timestamp-only HMAC (no body) since TLS guarantees integrity .
110- fn compute_auth_header ( & self ) -> String {
109+ /// The signature covers the timestamp and raw gRPC request body bytes .
110+ fn compute_auth_header ( & self , body : & [ u8 ] ) -> String {
111111 let timestamp = SystemTime :: now ( )
112112 . duration_since ( UNIX_EPOCH )
113113 . expect ( "System time should be after Unix epoch" )
114114 . as_secs ( ) ;
115115
116- // HMAC-SHA256(api_key, timestamp_bytes) — no body
117116 let mut hmac_engine: HmacEngine < sha256:: Hash > = HmacEngine :: new ( self . api_key . as_bytes ( ) ) ;
118117 hmac_engine. input ( & timestamp. to_be_bytes ( ) ) ;
118+ hmac_engine. input ( body) ;
119119 let hmac_result = Hmac :: < sha256:: Hash > :: from_engine ( hmac_engine) ;
120120
121121 format ! ( "HMAC {}:{}" , timestamp, hmac_result)
@@ -428,7 +428,7 @@ impl LdkServerClient {
428428 let grpc_body = encode_grpc_frame ( & request. encode_to_vec ( ) ) . to_vec ( ) ;
429429
430430 let url = format ! ( "https://{}{}{}" , self . base_url, GRPC_SERVICE_PREFIX , method) ;
431- let auth_header = self . compute_auth_header ( ) ;
431+ let auth_header = self . compute_auth_header ( & grpc_body ) ;
432432
433433 let response = self
434434 . client
@@ -471,7 +471,7 @@ impl LdkServerClient {
471471 let grpc_body = encode_grpc_frame ( & request. encode_to_vec ( ) ) . to_vec ( ) ;
472472
473473 let url = format ! ( "https://{}{}{}" , self . base_url, GRPC_SERVICE_PREFIX , method) ;
474- let auth_header = self . compute_auth_header ( ) ;
474+ let auth_header = self . compute_auth_header ( & grpc_body ) ;
475475
476476 let response = self
477477 . streaming_client
0 commit comments