Private/Invoke-SshImportIdFetch.ps1
|
function Invoke-SshImportIdFetch { <# .SYNOPSIS Downloads the raw public-key list from a keys-fetch URL. #> [CmdletBinding()] [OutputType([string[]])] param( [Parameter(Mandatory)] [string] $Url ) try { $response = Invoke-RestMethod -Uri $Url -Method Get -ErrorAction Stop } catch { throw "Failed to fetch keys from '$Url': $($_.Exception.Message)" } $lines = @($response -split '\r?\n' | Where-Object { $_.Trim() -ne '' }) if (-not $lines) { throw "No SSH public keys found at '$Url'." } return $lines } |