diff --git a/demo/scql/index.html b/demo/scql/index.html index 2f71aa0..0faf0fa 100644 --- a/demo/scql/index.html +++ b/demo/scql/index.html @@ -244,7 +244,6 @@ function buildFlowSvg() { const aliceBg = get('--alice-bg'); const bobBg = get('--bob-bg'); const panel = get('--panel'); - const panel2 = get('--panel-2)'); let s = ` @@ -267,64 +266,70 @@ function buildFlowSvg() { s += `🛒 shop 电商`; s += `⚙️ SCQL 引擎`; + // 节点 y 坐标 + const Y_INPUT = 88; + const Y_PSI = 170; + const Y_COMPUTE= 218; + const Y_REVEAL = 260; + const cx = 660; + // 两侧 site.put 节点 const sides = [ - { x: 80, color: alice, label: 'uid / city / age', revealStage: 1 }, + { x: 80, color: alice, label: 'uid / city / age', revealStage: 1 }, { x: 1240, color: bob, label: 'uid / amount', revealStage: 1 }, ]; sides.forEach(side => { s += ``; - s += ``; - s += `📥 site.put(df)`; - s += `${side.label}`; + s += ``; + s += `📥 site.put(df)`; + s += `${side.label}`; s += ``; }); // 中央 SCQL handle 节点 - const cx = 660, cy = 88; s += ``; - s += ``; - s += `🔒 secret handle`; - s += `本地密文引用(不出域)`; + s += ``; + s += `🔒 secret handle`; + s += `本地密文引用(不出域)`; s += ``; - // 第 2 层:PSI 大节点 - const psiY = 160; + // 第 2 层:ECDH-PSI 大节点(内嵌握手 ↔ 标识,避免跨界椭圆弧) s += ``; - s += ``; - s += `双方行序对齐 · 只看到交集(盲化点交换)`; - s += `🤝 ECDH-PSI · nax.data.intersect`; - s += `→ ? 行命中`; + s += ``; + s += `双方行序对齐 · 只看到交集 · 盲化点交换 ↔`; + s += `🤝 ECDH-PSI · nax.data.intersect`; + s += `→ ? 行命中`; s += ``; // 第 3 层:密文计算长条 - const cmY = 210; s += ``; - s += ``; - s += `⚙️ WHERE → 0/1 共享位 · GROUP BY city · COUNT / AVG`; + s += ``; + s += `⚙️ WHERE → 0/1 共享位 · GROUP BY city · COUNT / AVG`; s += ``; // 第 4 层:reveal(左侧 → bank)+ 不向 shop 揭示(右侧虚线) - const rvY = 258; s += ``; - s += ``; - s += `🔓 reveal → bank`; + s += ``; + s += `🔓 reveal → bank`; s += ``; s += ``; - s += ``; - s += `🚫 不向 shop 揭示`; + s += ``; + s += `🚫 不向 shop 揭示`; s += ``; - // 连线(按 stage reveal 顺序) + // 连线(端点对齐节点边界,不穿越节点) const edges = [ - { id: 'e1a', d: `M145,116 C300,116 480,116 ${cx-90},116`, color: alice, marker: 'arrA', rs: 1 }, - { id: 'e1b', d: `M${cx+90},116 C840,116 1020,116 1175,116`, color: bob, marker: 'arrB', rs: 1 }, - { id: 'e2a', d: `M${cx},${cy+28} L${cx},${psiY-22}`, color: dim, marker: 'arrD', rs: 2 }, - { id: 'e2ba', d: `M145,${psiY-22} C145,${psiY-50} ${W-145},${psiY-50} ${W-145},${psiY-22}`, color: alice, marker: 'arrB', rs: 2, dash: '6 4' }, - { id: 'e2ab', d: `M${W-145},${psiY-22} C${W-145},${psiY-44} 145,${psiY-44} 145,${psiY-22}`, color: bob, marker: 'arrA', rs: 2, dash: '6 4' }, - { id: 'e3', d: `M${cx},${psiY+22} L${cx},${cmY-20}`, color: dim, marker: 'arrD', rs: 3 }, - { id: 'e4a', d: `M${cx-200},${cmY+20} L210,${rvY-16}`, color: ok, marker: 'arrE', rs: 5 }, - { id: 'e4b', d: `M${cx+200},${cmY+20} L1110,${rvY-16}`, color: bob, marker: 'arrB', rs: 4 }, + // ① side → handle(直线,端点在节点边缘) + { id: 'e1a', d: `M145,${Y_INPUT} L${cx - 90},${Y_INPUT}`, color: alice, marker: 'arrA', rs: 1 }, + { id: 'e1b', d: `M${cx + 90},${Y_INPUT} L1175,${Y_INPUT}`, color: bob, marker: 'arrB', rs: 1 }, + // ② handle → PSI 顶部(直线) + { id: 'e2a', d: `M${cx},${Y_INPUT + 28} L${cx},${Y_PSI - 25}`, color: dim, marker: 'arrD', rs: 2 }, + // ③ PSI → COMPUTE(紧邻,几乎直线) + { id: 'e3', d: `M${cx},${Y_PSI + 25} L${cx},${Y_COMPUTE - 20}`, color: dim, marker: 'arrD', rs: 3 }, + // ④ COMPUTE → reveal(bank,左下) + { id: 'e4a', d: `M${cx - 200},${Y_COMPUTE + 20} L210,${Y_REVEAL - 16}`, color: ok, marker: 'arrE', rs: 5 }, + // ⑤ COMPUTE → 不向 shop 揭示(右下,虚线) + { id: 'e4b', d: `M${cx + 200},${Y_COMPUTE + 20} L1110,${Y_REVEAL - 16}`, color: bob, marker: 'arrB', rs: 4, dash: '5 4' }, ]; edges.forEach(e => { const dash = e.dash ? ` stroke-dasharray="${e.dash}"` : '';