Files
bot/apps/shared/BotKit/Tests/BotKitTests/DeviceAuthPayloadTests.swift
zeekay c715d72ffd Merge openclaw/main via rebrand bridge
Merged 3580 upstream commits from openclaw/main through a bridge branch
that applied the openclaw→hanzo-bot rebrand before merging.

Key upstream additions:
- Android device diagnostics and notification actions
- Device-auth v2 migration improvements
- Docker CLI packaging fixes
- Ollama discovery log demotion
- Channel health monitoring
- Slack native streaming
- Linq iMessage channel
- Gemini OAuth and FTS improvements
- Inbound sender metadata
- Daemon PATH improvements
- Canvas host and onboarding enhancements
- Security hardening (session files, exec allowlist)
2026-02-26 22:47:28 -08:00

31 lines
1.1 KiB
Swift

import Testing
@testable import BotKit
@Suite("DeviceAuthPayload")
struct DeviceAuthPayloadTests {
@Test("builds canonical v3 payload vector")
func buildsCanonicalV3PayloadVector() {
let payload = GatewayDeviceAuthPayload.buildV3(
deviceId: "dev-1",
clientId: "hanzo-bot-macos",
clientMode: "ui",
role: "operator",
scopes: ["operator.admin", "operator.read"],
signedAtMs: 1_700_000_000_000,
token: "tok-123",
nonce: "nonce-abc",
platform: " IOS ",
deviceFamily: " iPhone ")
#expect(
payload
== "v3|dev-1|hanzo-bot-macos|ui|operator|operator.admin,operator.read|1700000000000|tok-123|nonce-abc|ios|iphone")
}
@Test("normalizes metadata with ASCII-only lowercase")
func normalizesMetadataWithAsciiLowercase() {
#expect(GatewayDeviceAuthPayload.normalizeMetadataField(" İOS ") == "İos")
#expect(GatewayDeviceAuthPayload.normalizeMetadataField(" MAC ") == "mac")
#expect(GatewayDeviceAuthPayload.normalizeMetadataField(nil) == "")
}
}