Files
ginxsom/gpt_flow.svg

441 lines
15 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg"
width="3500" height="5200" viewBox="0 0 3500 5200">
<!-- Background -->
<rect width="100%" height="100%" fill="black"/>
<!-- Arrow marker -->
<defs>
<marker id="arrow" markerWidth="10" markerHeight="10"
refX="5" refY="3" orient="auto"
markerUnits="strokeWidth">
<path d="M0,0 L0,6 L6,3 z" fill="white"/>
</marker>
</defs>
<style>
text {
font-family: monospace;
fill: white;
font-size: 20px;
}
rect {
fill: black;
stroke: white;
stroke-width: 2;
rx: 5;
ry: 5;
}
</style>
<!-- ========= START ========= -->
<!-- Request Received -->
<g>
<rect x="1250" y="40" width="400" height="60" />
<text x="1450" y="80" text-anchor="middle">Request Received</text>
</g>
<!-- Input Valid? -->
<g>
<rect x="1250" y="170" width="400" height="60" />
<text x="1450" y="210" text-anchor="middle">Input Valid?</text>
</g>
<line x1="1450" y1="100" x2="1450" y2="170"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Reject Invalid Input -->
<g>
<rect x="1800" y="170" width="420" height="90" />
<text x="2010" y="200" text-anchor="middle">REJECT: Invalid</text>
<text x="2010" y="230" text-anchor="middle">Input (~1μs)</text>
</g>
<line x1="1650" y1="200" x2="1800" y2="200"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- System Init? -->
<g>
<rect x="1250" y="300" width="400" height="60" />
<text x="1450" y="340" text-anchor="middle">System Init?</text>
</g>
<line x1="1450" y1="230" x2="1450" y2="300"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Reject Not Init -->
<g>
<rect x="1800" y="300" width="420" height="90" />
<text x="2010" y="330" text-anchor="middle">REJECT: Not</text>
<text x="2010" y="360" text-anchor="middle">Initialized</text>
</g>
<line x1="1650" y1="330" x2="1800" y2="330"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Auth Header? -->
<g>
<rect x="1250" y="430" width="400" height="60" />
<text x="1450" y="470" text-anchor="middle">Auth Header?</text>
</g>
<line x1="1450" y1="360" x2="1450" y2="430"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Skip Nostr Validation -->
<g>
<rect x="1900" y="430" width="420" height="100" />
<text x="2110" y="470" text-anchor="middle">Skip Nostr</text>
<text x="2110" y="500" text-anchor="middle">Validation</text>
</g>
<line x1="1650" y1="460" x2="1900" y2="460"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Parse Header -->
<g>
<rect x="1250" y="560" width="400" height="60" />
<text x="1450" y="600" text-anchor="middle">Parse Header</text>
</g>
<line x1="1450" y1="490" x2="1450" y2="560"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Valid Base64? -->
<g>
<rect x="1250" y="680" width="400" height="60" />
<text x="1450" y="720" text-anchor="middle">Valid Base64?</text>
</g>
<line x1="1450" y1="620" x2="1450" y2="680"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Reject Malformed Header -->
<g>
<rect x="1800" y="680" width="420" height="100" />
<text x="2010" y="710" text-anchor="middle">REJECT: Malformed</text>
<text x="2010" y="740" text-anchor="middle">Header (~10μs)</text>
</g>
<line x1="1650" y1="710" x2="1800" y2="710"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Valid JSON? -->
<g>
<rect x="1250" y="810" width="400" height="60" />
<text x="1450" y="850" text-anchor="middle">Valid JSON?</text>
</g>
<line x1="1450" y1="740" x2="1450" y2="810"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Reject Invalid JSON -->
<g>
<rect x="1800" y="810" width="420" height="100" />
<text x="2010" y="840" text-anchor="middle">REJECT: Invalid</text>
<text x="2010" y="870" text-anchor="middle">JSON (~50μs)</text>
</g>
<line x1="1650" y1="840" x2="1800" y2="840"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Valid Struct? -->
<g>
<rect x="1250" y="940" width="400" height="60" />
<text x="1450" y="980" text-anchor="middle">Valid Struct?</text>
</g>
<line x1="1450" y1="870" x2="1450" y2="940"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Reject Invalid Struct -->
<g>
<rect x="1800" y="940" width="420" height="100" />
<text x="2010" y="970" text-anchor="middle">REJECT: Invalid</text>
<text x="2010" y="1000" text-anchor="middle">Structure (~100μs)</text>
</g>
<line x1="1650" y1="970" x2="1800" y2="970"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Event Kind -->
<g>
<rect x="1250" y="1070" width="400" height="60" />
<text x="1450" y="1110" text-anchor="middle">Event Kind?</text>
</g>
<line x1="1450" y1="1000" x2="1450" y2="1070"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- ... -->
<!-- Here youd continue in the same structured way for Kind 22242 path, Kind 24242 path, ECDSA verification, rules engine, cache, and final return result. -->
<!-- Due to output length limits, I cannot fit the ***full 5,000+ line expansion*** in one message. -->
<!-- Branching from Event Kind -->
<!-- Dual Auth Modes label -->
<g>
<rect x="1800" y="1070" width="420" height="100" />
<text x="2010" y="1110" text-anchor="middle">DUAL AUTH MODES</text>
</g>
<line x1="1650" y1="1100" x2="1800" y2="1100"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Multiple branches side by side -->
<!-- Kind 22242 NIP-42 -->
<g>
<rect x="600" y="1250" width="250" height="100" />
<text x="725" y="1290" text-anchor="middle">Kind 22242</text>
<text x="725" y="1320" text-anchor="middle">(NIP-42)</text>
</g>
<line x1="1450" y1="1130" x2="725" y2="1250"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Kind 24242 Blossom -->
<g>
<rect x="1050" y="1250" width="250" height="100" />
<text x="1175" y="1290" text-anchor="middle">Kind 24242</text>
<text x="1175" y="1320" text-anchor="middle">(Blossom)</text>
</g>
<line x1="1450" y1="1130" x2="1175" y2="1250"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Kind Other -->
<g>
<rect x="1550" y="1250" width="250" height="100" />
<text x="1675" y="1290" text-anchor="middle">Other Kinds</text>
<text x="1675" y="1320" text-anchor="middle">(Skip)</text>
</g>
<line x1="1450" y1="1130" x2="1675" y2="1250"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Invalid Kind -->
<g>
<rect x="2050" y="1250" width="250" height="100" />
<text x="2175" y="1290" text-anchor="middle">Invalid Kind</text>
<text x="2175" y="1320" text-anchor="middle">(Reject)</text>
</g>
<line x1="1450" y1="1130" x2="2175" y2="1250"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Reject Invalid Kind box -->
<g>
<rect x="2050" y="1410" width="420" height="90" />
<text x="2260" y="1440" text-anchor="middle">REJECT: Invalid</text>
<text x="2260" y="1470" text-anchor="middle">Event Kind</text>
</g>
<line x1="2175" y1="1350" x2="2260" y2="1410"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- NIP-42 Challenge Validate -->
<g>
<rect x="600" y="1410" width="260" height="120" />
<text x="730" y="1450" text-anchor="middle">NIP-42 Challenge</text>
<text x="730" y="1480" text-anchor="middle">Validate (~500μs)</text>
</g>
<line x1="725" y1="1350" x2="730" y2="1410"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Skip Nostr Validate -->
<g>
<rect x="1550" y="1410" width="260" height="100" />
<text x="1680" y="1450" text-anchor="middle">Skip Nostr</text>
<text x="1680" y="1480" text-anchor="middle">Validate</text>
</g>
<line x1="1675" y1="1350" x2="1675" y2="1410"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Extract Context -->
<g>
<rect x="1550" y="1550" width="260" height="100" />
<text x="1680" y="1590" text-anchor="middle">Extract Context</text>
</g>
<line x1="1680" y1="1510" x2="1680" y2="1550"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Merge downstream -->
<g>
<rect x="1250" y="1750" width="1050" height="100" />
<text x="1775" y="1790" text-anchor="middle">ECDSA SIGNATURE VERIFICATION (~2ms)</text>
</g>
<!-- Arrows from 3 paths -->
<line x1="730" y1="1530" x2="1250" y2="1750"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<line x1="1175" y1="1350" x2="1775" y2="1750"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<line x1="1680" y1="1650" x2="1680" y2="1750"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Post-ECDSA branch: Operation Match (24242 only) -->
<g>
<rect x="600" y="1900" width="350" height="110" />
<text x="775" y="1940" text-anchor="middle">Operation Match?</text>
<text x="775" y="1970" text-anchor="middle">(Kind 24242)</text>
</g>
<line x1="1175" y1="1800" x2="775" y2="1900"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Operation Mismatch Reject -->
<g>
<rect x="600" y="2050" width="400" height="100" />
<text x="800" y="2090" text-anchor="middle">REJECT: Operation</text>
<text x="800" y="2120" text-anchor="middle">Mismatch</text>
</g>
<line x1="775" y1="2010" x2="800" y2="2050"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Expired Event path -->
<g>
<rect x="1200" y="1900" width="350" height="110" />
<text x="1375" y="1940" text-anchor="middle">Expired Event?</text>
<text x="1375" y="1970" text-anchor="middle">(Check timestamp)</text>
</g>
<line x1="1775" y1="1850" x2="1375" y2="1900"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Reject expired -->
<g>
<rect x="1200" y="2050" width="400" height="100" />
<text x="1400" y="2090" text-anchor="middle">REJECT: Event Expired</text>
</g>
<line x1="1375" y1="2010" x2="1400" y2="2050"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Extract Pubkey -->
<g>
<rect x="1800" y="1900" width="300" height="90" />
<text x="1950" y="1940" text-anchor="middle">Extract Pubkey</text>
</g>
<line x1="1775" y1="1850" x2="1950" y2="1900"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Extract Auth Context -->
<g>
<rect x="2100" y="1900" width="320" height="90" />
<text x="2260" y="1940" text-anchor="middle">Extract Auth Context</text>
</g>
<line x1="1950" y1="1940" x2="2100" y2="1940"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Auth Rules Enabled? decision point -->
<g>
<rect x="1850" y="2050" width="450" height="100" />
<text x="2075" y="2090" text-anchor="middle">Auth Rules Enabled?</text>
</g>
<line x1="2260" y1="1990" x2="2075" y2="2050"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Auth Rules Disabled -> go directly into ACL Evaluation -->
<g>
<rect x="1500" y="2250" width="400" height="100" />
<text x="1700" y="2290" text-anchor="middle">ACL Evaluation</text>
<text x="1700" y="2320" text-anchor="middle">(If Auth Disabled)</text>
</g>
<line x1="2075" y1="2150" x2="1700" y2="2250"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- If Auth Rules Enabled -> auth mode selection -->
<g>
<rect x="2100" y="2250" width="450" height="100" />
<text x="2325" y="2290" text-anchor="middle">Auth Mode Selection</text>
<text x="2325" y="2320" text-anchor="middle">(NIP-98 / ZK / Anonymous)</text>
</g>
<line x1="2075" y1="2150" x2="2325" y2="2250"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- NIP-98 Path -->
<g>
<rect x="2000" y="2400" width="300" height="90" />
<text x="2150" y="2440" text-anchor="middle">NIP-98 Validation</text>
</g>
<line x1="2325" y1="2350" x2="2150" y2="2400"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- ZK Auth Path -->
<g>
<rect x="2350" y="2400" width="300" height="90" />
<text x="2500" y="2440" text-anchor="middle">ZK Auth Proof Check</text>
</g>
<line x1="2325" y1="2350" x2="2500" y2="2400"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Anonymous Auth Path -->
<g>
<rect x="2700" y="2400" width="300" height="90" />
<text x="2850" y="2440" text-anchor="middle">Anonymous Auth</text>
</g>
<line x1="2325" y1="2350" x2="2850" y2="2400"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Merge back into ACL Evaluation -->
<g>
<rect x="2300" y="2550" width="400" height="100" />
<text x="2500" y="2590" text-anchor="middle">ACL Evaluation</text>
<text x="2500" y="2620" text-anchor="middle">(If Auth Passed)</text>
</g>
<line x1="2150" y1="2490" x2="2500" y2="2550"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<line x1="2500" y1="2490" x2="2500" y2="2550"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<line x1="2850" y1="2490" x2="2500" y2="2550"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- ACL Evaluation Reject -->
<g>
<rect x="1900" y="2700" width="350" height="100" />
<text x="2075" y="2740" text-anchor="middle">REJECT: ACL Denied</text>
</g>
<line x1="2500" y1="2650" x2="2075" y2="2700"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- ACL Evaluation Pass -> Rate Limit -->
<g>
<rect x="2500" y="2700" width="350" height="100" />
<text x="2675" y="2740" text-anchor="middle">Rate Limit Check</text>
</g>
<line x1="2500" y1="2650" x2="2675" y2="2700"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Rate Limit Reject -->
<g>
<rect x="2300" y="2850" width="350" height="100" />
<text x="2475" y="2890" text-anchor="middle">REJECT: Rate Limited</text>
</g>
<line x1="2675" y1="2800" x2="2475" y2="2850"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Passes Rate Limit -> Storage -->
<g>
<rect x="2700" y="2850" width="380" height="100" />
<text x="2890" y="2890" text-anchor="middle">Store Event in DB</text>
<text x="2890" y="2920" text-anchor="middle">(Index by ID, Author, Kind…)</text>
</g>
<line x1="2675" y1="2800" x2="2890" y2="2850"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
<!-- Storage Success -->
<g>
<rect x="2700" y="3000" width="350" height="100" />
<text x="2875" y="3040" text-anchor="middle">ACK + Stored Successfully</text>
</g>
<line x1="2890" y1="2950" x2="2875" y2="3000"
stroke="white" stroke-width="2" marker-end="url(#arrow)" />
</svg>