# AgentPKI bootstrap (PowerShell). Runs three real scenarios against the live # issuer + verifier: # 1. happy path -> verdict: allow # 2. tampered signature -> verdict: deny (failure_reason: bad_signature) # 3. revoked-key sign -> verdict: deny (failure_reason: revoked_key) # # Nothing destructive. Six HTTP calls total. The point: you watch the same # verifier accept a real token and reject two different attacks, with # different latencies that tell you WHERE in the trust chain each check fired. # # Source: https://github.com/agentpki/web/blob/main/public/bootstrap.ps1 # Inspect without executing: # iwr https://agentpki.dev/bootstrap.ps1 | Select-Object -Expand Content $ErrorActionPreference = 'Stop' Write-Host '' Write-Host 'AgentPKI bootstrap . v1.0 (3-scenario trust demo)' Write-Host '----------------------------------------------------' Write-Host '' # ─── Step 0: collect email ────────────────────────────────────────────── if ($env:AGENTPKI_BOOTSTRAP_EMAIL) { $email = $env:AGENTPKI_BOOTSTRAP_EMAIL Write-Host (' Email? ' + $email + ' (from env)') } else { $email = Read-Host ' Email' } $email = $email.Trim().ToLowerInvariant() if (-not ($email -match '^[^\s@]+@[^\s@]+\.[^\s@]+$')) { Write-Host '' Write-Host (' [fail] "' + $email + '" does not look like an email.') Write-Host '' exit 1 } Write-Host '' # ════════════════════════════════════════════════════════════════════════ # SCENARIO 1 / 3 . happy path # Expect: verdict allow. This is also the only scenario that produces a # shareable /check/result/ permalink, since you'd only share real # passages. # ════════════════════════════════════════════════════════════════════════ Write-Host ' Scenario 1 of 3 . happy path' Write-Host ' --------------------------------------------------' Write-Host -NoNewline ' Claiming subdomain + minting + verifying + storing ... ' $body = @{ email = $email } | ConvertTo-Json -Compress try { $s1 = Invoke-RestMethod -Method POST ` -Uri 'https://agentpki.dev/api/v1/bootstrap-claim' ` -ContentType 'application/json' -Body $body } catch { Write-Host 'fail' Write-Host '' Write-Host (' Error: ' + $_.Exception.Message) Write-Host '' exit 1 } if (-not $s1.ok) { Write-Host 'fail' Write-Host ' ' ($s1 | ConvertTo-Json -Depth 5 -Compress) exit 1 } Write-Host ('ok in ' + $s1.bootstrap_elapsed_ms + 'ms') $tokHead = $s1.passport_token.Substring(0, [Math]::Min(24, $s1.passport_token.Length)) Write-Host (' issuer ' + $s1.subdomain) Write-Host (' passport ' + $tokHead + '... (' + $s1.passport_token_length + ' chars)') Write-Host (' verdict ' + $s1.verdict + ' (verifier elapsed ' + $s1.verifier_elapsed_ms + 'ms)') if ($s1.check_url) { Write-Host (' share ' + $s1.check_url) } Write-Host '' # ════════════════════════════════════════════════════════════════════════ # SCENARIO 2 / 3 . tampered signature # Mint a fresh real token, flip the last 4 chars of the payload+sig blob. # Those last chars are part of the Ed25519 signature -- flipping them # leaves the inner JSON payload intact (so the verifier parses it fine) # but the signature no longer matches. # Expect: verdict deny, failure_reason bad_signature. # ════════════════════════════════════════════════════════════════════════ Write-Host ' Scenario 2 of 3 . tampered signature' Write-Host ' --------------------------------------------------' Write-Host -NoNewline ' Minting a fresh token, flipping 4 chars of its Ed25519 signature, verifying ... ' $cleanMint = Invoke-RestMethod -Uri 'https://demo.agentpki.dev/mint' $clean = $cleanMint.token # PASETO v4.public shape: v4.public..