# setup-certs.ps1

# 1. Get Phone IP (assumes connected via ADB)
$phoneIp = adb shell "ip route" | Select-String "src" | ForEach-Object { $_.ToString().Split(' ')[8] }
Write-Host "Detected Phone IP: $phoneIp"

# 2. Generate Certs
mkcert -cert-file cert.pem -key-file key.pem $phoneIp localhost 127.0.0.1
Write-Host "Certificates generated."

# 3. Push to Phone
adb push cert.pem /sdcard/Download/cert.pem
adb push key.pem /sdcard/Download/key.pem
Write-Host "Certificates pushed to Android Downloads folder."