Public/Get-PublishedPersistChallenge.ps1

function Get-PublishedPersistChallenge {
    [CmdletBinding()]
    param (
    )

    Process {

        $pubCachePath = Join-Path (Get-ConfigRoot) 'PersistedChallenges.json'
        if (-not (Test-Path $pubCachePath)) {
            return
        }

        $storedCache = Get-Content $pubCachePath -Raw | ConvertFrom-Json
        $needsMigration = @($storedCache | Where-Object { $_.PSObject.Properties['hashAcctUri'] }).Count -gt 0
        $pubCache = @(ConvertTo-PersistedChallengeCache $storedCache)
        if ($needsMigration) {
            ConvertTo-Json -InputObject $pubCache -Depth 5 | Set-Content $pubCachePath
        }

        # Output the contents of the cache in a form that could potentially be piped
        # or splatted to Unpublish-DnsPersistChallenge
        $pubCache | ForEach-Object {
            [pscustomobject][ordered]@{
                Domain                = $_.fqdn
                AccountDigest         = $_.accountDigest
                LegacyWireFormat      = [bool]$_.legacyWireFormat
                IssuerDomainName      = $_.issuer
                AllowWildcard         = [bool]$_.addWildcard
                PersistUntil          = $(if ($_.persistUntil) {
                    [DateTimeOffset]::FromUnixTimeSeconds($_.persistUntil)
                } else {
                    $null
                })
                FromAccountUri        = $_.fromAcctUri
                FromAccountThumbprint = $_.fromAcctThumb
            }
        }
    }
}