@@ -16,6 +16,10 @@ use crate::webhook::envelope::{BareWebhookNotificationEnvelope, WebhookNotificat
16
16
17
17
pub mod envelope;
18
18
19
+ // --- Constants ---
20
+ const SIGNATURE_HEADER_NAME : & str = "x-signature-sha256" ;
21
+ const TIMESTAMP_HEADER_NAME : & str = "x-request-timestamp" ;
22
+
19
23
// --- Configuration ---
20
24
#[ derive( Clone , Debug ) ]
21
25
pub struct WebhookRetryConfig {
@@ -187,15 +191,11 @@ impl DurableExecution for WebhookJobHandler {
187
191
let signature_bytes = mac. finalize ( ) . into_bytes ( ) ;
188
192
let signature_hex = hex:: encode ( signature_bytes) ;
189
193
190
- // Standard header names
191
- let signature_header_name = "X-Signature-SHA256" ;
192
- let timestamp_header_name = "X-Request-Timestamp" ;
193
-
194
194
let signature_header_value = HeaderValue :: from_str ( & signature_hex)
195
195
. map_err ( |e| {
196
196
WebhookError :: RequestConstruction ( format ! (
197
197
"Invalid header value for '{}': {}" ,
198
- signature_header_name , e
198
+ SIGNATURE_HEADER_NAME , e
199
199
) )
200
200
} )
201
201
. map_err_fail ( ) ?;
@@ -204,17 +204,17 @@ impl DurableExecution for WebhookJobHandler {
204
204
. map_err ( |e| {
205
205
WebhookError :: RequestConstruction ( format ! (
206
206
"Invalid header value for '{}': {}" ,
207
- timestamp_header_name , e
207
+ TIMESTAMP_HEADER_NAME , e
208
208
) )
209
209
} )
210
210
. map_err_fail ( ) ?;
211
211
212
212
request_headers. insert (
213
- HeaderName :: from_static ( signature_header_name ) ,
213
+ HeaderName :: from_static ( SIGNATURE_HEADER_NAME ) ,
214
214
signature_header_value,
215
215
) ;
216
216
request_headers. insert (
217
- HeaderName :: from_static ( timestamp_header_name ) ,
217
+ HeaderName :: from_static ( TIMESTAMP_HEADER_NAME ) ,
218
218
timestamp_header_value,
219
219
) ;
220
220
}
0 commit comments