@nostrify/nostrify 0.46.8 → 0.46.9
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/.turbo/turbo-build.log +124 -28
- package/.turbo/turbo-test.log +91 -123
- package/CHANGELOG.md +8 -0
- package/NIP05.ts +6 -6
- package/NSchema.ts +71 -30
- package/dist/NSchema.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/tsconfig.json +1 -2
- package/dist/BunkerURI.js +0 -48
- package/dist/NBrowserSigner.js +0 -82
- package/dist/NCache.js +0 -39
- package/dist/NConnectSigner.js +0 -132
- package/dist/NIP05.js +0 -35
- package/dist/NIP50.js +0 -21
- package/dist/NIP98.js +0 -74
- package/dist/NKinds.js +0 -25
- package/dist/NPool.js +0 -154
- package/dist/NRelay1.js +0 -318
- package/dist/NSchema.js +0 -187
- package/dist/NSecSigner.js +0 -38
- package/dist/NSet.js +0 -143
- package/dist/RelayError.js +0 -20
- package/dist/ln/LNURL.js +0 -101
- package/dist/ln/mod.js +0 -4
- package/dist/ln/mod.js.map +0 -7
- package/dist/ln/types/LNURLCallback.js +0 -0
- package/dist/ln/types/LNURLDetails.js +0 -0
- package/dist/mod.js +0 -30
- package/dist/mod.js.map +0 -7
- package/dist/test/ErrorRelay.js +0 -23
- package/dist/test/MockRelay.js +0 -61
- package/dist/test/TestRelayServer.js +0 -149
- package/dist/test/mod.js +0 -24
- package/dist/test/mod.js.map +0 -7
- package/dist/uploaders/BlossomUploader.js +0 -70
- package/dist/uploaders/NostrBuildUploader.js +0 -65
- package/dist/uploaders/mod.js +0 -6
- package/dist/uploaders/mod.js.map +0 -7
- package/dist/utils/CircularSet.js +0 -29
- package/dist/utils/Machina.js +0 -38
- package/dist/utils/N64.js +0 -17
- package/dist/utils/mod.js +0 -6
- package/dist/utils/mod.js.map +0 -7
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,28 +1,124 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @nostrify/nostrify@0.46.8 build /home/sid/repos/nostrify/packages/nostrify
|
|
4
|
+
> tsc -p tsconfig.json && node ../../esbuild.config.js --package ./
|
|
5
|
+
|
|
6
|
+
[96mNIP05.ts[0m:[93m18[0m:[93m5[0m - [91merror[0m[90m TS2322: [0mType 'ZodObject<{ pubkey: ZodString; relays: ZodOptional<ZodArray<ZodType<`ws://${string}` | `wss://${string}`, ZodTypeDef, `ws://${string}` | `wss://${string}`>, "many">>; }, "strip", ZodTypeAny, { ...; }, { ...; }>' is not assignable to type 'ZodType<NProfilePointer, ZodTypeDef, NProfilePointer>'.
|
|
7
|
+
Types of property '_type' are incompatible.
|
|
8
|
+
Type '{ pubkey?: string; relays?: (`ws://${string}` | `wss://${string}`)[]; }' is not assignable to type 'NProfilePointer'.
|
|
9
|
+
Property 'pubkey' is optional in type '{ pubkey?: string; relays?: (`ws://${string}` | `wss://${string}`)[]; }' but required in type 'NProfilePointer'.
|
|
10
|
+
|
|
11
|
+
[7m18[0m return z.object({
|
|
12
|
+
[7m [0m [91m ~~~~~~[0m
|
|
13
|
+
|
|
14
|
+
[96mNSchema.ts[0m:[93m45[0m:[93m5[0m - [91merror[0m[90m TS2322: [0mType 'ZodObject<{ id: ZodString; kind: ZodNumber; pubkey: ZodString; tags: ZodArray<ZodArray<ZodString, "many">, "many">; content: ZodString; created_at: ZodNumber; sig: ZodString; }, "strip", ZodTypeAny, { ...; }, { ...; }>' is not assignable to type 'ZodType<NostrEvent, ZodTypeDef, NostrEvent>'.
|
|
15
|
+
Types of property '_type' are incompatible.
|
|
16
|
+
Type '{ pubkey?: string; tags?: string[][]; id?: string; sig?: string; created_at?: number; kind?: number; content?: string; }' is not assignable to type 'NostrEvent'.
|
|
17
|
+
Property 'id' is optional in type '{ pubkey?: string; tags?: string[][]; id?: string; sig?: string; created_at?: number; kind?: number; content?: string; }' but required in type 'NostrEvent'.
|
|
18
|
+
|
|
19
|
+
[7m45[0m return z.object({
|
|
20
|
+
[7m [0m [91m ~~~~~~[0m
|
|
21
|
+
|
|
22
|
+
[96mNSchema.ts[0m:[93m108[0m:[93m5[0m - [91merror[0m[90m TS2322: [0mType 'ZodTuple<[ZodLiteral<"EVENT">, ZodType<NostrEvent, ZodTypeDef, NostrEvent>], null>' is not assignable to type 'ZodType<NostrClientEVENT, ZodTypeDef, NostrClientEVENT>'.
|
|
23
|
+
Types of property '_type' are incompatible.
|
|
24
|
+
Type '["EVENT", NostrEvent, ...unknown[]]' is not assignable to type 'NostrClientEVENT'.
|
|
25
|
+
Target allows only 2 element(s) but source may have more.
|
|
26
|
+
|
|
27
|
+
[7m108[0m return z.tuple([z.literal('EVENT'), NSchema.event()]);
|
|
28
|
+
[7m [0m [91m ~~~~~~[0m
|
|
29
|
+
|
|
30
|
+
[96mNSchema.ts[0m:[93m123[0m:[93m5[0m - [91merror[0m[90m TS2322: [0mType 'ZodTuple<[ZodLiteral<"CLOSE">, ZodString], null>' is not assignable to type 'ZodType<NostrClientCLOSE, ZodTypeDef, NostrClientCLOSE>'.
|
|
31
|
+
Types of property '_type' are incompatible.
|
|
32
|
+
Type '["CLOSE", string, ...unknown[]]' is not assignable to type 'NostrClientCLOSE'.
|
|
33
|
+
Target allows only 2 element(s) but source may have more.
|
|
34
|
+
|
|
35
|
+
[7m123[0m return z.tuple([z.literal('CLOSE'), z.string()]);
|
|
36
|
+
[7m [0m [91m ~~~~~~[0m
|
|
37
|
+
|
|
38
|
+
[96mNSchema.ts[0m:[93m128[0m:[93m5[0m - [91merror[0m[90m TS2322: [0mType 'ZodTuple<[ZodLiteral<"AUTH">, ZodType<NostrEvent, ZodTypeDef, NostrEvent>], null>' is not assignable to type 'ZodType<NostrClientAUTH, ZodTypeDef, NostrClientAUTH>'.
|
|
39
|
+
Types of property '_type' are incompatible.
|
|
40
|
+
Type '["AUTH", NostrEvent, ...unknown[]]' is not assignable to type 'NostrClientAUTH'.
|
|
41
|
+
Target allows only 2 element(s) but source may have more.
|
|
42
|
+
|
|
43
|
+
[7m128[0m return z.tuple([z.literal('AUTH'), NSchema.event()]);
|
|
44
|
+
[7m [0m [91m ~~~~~~[0m
|
|
45
|
+
|
|
46
|
+
[96mNSchema.ts[0m:[93m144[0m:[93m5[0m - [91merror[0m[90m TS2322: [0mType 'ZodTuple<[ZodLiteral<"EVENT">, ZodString, ZodType<NostrEvent, ZodTypeDef, NostrEvent>], null>' is not assignable to type 'ZodType<NostrRelayEVENT, ZodTypeDef, NostrRelayEVENT>'.
|
|
47
|
+
Types of property '_type' are incompatible.
|
|
48
|
+
Type '["EVENT", string, NostrEvent, ...unknown[]]' is not assignable to type 'NostrRelayEVENT'.
|
|
49
|
+
Target allows only 3 element(s) but source may have more.
|
|
50
|
+
|
|
51
|
+
[7m144[0m return z.tuple([z.literal('EVENT'), z.string(), NSchema.event()]);
|
|
52
|
+
[7m [0m [91m ~~~~~~[0m
|
|
53
|
+
|
|
54
|
+
[96mNSchema.ts[0m:[93m149[0m:[93m5[0m - [91merror[0m[90m TS2322: [0mType 'ZodTuple<[ZodLiteral<"OK">, ZodString, ZodBoolean, ZodString], null>' is not assignable to type 'ZodType<NostrRelayOK, ZodTypeDef, NostrRelayOK>'.
|
|
55
|
+
Types of property '_type' are incompatible.
|
|
56
|
+
Type '["OK", string, boolean, string, ...unknown[]]' is not assignable to type 'NostrRelayOK'.
|
|
57
|
+
Target allows only 4 element(s) but source may have more.
|
|
58
|
+
|
|
59
|
+
[7m149[0m return z.tuple([z.literal('OK'), NSchema.id(), z.boolean(), z.string()]);
|
|
60
|
+
[7m [0m [91m ~~~~~~[0m
|
|
61
|
+
|
|
62
|
+
[96mNSchema.ts[0m:[93m154[0m:[93m5[0m - [91merror[0m[90m TS2322: [0mType 'ZodTuple<[ZodLiteral<"EOSE">, ZodString], null>' is not assignable to type 'ZodType<NostrRelayEOSE, ZodTypeDef, NostrRelayEOSE>'.
|
|
63
|
+
Types of property '_type' are incompatible.
|
|
64
|
+
Type '["EOSE", string, ...unknown[]]' is not assignable to type 'NostrRelayEOSE'.
|
|
65
|
+
Target allows only 2 element(s) but source may have more.
|
|
66
|
+
|
|
67
|
+
[7m154[0m return z.tuple([z.literal('EOSE'), z.string()]);
|
|
68
|
+
[7m [0m [91m ~~~~~~[0m
|
|
69
|
+
|
|
70
|
+
[96mNSchema.ts[0m:[93m159[0m:[93m5[0m - [91merror[0m[90m TS2322: [0mType 'ZodTuple<[ZodLiteral<"NOTICE">, ZodString], null>' is not assignable to type 'ZodType<NostrRelayNOTICE, ZodTypeDef, NostrRelayNOTICE>'.
|
|
71
|
+
Types of property '_type' are incompatible.
|
|
72
|
+
Type '["NOTICE", string, ...unknown[]]' is not assignable to type 'NostrRelayNOTICE'.
|
|
73
|
+
Target allows only 2 element(s) but source may have more.
|
|
74
|
+
|
|
75
|
+
[7m159[0m return z.tuple([z.literal('NOTICE'), z.string()]);
|
|
76
|
+
[7m [0m [91m ~~~~~~[0m
|
|
77
|
+
|
|
78
|
+
[96mNSchema.ts[0m:[93m164[0m:[93m5[0m - [91merror[0m[90m TS2322: [0mType 'ZodTuple<[ZodLiteral<"CLOSED">, ZodString, ZodString], null>' is not assignable to type 'ZodType<NostrRelayCLOSED, ZodTypeDef, NostrRelayCLOSED>'.
|
|
79
|
+
Types of property '_type' are incompatible.
|
|
80
|
+
Type '["CLOSED", string, string, ...unknown[]]' is not assignable to type 'NostrRelayCLOSED'.
|
|
81
|
+
Target allows only 3 element(s) but source may have more.
|
|
82
|
+
|
|
83
|
+
[7m164[0m return z.tuple([z.literal('CLOSED'), z.string(), z.string()]);
|
|
84
|
+
[7m [0m [91m ~~~~~~[0m
|
|
85
|
+
|
|
86
|
+
[96mNSchema.ts[0m:[93m169[0m:[93m5[0m - [91merror[0m[90m TS2322: [0mType 'ZodTuple<[ZodLiteral<"AUTH">, ZodString], null>' is not assignable to type 'ZodType<NostrRelayAUTH, ZodTypeDef, NostrRelayAUTH>'.
|
|
87
|
+
Types of property '_type' are incompatible.
|
|
88
|
+
Type '["AUTH", string, ...unknown[]]' is not assignable to type 'NostrRelayAUTH'.
|
|
89
|
+
Target allows only 2 element(s) but source may have more.
|
|
90
|
+
|
|
91
|
+
[7m169[0m return z.tuple([z.literal('AUTH'), z.string()]);
|
|
92
|
+
[7m [0m [91m ~~~~~~[0m
|
|
93
|
+
|
|
94
|
+
[96mNSchema.ts[0m:[93m174[0m:[93m5[0m - [91merror[0m[90m TS2322: [0mType 'ZodTuple<[ZodLiteral<"COUNT">, ZodString, ZodObject<{ count: ZodNumber; approximate: ZodOptional<ZodBoolean>; }, "strip", ZodTypeAny, { ...; }, { ...; }>], null>' is not assignable to type 'ZodType<NostrRelayCOUNT, ZodTypeDef, NostrRelayCOUNT>'.
|
|
95
|
+
Types of property '_type' are incompatible.
|
|
96
|
+
Type '["COUNT", string, { count?: number; approximate?: boolean; }, ...unknown[]]' is not assignable to type 'NostrRelayCOUNT'.
|
|
97
|
+
Target allows only 3 element(s) but source may have more.
|
|
98
|
+
|
|
99
|
+
[7m174[0m return z.tuple([
|
|
100
|
+
[7m [0m [91m ~~~~~~[0m
|
|
101
|
+
|
|
102
|
+
[96mNSchema.ts[0m:[93m215[0m:[93m5[0m - [91merror[0m[90m TS2322: [0mType 'ZodObject<{ id: ZodString; method: ZodString; params: ZodArray<ZodString, "many">; }, "strip", ZodTypeAny, { id?: string; params?: string[]; method?: string; }, { ...; }>' is not assignable to type 'ZodType<NostrConnectRequest, ZodTypeDef, NostrConnectRequest>'.
|
|
103
|
+
Types of property '_type' are incompatible.
|
|
104
|
+
Type '{ id?: string; params?: string[]; method?: string; }' is not assignable to type 'NostrConnectRequest'.
|
|
105
|
+
Property 'id' is optional in type '{ id?: string; params?: string[]; method?: string; }' but required in type 'NostrConnectRequest'.
|
|
106
|
+
|
|
107
|
+
[7m215[0m return z.object({
|
|
108
|
+
[7m [0m [91m ~~~~~~[0m
|
|
109
|
+
|
|
110
|
+
[96mNSchema.ts[0m:[93m224[0m:[93m5[0m - [91merror[0m[90m TS2322: [0mType 'ZodObject<{ id: ZodString; result: ZodString; error: ZodOptional<ZodString>; }, "strip", ZodTypeAny, { id?: string; result?: string; error?: string; }, { ...; }>' is not assignable to type 'ZodType<NostrConnectResponse, ZodTypeDef, NostrConnectResponse>'.
|
|
111
|
+
Types of property '_type' are incompatible.
|
|
112
|
+
Type '{ id?: string; result?: string; error?: string; }' is not assignable to type 'NostrConnectResponse'.
|
|
113
|
+
Property 'id' is optional in type '{ id?: string; result?: string; error?: string; }' but required in type 'NostrConnectResponse'.
|
|
114
|
+
|
|
115
|
+
[7m224[0m return z.object({
|
|
116
|
+
[7m [0m [91m ~~~~~~[0m
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
Found 14 errors in 2 files.
|
|
120
|
+
|
|
121
|
+
Errors Files
|
|
122
|
+
1 NIP05.ts[90m:18[0m
|
|
123
|
+
13 NSchema.ts[90m:45[0m
|
|
124
|
+
[41m[30m ELIFECYCLE [39m[49m [31mCommand failed with exit code 2.[39m
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,123 +1,91 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
✔ BunkerURI
|
|
7
|
-
✔
|
|
8
|
-
✔ NBrowserSigner -
|
|
9
|
-
✔ NBrowserSigner
|
|
10
|
-
✔ NBrowserSigner.
|
|
11
|
-
✔ NBrowserSigner.
|
|
12
|
-
✔ NBrowserSigner -
|
|
13
|
-
✔ NBrowserSigner - missing
|
|
14
|
-
✔ NBrowserSigner -
|
|
15
|
-
✔
|
|
16
|
-
✔
|
|
17
|
-
✔ NConnectSigner.signEvent with
|
|
18
|
-
✔
|
|
19
|
-
✔ NIP05.lookup
|
|
20
|
-
✔ NIP05.lookup with invalid
|
|
21
|
-
✔
|
|
22
|
-
✔ NIP50.parseInput
|
|
23
|
-
✔
|
|
24
|
-
✔ NIP98.template
|
|
25
|
-
✔ NIP98.
|
|
26
|
-
✔ NIP98.verify
|
|
27
|
-
✔ NIP98.verify fails with missing
|
|
28
|
-
✔ NIP98.verify fails with
|
|
29
|
-
✔ NIP98.verify fails with invalid
|
|
30
|
-
✔ NIP98.verify fails with
|
|
31
|
-
✔ NIP98.verify fails with wrong
|
|
32
|
-
✔ NIP98.verify fails with wrong request
|
|
33
|
-
✔ NIP98.verify fails with
|
|
34
|
-
✔ NIP98.verify fails with
|
|
35
|
-
✔
|
|
36
|
-
✔
|
|
37
|
-
✔ NPool.
|
|
38
|
-
✔ NPool.
|
|
39
|
-
✔
|
|
40
|
-
✔ NRelay1.query
|
|
41
|
-
✔ NRelay1.
|
|
42
|
-
✔ NRelay1.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
✔ websocket
|
|
47
|
-
✔ websocket
|
|
48
|
-
✔
|
|
49
|
-
✔ NRelay1
|
|
50
|
-
✔ NRelay1
|
|
51
|
-
✔
|
|
52
|
-
✔ n.
|
|
53
|
-
✔ n.
|
|
54
|
-
✔ n.
|
|
55
|
-
✔ n.
|
|
56
|
-
✔
|
|
57
|
-
✔ NSecSigner
|
|
58
|
-
✔
|
|
59
|
-
✔ NSet
|
|
60
|
-
✔ NSet.add (
|
|
61
|
-
✔ NSet.add (
|
|
62
|
-
✔
|
|
63
|
-
✔
|
|
64
|
-
✔
|
|
65
|
-
✔ LNURL.
|
|
66
|
-
✔ LNURL.
|
|
67
|
-
✔ LNURL.
|
|
68
|
-
✔ LNURL.
|
|
69
|
-
✔
|
|
70
|
-
✔
|
|
71
|
-
✔
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
✔
|
|
79
|
-
✔ push
|
|
80
|
-
✔
|
|
81
|
-
✔
|
|
82
|
-
✔
|
|
83
|
-
✔
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
ℹ
|
|
89
|
-
ℹ
|
|
90
|
-
ℹ
|
|
91
|
-
ℹ
|
|
92
|
-
ℹ cancelled 0
|
|
93
|
-
ℹ skipped 1
|
|
94
|
-
ℹ todo 0
|
|
95
|
-
ℹ duration_ms 3317.855572
|
|
96
|
-
|
|
97
|
-
✖ failing tests:
|
|
98
|
-
|
|
99
|
-
test at uploaders/NostrBuildUploader.test.ts:10:7
|
|
100
|
-
✖ NostrBuildUploader.upload (1590.593336ms)
|
|
101
|
-
Error [ZodError]: [
|
|
102
|
-
{
|
|
103
|
-
"code": "invalid_type",
|
|
104
|
-
"expected": "array",
|
|
105
|
-
"received": "object",
|
|
106
|
-
"path": [
|
|
107
|
-
"data"
|
|
108
|
-
],
|
|
109
|
-
"message": "Expected array, received object"
|
|
110
|
-
}
|
|
111
|
-
]
|
|
112
|
-
at get error (file:///home/sid/repos/nostrify/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js:39:31)
|
|
113
|
-
at ZodObject.parse (file:///home/sid/repos/nostrify/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js:114:22)
|
|
114
|
-
at NostrBuildUploader.upload (file:///home/sid/repos/nostrify/packages/nostrify/uploaders/NostrBuildUploader.ts:51:48)
|
|
115
|
-
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
|
|
116
|
-
at async TestContext.<anonymous> (file:///home/sid/repos/nostrify/packages/nostrify/uploaders/NostrBuildUploader.test.ts:22:18)
|
|
117
|
-
at async Test.run (node:internal/test_runner/test:1088:7)
|
|
118
|
-
at async startSubtestAfterBootstrap (node:internal/test_runner/harness:332:3)
|
|
119
|
-
at async file:///home/sid/repos/nostrify/packages/nostrify/uploaders/NostrBuildUploader.test.ts:10:1 {
|
|
120
|
-
issues: [ { code: 'invalid_type', expected: 'array', received: 'object', path: [Array], message: 'Expected array, received object' } ],
|
|
121
|
-
[errors]: [ { code: 'invalid_type', expected: 'array', received: 'object', path: [Array], message: 'Expected array, received object' } ]
|
|
122
|
-
}
|
|
123
|
-
ELIFECYCLE Test failed. See above for more details.
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @nostrify/nostrify@0.46.8 test /home/sid/repos/nostrify/packages/nostrify
|
|
4
|
+
> node --test "**/*.test.ts"
|
|
5
|
+
|
|
6
|
+
✔ BunkerURI (2.901722ms)
|
|
7
|
+
✔ BunkerURI.fromJSON (0.681727ms)
|
|
8
|
+
✔ NBrowserSigner - without extension (2.955361ms)
|
|
9
|
+
✔ NBrowserSigner - with extension polyfill (142.479686ms)
|
|
10
|
+
✔ NBrowserSigner.nip44 - with extension polyfill (63.176698ms)
|
|
11
|
+
✔ NBrowserSigner.nip04 - with extension polyfill (94.046199ms)
|
|
12
|
+
✔ NBrowserSigner.getRelays - with extension polyfill (1.225726ms)
|
|
13
|
+
✔ NBrowserSigner - missing nip44 support (0.470316ms)
|
|
14
|
+
✔ NBrowserSigner - missing nip04 support (0.596869ms)
|
|
15
|
+
✔ NBrowserSigner - feature detection (0.692134ms)
|
|
16
|
+
✔ NCache (4.463457ms)
|
|
17
|
+
✔ NConnectSigner.signEvent with nip04 encryption (264.497854ms)
|
|
18
|
+
✔ NConnectSigner.signEvent with nip44 encryption (151.108865ms)
|
|
19
|
+
✔ NIP05.lookup (82.449297ms)
|
|
20
|
+
✔ NIP05.lookup with invalid values but valid profile pointer (5.343535ms)
|
|
21
|
+
✔ NIP05.lookup with invalid document (5.910931ms)
|
|
22
|
+
✔ NIP50.parseInput (6.388441ms)
|
|
23
|
+
✔ NIP50.parseInput with negated token (0.443007ms)
|
|
24
|
+
✔ NIP98.template (3.769298ms)
|
|
25
|
+
✔ NIP98.template with payload (18.668676ms)
|
|
26
|
+
✔ NIP98.verify (102.562862ms)
|
|
27
|
+
✔ NIP98.verify fails with missing header (4.419038ms)
|
|
28
|
+
✔ NIP98.verify fails with missing token (2.752191ms)
|
|
29
|
+
✔ NIP98.verify fails with invalid token (4.587427ms)
|
|
30
|
+
✔ NIP98.verify fails with invalid event (16.989187ms)
|
|
31
|
+
✔ NIP98.verify fails with wrong event kind (40.621459ms)
|
|
32
|
+
✔ NIP98.verify fails with wrong request URL (41.071101ms)
|
|
33
|
+
✔ NIP98.verify fails with wrong request method (62.625645ms)
|
|
34
|
+
✔ NIP98.verify fails with expired event (20.760162ms)
|
|
35
|
+
✔ NIP98.verify fails with invalid payload (51.97091ms)
|
|
36
|
+
✔ NKinds (3.308412ms)
|
|
37
|
+
✔ NPool.query (368.093259ms)
|
|
38
|
+
✔ NPool.req (266.969001ms)
|
|
39
|
+
✔ NPool.event (232.161184ms)
|
|
40
|
+
✔ NRelay1.query (280.362725ms)
|
|
41
|
+
✔ NRelay1.query mismatched filter (245.542477ms)
|
|
42
|
+
✔ NRelay1.req (247.658198ms)
|
|
43
|
+
✔ NRelay1.event (216.357493ms)
|
|
44
|
+
﹣ NRelay1 backoff (0.334682ms) # SKIP
|
|
45
|
+
▶ NRelay1 idleTimeout
|
|
46
|
+
✔ websocket opens (40.531572ms)
|
|
47
|
+
✔ websocket closes after idleTimeout (150.405626ms)
|
|
48
|
+
✔ websocket wakes up during activity (14.544161ms)
|
|
49
|
+
✔ NRelay1 idleTimeout (209.795356ms)
|
|
50
|
+
✔ NRelay1.count rejects when the server sends CLOSED (6.440892ms)
|
|
51
|
+
✔ NRelay1 closes when it receives a binary message (5.03225ms)
|
|
52
|
+
✔ n.id (3.950608ms)
|
|
53
|
+
✔ n.bech32 (1.817636ms)
|
|
54
|
+
✔ n.filter (10.95275ms)
|
|
55
|
+
✔ n.event (2.561941ms)
|
|
56
|
+
✔ n.metadata (11.862022ms)
|
|
57
|
+
✔ NSecSigner (178.164717ms)
|
|
58
|
+
✔ NSecSigner.nip44 (31.935079ms)
|
|
59
|
+
✔ NSet (19.978352ms)
|
|
60
|
+
✔ NSet.add (replaceable) (0.615308ms)
|
|
61
|
+
✔ NSet.add (parameterized) (0.985888ms)
|
|
62
|
+
✔ NSet.add (deletion) (0.380918ms)
|
|
63
|
+
✔ Construct a RelayError from the reason message (1.717692ms)
|
|
64
|
+
✔ Throw a new RelayError if the OK message is false (0.750801ms)
|
|
65
|
+
✔ LNURL.fromString (7.817616ms)
|
|
66
|
+
✔ LNURL.fromLightningAddress (0.932529ms)
|
|
67
|
+
✔ LNURL.toString (1.933713ms)
|
|
68
|
+
✔ LNURL.getDetails (111.66131ms)
|
|
69
|
+
✔ LNURL.getInvoice (13.562812ms)
|
|
70
|
+
✔ ErrorRelay (112.209428ms)
|
|
71
|
+
✔ MockRelay (3.019126ms)
|
|
72
|
+
﹣ BlossomUploader.upload (1.127947ms) # SKIP
|
|
73
|
+
﹣ NostrBuildUploader.upload (2.842008ms) # SKIP
|
|
74
|
+
✔ CircularSet (2.247513ms)
|
|
75
|
+
✔ push, iterate, & close (103.751782ms)
|
|
76
|
+
✔ close & reopen (0.982257ms)
|
|
77
|
+
✔ aborts with signal (51.656203ms)
|
|
78
|
+
✔ already aborted signal in constructor (1.251916ms)
|
|
79
|
+
✔ push after abort (0.906129ms)
|
|
80
|
+
✔ multiple messages in queue (0.531637ms)
|
|
81
|
+
✔ N64 (8.171994ms)
|
|
82
|
+
✔ N64.encodeEvent (0.513338ms)
|
|
83
|
+
✔ N64.decodeEvent (1.449988ms)
|
|
84
|
+
ℹ tests 77
|
|
85
|
+
ℹ suites 0
|
|
86
|
+
ℹ pass 74
|
|
87
|
+
ℹ fail 0
|
|
88
|
+
ℹ cancelled 0
|
|
89
|
+
ℹ skipped 3
|
|
90
|
+
ℹ todo 0
|
|
91
|
+
ℹ duration_ms 2192.909865
|
package/CHANGELOG.md
CHANGED
package/NIP05.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { NProfilePointer } from
|
|
1
|
+
import type { NProfilePointer } from "@nostrify/types";
|
|
2
2
|
|
|
3
|
-
import { NSchema as n, z } from
|
|
3
|
+
import { NSchema as n, z } from "./NSchema.ts";
|
|
4
4
|
|
|
5
5
|
interface LookupOpts {
|
|
6
6
|
fetch?: typeof fetch;
|
|
@@ -18,7 +18,7 @@ export class NIP05 {
|
|
|
18
18
|
return z.object({
|
|
19
19
|
pubkey: n.id(),
|
|
20
20
|
relays: n.relayUrl().array().optional(),
|
|
21
|
-
})
|
|
21
|
+
}) as z.ZodType<NProfilePointer>;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/** Resolve NIP-05 name to a profile pointer. */
|
|
@@ -31,10 +31,10 @@ export class NIP05 {
|
|
|
31
31
|
const match = nip05.match(NIP05.regex());
|
|
32
32
|
if (!match) throw new Error(`NIP-05: invalid name ${nip05}`);
|
|
33
33
|
|
|
34
|
-
const [_, name =
|
|
34
|
+
const [_, name = "_", domain] = match;
|
|
35
35
|
|
|
36
|
-
const url = new URL(
|
|
37
|
-
url.searchParams.set(
|
|
36
|
+
const url = new URL("/.well-known/nostr.json", `https://${domain}/`);
|
|
37
|
+
url.searchParams.set("name", name);
|
|
38
38
|
|
|
39
39
|
const response = await fetch(url, { signal });
|
|
40
40
|
const json = await response.json();
|
package/NSchema.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
|
|
3
3
|
import type {
|
|
4
4
|
NostrClientAUTH,
|
|
@@ -20,7 +20,7 @@ import type {
|
|
|
20
20
|
NostrRelayMsg,
|
|
21
21
|
NostrRelayNOTICE,
|
|
22
22
|
NostrRelayOK,
|
|
23
|
-
} from
|
|
23
|
+
} from "@nostrify/types";
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* A suite of [zod](https://github.com/colinhacks/zod) schemas for Nostr.
|
|
@@ -50,7 +50,15 @@ class NSchema {
|
|
|
50
50
|
content: z.string(),
|
|
51
51
|
created_at: z.number().int().nonnegative(),
|
|
52
52
|
sig: z.string(),
|
|
53
|
-
})
|
|
53
|
+
}).required({
|
|
54
|
+
id: true,
|
|
55
|
+
kind: true,
|
|
56
|
+
pubkey: true,
|
|
57
|
+
tags: true,
|
|
58
|
+
content: true,
|
|
59
|
+
created_at: true,
|
|
60
|
+
sig: true,
|
|
61
|
+
}) as z.ZodType<NostrEvent>;
|
|
54
62
|
}
|
|
55
63
|
|
|
56
64
|
/** Nostr filter schema. */
|
|
@@ -67,16 +75,16 @@ class NSchema {
|
|
|
67
75
|
.passthrough()
|
|
68
76
|
.transform((value) => {
|
|
69
77
|
const keys = [
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
"kinds",
|
|
79
|
+
"ids",
|
|
80
|
+
"authors",
|
|
81
|
+
"since",
|
|
82
|
+
"until",
|
|
83
|
+
"limit",
|
|
84
|
+
"search",
|
|
77
85
|
];
|
|
78
86
|
return Object.entries(value).reduce((acc, [key, val]) => {
|
|
79
|
-
if (keys.includes(key) || key.startsWith(
|
|
87
|
+
if (keys.includes(key) || key.startsWith("#")) {
|
|
80
88
|
acc[key] = val;
|
|
81
89
|
}
|
|
82
90
|
return acc;
|
|
@@ -92,7 +100,9 @@ class NSchema {
|
|
|
92
100
|
return z
|
|
93
101
|
.string()
|
|
94
102
|
.regex(/^[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}$/)
|
|
95
|
-
.refine((value) =>
|
|
103
|
+
.refine((value) =>
|
|
104
|
+
prefix ? value.startsWith(`${prefix}1`) : true
|
|
105
|
+
) as z.ZodType<`${P}1${string}`>;
|
|
96
106
|
}
|
|
97
107
|
|
|
98
108
|
/** WebSocket URL starting with `ws://` or `wss://`. */
|
|
@@ -105,27 +115,39 @@ class NSchema {
|
|
|
105
115
|
|
|
106
116
|
/** NIP-01 `EVENT` message from client to relay. */
|
|
107
117
|
static clientEVENT(): z.ZodType<NostrClientEVENT> {
|
|
108
|
-
return z.tuple([
|
|
118
|
+
return z.tuple([
|
|
119
|
+
z.literal("EVENT"),
|
|
120
|
+
NSchema.event(),
|
|
121
|
+
]) as unknown as z.ZodType<
|
|
122
|
+
NostrClientEVENT
|
|
123
|
+
>;
|
|
109
124
|
}
|
|
110
125
|
|
|
111
126
|
/** NIP-01 `REQ` message from client to relay. */
|
|
112
127
|
static clientREQ(): z.ZodType<NostrClientREQ> {
|
|
113
|
-
return z.tuple([z.literal(
|
|
128
|
+
return z.tuple([z.literal("REQ"), z.string()]).rest(NSchema.filter());
|
|
114
129
|
}
|
|
115
130
|
|
|
116
131
|
/** NIP-45 `COUNT` message from client to relay. */
|
|
117
132
|
static clientCOUNT(): z.ZodType<NostrClientCOUNT> {
|
|
118
|
-
return z.tuple([z.literal(
|
|
133
|
+
return z.tuple([z.literal("COUNT"), z.string()]).rest(NSchema.filter());
|
|
119
134
|
}
|
|
120
135
|
|
|
121
136
|
/** NIP-01 `CLOSE` message from client to relay. */
|
|
122
137
|
static clientCLOSE(): z.ZodType<NostrClientCLOSE> {
|
|
123
|
-
return z.tuple([z.literal(
|
|
138
|
+
return z.tuple([z.literal("CLOSE"), z.string()]) as unknown as z.ZodType<
|
|
139
|
+
NostrClientCLOSE
|
|
140
|
+
>;
|
|
124
141
|
}
|
|
125
142
|
|
|
126
143
|
/** NIP-42 `AUTH` message from client to relay. */
|
|
127
144
|
static clientAUTH(): z.ZodType<NostrClientAUTH> {
|
|
128
|
-
return z.tuple([
|
|
145
|
+
return z.tuple([
|
|
146
|
+
z.literal("AUTH"),
|
|
147
|
+
NSchema.event(),
|
|
148
|
+
]) as unknown as z.ZodType<
|
|
149
|
+
NostrClientAUTH
|
|
150
|
+
>;
|
|
129
151
|
}
|
|
130
152
|
|
|
131
153
|
/** NIP-01 message from client to relay. */
|
|
@@ -136,49 +158,68 @@ class NSchema {
|
|
|
136
158
|
NSchema.clientCOUNT(),
|
|
137
159
|
NSchema.clientCLOSE(),
|
|
138
160
|
NSchema.clientAUTH(),
|
|
139
|
-
])
|
|
161
|
+
]) as z.ZodType<NostrClientMsg>;
|
|
140
162
|
}
|
|
141
163
|
|
|
142
164
|
/** NIP-01 `EVENT` message from relay to client. */
|
|
143
165
|
static relayEVENT(): z.ZodType<NostrRelayEVENT> {
|
|
144
|
-
return z.tuple([
|
|
166
|
+
return z.tuple([
|
|
167
|
+
z.literal("EVENT"),
|
|
168
|
+
z.string(),
|
|
169
|
+
NSchema.event(),
|
|
170
|
+
]) as unknown as z.ZodType<NostrRelayEVENT>;
|
|
145
171
|
}
|
|
146
172
|
|
|
147
173
|
/** NIP-01 `OK` message from relay to client. */
|
|
148
174
|
static relayOK(): z.ZodType<NostrRelayOK> {
|
|
149
|
-
return z.tuple([
|
|
175
|
+
return z.tuple([
|
|
176
|
+
z.literal("OK"),
|
|
177
|
+
NSchema.id(),
|
|
178
|
+
z.boolean(),
|
|
179
|
+
z.string(),
|
|
180
|
+
]) as unknown as z.ZodType<NostrRelayOK>;
|
|
150
181
|
}
|
|
151
182
|
|
|
152
183
|
/** NIP-01 `EOSE` message from relay to client. */
|
|
153
184
|
static relayEOSE(): z.ZodType<NostrRelayEOSE> {
|
|
154
|
-
return z.tuple([z.literal(
|
|
185
|
+
return z.tuple([z.literal("EOSE"), z.string()]) as unknown as z.ZodType<
|
|
186
|
+
NostrRelayEOSE
|
|
187
|
+
>;
|
|
155
188
|
}
|
|
156
189
|
|
|
157
190
|
/** NIP-01 `NOTICE` message from relay to client. */
|
|
158
191
|
static relayNOTICE(): z.ZodType<NostrRelayNOTICE> {
|
|
159
|
-
return z.tuple([z.literal(
|
|
192
|
+
return z.tuple([z.literal("NOTICE"), z.string()]) as unknown as z.ZodType<
|
|
193
|
+
NostrRelayNOTICE
|
|
194
|
+
>;
|
|
160
195
|
}
|
|
161
196
|
|
|
162
197
|
/** NIP-01 `CLOSED` message from relay to client. */
|
|
163
198
|
static relayCLOSED(): z.ZodType<NostrRelayCLOSED> {
|
|
164
|
-
return z.tuple([
|
|
199
|
+
return z.tuple([
|
|
200
|
+
z.literal("CLOSED"),
|
|
201
|
+
z.string(),
|
|
202
|
+
z.string(),
|
|
203
|
+
]) as unknown as z.ZodType<NostrRelayCLOSED>;
|
|
165
204
|
}
|
|
166
205
|
|
|
167
206
|
/** NIP-42 `AUTH` message from relay to client. */
|
|
168
207
|
static relayAUTH(): z.ZodType<NostrRelayAUTH> {
|
|
169
|
-
return z.tuple([z.literal(
|
|
208
|
+
return z.tuple([z.literal("AUTH"), z.string()]) as unknown as z.ZodType<
|
|
209
|
+
NostrRelayAUTH
|
|
210
|
+
>;
|
|
170
211
|
}
|
|
171
212
|
|
|
172
213
|
/** NIP-45 `COUNT` message from relay to client. */
|
|
173
214
|
static relayCOUNT(): z.ZodType<NostrRelayCOUNT> {
|
|
174
215
|
return z.tuple([
|
|
175
|
-
z.literal(
|
|
216
|
+
z.literal("COUNT"),
|
|
176
217
|
z.string(),
|
|
177
218
|
z.object({
|
|
178
219
|
count: z.number().int().nonnegative(),
|
|
179
220
|
approximate: z.boolean().optional(),
|
|
180
221
|
}),
|
|
181
|
-
])
|
|
222
|
+
]) as unknown as z.ZodType<NostrRelayCOUNT>;
|
|
182
223
|
}
|
|
183
224
|
|
|
184
225
|
/** NIP-01 message from relay to client. */
|
|
@@ -201,7 +242,7 @@ class NSchema {
|
|
|
201
242
|
banner: z.string().url().optional().catch(undefined),
|
|
202
243
|
bot: z.boolean().optional().catch(undefined),
|
|
203
244
|
display_name: z.string().optional().catch(undefined),
|
|
204
|
-
lud06: NSchema.bech32(
|
|
245
|
+
lud06: NSchema.bech32("lnurl").optional().catch(undefined),
|
|
205
246
|
lud16: z.string().email().optional().catch(undefined),
|
|
206
247
|
name: z.string().optional().catch(undefined),
|
|
207
248
|
nip05: z.string().email().optional().catch(undefined),
|
|
@@ -216,7 +257,7 @@ class NSchema {
|
|
|
216
257
|
id: z.string(),
|
|
217
258
|
method: z.string(),
|
|
218
259
|
params: z.string().array(),
|
|
219
|
-
})
|
|
260
|
+
}) as z.ZodType<NostrConnectRequest>;
|
|
220
261
|
}
|
|
221
262
|
|
|
222
263
|
/** NIP-46 response content schema. */
|
|
@@ -225,7 +266,7 @@ class NSchema {
|
|
|
225
266
|
id: z.string(),
|
|
226
267
|
result: z.string(),
|
|
227
268
|
error: z.string().optional(),
|
|
228
|
-
})
|
|
269
|
+
}) as z.ZodType<NostrConnectResponse>;
|
|
229
270
|
}
|
|
230
271
|
|
|
231
272
|
/**
|
|
@@ -240,7 +281,7 @@ class NSchema {
|
|
|
240
281
|
try {
|
|
241
282
|
return JSON.parse(value) as unknown;
|
|
242
283
|
} catch (_e) {
|
|
243
|
-
ctx.addIssue({ code: z.ZodIssueCode.custom, message:
|
|
284
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "Invalid JSON" });
|
|
244
285
|
return z.NEVER;
|
|
245
286
|
}
|
|
246
287
|
});
|