meshsig 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +276 -0
- package/dist/crypto.d.ts +43 -0
- package/dist/crypto.js +108 -0
- package/dist/crypto.js.map +1 -0
- package/dist/dashboard.html +635 -0
- package/dist/demo.d.ts +2 -0
- package/dist/demo.js +107 -0
- package/dist/demo.js.map +1 -0
- package/dist/discovery.d.ts +24 -0
- package/dist/discovery.js +119 -0
- package/dist/discovery.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +459 -0
- package/dist/main.js.map +1 -0
- package/dist/peers.d.ts +35 -0
- package/dist/peers.js +227 -0
- package/dist/peers.js.map +1 -0
- package/dist/registry.d.ts +85 -0
- package/dist/registry.js +311 -0
- package/dist/registry.js.map +1 -0
- package/dist/server.d.ts +27 -0
- package/dist/server.js +433 -0
- package/dist/server.js.map +1 -0
- package/dist/terminal.d.ts +17 -0
- package/dist/terminal.js +175 -0
- package/dist/terminal.js.map +1 -0
- package/package.json +51 -0
- package/scripts/install.sh +271 -0
- package/scripts/invoke-mesh.sh +190 -0
- package/scripts/register-agent.sh +89 -0
- package/scripts/uninstall.sh +25 -0
- package/scripts/unregister-agent.sh +23 -0
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Registry } from './registry.js';
|
|
2
|
+
import { PeerNetwork } from './peers.js';
|
|
3
|
+
export interface ServerConfig {
|
|
4
|
+
port: number;
|
|
5
|
+
host: string;
|
|
6
|
+
dbPath: string;
|
|
7
|
+
name: string;
|
|
8
|
+
peers: string[];
|
|
9
|
+
}
|
|
10
|
+
export declare class MeshServer {
|
|
11
|
+
registry: Registry;
|
|
12
|
+
peerNetwork: PeerNetwork;
|
|
13
|
+
private config;
|
|
14
|
+
private httpServer;
|
|
15
|
+
private wss;
|
|
16
|
+
private dashboards;
|
|
17
|
+
private dashboardHtml;
|
|
18
|
+
constructor(config?: Partial<ServerConfig>);
|
|
19
|
+
start(): Promise<void>;
|
|
20
|
+
stop(): Promise<void>;
|
|
21
|
+
private _handleHttp;
|
|
22
|
+
private _handleWs;
|
|
23
|
+
private _broadcast;
|
|
24
|
+
private _json;
|
|
25
|
+
private _readBody;
|
|
26
|
+
private _verifyPageHtml;
|
|
27
|
+
}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// MeshSig Server — HTTP + WebSocket + Live Dashboard
|
|
3
|
+
// ============================================================================
|
|
4
|
+
import { createServer } from 'node:http';
|
|
5
|
+
import { WebSocketServer, WebSocket } from 'ws';
|
|
6
|
+
import { readFileSync } from 'node:fs';
|
|
7
|
+
import { resolve, dirname } from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { Registry } from './registry.js';
|
|
10
|
+
import { PeerNetwork } from './peers.js';
|
|
11
|
+
import { sign, verify, verifyWithDid, createHandshakeRequest, verifyHandshakeRequest, createHandshakeResponse, } from './crypto.js';
|
|
12
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
export class MeshServer {
|
|
14
|
+
registry;
|
|
15
|
+
peerNetwork;
|
|
16
|
+
config;
|
|
17
|
+
httpServer;
|
|
18
|
+
wss;
|
|
19
|
+
dashboards = new Set();
|
|
20
|
+
dashboardHtml;
|
|
21
|
+
constructor(config = {}) {
|
|
22
|
+
this.config = {
|
|
23
|
+
port: config.port || parseInt(process.env.MESH_PORT || '4888'),
|
|
24
|
+
host: config.host || '0.0.0.0',
|
|
25
|
+
dbPath: config.dbPath || ':memory:',
|
|
26
|
+
name: config.name || 'meshsig',
|
|
27
|
+
peers: config.peers || [],
|
|
28
|
+
};
|
|
29
|
+
this.registry = new Registry(this.config.dbPath);
|
|
30
|
+
this.peerNetwork = new PeerNetwork(this.registry, this.config.name);
|
|
31
|
+
this.httpServer = createServer(this._handleHttp.bind(this));
|
|
32
|
+
this.wss = new WebSocketServer({ server: this.httpServer });
|
|
33
|
+
this.wss.on('connection', this._handleWs.bind(this));
|
|
34
|
+
// Broadcast registry events to all dashboards
|
|
35
|
+
this.registry.on('mesh-event', (event) => {
|
|
36
|
+
this._broadcast(event);
|
|
37
|
+
});
|
|
38
|
+
// Broadcast peer events to dashboards
|
|
39
|
+
this.peerNetwork.on('peer-event', (event) => {
|
|
40
|
+
this._broadcast({ type: event.type, timestamp: new Date().toISOString(), data: event.data });
|
|
41
|
+
});
|
|
42
|
+
// Load dashboard HTML
|
|
43
|
+
try {
|
|
44
|
+
this.dashboardHtml = readFileSync(resolve(__dirname, 'dashboard.html'), 'utf-8');
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
this.dashboardHtml = '<html><body><h1>MeshSig</h1><p>Dashboard file not found.</p></body></html>';
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async start() {
|
|
51
|
+
await new Promise(r => this.httpServer.listen(this.config.port, this.config.host, r));
|
|
52
|
+
// Connect to configured peers
|
|
53
|
+
for (const peerUrl of this.config.peers) {
|
|
54
|
+
this.peerNetwork.connectTo(peerUrl);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async stop() {
|
|
58
|
+
this.peerNetwork.close();
|
|
59
|
+
this.wss.close();
|
|
60
|
+
await new Promise(r => this.httpServer.close(() => r()));
|
|
61
|
+
this.registry.close();
|
|
62
|
+
}
|
|
63
|
+
// -- HTTP ------------------------------------------------------------------
|
|
64
|
+
async _handleHttp(req, res) {
|
|
65
|
+
const url = new URL(req.url || '/', `http://${req.headers.host}`);
|
|
66
|
+
const path = url.pathname;
|
|
67
|
+
const method = req.method;
|
|
68
|
+
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
69
|
+
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
|
|
70
|
+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
|
|
71
|
+
if (method === 'OPTIONS') {
|
|
72
|
+
res.writeHead(204);
|
|
73
|
+
res.end();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
let body = null;
|
|
78
|
+
if (method === 'POST')
|
|
79
|
+
body = await this._readBody(req);
|
|
80
|
+
// Dashboard
|
|
81
|
+
if (method === 'GET' && (path === '/' || path === '/dashboard')) {
|
|
82
|
+
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
83
|
+
res.end(this.dashboardHtml);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
// Health
|
|
87
|
+
if (method === 'GET' && path === '/health') {
|
|
88
|
+
return this._json(res, 200, { status: 'ok', name: this.config.name });
|
|
89
|
+
}
|
|
90
|
+
// Stats
|
|
91
|
+
if (method === 'GET' && path === '/stats') {
|
|
92
|
+
return this._json(res, 200, { ...this.registry.stats(), uptime: process.uptime() });
|
|
93
|
+
}
|
|
94
|
+
// Snapshot (full state)
|
|
95
|
+
if (method === 'GET' && path === '/snapshot') {
|
|
96
|
+
return this._json(res, 200, this.registry.snapshot());
|
|
97
|
+
}
|
|
98
|
+
// Register agent
|
|
99
|
+
if (method === 'POST' && path === '/agents/register') {
|
|
100
|
+
const result = await this.registry.registerAgent(body.name, body.capabilities || []);
|
|
101
|
+
return this._json(res, 201, result);
|
|
102
|
+
}
|
|
103
|
+
// List agents
|
|
104
|
+
if (method === 'GET' && path === '/agents') {
|
|
105
|
+
return this._json(res, 200, { agents: this.registry.listAgents(url.searchParams.get('status') || undefined) });
|
|
106
|
+
}
|
|
107
|
+
// Get agent
|
|
108
|
+
if (method === 'GET' && path.startsWith('/agents/did:')) {
|
|
109
|
+
const did = path.slice('/agents/'.length);
|
|
110
|
+
const agent = this.registry.getAgent(did);
|
|
111
|
+
if (!agent)
|
|
112
|
+
return this._json(res, 404, { error: 'Not found' });
|
|
113
|
+
return this._json(res, 200, { agent });
|
|
114
|
+
}
|
|
115
|
+
// Discover
|
|
116
|
+
if (method === 'POST' && path === '/discover') {
|
|
117
|
+
const agents = this.registry.discover(body);
|
|
118
|
+
this._broadcast({
|
|
119
|
+
type: 'discovery:query', timestamp: new Date().toISOString(),
|
|
120
|
+
data: { capability: body.capability, results: agents.length },
|
|
121
|
+
});
|
|
122
|
+
return this._json(res, 200, { agents, total: agents.length });
|
|
123
|
+
}
|
|
124
|
+
// Sign
|
|
125
|
+
if (method === 'POST' && path === '/messages/sign') {
|
|
126
|
+
const ts = new Date().toISOString();
|
|
127
|
+
const sig = await sign(`${body.message}|${ts}`, body.privateKey);
|
|
128
|
+
return this._json(res, 200, { protocol: 'meshsig-v1', did: body.did, message: body.message, signature: sig, timestamp: ts });
|
|
129
|
+
}
|
|
130
|
+
// Verify
|
|
131
|
+
if (method === 'POST' && path === '/messages/verify') {
|
|
132
|
+
const content = body.timestamp ? `${body.message}|${body.timestamp}` : body.message;
|
|
133
|
+
const valid = await verifyWithDid(content, body.signature, body.did);
|
|
134
|
+
return this._json(res, 200, { valid, did: body.did });
|
|
135
|
+
}
|
|
136
|
+
// Send message (sign + log + broadcast)
|
|
137
|
+
if (method === 'POST' && path === '/messages/send') {
|
|
138
|
+
const ts = new Date().toISOString();
|
|
139
|
+
const sig = await sign(`${body.message}|${ts}`, body.privateKey);
|
|
140
|
+
const valid = await verifyWithDid(`${body.message}|${ts}`, sig, body.fromDid);
|
|
141
|
+
this.registry.logMessage(body.fromDid, body.toDid, body.message, sig, valid);
|
|
142
|
+
return this._json(res, 200, { sent: true, verified: valid, signature: sig, timestamp: ts });
|
|
143
|
+
}
|
|
144
|
+
// Handshake
|
|
145
|
+
if (method === 'POST' && path === '/handshake') {
|
|
146
|
+
const agentA = this.registry.getAgent(body.fromDid);
|
|
147
|
+
const agentB = this.registry.getAgent(body.toDid);
|
|
148
|
+
if (!agentA || !agentB)
|
|
149
|
+
return this._json(res, 404, { error: 'Agent not found' });
|
|
150
|
+
const req2 = await createHandshakeRequest(body.fromDid, body.toDid, body.privateKeyA, body.permissions || ['send:request']);
|
|
151
|
+
await verifyHandshakeRequest(req2, agentA.publicKey);
|
|
152
|
+
this._broadcast({
|
|
153
|
+
type: 'handshake:verify', timestamp: new Date().toISOString(),
|
|
154
|
+
data: { fromDid: body.fromDid, toDid: body.toDid, fromName: agentA.displayName, toName: agentB.displayName },
|
|
155
|
+
});
|
|
156
|
+
const conn = this.registry.createConnection(body.fromDid, body.toDid);
|
|
157
|
+
const resp = await createHandshakeResponse(req2, body.toDid, body.privateKeyB, true, body.permissions || ['send:request'], conn.channelId);
|
|
158
|
+
return this._json(res, 200, { connection: conn, handshake: { request: req2, response: resp } });
|
|
159
|
+
}
|
|
160
|
+
// Connections
|
|
161
|
+
if (method === 'GET' && path === '/connections') {
|
|
162
|
+
const did = url.searchParams.get('did') || undefined;
|
|
163
|
+
return this._json(res, 200, { connections: this.registry.getConnections(did) });
|
|
164
|
+
}
|
|
165
|
+
// Messages
|
|
166
|
+
if (method === 'GET' && path === '/messages') {
|
|
167
|
+
const limit = parseInt(url.searchParams.get('limit') || '50');
|
|
168
|
+
return this._json(res, 200, { messages: this.registry.getMessages(limit) });
|
|
169
|
+
}
|
|
170
|
+
// Peers
|
|
171
|
+
if (method === 'GET' && path === '/peers') {
|
|
172
|
+
return this._json(res, 200, { peers: this.peerNetwork.listPeers() });
|
|
173
|
+
}
|
|
174
|
+
if (method === 'POST' && path === '/peers/connect') {
|
|
175
|
+
if (!body?.url)
|
|
176
|
+
return this._json(res, 400, { error: 'url required' });
|
|
177
|
+
const peer = this.peerNetwork.connectTo(body.url);
|
|
178
|
+
return this._json(res, 200, { message: 'Connecting...', peerId: peer.id });
|
|
179
|
+
}
|
|
180
|
+
// Network discover (local + remote)
|
|
181
|
+
if (method === 'POST' && path === '/discover/network') {
|
|
182
|
+
const local = this.registry.discover(body);
|
|
183
|
+
const remote = await this.peerNetwork.discoverRemote(body);
|
|
184
|
+
return this._json(res, 200, { local, remote, total: local.length + remote.length });
|
|
185
|
+
}
|
|
186
|
+
// Audit export — full compliance report
|
|
187
|
+
if (method === 'GET' && path === '/audit/export') {
|
|
188
|
+
const format = url.searchParams.get('format') || 'json';
|
|
189
|
+
const agents = this.registry.listAgents();
|
|
190
|
+
const connections = this.registry.getConnections();
|
|
191
|
+
const messages = this.registry.getMessages(1000);
|
|
192
|
+
const rstats = this.registry.stats();
|
|
193
|
+
const uptime = process.uptime();
|
|
194
|
+
const report = {
|
|
195
|
+
meshsig: {
|
|
196
|
+
version: '0.5.0',
|
|
197
|
+
exported: new Date().toISOString(),
|
|
198
|
+
server: this.config.name,
|
|
199
|
+
},
|
|
200
|
+
summary: {
|
|
201
|
+
totalAgents: agents.length,
|
|
202
|
+
localAgents: agents.filter(a => a.origin === 'local').length,
|
|
203
|
+
remoteAgents: agents.filter(a => a.origin === 'remote').length,
|
|
204
|
+
totalConnections: connections.length,
|
|
205
|
+
totalMessages: messages.length,
|
|
206
|
+
verifiedMessages: messages.filter((m) => m.verified).length,
|
|
207
|
+
failedVerifications: messages.filter((m) => !m.verified).length,
|
|
208
|
+
averageTrust: agents.length > 0
|
|
209
|
+
? agents.reduce((sum, a) => sum + a.trustScore, 0) / agents.length
|
|
210
|
+
: 0,
|
|
211
|
+
uptime,
|
|
212
|
+
},
|
|
213
|
+
agents: agents.map(a => ({
|
|
214
|
+
did: a.did,
|
|
215
|
+
name: a.displayName,
|
|
216
|
+
publicKey: a.publicKey,
|
|
217
|
+
capabilities: a.capabilities,
|
|
218
|
+
trustScore: a.trustScore,
|
|
219
|
+
interactionsTotal: a.interactionsTotal,
|
|
220
|
+
interactionsSuccess: a.interactionsSuccess,
|
|
221
|
+
origin: a.origin,
|
|
222
|
+
originServer: a.originServer,
|
|
223
|
+
createdAt: a.createdAt,
|
|
224
|
+
})),
|
|
225
|
+
connections: connections.map((c) => ({
|
|
226
|
+
agentA: c.agentADid,
|
|
227
|
+
agentB: c.agentBDid,
|
|
228
|
+
trustScore: c.trustScore,
|
|
229
|
+
messagesExchanged: c.messagesExchanged,
|
|
230
|
+
createdAt: c.createdAt,
|
|
231
|
+
})),
|
|
232
|
+
messages: messages.map((m) => ({
|
|
233
|
+
id: m.id,
|
|
234
|
+
from: m.fromDid,
|
|
235
|
+
to: m.toDid,
|
|
236
|
+
content: m.content,
|
|
237
|
+
signature: m.signature,
|
|
238
|
+
verified: !!m.verified,
|
|
239
|
+
timestamp: m.createdAt,
|
|
240
|
+
})),
|
|
241
|
+
};
|
|
242
|
+
return this._json(res, 200, report);
|
|
243
|
+
}
|
|
244
|
+
// Public verify endpoint — anyone can verify a signature
|
|
245
|
+
if (method === 'POST' && path === '/verify') {
|
|
246
|
+
const { message, signature, publicKey, did } = body;
|
|
247
|
+
if (!message || !signature)
|
|
248
|
+
return this._json(res, 400, { error: 'message and signature required' });
|
|
249
|
+
if (!publicKey && !did)
|
|
250
|
+
return this._json(res, 400, { error: 'publicKey or did required' });
|
|
251
|
+
let valid;
|
|
252
|
+
if (did) {
|
|
253
|
+
valid = await verifyWithDid(message, signature, did);
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
valid = await verify(message, signature, publicKey);
|
|
257
|
+
}
|
|
258
|
+
return this._json(res, 200, {
|
|
259
|
+
valid,
|
|
260
|
+
message: message.slice(0, 100),
|
|
261
|
+
signer: did || publicKey,
|
|
262
|
+
verifiedAt: new Date().toISOString(),
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
// Verify page — browser-based signature verifier
|
|
266
|
+
if (method === 'GET' && path === '/verify') {
|
|
267
|
+
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
268
|
+
res.end(this._verifyPageHtml());
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
// API docs
|
|
272
|
+
this._json(res, 404, { error: 'Not found', endpoints: [
|
|
273
|
+
'GET /', 'GET /health', 'GET /stats', 'GET /snapshot',
|
|
274
|
+
'POST /agents/register', 'GET /agents', 'GET /agents/:did',
|
|
275
|
+
'POST /discover', 'POST /discover/network',
|
|
276
|
+
'POST /messages/send', 'POST /messages/verify',
|
|
277
|
+
'POST /handshake', 'GET /connections', 'GET /messages',
|
|
278
|
+
'GET /peers', 'POST /peers/connect',
|
|
279
|
+
'GET /audit/export', 'GET /verify', 'POST /verify',
|
|
280
|
+
'POST /messages/sign', 'POST /messages/verify', 'POST /messages/send',
|
|
281
|
+
'POST /handshake', 'GET /connections', 'GET /messages',
|
|
282
|
+
'GET /peers', 'POST /peers/connect',
|
|
283
|
+
'WS ws://host:port',
|
|
284
|
+
] });
|
|
285
|
+
}
|
|
286
|
+
catch (err) {
|
|
287
|
+
this._json(res, err.statusCode || 500, { error: err.message });
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
// -- WebSocket -------------------------------------------------------------
|
|
291
|
+
_handleWs(ws, req) {
|
|
292
|
+
const url = new URL(req.url || '/', `http://${req.headers.host}`);
|
|
293
|
+
const role = url.searchParams.get('role');
|
|
294
|
+
// Peer connection
|
|
295
|
+
if (role === 'peer') {
|
|
296
|
+
const fromName = url.searchParams.get('from') || 'unknown';
|
|
297
|
+
this.peerNetwork.handleIncoming(ws, fromName);
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
// Dashboard connection
|
|
301
|
+
this.dashboards.add(ws);
|
|
302
|
+
// Send current state immediately
|
|
303
|
+
ws.send(JSON.stringify({
|
|
304
|
+
type: 'snapshot',
|
|
305
|
+
timestamp: new Date().toISOString(),
|
|
306
|
+
data: this.registry.snapshot(),
|
|
307
|
+
}));
|
|
308
|
+
ws.on('close', () => this.dashboards.delete(ws));
|
|
309
|
+
}
|
|
310
|
+
_broadcast(event) {
|
|
311
|
+
const json = JSON.stringify(event);
|
|
312
|
+
for (const ws of this.dashboards) {
|
|
313
|
+
if (ws.readyState === WebSocket.OPEN) {
|
|
314
|
+
try {
|
|
315
|
+
ws.send(json);
|
|
316
|
+
}
|
|
317
|
+
catch { }
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
// -- Helpers ---------------------------------------------------------------
|
|
322
|
+
_json(res, status, data) {
|
|
323
|
+
res.writeHead(status, { 'Content-Type': 'application/json' });
|
|
324
|
+
res.end(JSON.stringify(data, null, 2));
|
|
325
|
+
}
|
|
326
|
+
_readBody(req) {
|
|
327
|
+
return new Promise((resolve, reject) => {
|
|
328
|
+
const chunks = [];
|
|
329
|
+
req.on('data', c => chunks.push(c));
|
|
330
|
+
req.on('end', () => { try {
|
|
331
|
+
resolve(JSON.parse(Buffer.concat(chunks).toString()));
|
|
332
|
+
}
|
|
333
|
+
catch {
|
|
334
|
+
reject(new Error('Invalid JSON'));
|
|
335
|
+
} });
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
_verifyPageHtml() {
|
|
339
|
+
return `<!DOCTYPE html>
|
|
340
|
+
<html lang="en"><head>
|
|
341
|
+
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
342
|
+
<title>MeshSig — Signature Verifier</title>
|
|
343
|
+
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
|
344
|
+
<style>
|
|
345
|
+
*{margin:0;padding:0;box-sizing:border-box}
|
|
346
|
+
body{background:#050a12;color:#c8d6e5;font-family:'Outfit',sans-serif;min-height:100vh;
|
|
347
|
+
display:flex;align-items:center;justify-content:center;padding:40px 20px}
|
|
348
|
+
body::after{content:'';position:fixed;top:0;left:0;right:0;bottom:0;
|
|
349
|
+
background:repeating-linear-gradient(0deg,rgba(0,0,0,0.02) 0px,rgba(0,0,0,0.02) 1px,transparent 1px,transparent 2px);
|
|
350
|
+
pointer-events:none;z-index:999}
|
|
351
|
+
.card{background:#0a1220;border:1px solid #0d2137;border-radius:16px;padding:48px;
|
|
352
|
+
max-width:600px;width:100%;position:relative;z-index:1}
|
|
353
|
+
h1{font:700 24px 'JetBrains Mono',monospace;color:#00d4ff;margin-bottom:8px;letter-spacing:0.04em}
|
|
354
|
+
.sub{font:300 14px 'Outfit',sans-serif;color:#3a7ca5;margin-bottom:32px}
|
|
355
|
+
label{font:500 11px 'JetBrains Mono',monospace;color:#3a7ca5;letter-spacing:0.1em;
|
|
356
|
+
display:block;margin-bottom:6px;margin-top:20px}
|
|
357
|
+
textarea,input{width:100%;background:#050a12;border:1px solid #1e3a5f;border-radius:8px;
|
|
358
|
+
padding:12px 16px;color:#c8d6e5;font:400 13px 'JetBrains Mono',monospace;
|
|
359
|
+
outline:none;transition:border-color 0.3s;resize:vertical}
|
|
360
|
+
textarea:focus,input:focus{border-color:#00d4ff}
|
|
361
|
+
textarea{min-height:80px}
|
|
362
|
+
button{width:100%;margin-top:28px;padding:14px;background:#00d4ff;color:#050a12;
|
|
363
|
+
font:600 14px 'JetBrains Mono',monospace;border:none;border-radius:8px;cursor:pointer;
|
|
364
|
+
transition:all 0.3s;letter-spacing:0.04em}
|
|
365
|
+
button:hover{box-shadow:0 0 30px rgba(0,212,255,0.3);transform:translateY(-1px)}
|
|
366
|
+
button:disabled{opacity:0.5;cursor:not-allowed;transform:none;box-shadow:none}
|
|
367
|
+
#result{margin-top:24px;padding:20px;border-radius:10px;display:none;text-align:center;
|
|
368
|
+
font:600 16px 'JetBrains Mono',monospace}
|
|
369
|
+
#result.valid{display:block;background:rgba(0,255,136,0.06);border:1px solid rgba(0,255,136,0.2);color:#00ff88}
|
|
370
|
+
#result.invalid{display:block;background:rgba(255,51,85,0.06);border:1px solid rgba(255,51,85,0.2);color:#ff3355}
|
|
371
|
+
#result .detail{font:400 11px 'JetBrains Mono',monospace;color:#3a7ca5;margin-top:8px}
|
|
372
|
+
.back{display:inline-block;margin-bottom:24px;font:400 12px 'JetBrains Mono',monospace;
|
|
373
|
+
color:#3a7ca5;text-decoration:none;transition:color 0.3s}
|
|
374
|
+
.back:hover{color:#00d4ff}
|
|
375
|
+
.or{text-align:center;color:#1e3a5f;font:11px 'JetBrains Mono',monospace;margin:4px 0}
|
|
376
|
+
</style>
|
|
377
|
+
</head><body>
|
|
378
|
+
<div class="card">
|
|
379
|
+
<a href="/" class="back">← Dashboard</a>
|
|
380
|
+
<h1>VERIFY SIGNATURE</h1>
|
|
381
|
+
<p class="sub">Paste a message, its Ed25519 signature, and the signer's public key or DID to verify authenticity.</p>
|
|
382
|
+
|
|
383
|
+
<label>MESSAGE</label>
|
|
384
|
+
<textarea id="msg" placeholder="The original message that was signed"></textarea>
|
|
385
|
+
|
|
386
|
+
<label>SIGNATURE (Base64)</label>
|
|
387
|
+
<input id="sig" placeholder="HkyrXOPOXF7v422A4iOcg/qkg/Juy...">
|
|
388
|
+
|
|
389
|
+
<label>PUBLIC KEY (Base64)</label>
|
|
390
|
+
<input id="pk" placeholder="KGC0lHB6Cwhhg1kyEjrPk0EjUujIO+Wq...">
|
|
391
|
+
<div class="or">— or —</div>
|
|
392
|
+
<label>DID</label>
|
|
393
|
+
<input id="did" placeholder="did:msig:3icqQkmJWby4S5rpa...">
|
|
394
|
+
|
|
395
|
+
<button onclick="doVerify()">VERIFY SIGNATURE</button>
|
|
396
|
+
|
|
397
|
+
<div id="result">
|
|
398
|
+
<div id="result-text"></div>
|
|
399
|
+
<div class="detail" id="result-detail"></div>
|
|
400
|
+
</div>
|
|
401
|
+
</div>
|
|
402
|
+
<script>
|
|
403
|
+
async function doVerify(){
|
|
404
|
+
const msg=document.getElementById('msg').value.trim();
|
|
405
|
+
const sig=document.getElementById('sig').value.trim();
|
|
406
|
+
const pk=document.getElementById('pk').value.trim();
|
|
407
|
+
const did=document.getElementById('did').value.trim();
|
|
408
|
+
const r=document.getElementById('result');
|
|
409
|
+
const rt=document.getElementById('result-text');
|
|
410
|
+
const rd=document.getElementById('result-detail');
|
|
411
|
+
|
|
412
|
+
if(!msg||!sig||(!pk&&!did)){r.className='invalid';r.style.display='block';rt.textContent='Fill all fields';return}
|
|
413
|
+
|
|
414
|
+
const body={message:msg,signature:sig};
|
|
415
|
+
if(did)body.did=did; else body.publicKey=pk;
|
|
416
|
+
|
|
417
|
+
try{
|
|
418
|
+
const res=await fetch('/verify',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(body)});
|
|
419
|
+
const data=await res.json();
|
|
420
|
+
if(data.valid){
|
|
421
|
+
r.className='valid';rt.textContent='\\u2713 SIGNATURE VALID';
|
|
422
|
+
rd.textContent='Verified at '+data.verifiedAt+' \\u2014 Signer: '+(data.signer||'').slice(0,40)+'...';
|
|
423
|
+
} else {
|
|
424
|
+
r.className='invalid';rt.textContent='\\u2717 SIGNATURE INVALID';
|
|
425
|
+
rd.textContent='The signature does not match the message and key provided.';
|
|
426
|
+
}
|
|
427
|
+
}catch(e){r.className='invalid';rt.textContent='Error: '+e.message;rd.textContent=''}
|
|
428
|
+
}
|
|
429
|
+
</script>
|
|
430
|
+
</body></html>`;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,qDAAqD;AACrD,+EAA+E;AAE/E,OAAO,EAAE,YAAY,EAAmC,MAAM,WAAW,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EACL,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,sBAAsB,EACnD,sBAAsB,EAAE,uBAAuB,GAChD,MAAM,aAAa,CAAC;AAGrB,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CA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CAAC;IAEO,SAAS,CAAC,GAAoB;QACpC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,MAAM,GAAa,EAAE,CAAC;YAC5B,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACpC,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;gBAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;YAAC,CAAC;YAAC,MAAM,CAAC;gBAAC,MAAM,CAAC,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;YAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvI,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,eAAe;QACrB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eA2FI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { MeshEvent } from './registry.js';
|
|
2
|
+
export declare class TerminalDisplay {
|
|
3
|
+
private agents;
|
|
4
|
+
private connectionCount;
|
|
5
|
+
private messageCount;
|
|
6
|
+
private eventLog;
|
|
7
|
+
private maxLogLines;
|
|
8
|
+
private refreshInterval;
|
|
9
|
+
private startTime;
|
|
10
|
+
start(): void;
|
|
11
|
+
stop(): void;
|
|
12
|
+
handleEvent(event: MeshEvent): void;
|
|
13
|
+
private addLog;
|
|
14
|
+
render(): void;
|
|
15
|
+
private buildGraph;
|
|
16
|
+
private calculatePositions;
|
|
17
|
+
}
|