@openclaw/nostr 2026.5.20-beta.1 → 2026.5.20
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/api.js +2 -2
- package/dist/{channel-kxjS7m4j.js → channel-CLtuqldV.js} +2 -2
- package/dist/channel-plugin-api.js +1 -1
- package/dist/setup-adapter-DHjtTdO5.js +68 -0
- package/dist/setup-api.js +1 -1
- package/dist/setup-plugin-api.js +9 -64
- package/dist/{setup-surface-vMnYmvEC.js → setup-surface-DasBv0H6.js} +11 -62
- package/dist/test-api.js +1 -1
- package/package.json +5 -5
- package/dist/default-relays-CSfmlk7O.js +0 -4
package/dist/api.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { o as resolveNostrAccount } from "./setup-surface-
|
|
1
|
+
import { o as resolveNostrAccount } from "./setup-surface-DasBv0H6.js";
|
|
2
2
|
import { getPluginRuntimeGatewayRequestScope } from "./runtime-api.js";
|
|
3
3
|
import { n as NostrProfileSchema } from "./config-schema-DIiXiBKr.js";
|
|
4
|
-
import { a as setNostrRuntime, i as getNostrRuntime, n as nostrPlugin, o as contentToProfile, r as publishNostrProfile, t as getNostrProfileState } from "./channel-
|
|
4
|
+
import { a as setNostrRuntime, i as getNostrRuntime, n as nostrPlugin, o as contentToProfile, r as publishNostrProfile, t as getNostrProfileState } from "./channel-CLtuqldV.js";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import { SimplePool, verifyEvent } from "nostr-tools";
|
|
7
7
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, readStringValue } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as resolveDefaultNostrAccountId, c as validatePrivateKey, i as listNostrAccountIds, n as nostrSetupWizard, o as resolveNostrAccount, s as normalizePubkey, t as nostrSetupAdapter } from "./setup-surface-
|
|
1
|
+
import { a as resolveDefaultNostrAccountId, c as validatePrivateKey, i as listNostrAccountIds, n as nostrSetupWizard, o as resolveNostrAccount, s as normalizePubkey, t as nostrSetupAdapter } from "./setup-surface-DasBv0H6.js";
|
|
2
2
|
import { a as collectStatusIssuesFromLastError, i as buildChannelConfigSchema, n as NostrProfileSchema, o as createDefaultChannelRuntimeState, r as DEFAULT_ACCOUNT_ID, s as formatPairingApproveHint, t as NostrConfigSchema } from "./config-schema-DIiXiBKr.js";
|
|
3
|
-
import {
|
|
3
|
+
import { i as DEFAULT_RELAYS } from "./setup-adapter-DHjtTdO5.js";
|
|
4
4
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
5
5
|
import { createScopedDmSecurityResolver, createTopLevelChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
6
6
|
import { createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as nostrPlugin } from "./channel-
|
|
1
|
+
import { n as nostrPlugin } from "./channel-CLtuqldV.js";
|
|
2
2
|
export { nostrPlugin };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/routing";
|
|
2
|
+
import { patchTopLevelChannelConfigSection, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
3
|
+
//#region extensions/nostr/src/default-relays.ts
|
|
4
|
+
const DEFAULT_RELAYS = ["wss://relay.damus.io", "wss://nos.lol"];
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region extensions/nostr/src/setup-adapter.ts
|
|
7
|
+
const channel = "nostr";
|
|
8
|
+
function buildNostrSetupPatch(accountId, patch) {
|
|
9
|
+
return {
|
|
10
|
+
...accountId !== DEFAULT_ACCOUNT_ID ? { defaultAccount: accountId } : {},
|
|
11
|
+
...patch
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function parseRelayUrls(raw) {
|
|
15
|
+
const relays = [];
|
|
16
|
+
for (const entry of splitSetupEntries(raw)) {
|
|
17
|
+
try {
|
|
18
|
+
const parsed = new URL(entry);
|
|
19
|
+
if (parsed.protocol !== "ws:" && parsed.protocol !== "wss:") return {
|
|
20
|
+
relays: [],
|
|
21
|
+
error: `Relay must use ws:// or wss:// (${entry})`
|
|
22
|
+
};
|
|
23
|
+
} catch {
|
|
24
|
+
return {
|
|
25
|
+
relays: [],
|
|
26
|
+
error: `Invalid relay URL: ${entry}`
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
relays.push(entry);
|
|
30
|
+
}
|
|
31
|
+
return { relays: [...new Set(relays)] };
|
|
32
|
+
}
|
|
33
|
+
function createNostrSetupAdapter(params) {
|
|
34
|
+
return {
|
|
35
|
+
resolveAccountId: ({ cfg, accountId }) => params.resolveAccountId(cfg, accountId),
|
|
36
|
+
applyAccountName: ({ cfg, accountId, name }) => patchTopLevelChannelConfigSection({
|
|
37
|
+
cfg,
|
|
38
|
+
channel,
|
|
39
|
+
patch: buildNostrSetupPatch(accountId, name?.trim() ? { name: name.trim() } : {})
|
|
40
|
+
}),
|
|
41
|
+
validateInput: ({ input }) => {
|
|
42
|
+
const typedInput = input;
|
|
43
|
+
if (!typedInput.useEnv) {
|
|
44
|
+
const privateKey = typedInput.privateKey?.trim();
|
|
45
|
+
if (!privateKey) return "Nostr requires --private-key or --use-env.";
|
|
46
|
+
if (!params.validatePrivateKey(privateKey)) return "Nostr private key must be valid nsec or 64-character hex.";
|
|
47
|
+
}
|
|
48
|
+
if (typedInput.relayUrls?.trim()) return parseRelayUrls(typedInput.relayUrls).error ?? null;
|
|
49
|
+
return null;
|
|
50
|
+
},
|
|
51
|
+
applyAccountConfig: ({ cfg, accountId, input }) => {
|
|
52
|
+
const typedInput = input;
|
|
53
|
+
const relayResult = typedInput.relayUrls?.trim() ? parseRelayUrls(typedInput.relayUrls) : { relays: [] };
|
|
54
|
+
return patchTopLevelChannelConfigSection({
|
|
55
|
+
cfg,
|
|
56
|
+
channel,
|
|
57
|
+
enabled: true,
|
|
58
|
+
clearFields: typedInput.useEnv ? ["privateKey"] : void 0,
|
|
59
|
+
patch: buildNostrSetupPatch(accountId, {
|
|
60
|
+
...typedInput.useEnv ? {} : { privateKey: typedInput.privateKey?.trim() },
|
|
61
|
+
...relayResult.relays.length > 0 ? { relays: relayResult.relays } : {}
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { DEFAULT_RELAYS as i, createNostrSetupAdapter as n, parseRelayUrls as r, buildNostrSetupPatch as t };
|
package/dist/setup-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as nostrSetupWizard, t as nostrSetupAdapter } from "./setup-surface-
|
|
1
|
+
import { n as nostrSetupWizard, t as nostrSetupAdapter } from "./setup-surface-DasBv0H6.js";
|
|
2
2
|
export { nostrSetupAdapter, nostrSetupWizard };
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { i as buildChannelConfigSchema, t as NostrConfigSchema } from "./config-schema-DIiXiBKr.js";
|
|
2
|
-
import {
|
|
2
|
+
import { i as DEFAULT_RELAYS, n as createNostrSetupAdapter } from "./setup-adapter-DHjtTdO5.js";
|
|
3
3
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
4
|
-
import {
|
|
5
|
-
import { DEFAULT_ACCOUNT_ID, createDelegatedSetupWizardProxy, createSetupTranslator as createSetupTranslator$1, createStandardChannelSetupStatus as createStandardChannelSetupStatus$1 } from "openclaw/plugin-sdk/setup-runtime";
|
|
4
|
+
import { DEFAULT_ACCOUNT_ID, createDelegatedSetupWizardProxy, createSetupTranslator, createStandardChannelSetupStatus } from "openclaw/plugin-sdk/setup-runtime";
|
|
6
5
|
//#region extensions/nostr/src/channel.setup.ts
|
|
7
|
-
const t = createSetupTranslator
|
|
6
|
+
const t = createSetupTranslator();
|
|
8
7
|
const channel = "nostr";
|
|
9
8
|
function getNostrConfig(cfg) {
|
|
10
9
|
return cfg.channels?.nostr;
|
|
@@ -43,71 +42,17 @@ function resolveSetupNostrAccount(params) {
|
|
|
43
42
|
}
|
|
44
43
|
};
|
|
45
44
|
}
|
|
46
|
-
function buildNostrSetupPatch(accountId, patch) {
|
|
47
|
-
return {
|
|
48
|
-
...accountId !== DEFAULT_ACCOUNT_ID ? { defaultAccount: accountId } : {},
|
|
49
|
-
...patch
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
function parseRelayUrls(raw) {
|
|
53
|
-
const entries = raw.split(/[,\n]/).map((entry) => entry.trim()).filter(Boolean);
|
|
54
|
-
const relays = [];
|
|
55
|
-
for (const entry of entries) {
|
|
56
|
-
try {
|
|
57
|
-
const parsed = new URL(entry);
|
|
58
|
-
if (parsed.protocol !== "ws:" && parsed.protocol !== "wss:") return {
|
|
59
|
-
relays: [],
|
|
60
|
-
error: `Relay must use ws:// or wss:// (${entry})`
|
|
61
|
-
};
|
|
62
|
-
} catch {
|
|
63
|
-
return {
|
|
64
|
-
relays: [],
|
|
65
|
-
error: `Invalid relay URL: ${entry}`
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
relays.push(entry);
|
|
69
|
-
}
|
|
70
|
-
return { relays: [...new Set(relays)] };
|
|
71
|
-
}
|
|
72
45
|
function looksLikeNostrPrivateKey(privateKey) {
|
|
73
46
|
return privateKey.startsWith("nsec1") || /^[0-9a-fA-F]{64}$/.test(privateKey);
|
|
74
47
|
}
|
|
75
|
-
const nostrSetupAdapter = {
|
|
76
|
-
resolveAccountId: (
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
channel,
|
|
80
|
-
patch: buildNostrSetupPatch(accountId, name?.trim() ? { name: name.trim() } : {})
|
|
81
|
-
}),
|
|
82
|
-
validateInput: ({ input }) => {
|
|
83
|
-
const typedInput = input;
|
|
84
|
-
if (!typedInput.useEnv) {
|
|
85
|
-
const privateKey = typedInput.privateKey?.trim();
|
|
86
|
-
if (!privateKey) return "Nostr requires --private-key or --use-env.";
|
|
87
|
-
if (!looksLikeNostrPrivateKey(privateKey)) return "Nostr private key must be valid nsec or 64-character hex.";
|
|
88
|
-
}
|
|
89
|
-
if (typedInput.relayUrls?.trim()) return parseRelayUrls(typedInput.relayUrls).error ?? null;
|
|
90
|
-
return null;
|
|
91
|
-
},
|
|
92
|
-
applyAccountConfig: ({ cfg, accountId, input }) => {
|
|
93
|
-
const typedInput = input;
|
|
94
|
-
const relayResult = typedInput.relayUrls?.trim() ? parseRelayUrls(typedInput.relayUrls) : { relays: [] };
|
|
95
|
-
return patchTopLevelChannelConfigSection({
|
|
96
|
-
cfg,
|
|
97
|
-
channel,
|
|
98
|
-
enabled: true,
|
|
99
|
-
clearFields: typedInput.useEnv ? ["privateKey"] : void 0,
|
|
100
|
-
patch: buildNostrSetupPatch(accountId, {
|
|
101
|
-
...typedInput.useEnv ? {} : { privateKey: typedInput.privateKey?.trim() },
|
|
102
|
-
...relayResult.relays.length > 0 ? { relays: relayResult.relays } : {}
|
|
103
|
-
})
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
};
|
|
48
|
+
const nostrSetupAdapter = createNostrSetupAdapter({
|
|
49
|
+
resolveAccountId: (cfg, accountId) => accountId?.trim() || resolveDefaultSetupNostrAccountId(cfg),
|
|
50
|
+
validatePrivateKey: looksLikeNostrPrivateKey
|
|
51
|
+
});
|
|
107
52
|
const nostrSetupWizard = createDelegatedSetupWizardProxy({
|
|
108
53
|
channel,
|
|
109
|
-
loadWizard: async () => (await import("./setup-surface-
|
|
110
|
-
status: { ...createStandardChannelSetupStatus
|
|
54
|
+
loadWizard: async () => (await import("./setup-surface-DasBv0H6.js").then((n) => n.r)).nostrSetupWizard,
|
|
55
|
+
status: { ...createStandardChannelSetupStatus({
|
|
111
56
|
channelLabel: "Nostr",
|
|
112
57
|
configuredLabel: t("wizard.channels.statusConfigured"),
|
|
113
58
|
unconfiguredLabel: t("wizard.channels.statusNeedsPrivateKey"),
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as DEFAULT_RELAYS, n as createNostrSetupAdapter, r as parseRelayUrls, t as buildNostrSetupPatch } from "./setup-adapter-DHjtTdO5.js";
|
|
2
2
|
import { hasConfiguredSecretInput, normalizeSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
3
3
|
import { getPublicKey, nip19 } from "nostr-tools";
|
|
4
4
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId, normalizeOptionalAccountId } from "openclaw/plugin-sdk/account-id";
|
|
5
5
|
import { listCombinedAccountIds, resolveListedDefaultAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
6
6
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1 } from "openclaw/plugin-sdk/routing";
|
|
8
|
-
import { createSetupTranslator, createStandardChannelSetupStatus, createTopLevelChannelDmPolicy, createTopLevelChannelParsedAllowFromPrompt, formatDocsLink, mergeAllowFromEntries, parseSetupEntriesWithParser, patchTopLevelChannelConfigSection
|
|
8
|
+
import { createSetupTranslator, createStandardChannelSetupStatus, createTopLevelChannelDmPolicy, createTopLevelChannelParsedAllowFromPrompt, formatDocsLink, mergeAllowFromEntries, parseSetupEntriesWithParser, patchTopLevelChannelConfigSection } from "openclaw/plugin-sdk/setup";
|
|
9
9
|
//#region \0rolldown/runtime.js
|
|
10
10
|
var __defProp = Object.defineProperty;
|
|
11
11
|
var __exportAll = (all, no_symbols) => {
|
|
@@ -134,32 +134,6 @@ const NOSTR_ALLOW_FROM_HELP_LINES = [
|
|
|
134
134
|
t("wizard.nostr.multipleEntries"),
|
|
135
135
|
`Docs: ${formatDocsLink("/channels/nostr", "channels/nostr")}`
|
|
136
136
|
];
|
|
137
|
-
function buildNostrSetupPatch(accountId, patch) {
|
|
138
|
-
return {
|
|
139
|
-
...accountId !== DEFAULT_ACCOUNT_ID$1 ? { defaultAccount: accountId } : {},
|
|
140
|
-
...patch
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
function parseRelayUrls(raw) {
|
|
144
|
-
const entries = splitSetupEntries(raw);
|
|
145
|
-
const relays = [];
|
|
146
|
-
for (const entry of entries) {
|
|
147
|
-
try {
|
|
148
|
-
const parsed = new URL(entry);
|
|
149
|
-
if (parsed.protocol !== "ws:" && parsed.protocol !== "wss:") return {
|
|
150
|
-
relays: [],
|
|
151
|
-
error: `Relay must use ws:// or wss:// (${entry})`
|
|
152
|
-
};
|
|
153
|
-
} catch {
|
|
154
|
-
return {
|
|
155
|
-
relays: [],
|
|
156
|
-
error: `Invalid relay URL: ${entry}`
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
relays.push(entry);
|
|
160
|
-
}
|
|
161
|
-
return { relays: [...new Set(relays)] };
|
|
162
|
-
}
|
|
163
137
|
function parseNostrAllowFrom(raw) {
|
|
164
138
|
return parseSetupEntriesWithParser(raw, (entry) => {
|
|
165
139
|
const cleaned = entry.replace(/^nostr:/i, "").trim();
|
|
@@ -187,42 +161,17 @@ const nostrDmPolicy = createTopLevelChannelDmPolicy({
|
|
|
187
161
|
mergeEntries: ({ existing, parsed }) => mergeAllowFromEntries(existing, parsed)
|
|
188
162
|
})
|
|
189
163
|
});
|
|
190
|
-
const nostrSetupAdapter = {
|
|
191
|
-
resolveAccountId: (
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
const typedInput = input;
|
|
199
|
-
if (!typedInput.useEnv) {
|
|
200
|
-
const privateKey = typedInput.privateKey?.trim();
|
|
201
|
-
if (!privateKey) return "Nostr requires --private-key or --use-env.";
|
|
202
|
-
try {
|
|
203
|
-
getPublicKeyFromPrivate(privateKey);
|
|
204
|
-
} catch {
|
|
205
|
-
return "Nostr private key must be valid nsec or 64-character hex.";
|
|
206
|
-
}
|
|
164
|
+
const nostrSetupAdapter = createNostrSetupAdapter({
|
|
165
|
+
resolveAccountId: (cfg, accountId) => accountId?.trim() || resolveDefaultNostrAccountId(cfg),
|
|
166
|
+
validatePrivateKey: (privateKey) => {
|
|
167
|
+
try {
|
|
168
|
+
getPublicKeyFromPrivate(privateKey);
|
|
169
|
+
return true;
|
|
170
|
+
} catch {
|
|
171
|
+
return false;
|
|
207
172
|
}
|
|
208
|
-
if (typedInput.relayUrls?.trim()) return parseRelayUrls(typedInput.relayUrls).error ?? null;
|
|
209
|
-
return null;
|
|
210
|
-
},
|
|
211
|
-
applyAccountConfig: ({ cfg, accountId, input }) => {
|
|
212
|
-
const typedInput = input;
|
|
213
|
-
const relayResult = typedInput.relayUrls?.trim() ? parseRelayUrls(typedInput.relayUrls) : { relays: [] };
|
|
214
|
-
return patchTopLevelChannelConfigSection({
|
|
215
|
-
cfg,
|
|
216
|
-
channel,
|
|
217
|
-
enabled: true,
|
|
218
|
-
clearFields: typedInput.useEnv ? ["privateKey"] : void 0,
|
|
219
|
-
patch: buildNostrSetupPatch(accountId, {
|
|
220
|
-
...typedInput.useEnv ? {} : { privateKey: typedInput.privateKey?.trim() },
|
|
221
|
-
...relayResult.relays.length > 0 ? { relays: relayResult.relays } : {}
|
|
222
|
-
})
|
|
223
|
-
});
|
|
224
173
|
}
|
|
225
|
-
};
|
|
174
|
+
});
|
|
226
175
|
const nostrSetupWizard = {
|
|
227
176
|
channel,
|
|
228
177
|
resolveAccountIdForConfigure: ({ accountOverride, defaultAccountId }) => accountOverride?.trim() || defaultAccountId,
|
package/dist/test-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as nostrPlugin } from "./channel-
|
|
1
|
+
import { n as nostrPlugin } from "./channel-CLtuqldV.js";
|
|
2
2
|
export { nostrPlugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/nostr",
|
|
3
|
-
"version": "2026.5.20
|
|
3
|
+
"version": "2026.5.20",
|
|
4
4
|
"description": "OpenClaw Nostr channel plugin for NIP-04 encrypted DMs",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"nostr-tools": "2.23.
|
|
11
|
+
"nostr-tools": "2.23.5",
|
|
12
12
|
"zod": "4.4.3"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"openclaw": "workspace:*"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"openclaw": ">=2026.5.20
|
|
19
|
+
"openclaw": ">=2026.5.20"
|
|
20
20
|
},
|
|
21
21
|
"peerDependenciesMeta": {
|
|
22
22
|
"openclaw": {
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
"minHostVersion": ">=2026.4.10"
|
|
55
55
|
},
|
|
56
56
|
"compat": {
|
|
57
|
-
"pluginApi": ">=2026.5.20
|
|
57
|
+
"pluginApi": ">=2026.5.20"
|
|
58
58
|
},
|
|
59
59
|
"build": {
|
|
60
|
-
"openclawVersion": "2026.5.20
|
|
60
|
+
"openclawVersion": "2026.5.20"
|
|
61
61
|
},
|
|
62
62
|
"release": {
|
|
63
63
|
"publishToClawHub": true,
|