Files
ssw-tds-test/build/verify-mpc.sh
T
ssw-tds-test e4e5faa55e init: ssw-tds-test 可信数据空间部署测试工程
初始提交,沉淀 k8s-tenant-wuguirong 租户下完整可信数据空间
的部署、真机/真数据/真多方验证成果。

包含:
- CLAUDE.md / docs/:工程入口、armv7 glibc 兼容性整改规格、
  ssw-platform#1(armv7 stdout=文件即 exit 100)issue 正文
- build/:TDS 服务端 + tdc-connector 交叉构建脚本、cube 沙箱
  编排、三方拓扑/真机验收脚本、ELF 符号扫描工具
- card/:软卡(softcard)源码与预编译产物(local/amd64/armv7)
- evidence/:验收报告、三方真实结果、armv7 stdout 矩阵复现证据
- .workbuddy/memory/:工作日志

排除:ssw-tds/ 与 ssw-acz7015/ 为上游源码独立仓库(含 .git,
体积大);build/ 下 ctx-*/dist/pglite-* 等可重建中间产物;
build/.env.*、tdc-conn-key/、.tdc-identity-secret 等明文密钥。
2026-11-13 10:19:19 +08:00

69 lines
3.1 KiB
Bash
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.
#!/usr/bin/env bash
# MPC 编排(ssw-mpc-flow)接口验收:登录 + 设备同步(真源=控制面 /nodes)
#
# 用法: bash build/verify-mpc.sh [BASE]
set -uo pipefail
BASE="${1:-http://192.168.1.26:30203}"
ACCOUNT="${MPC_ACCOUNT:-admin}"
PASSWORD="${MPC_PASSWORD:-123456}"
CIPHER_KEY="EY8WePvjM5GGwQzn"
ok=0; bad=0
p() { if [ "$1" = "1" ]; then echo " ✅ $2"; ok=$((ok+1)); else echo " ❌ $2"; bad=$((bad+1)); fi; }
enc_pwd() {
# 🔴 JNPF / 编排同款(已在 node/CryptoJS 与 openssl 双向校验):
# key = md5(CIPHER_KEY) 的十六进制串的 **ASCII 字节**(32B)→ openssl -K 吃它的 hex
# data = md5(明文) 的十六进制串的 **ASCII 字节**(32B)→ 直接喂给 openssl 的 stdin
# AES-256-ECB-PKCS7 → hex 输出
# 🔴 data **不能再 hex 化一次**(那是把 32 个 ASCII 字节变成 64 个字节,错)。
local kh dh kh_hex
kh=$(printf '%s' "$CIPHER_KEY" | md5 -q 2>/dev/null || printf '%s' "$CIPHER_KEY" | md5sum | cut -d' ' -f1)
dh=$(printf '%s' "$1" | md5 -q 2>/dev/null || printf '%s' "$1" | md5sum | cut -d' ' -f1)
kh_hex=$(printf '%s' "$kh" | od -An -tx1 | tr -d '
')
printf '%s' "$dh" | openssl enc -aes-256-ecb -K "$kh_hex" -nosalt 2>/dev/null | od -An -tx1 | tr -d '
'
}
echo "=== 1. 编排登录 ($BASE) ==="
ENCPW=$(enc_pwd "$PASSWORD")
LOGIN=$(curl -s -m 25 -X POST "$BASE/api/oauth/Login" \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode "account=$ACCOUNT" --data-urlencode "password=$ENCPW" \
--data-urlencode "grant_type=password" 2>&1)
echo " raw: $(printf '%s' "$LOGIN" | head -c 160)"
TOKEN=$(printf '%s' "$LOGIN" | sed -n 's/.*"token":"\([^"]*\)".*/\1/p')
if [ -z "$TOKEN" ]; then
# 编排可能是明文口令通道
LOGIN2=$(curl -s -m 25 -X POST "$BASE/api/oauth/Login" -H 'Content-Type: application/json' \
-d "{\"account\":\"$ACCOUNT\",\"password\":\"$PASSWORD\",\"grant_type\":\"password\"}" 2>&1)
echo " json 直送: $(printf '%s' "$LOGIN2" | head -c 160)"
TOKEN=$(printf '%s' "$LOGIN2" | sed -n 's/.*"token":"\([^"]*\)".*/\1/p')
fi
[ -n "$TOKEN" ] && p 1 "登录成功 token=${TOKEN:0:24}…" || { p 0 "登录失败"; exit 1; }
H="Authorization: $TOKEN"
echo "=== 2. 同步真机设备(真源 = 控制面 /nodes)==="
SYNC=$(curl -s -m 90 -X POST "$BASE/api/ssw/sswdevice/Device/Sync" -H "$H" 2>&1)
echo " $(printf '%s' "$SYNC" | head -c 400)"
printf '%s' "$SYNC" | grep -q '"code":200' && p 1 "同步接口返回 200" || p 0 "同步失败"
printf '%s' "$SYNC" | grep -q 'control-plane' && p 1 "真源 = control-plane(非 mock)" || p 0 "真源不是 control-plane"
echo "=== 3. 设备列表 ==="
LIST=$(curl -s -m 30 -H "$H" "$BASE/api/ssw/sswdevice/Device/List" 2>&1)
echo " $(printf '%s' "$LIST" | head -c 700)"
echo "=== 4. 链上存证列表 ==="
CHAIN=$(curl -s -m 30 -H "$H" "$BASE/api/ssw/sswchain/ChainBlock/List" 2>&1)
echo " $(printf '%s' "$CHAIN" | head -c 400)"
echo "=== 5. 编排流程列表 ==="
FLOW=$(curl -s -m 30 -H "$H" "$BASE/api/ssw/sswflow/Flow/List" 2>&1)
echo " $(printf '%s' "$FLOW" | head -c 400)"
echo
echo "======== 通过 $ok / 失败 $bad ========"
[ "$bad" -eq 0 ]