- ZKP Mesh Authentication: Zero-Knowledge Proof identity for mesh nodes - New API endpoints: zkp-challenge, zkp-verify, zkp/graph - Shell functions: ml_zkp_init, ml_zkp_challenge, ml_zkp_verify - Enhanced join flow with optional ZKP proof requirement - Blockchain acknowledgment via peer_zkp_verified blocks - LuCI dashboard with ZKP status section and peer badges - MirrorNet Ash Compatibility: Fixed BusyBox shell incompatibilities - Replaced process substitution with pipe-based patterns - Fixed mirror.sh, gossip.sh, health.sh, identity.sh - Mesh Blockchain Sync: Fixed chain synchronization between nodes - Fixed /api/chain/since endpoint to return only new blocks - chain_add_block/chain_merge_block use awk for safe JSON insertion - Handles varying JSON formatting (whitespace, newlines) - Tested bidirectional sync: Master <-> Clone at height 70 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
29 lines
683 B
Bash
29 lines
683 B
Bash
#!/bin/sh
|
|
# Master-Link API - ZKP Challenge Generation
|
|
# GET /api/master-link/zkp-challenge
|
|
# Returns: challenge_id and timestamp for ZKP authentication
|
|
|
|
echo "Content-Type: application/json"
|
|
echo "Access-Control-Allow-Origin: *"
|
|
echo "Access-Control-Allow-Methods: GET, OPTIONS"
|
|
echo "Access-Control-Allow-Headers: Content-Type"
|
|
echo ""
|
|
|
|
# Handle CORS preflight
|
|
if [ "$REQUEST_METHOD" = "OPTIONS" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
# Load library
|
|
. /usr/lib/secubox/master-link.sh >/dev/null 2>&1
|
|
|
|
# Check if ZKP is enabled
|
|
zkp_enabled=$(uci -q get master-link.main.zkp_enabled)
|
|
if [ "$zkp_enabled" != "1" ]; then
|
|
echo '{"error":"zkp_disabled"}'
|
|
exit 0
|
|
fi
|
|
|
|
# Generate challenge
|
|
ml_zkp_challenge
|