@openclaw/nostr 2026.7.2-beta.1 → 2026.7.2-beta.2
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 +34 -60
- package/dist/{channel-BZfbDZcY.js → channel-B51rExHD.js} +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/setup-api.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-CKamwGa3.js → setup-surface-B52P4uo2.js} +16 -28
- package/npm-shrinkwrap.json +3 -3
- package/package.json +4 -4
package/dist/api.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { o as resolveNostrAccount } from "./setup-surface-
|
|
1
|
+
import { o as resolveNostrAccount } from "./setup-surface-B52P4uo2.js";
|
|
2
2
|
import { getPluginRuntimeGatewayRequestScope } from "./runtime-api.js";
|
|
3
3
|
import { n as NostrProfileSchema } from "./config-schema-CelPzg1N.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-B51rExHD.js";
|
|
5
5
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, readStringValue } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
-
import { SimplePool
|
|
7
|
+
import { SimplePool } from "nostr-tools";
|
|
8
8
|
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
9
9
|
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
10
10
|
import { readJsonBodyWithLimit, requestBodyErrorToText } from "openclaw/plugin-sdk/webhook-request-guards";
|
|
@@ -79,69 +79,42 @@ async function importProfileFromRelays(opts) {
|
|
|
79
79
|
relaysQueried: []
|
|
80
80
|
};
|
|
81
81
|
const pool = new SimplePool();
|
|
82
|
-
const relaysQueried = [];
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
};
|
|
82
|
+
const relaysQueried = [...relays];
|
|
83
|
+
let deadlineTimer;
|
|
84
|
+
const deadline = new Promise((resolve) => {
|
|
85
|
+
deadlineTimer = setTimeout(resolve, timeoutMs);
|
|
86
|
+
deadlineTimer.unref?.();
|
|
87
|
+
});
|
|
88
|
+
const subscriptions = [];
|
|
90
89
|
try {
|
|
91
90
|
const events = [];
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (completed >= relays.length) resolve();
|
|
114
|
-
},
|
|
115
|
-
onclose() {
|
|
116
|
-
completed++;
|
|
117
|
-
if (completed >= relays.length) resolve();
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
scheduleTimeout(() => {
|
|
121
|
-
sub.close();
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
await Promise.race([subscriptionPromise, timeoutPromise]);
|
|
126
|
-
for (const timer of timers.splice(0)) clearTimeout(timer);
|
|
91
|
+
await Promise.race([Promise.all(relays.map((relay) => new Promise((resolve) => {
|
|
92
|
+
const subscription = pool.subscribeMany([relay], {
|
|
93
|
+
kinds: [0],
|
|
94
|
+
authors: [pubkey],
|
|
95
|
+
limit: 1
|
|
96
|
+
}, {
|
|
97
|
+
onevent(event) {
|
|
98
|
+
events.push({
|
|
99
|
+
event,
|
|
100
|
+
relay
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
oneose() {
|
|
104
|
+
resolve();
|
|
105
|
+
},
|
|
106
|
+
onclose() {
|
|
107
|
+
resolve();
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
subscriptions.push(subscription);
|
|
111
|
+
}))), deadline]);
|
|
127
112
|
if (events.length === 0) return {
|
|
128
113
|
ok: false,
|
|
129
114
|
error: "No profile found on any relay",
|
|
130
115
|
relaysQueried
|
|
131
116
|
};
|
|
132
|
-
|
|
133
|
-
for (const item of events) if (!bestEvent || item.event.created_at > bestEvent.event.created_at) bestEvent = item;
|
|
134
|
-
if (!bestEvent) return {
|
|
135
|
-
ok: false,
|
|
136
|
-
error: "No valid profile event found",
|
|
137
|
-
relaysQueried
|
|
138
|
-
};
|
|
139
|
-
if (!verifyEvent(bestEvent.event)) return {
|
|
140
|
-
ok: false,
|
|
141
|
-
error: "Profile event has invalid signature",
|
|
142
|
-
relaysQueried,
|
|
143
|
-
sourceRelay: bestEvent.relay
|
|
144
|
-
};
|
|
117
|
+
const bestEvent = events.reduce((current, candidate) => candidate.event.created_at > current.event.created_at ? candidate : current);
|
|
145
118
|
let content;
|
|
146
119
|
try {
|
|
147
120
|
content = JSON.parse(bestEvent.event.content);
|
|
@@ -165,7 +138,8 @@ async function importProfileFromRelays(opts) {
|
|
|
165
138
|
sourceRelay: bestEvent.relay
|
|
166
139
|
};
|
|
167
140
|
} finally {
|
|
168
|
-
|
|
141
|
+
if (deadlineTimer) clearTimeout(deadlineTimer);
|
|
142
|
+
for (const subscription of subscriptions) subscription.close();
|
|
169
143
|
pool.close(relays);
|
|
170
144
|
}
|
|
171
145
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
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-B52P4uo2.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-CelPzg1N.js";
|
|
3
3
|
import { i as DEFAULT_RELAYS } from "./setup-adapter-DEU3o8MF.js";
|
|
4
4
|
import { t as normalizeNostrStateAccountId } from "./state-account-id-CvBZ9s6P.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as nostrPlugin } from "./channel-
|
|
1
|
+
import { n as nostrPlugin } from "./channel-B51rExHD.js";
|
|
2
2
|
export { nostrPlugin };
|
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-B52P4uo2.js";
|
|
2
2
|
export { nostrSetupAdapter, nostrSetupWizard };
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -51,7 +51,7 @@ const nostrSetupAdapter = createNostrSetupAdapter({
|
|
|
51
51
|
});
|
|
52
52
|
const nostrSetupWizard = createDelegatedSetupWizardProxy({
|
|
53
53
|
channel,
|
|
54
|
-
loadWizard: async () => (await import("./setup-surface-
|
|
54
|
+
loadWizard: async () => (await import("./setup-surface-B52P4uo2.js").then((n) => n.r)).nostrSetupWizard,
|
|
55
55
|
status: { ...createStandardChannelSetupStatus({
|
|
56
56
|
channelLabel: "Nostr",
|
|
57
57
|
configuredLabel: t("wizard.channels.statusConfigured"),
|
|
@@ -5,7 +5,7 @@ import { getPublicKey, nip19 } from "nostr-tools";
|
|
|
5
5
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId, normalizeOptionalAccountId } from "openclaw/plugin-sdk/account-id";
|
|
6
6
|
import { listCombinedAccountIds, resolveListedDefaultAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
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 } from "openclaw/plugin-sdk/setup";
|
|
8
|
+
import { createSetupTranslator, createStandardChannelSetupStatus, createTopLevelChannelDmPolicy, createTopLevelChannelParsedAllowFromPrompt, defineTokenCredential, formatDocsLink, mergeAllowFromEntries, parseSetupEntriesWithParser, patchTopLevelChannelConfigSection, setSetupChannelEnabled } from "openclaw/plugin-sdk/setup";
|
|
9
9
|
//#region \0rolldown/runtime.js
|
|
10
10
|
var __defProp = Object.defineProperty;
|
|
11
11
|
var __exportAll = (all, no_symbols) => {
|
|
@@ -209,8 +209,9 @@ const nostrSetupWizard = {
|
|
|
209
209
|
patch: buildNostrSetupPatch(accountId, {})
|
|
210
210
|
})
|
|
211
211
|
},
|
|
212
|
-
credentials: [{
|
|
212
|
+
credentials: [defineTokenCredential({
|
|
213
213
|
inputKey: "privateKey",
|
|
214
|
+
configKey: "privateKey",
|
|
214
215
|
providerHint: channel,
|
|
215
216
|
credentialLabel: "private key",
|
|
216
217
|
preferredEnvVar: "NOSTR_PRIVATE_KEY",
|
|
@@ -220,32 +221,23 @@ const nostrSetupWizard = {
|
|
|
220
221
|
keepPrompt: t("wizard.nostr.privateKeyKeep"),
|
|
221
222
|
inputPrompt: t("wizard.nostr.privateKeyInput"),
|
|
222
223
|
allowEnv: ({ accountId }) => accountId === DEFAULT_ACCOUNT_ID$1,
|
|
223
|
-
|
|
224
|
-
const account = resolveNostrAccount({
|
|
225
|
-
cfg,
|
|
226
|
-
accountId
|
|
227
|
-
});
|
|
228
|
-
return {
|
|
229
|
-
accountConfigured: account.configured,
|
|
230
|
-
hasConfiguredValue: hasConfiguredSecretInput(account.config.privateKey),
|
|
231
|
-
resolvedValue: normalizeSecretInputString(account.config.privateKey),
|
|
232
|
-
envValue: process.env.NOSTR_PRIVATE_KEY?.trim()
|
|
233
|
-
};
|
|
234
|
-
},
|
|
235
|
-
applyUseEnv: async ({ cfg, accountId }) => patchTopLevelChannelConfigSection({
|
|
224
|
+
resolveAccount: ({ cfg, accountId }) => resolveNostrAccount({
|
|
236
225
|
cfg,
|
|
237
|
-
|
|
238
|
-
enabled: true,
|
|
239
|
-
clearFields: ["privateKey"],
|
|
240
|
-
patch: buildNostrSetupPatch(accountId, {})
|
|
226
|
+
accountId
|
|
241
227
|
}),
|
|
242
|
-
|
|
228
|
+
accountConfigured: (account) => account.configured,
|
|
229
|
+
resolvedValue: (account) => normalizeSecretInputString(account.config.privateKey),
|
|
230
|
+
envValue: () => process.env.NOSTR_PRIVATE_KEY?.trim(),
|
|
231
|
+
patchAccount: ({ cfg, accountId, patch, clearFields }) => patchTopLevelChannelConfigSection({
|
|
243
232
|
cfg,
|
|
244
233
|
channel,
|
|
245
234
|
enabled: true,
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
235
|
+
clearFields,
|
|
236
|
+
patch: buildNostrSetupPatch(accountId, patch)
|
|
237
|
+
}),
|
|
238
|
+
useEnv: { clearFields: ["privateKey"] },
|
|
239
|
+
set: { value: "resolved" }
|
|
240
|
+
})],
|
|
249
241
|
textInputs: [{
|
|
250
242
|
inputKey: "relayUrls",
|
|
251
243
|
message: t("wizard.nostr.relayUrlsPrompt"),
|
|
@@ -276,11 +268,7 @@ const nostrSetupWizard = {
|
|
|
276
268
|
}
|
|
277
269
|
}],
|
|
278
270
|
dmPolicy: nostrDmPolicy,
|
|
279
|
-
disable: (cfg) =>
|
|
280
|
-
cfg,
|
|
281
|
-
channel,
|
|
282
|
-
patch: { enabled: false }
|
|
283
|
-
})
|
|
271
|
+
disable: (cfg) => setSetupChannelEnabled(cfg, channel, false)
|
|
284
272
|
};
|
|
285
273
|
//#endregion
|
|
286
274
|
export { resolveDefaultNostrAccountId as a, validatePrivateKey as c, listNostrAccountIds as i, nostrSetupWizard as n, resolveNostrAccount as o, setup_surface_exports as r, normalizePubkey as s, nostrSetupAdapter as t };
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/nostr",
|
|
3
|
-
"version": "2026.7.2-beta.
|
|
3
|
+
"version": "2026.7.2-beta.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/nostr",
|
|
9
|
-
"version": "2026.7.2-beta.
|
|
9
|
+
"version": "2026.7.2-beta.2",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"nostr-tools": "2.23.9",
|
|
12
12
|
"zod": "4.4.3"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"openclaw": ">=2026.7.2-beta.
|
|
15
|
+
"openclaw": ">=2026.7.2-beta.2"
|
|
16
16
|
},
|
|
17
17
|
"peerDependenciesMeta": {
|
|
18
18
|
"openclaw": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/nostr",
|
|
3
|
-
"version": "2026.7.2-beta.
|
|
3
|
+
"version": "2026.7.2-beta.2",
|
|
4
4
|
"description": "OpenClaw Nostr channel plugin for NIP-04 encrypted direct messages.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"zod": "4.4.3"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"openclaw": ">=2026.7.2-beta.
|
|
15
|
+
"openclaw": ">=2026.7.2-beta.2"
|
|
16
16
|
},
|
|
17
17
|
"peerDependenciesMeta": {
|
|
18
18
|
"openclaw": {
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"minHostVersion": ">=2026.4.10"
|
|
51
51
|
},
|
|
52
52
|
"compat": {
|
|
53
|
-
"pluginApi": ">=2026.7.2-beta.
|
|
53
|
+
"pluginApi": ">=2026.7.2-beta.2"
|
|
54
54
|
},
|
|
55
55
|
"build": {
|
|
56
|
-
"openclawVersion": "2026.7.2-beta.
|
|
56
|
+
"openclawVersion": "2026.7.2-beta.2"
|
|
57
57
|
},
|
|
58
58
|
"release": {
|
|
59
59
|
"publishToClawHub": true,
|