nostr-wot-sdk 0.8.7 → 0.9.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/react/index.cjs +6 -3
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +19 -3
- package/dist/react/index.d.ts +19 -3
- package/dist/react/index.js +7 -4
- package/dist/react/index.js.map +1 -1
- package/package.json +3 -3
package/dist/react/index.cjs
CHANGED
|
@@ -10,6 +10,7 @@ function NostrSdkProvider({
|
|
|
10
10
|
relays,
|
|
11
11
|
profileAggregators,
|
|
12
12
|
cache,
|
|
13
|
+
session,
|
|
13
14
|
wot
|
|
14
15
|
}) {
|
|
15
16
|
const dataProps = {
|
|
@@ -17,12 +18,14 @@ function NostrSdkProvider({
|
|
|
17
18
|
...profileAggregators !== void 0 ? { profileAggregators } : {},
|
|
18
19
|
...cache !== void 0 ? { cache } : {}
|
|
19
20
|
};
|
|
20
|
-
|
|
21
|
+
let tree = /* @__PURE__ */ jsxRuntime.jsx(react.NostrDataProvider, { ...dataProps, children });
|
|
21
22
|
if (wot == null ? void 0 : wot.enabled) {
|
|
22
23
|
const { enabled: _enabled, ...wotProps } = wot;
|
|
23
|
-
|
|
24
|
+
tree = /* @__PURE__ */ jsxRuntime.jsx(react$1.WoTProvider, { ...wotProps, children: tree });
|
|
24
25
|
}
|
|
25
|
-
return
|
|
26
|
+
if (session && session.enabled === false) return tree;
|
|
27
|
+
const { enabled: _se, ...sessionProps } = session != null ? session : {};
|
|
28
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.NostrSessionProvider, { ...sessionProps, children: tree });
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
exports.NostrSdkProvider = NostrSdkProvider;
|
package/dist/react/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/react/nostr-sdk-provider.tsx"],"names":["jsx","NostrDataProvider","WoTProvider"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../src/react/nostr-sdk-provider.tsx"],"names":["jsx","NostrDataProvider","WoTProvider","NostrSessionProvider"],"mappings":";;;;;;;AAqDO,SAAS,gBAAA,CAAiB;AAAA,EAC/B,QAAA;AAAA,EACA,MAAA;AAAA,EACA,kBAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,CAAA,EAA0B;AACxB,EAAA,MAAM,SAAA,GAAY;AAAA,IAChB,GAAI,MAAA,KAAW,MAAA,GAAY,EAAE,MAAA,KAAW,EAAC;AAAA,IACzC,GAAI,kBAAA,KAAuB,MAAA,GAAY,EAAE,kBAAA,KAAuB,EAAC;AAAA,IACjE,GAAI,KAAA,KAAU,MAAA,GAAY,EAAE,KAAA,KAAU;AAAC,GACzC;AACA,EAAA,IAAI,IAAA,mBACFA,cAAA,CAACC,uBAAA,EAAA,EAAmB,GAAG,WAAY,QAAA,EAAS,CAAA;AAE9C,EAAA,IAAI,2BAAK,OAAA,EAAS;AAChB,IAAA,MAAM,EAAE,OAAA,EAAS,QAAA,EAAU,GAAG,UAAS,GAAI,GAAA;AAC3C,IAAA,IAAA,mBAAOD,cAAA,CAACE,mBAAA,EAAA,EAAa,GAAG,QAAA,EAAW,QAAA,EAAA,IAAA,EAAK,CAAA;AAAA,EAC1C;AAGA,EAAA,IAAI,OAAA,IAAW,OAAA,CAAQ,OAAA,KAAY,KAAA,EAAO,OAAO,IAAA;AACjD,EAAA,MAAM,EAAE,OAAA,EAAS,GAAA,EAAK,GAAG,YAAA,EAAa,GAAK,4BAAW,EAAC;AAGvD,EAAA,uBACEF,cAAA,CAACG,0BAAA,EAAA,EAAsB,GAAG,YAAA,EAAe,QAAA,EAAA,IAAA,EAAK,CAAA;AAElD","file":"index.cjs","sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport {\n NostrDataProvider,\n NostrSessionProvider,\n type NostrSessionProviderProps,\n} from '@nostr-wot/data/react';\nimport { WoTProvider, type WoTProviderProps } from '@nostr-wot/wot/react';\n\nexport interface NostrSdkProviderProps {\n children: ReactNode;\n /** Override the default relay set used by all data fetchers. */\n relays?: string[];\n /** Specialised aggregators for kind-0 lookups (e.g. purplepag.es). */\n profileAggregators?: string[];\n /** Cache configuration. The SWR layer persists profiles, follows,\n * and relay-lists to localStorage by default. */\n cache?: {\n namespace?: string;\n ttlMs?: number;\n };\n /** Session context — holds the active signer + pubkey. By default the\n * provider mounts an empty session so any child can call `useSigner()`\n * safely. Pass `initialSigner` / `onChange` / `onLogout` to wire your\n * app's auth, or `{ enabled: false }` to opt out (useful when an\n * outer `<NostrSessionProvider>` already wraps the tree). */\n session?:\n | ({ enabled?: true } & Omit<NostrSessionProviderProps, 'children'>)\n | { enabled: false };\n /** Web-of-Trust configuration. WoT is opt-in:\n * - Omit `wot` (or set `wot: { enabled: false }`) → no WoT context;\n * `useWoTContext()` returns null safely.\n * - Set `wot: { enabled: true, ... }` → wraps children with the\n * WoT context so `useWoT`, `useTrustScore`, `useIsInWoT`,\n * `useBatchWoT` work. */\n wot?: { enabled: boolean } & Omit<WoTProviderProps, 'children'>;\n}\n\n/**\n * Top-level provider for an app using the full Nostr WoT SDK. Composes:\n * - `<NostrSessionProvider>` — single mount point for the active signer\n * + pubkey; consumed by DM hooks, blossom, login UI, etc.\n * - `<NostrDataProvider>` — sets default relays, profile aggregators,\n * cache namespace.\n * - `<WoTProvider>` (optional, when `wot.enabled === true`).\n *\n * For data-only apps with no WoT scoring, depend on `@nostr-wot/data`\n * and use `<NostrDataProvider>` directly — no need to install\n * `@nostr-wot/wot`. For full login UI, install `@nostr-wot/ui` and use\n * its `<NostrSessionProvider>` (a thin shell on top of this one that\n * also handles silent re-attach + theming attributes).\n */\nexport function NostrSdkProvider({\n children,\n relays,\n profileAggregators,\n cache,\n session,\n wot,\n}: NostrSdkProviderProps) {\n const dataProps = {\n ...(relays !== undefined ? { relays } : {}),\n ...(profileAggregators !== undefined ? { profileAggregators } : {}),\n ...(cache !== undefined ? { cache } : {}),\n };\n let tree: ReactNode = (\n <NostrDataProvider {...dataProps}>{children}</NostrDataProvider>\n );\n if (wot?.enabled) {\n const { enabled: _enabled, ...wotProps } = wot;\n tree = <WoTProvider {...wotProps}>{tree}</WoTProvider>;\n }\n // Default: mount session provider with empty signer state. Opt out\n // via `session: { enabled: false }`.\n if (session && session.enabled === false) return tree;\n const { enabled: _se, ...sessionProps } = (session ?? {}) as {\n enabled?: true;\n } & Omit<NostrSessionProviderProps, 'children'>;\n return (\n <NostrSessionProvider {...sessionProps}>{tree}</NostrSessionProvider>\n );\n}\n"]}
|
package/dist/react/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { WoTProviderProps } from '@nostr-wot/wot/react';
|
|
2
2
|
export * from '@nostr-wot/wot/react';
|
|
3
|
+
import { NostrSessionProviderProps } from '@nostr-wot/data/react';
|
|
3
4
|
export * from '@nostr-wot/data/react';
|
|
4
5
|
import * as react$2 from 'react';
|
|
5
6
|
import { ReactNode } from 'react';
|
|
@@ -16,6 +17,16 @@ interface NostrSdkProviderProps {
|
|
|
16
17
|
namespace?: string;
|
|
17
18
|
ttlMs?: number;
|
|
18
19
|
};
|
|
20
|
+
/** Session context — holds the active signer + pubkey. By default the
|
|
21
|
+
* provider mounts an empty session so any child can call `useSigner()`
|
|
22
|
+
* safely. Pass `initialSigner` / `onChange` / `onLogout` to wire your
|
|
23
|
+
* app's auth, or `{ enabled: false }` to opt out (useful when an
|
|
24
|
+
* outer `<NostrSessionProvider>` already wraps the tree). */
|
|
25
|
+
session?: ({
|
|
26
|
+
enabled?: true;
|
|
27
|
+
} & Omit<NostrSessionProviderProps, 'children'>) | {
|
|
28
|
+
enabled: false;
|
|
29
|
+
};
|
|
19
30
|
/** Web-of-Trust configuration. WoT is opt-in:
|
|
20
31
|
* - Omit `wot` (or set `wot: { enabled: false }`) → no WoT context;
|
|
21
32
|
* `useWoTContext()` returns null safely.
|
|
@@ -28,13 +39,18 @@ interface NostrSdkProviderProps {
|
|
|
28
39
|
}
|
|
29
40
|
/**
|
|
30
41
|
* Top-level provider for an app using the full Nostr WoT SDK. Composes:
|
|
42
|
+
* - `<NostrSessionProvider>` — single mount point for the active signer
|
|
43
|
+
* + pubkey; consumed by DM hooks, blossom, login UI, etc.
|
|
31
44
|
* - `<NostrDataProvider>` — sets default relays, profile aggregators,
|
|
32
45
|
* cache namespace.
|
|
33
46
|
* - `<WoTProvider>` (optional, when `wot.enabled === true`).
|
|
34
47
|
*
|
|
35
|
-
* For data-only apps
|
|
36
|
-
* use `<NostrDataProvider>` directly — no need to install
|
|
48
|
+
* For data-only apps with no WoT scoring, depend on `@nostr-wot/data`
|
|
49
|
+
* and use `<NostrDataProvider>` directly — no need to install
|
|
50
|
+
* `@nostr-wot/wot`. For full login UI, install `@nostr-wot/ui` and use
|
|
51
|
+
* its `<NostrSessionProvider>` (a thin shell on top of this one that
|
|
52
|
+
* also handles silent re-attach + theming attributes).
|
|
37
53
|
*/
|
|
38
|
-
declare function NostrSdkProvider({ children, relays, profileAggregators, cache, wot, }: NostrSdkProviderProps): react$2.JSX.Element;
|
|
54
|
+
declare function NostrSdkProvider({ children, relays, profileAggregators, cache, session, wot, }: NostrSdkProviderProps): react$2.JSX.Element;
|
|
39
55
|
|
|
40
56
|
export { NostrSdkProvider, type NostrSdkProviderProps };
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { WoTProviderProps } from '@nostr-wot/wot/react';
|
|
2
2
|
export * from '@nostr-wot/wot/react';
|
|
3
|
+
import { NostrSessionProviderProps } from '@nostr-wot/data/react';
|
|
3
4
|
export * from '@nostr-wot/data/react';
|
|
4
5
|
import * as react$2 from 'react';
|
|
5
6
|
import { ReactNode } from 'react';
|
|
@@ -16,6 +17,16 @@ interface NostrSdkProviderProps {
|
|
|
16
17
|
namespace?: string;
|
|
17
18
|
ttlMs?: number;
|
|
18
19
|
};
|
|
20
|
+
/** Session context — holds the active signer + pubkey. By default the
|
|
21
|
+
* provider mounts an empty session so any child can call `useSigner()`
|
|
22
|
+
* safely. Pass `initialSigner` / `onChange` / `onLogout` to wire your
|
|
23
|
+
* app's auth, or `{ enabled: false }` to opt out (useful when an
|
|
24
|
+
* outer `<NostrSessionProvider>` already wraps the tree). */
|
|
25
|
+
session?: ({
|
|
26
|
+
enabled?: true;
|
|
27
|
+
} & Omit<NostrSessionProviderProps, 'children'>) | {
|
|
28
|
+
enabled: false;
|
|
29
|
+
};
|
|
19
30
|
/** Web-of-Trust configuration. WoT is opt-in:
|
|
20
31
|
* - Omit `wot` (or set `wot: { enabled: false }`) → no WoT context;
|
|
21
32
|
* `useWoTContext()` returns null safely.
|
|
@@ -28,13 +39,18 @@ interface NostrSdkProviderProps {
|
|
|
28
39
|
}
|
|
29
40
|
/**
|
|
30
41
|
* Top-level provider for an app using the full Nostr WoT SDK. Composes:
|
|
42
|
+
* - `<NostrSessionProvider>` — single mount point for the active signer
|
|
43
|
+
* + pubkey; consumed by DM hooks, blossom, login UI, etc.
|
|
31
44
|
* - `<NostrDataProvider>` — sets default relays, profile aggregators,
|
|
32
45
|
* cache namespace.
|
|
33
46
|
* - `<WoTProvider>` (optional, when `wot.enabled === true`).
|
|
34
47
|
*
|
|
35
|
-
* For data-only apps
|
|
36
|
-
* use `<NostrDataProvider>` directly — no need to install
|
|
48
|
+
* For data-only apps with no WoT scoring, depend on `@nostr-wot/data`
|
|
49
|
+
* and use `<NostrDataProvider>` directly — no need to install
|
|
50
|
+
* `@nostr-wot/wot`. For full login UI, install `@nostr-wot/ui` and use
|
|
51
|
+
* its `<NostrSessionProvider>` (a thin shell on top of this one that
|
|
52
|
+
* also handles silent re-attach + theming attributes).
|
|
37
53
|
*/
|
|
38
|
-
declare function NostrSdkProvider({ children, relays, profileAggregators, cache, wot, }: NostrSdkProviderProps): react$2.JSX.Element;
|
|
54
|
+
declare function NostrSdkProvider({ children, relays, profileAggregators, cache, session, wot, }: NostrSdkProviderProps): react$2.JSX.Element;
|
|
39
55
|
|
|
40
56
|
export { NostrSdkProvider, type NostrSdkProviderProps };
|
package/dist/react/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WoTProvider } from '@nostr-wot/wot/react';
|
|
2
2
|
export * from '@nostr-wot/wot/react';
|
|
3
|
-
import { NostrDataProvider } from '@nostr-wot/data/react';
|
|
3
|
+
import { NostrSessionProvider, NostrDataProvider } from '@nostr-wot/data/react';
|
|
4
4
|
export * from '@nostr-wot/data/react';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
@@ -10,6 +10,7 @@ function NostrSdkProvider({
|
|
|
10
10
|
relays,
|
|
11
11
|
profileAggregators,
|
|
12
12
|
cache,
|
|
13
|
+
session,
|
|
13
14
|
wot
|
|
14
15
|
}) {
|
|
15
16
|
const dataProps = {
|
|
@@ -17,12 +18,14 @@ function NostrSdkProvider({
|
|
|
17
18
|
...profileAggregators !== void 0 ? { profileAggregators } : {},
|
|
18
19
|
...cache !== void 0 ? { cache } : {}
|
|
19
20
|
};
|
|
20
|
-
|
|
21
|
+
let tree = /* @__PURE__ */ jsx(NostrDataProvider, { ...dataProps, children });
|
|
21
22
|
if (wot == null ? void 0 : wot.enabled) {
|
|
22
23
|
const { enabled: _enabled, ...wotProps } = wot;
|
|
23
|
-
|
|
24
|
+
tree = /* @__PURE__ */ jsx(WoTProvider, { ...wotProps, children: tree });
|
|
24
25
|
}
|
|
25
|
-
return
|
|
26
|
+
if (session && session.enabled === false) return tree;
|
|
27
|
+
const { enabled: _se, ...sessionProps } = session != null ? session : {};
|
|
28
|
+
return /* @__PURE__ */ jsx(NostrSessionProvider, { ...sessionProps, children: tree });
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
export { NostrSdkProvider };
|
package/dist/react/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/react/nostr-sdk-provider.tsx"],"names":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../src/react/nostr-sdk-provider.tsx"],"names":[],"mappings":";;;;;;;AAqDO,SAAS,gBAAA,CAAiB;AAAA,EAC/B,QAAA;AAAA,EACA,MAAA;AAAA,EACA,kBAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,CAAA,EAA0B;AACxB,EAAA,MAAM,SAAA,GAAY;AAAA,IAChB,GAAI,MAAA,KAAW,MAAA,GAAY,EAAE,MAAA,KAAW,EAAC;AAAA,IACzC,GAAI,kBAAA,KAAuB,MAAA,GAAY,EAAE,kBAAA,KAAuB,EAAC;AAAA,IACjE,GAAI,KAAA,KAAU,MAAA,GAAY,EAAE,KAAA,KAAU;AAAC,GACzC;AACA,EAAA,IAAI,IAAA,mBACF,GAAA,CAAC,iBAAA,EAAA,EAAmB,GAAG,WAAY,QAAA,EAAS,CAAA;AAE9C,EAAA,IAAI,2BAAK,OAAA,EAAS;AAChB,IAAA,MAAM,EAAE,OAAA,EAAS,QAAA,EAAU,GAAG,UAAS,GAAI,GAAA;AAC3C,IAAA,IAAA,mBAAO,GAAA,CAAC,WAAA,EAAA,EAAa,GAAG,QAAA,EAAW,QAAA,EAAA,IAAA,EAAK,CAAA;AAAA,EAC1C;AAGA,EAAA,IAAI,OAAA,IAAW,OAAA,CAAQ,OAAA,KAAY,KAAA,EAAO,OAAO,IAAA;AACjD,EAAA,MAAM,EAAE,OAAA,EAAS,GAAA,EAAK,GAAG,YAAA,EAAa,GAAK,4BAAW,EAAC;AAGvD,EAAA,uBACE,GAAA,CAAC,oBAAA,EAAA,EAAsB,GAAG,YAAA,EAAe,QAAA,EAAA,IAAA,EAAK,CAAA;AAElD","file":"index.js","sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport {\n NostrDataProvider,\n NostrSessionProvider,\n type NostrSessionProviderProps,\n} from '@nostr-wot/data/react';\nimport { WoTProvider, type WoTProviderProps } from '@nostr-wot/wot/react';\n\nexport interface NostrSdkProviderProps {\n children: ReactNode;\n /** Override the default relay set used by all data fetchers. */\n relays?: string[];\n /** Specialised aggregators for kind-0 lookups (e.g. purplepag.es). */\n profileAggregators?: string[];\n /** Cache configuration. The SWR layer persists profiles, follows,\n * and relay-lists to localStorage by default. */\n cache?: {\n namespace?: string;\n ttlMs?: number;\n };\n /** Session context — holds the active signer + pubkey. By default the\n * provider mounts an empty session so any child can call `useSigner()`\n * safely. Pass `initialSigner` / `onChange` / `onLogout` to wire your\n * app's auth, or `{ enabled: false }` to opt out (useful when an\n * outer `<NostrSessionProvider>` already wraps the tree). */\n session?:\n | ({ enabled?: true } & Omit<NostrSessionProviderProps, 'children'>)\n | { enabled: false };\n /** Web-of-Trust configuration. WoT is opt-in:\n * - Omit `wot` (or set `wot: { enabled: false }`) → no WoT context;\n * `useWoTContext()` returns null safely.\n * - Set `wot: { enabled: true, ... }` → wraps children with the\n * WoT context so `useWoT`, `useTrustScore`, `useIsInWoT`,\n * `useBatchWoT` work. */\n wot?: { enabled: boolean } & Omit<WoTProviderProps, 'children'>;\n}\n\n/**\n * Top-level provider for an app using the full Nostr WoT SDK. Composes:\n * - `<NostrSessionProvider>` — single mount point for the active signer\n * + pubkey; consumed by DM hooks, blossom, login UI, etc.\n * - `<NostrDataProvider>` — sets default relays, profile aggregators,\n * cache namespace.\n * - `<WoTProvider>` (optional, when `wot.enabled === true`).\n *\n * For data-only apps with no WoT scoring, depend on `@nostr-wot/data`\n * and use `<NostrDataProvider>` directly — no need to install\n * `@nostr-wot/wot`. For full login UI, install `@nostr-wot/ui` and use\n * its `<NostrSessionProvider>` (a thin shell on top of this one that\n * also handles silent re-attach + theming attributes).\n */\nexport function NostrSdkProvider({\n children,\n relays,\n profileAggregators,\n cache,\n session,\n wot,\n}: NostrSdkProviderProps) {\n const dataProps = {\n ...(relays !== undefined ? { relays } : {}),\n ...(profileAggregators !== undefined ? { profileAggregators } : {}),\n ...(cache !== undefined ? { cache } : {}),\n };\n let tree: ReactNode = (\n <NostrDataProvider {...dataProps}>{children}</NostrDataProvider>\n );\n if (wot?.enabled) {\n const { enabled: _enabled, ...wotProps } = wot;\n tree = <WoTProvider {...wotProps}>{tree}</WoTProvider>;\n }\n // Default: mount session provider with empty signer state. Opt out\n // via `session: { enabled: false }`.\n if (session && session.enabled === false) return tree;\n const { enabled: _se, ...sessionProps } = (session ?? {}) as {\n enabled?: true;\n } & Omit<NostrSessionProviderProps, 'children'>;\n return (\n <NostrSessionProvider {...sessionProps}>{tree}</NostrSessionProvider>\n );\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nostr-wot-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Meta-package re-exporting @nostr-wot/{wot,relay,data}. Existing imports keep working; new code should depend on the scoped packages directly.",
|
|
5
5
|
"author": "Leon Acosta <leon@nostr-wot.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -114,9 +114,9 @@
|
|
|
114
114
|
"prepublishOnly": "npm run build"
|
|
115
115
|
},
|
|
116
116
|
"dependencies": {
|
|
117
|
-
"@nostr-wot/data": "^0.
|
|
117
|
+
"@nostr-wot/data": "^0.4.0",
|
|
118
118
|
"@nostr-wot/relay": "^0.1.1",
|
|
119
|
-
"@nostr-wot/wot": "^0.1.
|
|
119
|
+
"@nostr-wot/wot": "^0.1.5"
|
|
120
120
|
},
|
|
121
121
|
"peerDependencies": {
|
|
122
122
|
"react": ">=16.8.0",
|