Skip to content

Commit 46ea6ab

Browse files
benthecarmanclaude
andcommitted
Add fixed HMAC test vector for auth validation
Adds a test with a pre-computed HMAC value (cross-checked against Python's hmac module) so the auth logic is verified against a known fixture, not just round-tripped. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 958a3f6 commit 46ea6ab

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

ldk-server/src/service.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,12 @@ mod tests {
521521
assert_eq!(result.unwrap_err().error_code, LdkServerErrorCode::AuthError);
522522
}
523523

524+
#[test]
525+
fn test_hmac_known_vector() {
526+
let hmac = compute_hmac("test_api_key", 1_000_000_000);
527+
assert_eq!(hmac, "3c1a417dd9d2079f0bb5118b4fbb0cc25c695bb6d0e310c2da6cf7dd82f0c9b8");
528+
}
529+
524530
#[test]
525531
fn test_validate_auth_expired_timestamp() {
526532
let timestamp =

0 commit comments

Comments
 (0)