mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-21 15:01:03 +00:00
22 lines
725 B
Swift
22 lines
725 B
Swift
import Testing
|
|
@testable import OpenClaw
|
|
|
|
struct ExecApprovalsSocketAuthTests {
|
|
@Test
|
|
func `timing safe hex compare matches equal strings`() {
|
|
#expect(timingSafeHexStringEquals(String(repeating: "a", count: 64), String(repeating: "a", count: 64)))
|
|
}
|
|
|
|
@Test
|
|
func `timing safe hex compare rejects mismatched strings`() {
|
|
let expected = String(repeating: "a", count: 63) + "b"
|
|
let provided = String(repeating: "a", count: 63) + "c"
|
|
#expect(!timingSafeHexStringEquals(expected, provided))
|
|
}
|
|
|
|
@Test
|
|
func `timing safe hex compare rejects different length strings`() {
|
|
#expect(!timingSafeHexStringEquals(String(repeating: "a", count: 64), "deadbeef"))
|
|
}
|
|
}
|