#!/usr/bin/env python3 """Minimal `resolveMiniDoc` resolver for the e2e, backed by the local stack. tamis's OAuth `begin` resolves the login identifier through a Slingshot-compatible `com.bad-example.identity.resolveMiniDoc` service (`{did, pds}`). In production that's the public slingshot, but a locally-created test account only exists in the local PLC, which the public resolver can't see. This stub answers resolveMiniDoc for the single e2e account so the OAuth flow can run entirely against localhost. Usage: e2e-resolver.py """ import json import sys from http.server import BaseHTTPRequestHandler, HTTPServer from urllib.parse import urlparse DID = sys.argv[1] PDS = sys.argv[2] PORT = int(sys.argv[3]) class Handler(BaseHTTPRequestHandler): def do_GET(self): path = urlparse(self.path).path if path == "/xrpc/com.bad-example.identity.resolveMiniDoc": # The e2e has exactly one account, so the identifier is ignored. body = json.dumps({"did": DID, "pds": PDS}).encode() self.send_response(200) self.send_header("content-type", "application/json") self.send_header("content-length", str(len(body))) self.end_headers() self.wfile.write(body) else: self.send_response(404) self.end_headers() def log_message(self, format, *args): # keep the e2e output clean del format, args HTTPServer(("127.0.0.1", PORT), Handler).serve_forever()