Something went wrong. Try again.
A PDS proxy
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243#!/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 productionthat's the public slingshot, but a locally-created test account only exists in thelocal PLC, which the public resolver can't see. This stub answers resolveMiniDocfor the single e2e account so the OAuth flow can run entirely against localhost.
Usage: e2e-resolver.py <did> <pds_url> <port>"""
import jsonimport sysfrom http.server import BaseHTTPRequestHandler, HTTPServerfrom 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()