@openclaw/nostr 2026.5.9-beta.1 → 2026.5.10-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 +2 -2
- package/dist/{channel-C6LnxRyg.js → channel-BSOktL3g.js} +49 -44
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{config-schema-DIk4jlBg.js → config-schema-Clq-vlF1.js} +1 -2
- package/dist/setup-plugin-api.js +1 -1
- package/dist/test-api.js +1 -1
- package/package.json +4 -4
package/dist/api.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { o as resolveNostrAccount } from "./setup-surface-DxAaUTyC.js";
|
|
2
2
|
import { getPluginRuntimeGatewayRequestScope } from "./runtime-api.js";
|
|
3
|
-
import { n as NostrProfileSchema } from "./config-schema-
|
|
4
|
-
import { a as setNostrRuntime, i as getNostrRuntime, n as nostrPlugin, o as contentToProfile, r as publishNostrProfile, t as getNostrProfileState } from "./channel-
|
|
3
|
+
import { n as NostrProfileSchema } from "./config-schema-Clq-vlF1.js";
|
|
4
|
+
import { a as setNostrRuntime, i as getNostrRuntime, n as nostrPlugin, o as contentToProfile, r as publishNostrProfile, t as getNostrProfileState } from "./channel-BSOktL3g.js";
|
|
5
5
|
import { z } from "openclaw/plugin-sdk/zod";
|
|
6
6
|
import { SimplePool, verifyEvent } from "nostr-tools";
|
|
7
7
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, readStringValue } from "openclaw/plugin-sdk/text-runtime";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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-DxAaUTyC.js";
|
|
2
|
-
import { a as collectStatusIssuesFromLastError,
|
|
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-Clq-vlF1.js";
|
|
3
3
|
import { t as DEFAULT_RELAYS } from "./default-relays-DLwdWOTu.js";
|
|
4
4
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
5
5
|
import { createScopedDmSecurityResolver, createTopLevelChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
@@ -8,6 +8,7 @@ import { createChannelMessageAdapterFromOutbound } from "openclaw/plugin-sdk/cha
|
|
|
8
8
|
import { buildPassiveChannelStatusSummary, buildTrafficStatusSummary, safeParseJsonWithSchema } from "openclaw/plugin-sdk/extension-shared";
|
|
9
9
|
import { createComputedAccountStatusAdapter } from "openclaw/plugin-sdk/status-helpers";
|
|
10
10
|
import { z } from "openclaw/plugin-sdk/zod";
|
|
11
|
+
import { resolveStableChannelMessageIngress } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
11
12
|
import { createChannelPairingController } from "openclaw/plugin-sdk/channel-pairing";
|
|
12
13
|
import { attachChannelToResult } from "openclaw/plugin-sdk/channel-send-result";
|
|
13
14
|
import { SimplePool, finalizeEvent, getPublicKey, verifyEvent } from "nostr-tools";
|
|
@@ -1096,38 +1097,38 @@ async function sendEncryptedDm(pool, sk, toPubkey, text, relays, metrics, circui
|
|
|
1096
1097
|
//#region extensions/nostr/src/gateway.ts
|
|
1097
1098
|
const activeBuses = /* @__PURE__ */ new Map();
|
|
1098
1099
|
const metricsSnapshots = /* @__PURE__ */ new Map();
|
|
1100
|
+
const ACCESS_GROUP_PREFIX = "accessGroup:";
|
|
1101
|
+
function parseNostrAccessGroupAllowFromEntry(entry) {
|
|
1102
|
+
const trimmed = entry.trim();
|
|
1103
|
+
if (!trimmed.startsWith(ACCESS_GROUP_PREFIX)) return null;
|
|
1104
|
+
return trimmed.slice(12).trim() || null;
|
|
1105
|
+
}
|
|
1099
1106
|
function normalizeNostrAllowEntry(entry) {
|
|
1100
1107
|
const trimmed = entry.trim();
|
|
1101
1108
|
if (!trimmed) return null;
|
|
1102
1109
|
if (trimmed === "*") return "*";
|
|
1110
|
+
const accessGroup = parseNostrAccessGroupAllowFromEntry(trimmed);
|
|
1111
|
+
if (accessGroup) return `accessGroup:${accessGroup}`;
|
|
1103
1112
|
try {
|
|
1104
1113
|
return normalizePubkey(trimmed.replace(/^nostr:/i, ""));
|
|
1105
1114
|
} catch {
|
|
1106
1115
|
return null;
|
|
1107
1116
|
}
|
|
1108
1117
|
}
|
|
1109
|
-
function
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1118
|
+
function normalizeNostrSenderPubkey(value) {
|
|
1119
|
+
try {
|
|
1120
|
+
return normalizePubkey(value);
|
|
1121
|
+
} catch {
|
|
1122
|
+
return null;
|
|
1114
1123
|
}
|
|
1115
|
-
return false;
|
|
1116
|
-
}
|
|
1117
|
-
async function resolveNostrDirectAccess(params) {
|
|
1118
|
-
return resolveInboundDirectDmAccessWithRuntime({
|
|
1119
|
-
cfg: params.cfg,
|
|
1120
|
-
channel: "nostr",
|
|
1121
|
-
accountId: params.accountId,
|
|
1122
|
-
dmPolicy: params.dmPolicy,
|
|
1123
|
-
allowFrom: params.allowFrom,
|
|
1124
|
-
senderId: params.senderPubkey,
|
|
1125
|
-
rawBody: params.rawBody,
|
|
1126
|
-
isSenderAllowed: isNostrSenderAllowed,
|
|
1127
|
-
runtime: params.runtime,
|
|
1128
|
-
modeWhenAccessGroupsOff: "configured"
|
|
1129
|
-
});
|
|
1130
1124
|
}
|
|
1125
|
+
const nostrIngressIdentity = {
|
|
1126
|
+
key: "nostr-pubkey",
|
|
1127
|
+
normalizeEntry: normalizeNostrAllowEntry,
|
|
1128
|
+
normalizeSubject: normalizeNostrSenderPubkey,
|
|
1129
|
+
sensitivity: "pii",
|
|
1130
|
+
entryIdPrefix: "nostr-entry"
|
|
1131
|
+
};
|
|
1131
1132
|
const startNostrGatewayAccount = async (ctx) => {
|
|
1132
1133
|
const account = ctx.account;
|
|
1133
1134
|
ctx.setStatus({
|
|
@@ -1142,38 +1143,42 @@ const startNostrGatewayAccount = async (ctx) => {
|
|
|
1142
1143
|
channel: "nostr",
|
|
1143
1144
|
accountId: account.accountId
|
|
1144
1145
|
});
|
|
1145
|
-
const resolveInboundAccess = async (senderPubkey, rawBody) => await
|
|
1146
|
-
|
|
1146
|
+
const resolveInboundAccess = async (senderPubkey, rawBody) => await resolveStableChannelMessageIngress({
|
|
1147
|
+
channelId: "nostr",
|
|
1147
1148
|
accountId: account.accountId,
|
|
1149
|
+
identity: nostrIngressIdentity,
|
|
1150
|
+
cfg: ctx.cfg,
|
|
1151
|
+
useDefaultPairingStore: true,
|
|
1152
|
+
subject: { stableId: senderPubkey },
|
|
1153
|
+
conversation: {
|
|
1154
|
+
kind: "direct",
|
|
1155
|
+
id: senderPubkey
|
|
1156
|
+
},
|
|
1148
1157
|
dmPolicy: account.config.dmPolicy ?? "pairing",
|
|
1149
1158
|
allowFrom: account.config.allowFrom,
|
|
1150
|
-
|
|
1151
|
-
rawBody,
|
|
1152
|
-
runtime: {
|
|
1153
|
-
shouldComputeCommandAuthorized: runtime.channel.commands.shouldComputeCommandAuthorized,
|
|
1154
|
-
resolveCommandAuthorizedFromAuthorizers: runtime.channel.commands.resolveCommandAuthorizedFromAuthorizers
|
|
1155
|
-
}
|
|
1159
|
+
command: runtime.channel.commands.shouldComputeCommandAuthorized(rawBody, ctx.cfg) ? { modeWhenAccessGroupsOff: "configured" } : void 0
|
|
1156
1160
|
});
|
|
1157
1161
|
let busHandle = null;
|
|
1158
|
-
const authorizeSender =
|
|
1159
|
-
|
|
1160
|
-
|
|
1162
|
+
const authorizeSender = async (input) => {
|
|
1163
|
+
const resolved = await resolveInboundAccess(input.senderId, "");
|
|
1164
|
+
if (resolved.senderAccess.decision === "allow") return "allow";
|
|
1165
|
+
if (resolved.senderAccess.decision === "pairing") {
|
|
1161
1166
|
await pairing.issueChallenge({
|
|
1162
|
-
senderId,
|
|
1163
|
-
senderIdLine: `Your Nostr pubkey: ${senderId}`,
|
|
1164
|
-
sendPairingReply: reply,
|
|
1167
|
+
senderId: input.senderId,
|
|
1168
|
+
senderIdLine: `Your Nostr pubkey: ${input.senderId}`,
|
|
1169
|
+
sendPairingReply: input.reply,
|
|
1165
1170
|
onCreated: () => {
|
|
1166
|
-
ctx.log?.debug?.(`[${account.accountId}] nostr pairing request sender=${senderId}`);
|
|
1171
|
+
ctx.log?.debug?.(`[${account.accountId}] nostr pairing request sender=${input.senderId}`);
|
|
1167
1172
|
},
|
|
1168
1173
|
onReplyError: (err) => {
|
|
1169
|
-
ctx.log?.warn?.(`[${account.accountId}] nostr pairing reply failed for ${senderId}: ${String(err)}`);
|
|
1174
|
+
ctx.log?.warn?.(`[${account.accountId}] nostr pairing reply failed for ${input.senderId}: ${String(err)}`);
|
|
1170
1175
|
}
|
|
1171
1176
|
});
|
|
1172
|
-
|
|
1173
|
-
onBlocked: ({ senderId, reason }) => {
|
|
1174
|
-
ctx.log?.debug?.(`[${account.accountId}] blocked Nostr sender ${senderId} (${reason})`);
|
|
1177
|
+
return "pairing";
|
|
1175
1178
|
}
|
|
1176
|
-
|
|
1179
|
+
ctx.log?.debug?.(`[${account.accountId}] blocked Nostr sender ${input.senderId} (${resolved.senderAccess.reasonCode})`);
|
|
1180
|
+
return "block";
|
|
1181
|
+
};
|
|
1177
1182
|
const bus = await startNostrBus({
|
|
1178
1183
|
accountId: account.accountId,
|
|
1179
1184
|
privateKey: account.privateKey,
|
|
@@ -1184,8 +1189,8 @@ const startNostrGatewayAccount = async (ctx) => {
|
|
|
1184
1189
|
}),
|
|
1185
1190
|
onMessage: async (senderPubkey, text, reply, meta) => {
|
|
1186
1191
|
const resolvedAccess = await resolveInboundAccess(senderPubkey, text);
|
|
1187
|
-
if (resolvedAccess.
|
|
1188
|
-
ctx.log?.warn?.(`[${account.accountId}] dropping Nostr DM after preflight drift (${senderPubkey}, ${resolvedAccess.
|
|
1192
|
+
if (resolvedAccess.senderAccess.decision !== "allow") {
|
|
1193
|
+
ctx.log?.warn?.(`[${account.accountId}] dropping Nostr DM after preflight drift (${senderPubkey}, ${resolvedAccess.senderAccess.reasonCode})`);
|
|
1189
1194
|
return;
|
|
1190
1195
|
}
|
|
1191
1196
|
const { dispatchInboundDirectDmWithRuntime } = await import("./inbound-direct-dm-runtime-22bZWcIW.js");
|
|
@@ -1206,7 +1211,7 @@ const startNostrGatewayAccount = async (ctx) => {
|
|
|
1206
1211
|
rawBody: text,
|
|
1207
1212
|
messageId: meta.eventId,
|
|
1208
1213
|
timestamp: meta.createdAt * 1e3,
|
|
1209
|
-
commandAuthorized: resolvedAccess.
|
|
1214
|
+
commandAuthorized: resolvedAccess.commandAccess.requested ? resolvedAccess.commandAccess.authorized : void 0,
|
|
1210
1215
|
deliver: async (payload) => {
|
|
1211
1216
|
const outboundText = payload && typeof payload === "object" && "text" in payload ? payload.text ?? "" : "";
|
|
1212
1217
|
if (!outboundText.trim()) return;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as nostrPlugin } from "./channel-
|
|
1
|
+
import { n as nostrPlugin } from "./channel-BSOktL3g.js";
|
|
2
2
|
export { nostrPlugin };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { collectStatusIssuesFromLastError, createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers";
|
|
2
2
|
import { DEFAULT_ACCOUNT_ID, buildChannelConfigSchema, formatPairingApproveHint } from "openclaw/plugin-sdk/channel-plugin-common";
|
|
3
|
-
import { createPreCryptoDirectDmAuthorizer, resolveInboundDirectDmAccessWithRuntime } from "openclaw/plugin-sdk/direct-dm-access";
|
|
4
3
|
import { AllowFromListSchema, DmPolicySchema, MarkdownConfigSchema } from "openclaw/plugin-sdk/channel-config-primitives";
|
|
5
4
|
import { buildSecretInputSchema } from "openclaw/plugin-sdk/secret-input";
|
|
6
5
|
import { z } from "openclaw/plugin-sdk/zod";
|
|
@@ -61,4 +60,4 @@ const NostrConfigSchema = z.object({
|
|
|
61
60
|
profile: NostrProfileSchema.optional()
|
|
62
61
|
});
|
|
63
62
|
//#endregion
|
|
64
|
-
export { collectStatusIssuesFromLastError as a,
|
|
63
|
+
export { collectStatusIssuesFromLastError as a, buildChannelConfigSchema as i, NostrProfileSchema as n, createDefaultChannelRuntimeState as o, DEFAULT_ACCOUNT_ID as r, formatPairingApproveHint as s, NostrConfigSchema as t };
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as buildChannelConfigSchema, t as NostrConfigSchema } from "./config-schema-
|
|
1
|
+
import { i as buildChannelConfigSchema, t as NostrConfigSchema } from "./config-schema-Clq-vlF1.js";
|
|
2
2
|
import { t as DEFAULT_RELAYS } from "./default-relays-DLwdWOTu.js";
|
|
3
3
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
4
4
|
import { patchTopLevelChannelConfigSection } from "openclaw/plugin-sdk/setup";
|
package/dist/test-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as nostrPlugin } from "./channel-
|
|
1
|
+
import { n as nostrPlugin } from "./channel-BSOktL3g.js";
|
|
2
2
|
export { nostrPlugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/nostr",
|
|
3
|
-
"version": "2026.5.
|
|
3
|
+
"version": "2026.5.10-beta.2",
|
|
4
4
|
"description": "OpenClaw Nostr channel plugin for NIP-04 encrypted DMs",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"openclaw": "workspace:*"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"openclaw": ">=2026.5.
|
|
18
|
+
"openclaw": ">=2026.5.10-beta.2"
|
|
19
19
|
},
|
|
20
20
|
"peerDependenciesMeta": {
|
|
21
21
|
"openclaw": {
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"minHostVersion": ">=2026.4.10"
|
|
54
54
|
},
|
|
55
55
|
"compat": {
|
|
56
|
-
"pluginApi": ">=2026.5.
|
|
56
|
+
"pluginApi": ">=2026.5.10-beta.2"
|
|
57
57
|
},
|
|
58
58
|
"build": {
|
|
59
|
-
"openclawVersion": "2026.5.
|
|
59
|
+
"openclawVersion": "2026.5.10-beta.2"
|
|
60
60
|
},
|
|
61
61
|
"release": {
|
|
62
62
|
"publishToClawHub": true,
|