@onsignet/daemon 0.1.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/dist/agent-process.d.ts +19 -0
- package/dist/agent-process.d.ts.map +1 -0
- package/dist/agent-process.js +102 -0
- package/dist/agent-process.js.map +1 -0
- package/dist/audit-log.d.ts +23 -0
- package/dist/audit-log.d.ts.map +1 -0
- package/dist/audit-log.js +75 -0
- package/dist/audit-log.js.map +1 -0
- package/dist/config.d.ts +30 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +104 -0
- package/dist/config.js.map +1 -0
- package/dist/errors.d.ts +23 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +24 -0
- package/dist/errors.js.map +1 -0
- package/dist/identity.d.ts +39 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +107 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +524 -0
- package/dist/index.js.map +1 -0
- package/dist/policies.d.ts +11 -0
- package/dist/policies.d.ts.map +1 -0
- package/dist/policies.js +58 -0
- package/dist/policies.js.map +1 -0
- package/dist/relay-client.d.ts +34 -0
- package/dist/relay-client.d.ts.map +1 -0
- package/dist/relay-client.js +170 -0
- package/dist/relay-client.js.map +1 -0
- package/dist/server.d.ts +93 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +460 -0
- package/dist/server.js.map +1 -0
- package/package.json +35 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Managed agent process: spawn, crash detection, restart with exponential backoff (Addendum A1).
|
|
3
|
+
*/
|
|
4
|
+
import type { AgentProcessConfig } from "./config.js";
|
|
5
|
+
export type AgentProcessStatus = "running" | "away" | "stopped";
|
|
6
|
+
export interface AgentProcessState {
|
|
7
|
+
status: AgentProcessStatus;
|
|
8
|
+
pid: number | null;
|
|
9
|
+
restartCount: number;
|
|
10
|
+
lastExitCode: number | null;
|
|
11
|
+
lastExitSignal: string | null;
|
|
12
|
+
}
|
|
13
|
+
export declare function createAgentProcessRunner(config: AgentProcessConfig): {
|
|
14
|
+
getStatus: () => AgentProcessState;
|
|
15
|
+
start: (onStarted: (_err?: Error) => void) => void;
|
|
16
|
+
stop: (cb: () => void) => void;
|
|
17
|
+
clearRestartTimeout: () => void;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=agent-process.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-process.d.ts","sourceRoot":"","sources":["../src/agent-process.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAMtD,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;AAEhE,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,kBAAkB;qBAQ3C,iBAAiB;uBA+Bb,CAAC,IAAI,CAAC,EAAE,KAAK,KAAK,IAAI,KAAG,IAAI;eAwCrC,MAAM,IAAI,KAAG,IAAI;+BA3DH,IAAI;EA4ErC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Managed agent process: spawn, crash detection, restart with exponential backoff (Addendum A1).
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createAgentProcessRunner = createAgentProcessRunner;
|
|
7
|
+
const node_child_process_1 = require("node:child_process");
|
|
8
|
+
const BACKOFFS_MS = [1000, 2000, 4000, 8000, 16000];
|
|
9
|
+
const MAX_BACKOFF_MS = 16000;
|
|
10
|
+
const STABILITY_RESET_MS = 5 * 60 * 1000; // 5 minutes
|
|
11
|
+
function createAgentProcessRunner(config) {
|
|
12
|
+
let child = null;
|
|
13
|
+
let restartCount = 0;
|
|
14
|
+
let lastExitCode = null;
|
|
15
|
+
let lastExitSignal = null;
|
|
16
|
+
let lastStartTime = 0;
|
|
17
|
+
let timeoutId = null;
|
|
18
|
+
function getStatus() {
|
|
19
|
+
const status = child != null && child.exitCode == null ? "running" : restartCount >= (config.maxRestarts ?? 5) ? "stopped" : "away";
|
|
20
|
+
return {
|
|
21
|
+
status,
|
|
22
|
+
pid: child?.pid ?? null,
|
|
23
|
+
restartCount,
|
|
24
|
+
lastExitCode,
|
|
25
|
+
lastExitSignal,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function clearRestartTimeout() {
|
|
29
|
+
if (timeoutId != null) {
|
|
30
|
+
clearTimeout(timeoutId);
|
|
31
|
+
timeoutId = null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function scheduleRestart(onStarted) {
|
|
35
|
+
if (!(config.restartOnCrash !== false) || restartCount >= (config.maxRestarts ?? 5)) {
|
|
36
|
+
onStarted();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const backoffMs = BACKOFFS_MS[Math.min(restartCount, BACKOFFS_MS.length - 1)] ?? MAX_BACKOFF_MS;
|
|
40
|
+
timeoutId = setTimeout(() => {
|
|
41
|
+
timeoutId = null;
|
|
42
|
+
start(onStarted);
|
|
43
|
+
}, backoffMs);
|
|
44
|
+
}
|
|
45
|
+
function start(onStarted) {
|
|
46
|
+
if (child != null && child.exitCode == null) {
|
|
47
|
+
onStarted();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const [cmd, ...args] = config.command.trim().split(/\s+/);
|
|
51
|
+
if (!cmd) {
|
|
52
|
+
onStarted(new Error("agent.command is empty"));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
child = (0, node_child_process_1.spawn)(cmd, args, {
|
|
57
|
+
stdio: "inherit",
|
|
58
|
+
shell: true,
|
|
59
|
+
env: process.env,
|
|
60
|
+
});
|
|
61
|
+
lastStartTime = Date.now();
|
|
62
|
+
child.on("exit", (code, signal) => {
|
|
63
|
+
child = null;
|
|
64
|
+
lastExitCode = code ?? null;
|
|
65
|
+
lastExitSignal = signal ?? null;
|
|
66
|
+
restartCount += 1;
|
|
67
|
+
if (Date.now() - lastStartTime > STABILITY_RESET_MS) {
|
|
68
|
+
restartCount = 0;
|
|
69
|
+
}
|
|
70
|
+
scheduleRestart(onStarted);
|
|
71
|
+
});
|
|
72
|
+
child.on("error", (_err) => {
|
|
73
|
+
child = null;
|
|
74
|
+
lastExitCode = null;
|
|
75
|
+
lastExitSignal = "error";
|
|
76
|
+
restartCount += 1;
|
|
77
|
+
scheduleRestart(onStarted);
|
|
78
|
+
});
|
|
79
|
+
onStarted();
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
onStarted(err instanceof Error ? err : new Error(String(err)));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function stop(cb) {
|
|
86
|
+
clearRestartTimeout();
|
|
87
|
+
if (child == null || child.exitCode != null) {
|
|
88
|
+
cb();
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
child.once("exit", () => cb());
|
|
92
|
+
child.kill("SIGTERM");
|
|
93
|
+
const forceKill = setTimeout(() => {
|
|
94
|
+
if (child != null && child.exitCode == null) {
|
|
95
|
+
child.kill("SIGKILL");
|
|
96
|
+
}
|
|
97
|
+
}, 10_000);
|
|
98
|
+
child.once("exit", () => clearTimeout(forceKill));
|
|
99
|
+
}
|
|
100
|
+
return { getStatus, start, stop, clearRestartTimeout };
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=agent-process.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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GAAG,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,mBAAmB,EAAE,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type AuditEventType = "message_sent" | "message_received" | "connection_up" | "connection_down" | "policy_change" | "message_approved" | "message_denied" | "key_revoked" | "key_self_revoked" | "key_rotated" | "message_rejected_revoked" | "attestation_invalid" | "capability_invalid" | "message_filtered_tier";
|
|
2
|
+
export interface AuditEntry {
|
|
3
|
+
timestamp: string;
|
|
4
|
+
event: AuditEventType;
|
|
5
|
+
messageId?: string;
|
|
6
|
+
from?: string;
|
|
7
|
+
to?: string;
|
|
8
|
+
prevHash: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class AuditLog {
|
|
11
|
+
private path;
|
|
12
|
+
private lastHash;
|
|
13
|
+
constructor(dataDir: string);
|
|
14
|
+
private hashChain;
|
|
15
|
+
append(entry: Omit<AuditEntry, "prevHash">): void;
|
|
16
|
+
/** Read the last N entries (newest last). Returns entries and whether the chain is valid. */
|
|
17
|
+
readRecent(limit: number): {
|
|
18
|
+
entries: AuditEntry[];
|
|
19
|
+
lastHash: string;
|
|
20
|
+
chainValid: boolean;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=audit-log.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-log.d.ts","sourceRoot":"","sources":["../src/audit-log.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,cAAc,GACtB,cAAc,GACd,kBAAkB,GAClB,eAAe,GACf,iBAAiB,GACjB,eAAe,GACf,kBAAkB,GAClB,gBAAgB,GAChB,aAAa,GACb,kBAAkB,GAClB,aAAa,GACb,0BAA0B,GAC1B,qBAAqB,GACrB,oBAAoB,GACpB,uBAAuB,CAAC;AAE5B,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,cAAc,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;CAClB;AAID,qBAAa,QAAQ;IACnB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,QAAQ,CAAa;gBAEjB,OAAO,EAAE,MAAM;IAgB3B,OAAO,CAAC,SAAS;IAIjB,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,GAAG,IAAI;IASjD,6FAA6F;IAC7F,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG;QAAE,OAAO,EAAE,UAAU,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,OAAO,CAAA;KAAE;CA4B5F"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuditLog = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Append-only JSONL audit log with SHA-256 hash chain.
|
|
6
|
+
*/
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
|
+
const node_crypto_1 = require("node:crypto");
|
|
10
|
+
const LOG_FILE = "audit.log";
|
|
11
|
+
const MODE_APPEND = 0o600;
|
|
12
|
+
const ZERO_HASH = "0";
|
|
13
|
+
class AuditLog {
|
|
14
|
+
path;
|
|
15
|
+
lastHash = ZERO_HASH;
|
|
16
|
+
constructor(dataDir) {
|
|
17
|
+
this.path = (0, node_path_1.join)(dataDir, LOG_FILE);
|
|
18
|
+
if (!(0, node_fs_1.existsSync)(this.path)) {
|
|
19
|
+
const dir = (0, node_path_1.join)(dataDir);
|
|
20
|
+
if (!(0, node_fs_1.existsSync)(dir))
|
|
21
|
+
(0, node_fs_1.mkdirSync)(dir, { recursive: true });
|
|
22
|
+
this.lastHash = ZERO_HASH;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
const lines = (0, node_fs_1.readFileSync)(this.path, "utf8").trim().split("\n").filter(Boolean);
|
|
26
|
+
if (lines.length > 0) {
|
|
27
|
+
const last = lines[lines.length - 1];
|
|
28
|
+
const parsed = JSON.parse(last);
|
|
29
|
+
this.lastHash = parsed.hash ?? ZERO_HASH;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
hashChain(prevHash, line) {
|
|
34
|
+
return (0, node_crypto_1.createHash)("sha256").update(prevHash + line).digest("hex");
|
|
35
|
+
}
|
|
36
|
+
append(entry) {
|
|
37
|
+
const withPrev = { ...entry, prevHash: this.lastHash };
|
|
38
|
+
const line = JSON.stringify(withPrev) + "\n";
|
|
39
|
+
const hash = this.hashChain(this.lastHash, line);
|
|
40
|
+
const record = { ...withPrev, hash };
|
|
41
|
+
(0, node_fs_1.appendFileSync)(this.path, JSON.stringify(record) + "\n", { mode: MODE_APPEND });
|
|
42
|
+
this.lastHash = hash;
|
|
43
|
+
}
|
|
44
|
+
/** Read the last N entries (newest last). Returns entries and whether the chain is valid. */
|
|
45
|
+
readRecent(limit) {
|
|
46
|
+
if (!(0, node_fs_1.existsSync)(this.path)) {
|
|
47
|
+
return { entries: [], lastHash: ZERO_HASH, chainValid: true };
|
|
48
|
+
}
|
|
49
|
+
const content = (0, node_fs_1.readFileSync)(this.path, "utf8").trim();
|
|
50
|
+
const lines = content ? content.split("\n").filter(Boolean) : [];
|
|
51
|
+
let prevHash = ZERO_HASH;
|
|
52
|
+
let chainValid = true;
|
|
53
|
+
const entries = [];
|
|
54
|
+
for (const line of lines) {
|
|
55
|
+
const record = JSON.parse(line);
|
|
56
|
+
const withPrev = (({ hash: _h, ...e }) => e)(record);
|
|
57
|
+
const lineThatWasHashed = JSON.stringify(withPrev) + "\n";
|
|
58
|
+
const expectedHash = this.hashChain(prevHash, lineThatWasHashed);
|
|
59
|
+
if (record.hash !== expectedHash)
|
|
60
|
+
chainValid = false;
|
|
61
|
+
prevHash = record.hash ?? prevHash;
|
|
62
|
+
entries.push(withPrev);
|
|
63
|
+
}
|
|
64
|
+
const lastHash = lines.length > 0
|
|
65
|
+
? JSON.parse(lines[lines.length - 1]).hash ?? ZERO_HASH
|
|
66
|
+
: ZERO_HASH;
|
|
67
|
+
return {
|
|
68
|
+
entries: entries.slice(-limit),
|
|
69
|
+
lastHash,
|
|
70
|
+
chainValid,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.AuditLog = AuditLog;
|
|
75
|
+
//# sourceMappingURL=audit-log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-log.js","sourceRoot":"","sources":["../src/audit-log.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,qCAA8E;AAC9E,yCAAiC;AACjC,6CAAyC;AAEzC,MAAM,QAAQ,GAAG,WAAW,CAAC;AAC7B,MAAM,WAAW,GAAG,KAAK,CAAC;AA2B1B,MAAM,SAAS,GAAG,GAAG,CAAC;AAEtB,MAAa,QAAQ;IACX,IAAI,CAAS;IACb,QAAQ,GAAG,SAAS,CAAC;IAE7B,YAAY,OAAe;QACzB,IAAI,CAAC,IAAI,GAAG,IAAA,gBAAI,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACpC,IAAI,CAAC,IAAA,oBAAU,EAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3B,MAAM,GAAG,GAAG,IAAA,gBAAI,EAAC,OAAO,CAAC,CAAC;YAC1B,IAAI,CAAC,IAAA,oBAAU,EAAC,GAAG,CAAC;gBAAE,IAAA,mBAAS,EAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC1D,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC5B,CAAC;aAAM,CAAC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IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAE,CAAuB,CAAC,IAAI,IAAI,SAAS;YAC/E,CAAC,CAAC,SAAS,CAAC;QAChB,OAAO;YACL,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;YAC9B,QAAQ;YACR,UAAU;SACX,CAAC;IACJ,CAAC;CACF;AA9DD,4BA8DC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const DEFAULT_DATA_DIR: string;
|
|
2
|
+
/** Optional managed agent process (Addendum A1). */
|
|
3
|
+
export interface AgentProcessConfig {
|
|
4
|
+
/** Command to run (e.g. "node my-agent.js"). */
|
|
5
|
+
command: string;
|
|
6
|
+
/** Optional HTTP health check URL (e.g. "http://localhost:3000/health"). */
|
|
7
|
+
healthCheck?: string;
|
|
8
|
+
/** Restart agent on crash with exponential backoff. Default true. */
|
|
9
|
+
restartOnCrash?: boolean;
|
|
10
|
+
/** Max restarts before giving up; daemon keeps running. Default 5. */
|
|
11
|
+
maxRestarts?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface DaemonConfig {
|
|
14
|
+
dataDir: string;
|
|
15
|
+
relayUrl: string;
|
|
16
|
+
httpPort: number;
|
|
17
|
+
httpHost: string;
|
|
18
|
+
/** Optional webhook URL for OpenClaw (daemon POSTs delivered messages here). */
|
|
19
|
+
openclawWebhookUrl?: string;
|
|
20
|
+
/** Optional secret for HMAC signing webhook payloads. */
|
|
21
|
+
openclawWebhookSecret?: string;
|
|
22
|
+
/** Optional marketplace API URL (legacy). Prefer directoryApiUrl for directory. */
|
|
23
|
+
marketplaceApiUrl?: string;
|
|
24
|
+
/** Optional directory API URL for profile, contacts, search (e.g. http://localhost:3001). */
|
|
25
|
+
directoryApiUrl?: string;
|
|
26
|
+
/** Optional managed agent process (signet start managed mode). */
|
|
27
|
+
agent?: AgentProcessConfig;
|
|
28
|
+
}
|
|
29
|
+
export declare function loadConfig(): DaemonConfig;
|
|
30
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,gBAAgB,QAA6B,CAAC;AAI3D,oDAAoD;AACpD,MAAM,WAAW,kBAAkB;IACjC,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qEAAqE;IACrE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,sEAAsE;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,gFAAgF;IAChF,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,yDAAyD;IACzD,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mFAAmF;IACnF,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,6FAA6F;IAC7F,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kEAAkE;IAClE,KAAK,CAAC,EAAE,kBAAkB,CAAC;CAC5B;AAmFD,wBAAgB,UAAU,IAAI,YAAY,CAqCzC"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_DATA_DIR = void 0;
|
|
4
|
+
exports.loadConfig = loadConfig;
|
|
5
|
+
/**
|
|
6
|
+
* Daemon config: ~/.agentmesh/config.json (or ~/.config/agentmesh/config.json on Linux),
|
|
7
|
+
* then dataDir/config.json, then env. Env overrides file. No secrets in config file.
|
|
8
|
+
*/
|
|
9
|
+
const node_fs_1 = require("node:fs");
|
|
10
|
+
const node_path_1 = require("node:path");
|
|
11
|
+
const node_os_1 = require("node:os");
|
|
12
|
+
exports.DEFAULT_DATA_DIR = (0, node_path_1.join)((0, node_os_1.homedir)(), ".Signet");
|
|
13
|
+
const DEFAULT_RELAY_URL = "wss://relay.onsignet.com";
|
|
14
|
+
const DEFAULT_HTTP_PORT = 8766;
|
|
15
|
+
function loadJson(path) {
|
|
16
|
+
if (!(0, node_fs_1.existsSync)(path))
|
|
17
|
+
return null;
|
|
18
|
+
try {
|
|
19
|
+
const raw = (0, node_fs_1.readFileSync)(path, "utf8");
|
|
20
|
+
return JSON.parse(raw);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function getStandardConfigPaths() {
|
|
27
|
+
const home = (0, node_os_1.homedir)();
|
|
28
|
+
const paths = [(0, node_path_1.join)(home, ".agentmesh", "config.json")];
|
|
29
|
+
if ((0, node_os_1.platform)() === "linux") {
|
|
30
|
+
paths.push((0, node_path_1.join)(home, ".config", "agentmesh", "config.json"));
|
|
31
|
+
}
|
|
32
|
+
return paths;
|
|
33
|
+
}
|
|
34
|
+
function isValidUrl(s) {
|
|
35
|
+
try {
|
|
36
|
+
const u = new URL(s);
|
|
37
|
+
return u.protocol === "ws:" || u.protocol === "wss:" || u.protocol === "http:" || u.protocol === "https:";
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function validateAndApply(fromFile, dataDir) {
|
|
44
|
+
const relayUrl = process.env.SIGNET_RELAY_URL ?? fromFile?.relayUrl ?? fromFile?.relay_url ?? DEFAULT_RELAY_URL;
|
|
45
|
+
const httpPortRaw = process.env.SIGNET_HTTP_PORT ?? fromFile?.httpPort ?? fromFile?.http_port ?? DEFAULT_HTTP_PORT;
|
|
46
|
+
const httpPort = Number(httpPortRaw);
|
|
47
|
+
const httpHost = process.env.SIGNET_HTTP_HOST ?? fromFile?.httpHost ?? fromFile?.http_host ?? "127.0.0.1";
|
|
48
|
+
const resolvedDataDir = process.env.SIGNET_DATA_DIR ?? fromFile?.data_dir ?? dataDir;
|
|
49
|
+
if (!Number.isInteger(httpPort) || httpPort < 1 || httpPort > 65535) {
|
|
50
|
+
throw new Error(`Invalid config: httpPort must be 1-65535, got: ${httpPortRaw}`);
|
|
51
|
+
}
|
|
52
|
+
if (!isValidUrl(relayUrl)) {
|
|
53
|
+
throw new Error(`Invalid config: relayUrl must be a valid ws/wss/http/https URL, got: ${relayUrl}`);
|
|
54
|
+
}
|
|
55
|
+
const marketplaceApiUrl = process.env.MARKETPLACE_API_URL ?? fromFile?.marketplace_api_url;
|
|
56
|
+
const directoryApiUrl = process.env.DIRECTORY_API_URL ?? fromFile?.directory_api_url ?? marketplaceApiUrl;
|
|
57
|
+
const openclawWebhookUrl = process.env.SIGNET_OPENCLAW_WEBHOOK_URL ?? fromFile?.openclaw_webhook_url;
|
|
58
|
+
const openclawWebhookSecret = process.env.SIGNET_OPENCLAW_WEBHOOK_SECRET ?? fromFile?.openclaw_webhook_secret;
|
|
59
|
+
return {
|
|
60
|
+
relayUrl,
|
|
61
|
+
httpPort,
|
|
62
|
+
httpHost,
|
|
63
|
+
dataDir: resolvedDataDir,
|
|
64
|
+
...(marketplaceApiUrl !== undefined && marketplaceApiUrl !== "" && { marketplaceApiUrl }),
|
|
65
|
+
...(directoryApiUrl !== undefined && directoryApiUrl !== "" && { directoryApiUrl }),
|
|
66
|
+
...(openclawWebhookUrl !== undefined && openclawWebhookUrl !== "" && { openclawWebhookUrl }),
|
|
67
|
+
...(openclawWebhookSecret !== undefined && openclawWebhookSecret !== "" && { openclawWebhookSecret }),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function loadConfig() {
|
|
71
|
+
const defaultDataDir = process.env.SIGNET_DATA_DIR ?? exports.DEFAULT_DATA_DIR;
|
|
72
|
+
const standardPaths = getStandardConfigPaths();
|
|
73
|
+
const dataDirConfigPath = (0, node_path_1.join)(defaultDataDir, "config.json");
|
|
74
|
+
let fromFile = null;
|
|
75
|
+
for (const p of standardPaths) {
|
|
76
|
+
fromFile = loadJson(p);
|
|
77
|
+
if (fromFile != null)
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
if (fromFile == null) {
|
|
81
|
+
fromFile = loadJson(dataDirConfigPath);
|
|
82
|
+
}
|
|
83
|
+
const applied = validateAndApply(fromFile, defaultDataDir);
|
|
84
|
+
const agent = fromFile?.agent?.command != null
|
|
85
|
+
? {
|
|
86
|
+
command: fromFile.agent.command,
|
|
87
|
+
...(fromFile.agent.healthCheck != null && fromFile.agent.healthCheck !== "" && { healthCheck: fromFile.agent.healthCheck }),
|
|
88
|
+
restartOnCrash: fromFile.agent.restartOnCrash !== false,
|
|
89
|
+
maxRestarts: typeof fromFile.agent.maxRestarts === "number" ? fromFile.agent.maxRestarts : 5,
|
|
90
|
+
}
|
|
91
|
+
: undefined;
|
|
92
|
+
return {
|
|
93
|
+
dataDir: applied.dataDir,
|
|
94
|
+
relayUrl: applied.relayUrl,
|
|
95
|
+
httpPort: applied.httpPort,
|
|
96
|
+
httpHost: applied.httpHost,
|
|
97
|
+
...(applied.openclawWebhookUrl !== undefined && { openclawWebhookUrl: applied.openclawWebhookUrl }),
|
|
98
|
+
...(applied.openclawWebhookSecret !== undefined && { openclawWebhookSecret: applied.openclawWebhookSecret }),
|
|
99
|
+
...(applied.marketplaceApiUrl !== undefined && { marketplaceApiUrl: applied.marketplaceApiUrl }),
|
|
100
|
+
...(applied.directoryApiUrl !== undefined && { directoryApiUrl: applied.directoryApiUrl }),
|
|
101
|
+
...(agent !== undefined && { agent }),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],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package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API error codes for stable client handling (product plan Section 20.4).
|
|
3
|
+
* Use in JSON responses as { error: string, code?: string }.
|
|
4
|
+
*/
|
|
5
|
+
export declare const ErrorCodes: {
|
|
6
|
+
readonly E_RELAY_DOWN: "E_RELAY_DOWN";
|
|
7
|
+
readonly E_RECIPIENT_OFFLINE: "E_RECIPIENT_OFFLINE";
|
|
8
|
+
readonly E_UNKNOWN_RECIPIENT: "E_UNKNOWN_RECIPIENT";
|
|
9
|
+
readonly E_INVALID_SIGNATURE: "E_INVALID_SIGNATURE";
|
|
10
|
+
readonly E_EXPIRED_CAPABILITY: "E_EXPIRED_CAPABILITY";
|
|
11
|
+
readonly E_INSUFFICIENT_CAPABILITY: "E_INSUFFICIENT_CAPABILITY";
|
|
12
|
+
readonly E_RATE_LIMITED: "E_RATE_LIMITED";
|
|
13
|
+
readonly E_DECRYPTION_FAILED: "E_DECRYPTION_FAILED";
|
|
14
|
+
readonly E_POLICY_DENIED: "E_POLICY_DENIED";
|
|
15
|
+
readonly E_HUMAN_DENIED: "E_HUMAN_DENIED";
|
|
16
|
+
};
|
|
17
|
+
export type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];
|
|
18
|
+
export interface ApiErrorResponse {
|
|
19
|
+
error: string;
|
|
20
|
+
code?: ErrorCode;
|
|
21
|
+
}
|
|
22
|
+
export declare function apiError(message: string, code?: ErrorCode): ApiErrorResponse;
|
|
23
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;CAWb,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAErE,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,gBAAgB,CAE5E"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* API error codes for stable client handling (product plan Section 20.4).
|
|
4
|
+
* Use in JSON responses as { error: string, code?: string }.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ErrorCodes = void 0;
|
|
8
|
+
exports.apiError = apiError;
|
|
9
|
+
exports.ErrorCodes = {
|
|
10
|
+
E_RELAY_DOWN: "E_RELAY_DOWN",
|
|
11
|
+
E_RECIPIENT_OFFLINE: "E_RECIPIENT_OFFLINE",
|
|
12
|
+
E_UNKNOWN_RECIPIENT: "E_UNKNOWN_RECIPIENT",
|
|
13
|
+
E_INVALID_SIGNATURE: "E_INVALID_SIGNATURE",
|
|
14
|
+
E_EXPIRED_CAPABILITY: "E_EXPIRED_CAPABILITY",
|
|
15
|
+
E_INSUFFICIENT_CAPABILITY: "E_INSUFFICIENT_CAPABILITY",
|
|
16
|
+
E_RATE_LIMITED: "E_RATE_LIMITED",
|
|
17
|
+
E_DECRYPTION_FAILED: "E_DECRYPTION_FAILED",
|
|
18
|
+
E_POLICY_DENIED: "E_POLICY_DENIED",
|
|
19
|
+
E_HUMAN_DENIED: "E_HUMAN_DENIED",
|
|
20
|
+
};
|
|
21
|
+
function apiError(message, code) {
|
|
22
|
+
return code ? { error: message, code } : { error: message };
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAsBH,4BAEC;AAtBY,QAAA,UAAU,GAAG;IACxB,YAAY,EAAE,cAAc;IAC5B,mBAAmB,EAAE,qBAAqB;IAC1C,mBAAmB,EAAE,qBAAqB;IAC1C,mBAAmB,EAAE,qBAAqB;IAC1C,oBAAoB,EAAE,sBAAsB;IAC5C,yBAAyB,EAAE,2BAA2B;IACtD,cAAc,EAAE,gBAAgB;IAChC,mBAAmB,EAAE,qBAAqB;IAC1C,eAAe,EAAE,iBAAiB;IAClC,cAAc,EAAE,gBAAgB;CACxB,CAAC;AASX,SAAgB,QAAQ,CAAC,OAAe,EAAE,IAAgB;IACxD,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identity management: generate on first run, store in dataDir with restrictive permissions.
|
|
3
|
+
*/
|
|
4
|
+
import { type Ed25519KeyPair, type X25519KeyPair } from "@onsignet/core";
|
|
5
|
+
export interface StoredIdentity {
|
|
6
|
+
nodeId: string;
|
|
7
|
+
ed25519PublicKey: string;
|
|
8
|
+
ed25519SecretKey: string;
|
|
9
|
+
x25519PublicKey: string;
|
|
10
|
+
x25519SecretKey: string;
|
|
11
|
+
}
|
|
12
|
+
export interface StoredOwner {
|
|
13
|
+
publicKey: string;
|
|
14
|
+
secretKey: string;
|
|
15
|
+
}
|
|
16
|
+
export interface LoadedIdentity {
|
|
17
|
+
nodeId: string;
|
|
18
|
+
ed25519: Ed25519KeyPair;
|
|
19
|
+
x25519: X25519KeyPair;
|
|
20
|
+
}
|
|
21
|
+
export interface LoadedOwner {
|
|
22
|
+
ed25519: Ed25519KeyPair;
|
|
23
|
+
}
|
|
24
|
+
export declare function ensureDataDir(dataDir: string): void;
|
|
25
|
+
export declare function loadOrCreateIdentity(dataDir: string): LoadedIdentity;
|
|
26
|
+
export declare function loadOrCreateOwner(dataDir: string): LoadedOwner;
|
|
27
|
+
/**
|
|
28
|
+
* Create owner attestation: sign("Signet owner attestation: agent <nodeId>").
|
|
29
|
+
*/
|
|
30
|
+
export declare function createOwnerAttestation(agentNodeId: string, ownerSecretKey: Uint8Array): string;
|
|
31
|
+
/**
|
|
32
|
+
* Rotate agent identity: generate new keypair, backup old, return new identity.
|
|
33
|
+
* Caller is responsible for revoking the old key and reconnecting to the relay.
|
|
34
|
+
*/
|
|
35
|
+
export declare function rotateIdentity(dataDir: string): {
|
|
36
|
+
oldIdentity: LoadedIdentity;
|
|
37
|
+
newIdentity: LoadedIdentity;
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAML,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAC;AAMxB,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,aAAa,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,cAAc,CAAC;CACzB;AAID,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEnD;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,CA4BpE;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,CAoB9D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,GAAG,MAAM,CAI9F;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,WAAW,EAAE,cAAc,CAAC;IAAC,WAAW,EAAE,cAAc,CAAA;CAAE,CA0B5G"}
|
package/dist/identity.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Identity management: generate on first run, store in dataDir with restrictive permissions.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ensureDataDir = ensureDataDir;
|
|
7
|
+
exports.loadOrCreateIdentity = loadOrCreateIdentity;
|
|
8
|
+
exports.loadOrCreateOwner = loadOrCreateOwner;
|
|
9
|
+
exports.createOwnerAttestation = createOwnerAttestation;
|
|
10
|
+
exports.rotateIdentity = rotateIdentity;
|
|
11
|
+
const fs_1 = require("fs");
|
|
12
|
+
const path_1 = require("path");
|
|
13
|
+
const core_1 = require("@onsignet/core");
|
|
14
|
+
const IDENTITY_FILE = "identity.json";
|
|
15
|
+
const OWNER_FILE = "owner.json";
|
|
16
|
+
const MODE_RESTRICT = 0o600;
|
|
17
|
+
const ATTESTATION_PREFIX = "Signet owner attestation: agent ";
|
|
18
|
+
function ensureDataDir(dataDir) {
|
|
19
|
+
if (!(0, fs_1.existsSync)(dataDir))
|
|
20
|
+
(0, fs_1.mkdirSync)(dataDir, { recursive: true, mode: 0o700 });
|
|
21
|
+
}
|
|
22
|
+
function loadOrCreateIdentity(dataDir) {
|
|
23
|
+
ensureDataDir(dataDir);
|
|
24
|
+
const path = (0, path_1.join)(dataDir, IDENTITY_FILE);
|
|
25
|
+
if ((0, fs_1.existsSync)(path)) {
|
|
26
|
+
const raw = (0, fs_1.readFileSync)(path, "utf8");
|
|
27
|
+
const stored = JSON.parse(raw);
|
|
28
|
+
return {
|
|
29
|
+
nodeId: stored.nodeId,
|
|
30
|
+
ed25519: {
|
|
31
|
+
publicKey: (0, core_1.decodeBase64)(stored.ed25519PublicKey),
|
|
32
|
+
secretKey: (0, core_1.decodeBase64)(stored.ed25519SecretKey),
|
|
33
|
+
},
|
|
34
|
+
x25519: {
|
|
35
|
+
publicKey: (0, core_1.decodeBase64)(stored.x25519PublicKey),
|
|
36
|
+
secretKey: (0, core_1.decodeBase64)(stored.x25519SecretKey),
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const identity = (0, core_1.createAgentIdentity)();
|
|
41
|
+
const stored = {
|
|
42
|
+
nodeId: identity.nodeId,
|
|
43
|
+
ed25519PublicKey: (0, core_1.encodeBase64)(identity.ed25519.publicKey),
|
|
44
|
+
ed25519SecretKey: (0, core_1.encodeBase64)(identity.ed25519.secretKey),
|
|
45
|
+
x25519PublicKey: (0, core_1.encodeBase64)(identity.x25519.publicKey),
|
|
46
|
+
x25519SecretKey: (0, core_1.encodeBase64)(identity.x25519.secretKey),
|
|
47
|
+
};
|
|
48
|
+
(0, fs_1.writeFileSync)(path, JSON.stringify(stored, null, 0), { mode: MODE_RESTRICT });
|
|
49
|
+
return identity;
|
|
50
|
+
}
|
|
51
|
+
function loadOrCreateOwner(dataDir) {
|
|
52
|
+
ensureDataDir(dataDir);
|
|
53
|
+
const path = (0, path_1.join)(dataDir, OWNER_FILE);
|
|
54
|
+
if ((0, fs_1.existsSync)(path)) {
|
|
55
|
+
const raw = (0, fs_1.readFileSync)(path, "utf8");
|
|
56
|
+
const stored = JSON.parse(raw);
|
|
57
|
+
return {
|
|
58
|
+
ed25519: {
|
|
59
|
+
publicKey: (0, core_1.decodeBase64)(stored.publicKey),
|
|
60
|
+
secretKey: (0, core_1.decodeBase64)(stored.secretKey),
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const kp = (0, core_1.generateEd25519KeyPair)();
|
|
65
|
+
const stored = {
|
|
66
|
+
publicKey: (0, core_1.encodeBase64)(kp.publicKey),
|
|
67
|
+
secretKey: (0, core_1.encodeBase64)(kp.secretKey),
|
|
68
|
+
};
|
|
69
|
+
(0, fs_1.writeFileSync)(path, JSON.stringify(stored, null, 0), { mode: MODE_RESTRICT });
|
|
70
|
+
return { ed25519: kp };
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Create owner attestation: sign("Signet owner attestation: agent <nodeId>").
|
|
74
|
+
*/
|
|
75
|
+
function createOwnerAttestation(agentNodeId, ownerSecretKey) {
|
|
76
|
+
const statement = ATTESTATION_PREFIX + agentNodeId;
|
|
77
|
+
const sig = (0, core_1.sign)(new TextEncoder().encode(statement), ownerSecretKey);
|
|
78
|
+
return (0, core_1.encodeBase64)(sig);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Rotate agent identity: generate new keypair, backup old, return new identity.
|
|
82
|
+
* Caller is responsible for revoking the old key and reconnecting to the relay.
|
|
83
|
+
*/
|
|
84
|
+
function rotateIdentity(dataDir) {
|
|
85
|
+
ensureDataDir(dataDir);
|
|
86
|
+
const identityPath = (0, path_1.join)(dataDir, IDENTITY_FILE);
|
|
87
|
+
// Load current identity
|
|
88
|
+
const oldIdentity = loadOrCreateIdentity(dataDir);
|
|
89
|
+
// Backup old identity
|
|
90
|
+
const backupPath = (0, path_1.join)(dataDir, `identity.${Date.now()}.backup.json`);
|
|
91
|
+
if ((0, fs_1.existsSync)(identityPath)) {
|
|
92
|
+
const raw = (0, fs_1.readFileSync)(identityPath, "utf8");
|
|
93
|
+
(0, fs_1.writeFileSync)(backupPath, raw, { mode: MODE_RESTRICT });
|
|
94
|
+
}
|
|
95
|
+
// Generate new identity
|
|
96
|
+
const newIdent = (0, core_1.createAgentIdentity)();
|
|
97
|
+
const stored = {
|
|
98
|
+
nodeId: newIdent.nodeId,
|
|
99
|
+
ed25519PublicKey: (0, core_1.encodeBase64)(newIdent.ed25519.publicKey),
|
|
100
|
+
ed25519SecretKey: (0, core_1.encodeBase64)(newIdent.ed25519.secretKey),
|
|
101
|
+
x25519PublicKey: (0, core_1.encodeBase64)(newIdent.x25519.publicKey),
|
|
102
|
+
x25519SecretKey: (0, core_1.encodeBase64)(newIdent.x25519.secretKey),
|
|
103
|
+
};
|
|
104
|
+
(0, fs_1.writeFileSync)(identityPath, JSON.stringify(stored, null, 0), { mode: MODE_RESTRICT });
|
|
105
|
+
return { oldIdentity, newIdentity: newIdent };
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":";AAAA;;GAEG;;AA2CH,sCAEC;AAED,oDA4BC;AAED,8CAoBC;AAKD,wDAIC;AAMD,wCA0BC;AAxID,2BAAwE;AACxE,+BAA4B;AAC5B,yCAQwB;AAExB,MAAM,aAAa,GAAG,eAAe,CAAC;AACtC,MAAM,UAAU,GAAG,YAAY,CAAC;AAChC,MAAM,aAAa,GAAG,KAAK,CAAC;AAyB5B,MAAM,kBAAkB,GAAG,kCAAkC,CAAC;AAE9D,SAAgB,aAAa,CAAC,OAAe;IAC3C,IAAI,CAAC,IAAA,eAAU,EAAC,OAAO,CAAC;QAAE,IAAA,cAAS,EAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AACjF,CAAC;AAED,SAAgB,oBAAoB,CAAC,OAAe;IAClD,aAAa,CAAC,OAAO,CAAC,CAAC;IACvB,MAAM,IAAI,GAAG,IAAA,WAAI,EAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC1C,IAAI,IAAA,eAAU,EAAC,IAAI,CAAC,EAAE,CAAC;QACrB,MAAM,GAAG,GAAG,IAAA,iBAAY,EAAC,IAAI,EAA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