openclaw-nostr 2026.7.30

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.
Files changed (72) hide show
  1. package/CHANGELOG.md +183 -0
  2. package/README.md +845 -0
  3. package/api.ts +6 -0
  4. package/index.ts +69 -0
  5. package/node_modules/cascadia-ts/cascadia.ts +1187 -0
  6. package/node_modules/cascadia-ts/dist/cascadia.d.ts +607 -0
  7. package/node_modules/cascadia-ts/dist/cascadia.js +705 -0
  8. package/node_modules/cascadia-ts/package.json +21 -0
  9. package/openclaw.plugin.json +153 -0
  10. package/package.json +81 -0
  11. package/runtime-api.ts +12 -0
  12. package/setup-api.ts +1 -0
  13. package/setup-entry.ts +4 -0
  14. package/src/channel-actions.test.ts +304 -0
  15. package/src/channel-actions.ts +199 -0
  16. package/src/channel.dm-access.test.ts +387 -0
  17. package/src/channel.inbound.test.ts +476 -0
  18. package/src/channel.lifecycle.test.ts +768 -0
  19. package/src/channel.outbound.test.ts +1143 -0
  20. package/src/channel.test.ts +175 -0
  21. package/src/channel.ts +2827 -0
  22. package/src/config-schema.test.ts +486 -0
  23. package/src/config-schema.ts +356 -0
  24. package/src/default-relays.ts +1 -0
  25. package/src/fleet-agent.test.ts +423 -0
  26. package/src/fleet-agent.ts +549 -0
  27. package/src/metrics.ts +466 -0
  28. package/src/nip46-cutover.test.ts +324 -0
  29. package/src/nip46-cutover.ts +461 -0
  30. package/src/nip46-doctor.test.ts +191 -0
  31. package/src/nip46-doctor.ts +329 -0
  32. package/src/nip46-enroll.test.ts +346 -0
  33. package/src/nip46-enroll.ts +567 -0
  34. package/src/nip46-signer.test.ts +809 -0
  35. package/src/nip46-signer.ts +1263 -0
  36. package/src/nip46-status.test.ts +186 -0
  37. package/src/nip46-status.ts +250 -0
  38. package/src/nip51-lists.test.ts +404 -0
  39. package/src/nip51-lists.ts +777 -0
  40. package/src/nostr-access.test.ts +175 -0
  41. package/src/nostr-access.ts +134 -0
  42. package/src/nostr-bus-nip29.ts +998 -0
  43. package/src/nostr-bus-relay.ts +477 -0
  44. package/src/nostr-bus-types.ts +392 -0
  45. package/src/nostr-bus.fuzz.test.ts +533 -0
  46. package/src/nostr-bus.integration.test.ts +505 -0
  47. package/src/nostr-bus.protocol.test.ts +2057 -0
  48. package/src/nostr-bus.test.ts +235 -0
  49. package/src/nostr-bus.ts +1868 -0
  50. package/src/nostr-capabilities-extended.test.ts +612 -0
  51. package/src/nostr-capabilities.ts +719 -0
  52. package/src/nostr-discovery.test.ts +568 -0
  53. package/src/nostr-discovery.ts +336 -0
  54. package/src/nostr-extras.test.ts +88 -0
  55. package/src/nostr-extras.ts +136 -0
  56. package/src/nostr-profile-http.test.ts +662 -0
  57. package/src/nostr-profile-http.ts +836 -0
  58. package/src/nostr-profile-import.test.ts +274 -0
  59. package/src/nostr-profile-import.ts +295 -0
  60. package/src/nostr-profile.fuzz.test.ts +480 -0
  61. package/src/nostr-profile.test.ts +410 -0
  62. package/src/nostr-profile.ts +320 -0
  63. package/src/nostr-pubkey.ts +56 -0
  64. package/src/nostr-state-store.test.ts +790 -0
  65. package/src/nostr-state-store.ts +1284 -0
  66. package/src/runtime.ts +9 -0
  67. package/src/seen-tracker.test.ts +25 -0
  68. package/src/seen-tracker.ts +292 -0
  69. package/src/session-route.ts +25 -0
  70. package/src/setup-surface.ts +320 -0
  71. package/src/types.test.ts +783 -0
  72. package/src/types.ts +508 -0
package/api.ts ADDED
@@ -0,0 +1,6 @@
1
+ export * from "./runtime-api.js";
2
+ export * from "./src/fleet-agent.js";
3
+ export * from "./src/nip51-lists.js";
4
+ export { getNostrFleetDirectory } from "./src/channel.js";
5
+ export * from "./src/nip46-enroll.js";
6
+ export * from "./src/nip46-cutover.js";
package/index.ts ADDED
@@ -0,0 +1,69 @@
1
+ import { defineBundledChannelEntry } from "openclaw/plugin-sdk/channel-entry-contract";
2
+ import { nostrChannelConfigSchema, type NostrProfile } from "./src/config-schema.js";
3
+ import { createNostrProfileHttpHandler } from "./src/nostr-profile-http.js";
4
+ import { getNostrRuntime } from "./src/runtime.js";
5
+ import { resolveNostrAccount } from "./src/types.js";
6
+
7
+ export default defineBundledChannelEntry({
8
+ id: "nostr",
9
+ name: "Nostr",
10
+ description: "Nostr DM channel plugin via NIP-04 + NIP-17",
11
+ importMetaUrl: import.meta.url,
12
+ plugin: {
13
+ specifier: "./src/channel.js",
14
+ exportName: "nostrPlugin",
15
+ },
16
+ configSchema: nostrChannelConfigSchema,
17
+ runtime: {
18
+ specifier: "./src/runtime.js",
19
+ exportName: "setNostrRuntime",
20
+ },
21
+ registerFull(api) {
22
+ const httpHandler = createNostrProfileHttpHandler({
23
+ getConfigProfile: (accountId: string) => {
24
+ const runtime = getNostrRuntime();
25
+ const cfg = runtime.config.loadConfig();
26
+ const account = resolveNostrAccount({ cfg, accountId });
27
+ return account.profile;
28
+ },
29
+ updateConfigProfile: async (accountId: string, profile: NostrProfile) => {
30
+ const runtime = getNostrRuntime();
31
+ const cfg = runtime.config.loadConfig();
32
+
33
+ const channels = (cfg.channels ?? {}) as Record<string, unknown>;
34
+ const nostrConfig = (channels.nostr ?? {}) as Record<string, unknown>;
35
+
36
+ await runtime.config.writeConfigFile({
37
+ ...cfg,
38
+ channels: {
39
+ ...channels,
40
+ nostr: {
41
+ ...nostrConfig,
42
+ profile,
43
+ },
44
+ },
45
+ });
46
+ },
47
+ getAccountInfo: (accountId: string) => {
48
+ const runtime = getNostrRuntime();
49
+ const cfg = runtime.config.loadConfig();
50
+ const account = resolveNostrAccount({ cfg, accountId });
51
+ if (!account.configured || !account.publicKey) {
52
+ return null;
53
+ }
54
+ return {
55
+ pubkey: account.publicKey,
56
+ relays: account.relays,
57
+ };
58
+ },
59
+ log: api.logger,
60
+ });
61
+
62
+ api.registerHttpRoute({
63
+ path: "/api/channels/nostr",
64
+ auth: "gateway",
65
+ match: "prefix",
66
+ handler: httpHandler,
67
+ });
68
+ },
69
+ });