libp2r2p 0.10.0 → 0.10.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/idb/index.js +1 -0
- package/idb-queue/index.js +1 -0
- package/nip04/index.js +0 -2
- package/nip46/services/client.js +1 -2
- package/nip46/services/server-session.js +1 -2
- package/nip98/index.js +1 -0
- package/package.json +6 -2
- package/private-channel/services/received-chunks.js +1 -0
- package/private-messenger/services/channel-state.js +1 -0
- package/relay/constants/index.js +11 -3
- package/relay/helpers/publish.js +1 -0
- package/relay/index.js +1 -1
- package/relay/services/relay-pool.js +3 -3
package/idb/index.js
CHANGED
package/idb-queue/index.js
CHANGED
|
@@ -34,6 +34,7 @@ The queue state record is absent while the queue is empty.
|
|
|
34
34
|
function deferred () {
|
|
35
35
|
let resolve
|
|
36
36
|
let reject
|
|
37
|
+
// eslint-disable-next-line promise/param-names
|
|
37
38
|
const promise = new Promise((nextResolve, nextReject) => {
|
|
38
39
|
resolve = nextResolve
|
|
39
40
|
reject = nextReject
|
package/nip04/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { cbc } from '@noble/ciphers/aes.js'
|
|
2
2
|
import { randomBytes } from '@noble/ciphers/utils.js'
|
|
3
|
-
|
|
4
|
-
import { base16ToBytes } from '../base16/index.js'
|
|
5
3
|
import { base64ToBytes, bytesToBase64 } from '../base64/index.js'
|
|
6
4
|
import { sharedXOnlySecret } from '../ecdh/index.js'
|
|
7
5
|
import { ValidationError } from '../error/index.js'
|
package/nip46/services/client.js
CHANGED
|
@@ -198,8 +198,7 @@ export class Nip46Client {
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
#openResponseContext (pointer) {
|
|
201
|
-
|
|
202
|
-
context = this.#transport.openContext({
|
|
201
|
+
const context = this.#transport.openContext({
|
|
203
202
|
filter: {
|
|
204
203
|
kinds: [NIP46_KIND],
|
|
205
204
|
authors: [pointer.remoteSignerPubkey],
|
|
@@ -112,8 +112,7 @@ export class Nip46ServerSession {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
#openContext (relays) {
|
|
115
|
-
|
|
116
|
-
context = this.#transport.openContext({
|
|
115
|
+
const context = this.#transport.openContext({
|
|
117
116
|
filter: {
|
|
118
117
|
kinds: [NIP46_KIND],
|
|
119
118
|
'#p': [this.#transport.pubkey],
|
package/nip98/index.js
CHANGED
|
@@ -27,6 +27,7 @@ export async function getToken ({
|
|
|
27
27
|
payloadHash
|
|
28
28
|
}) {
|
|
29
29
|
if (typeof loginUrl !== 'string' || loginUrl.length === 0) throw new ValidationError('INVALID_LOGIN_URL')
|
|
30
|
+
// eslint-disable-next-line no-new
|
|
30
31
|
try { new URL(loginUrl) } catch (cause) { throw new ValidationError('INVALID_LOGIN_URL', { cause }) }
|
|
31
32
|
if (typeof httpMethod !== 'string' || httpMethod.trim().length === 0) throw new ValidationError('INVALID_HTTP_METHOD')
|
|
32
33
|
if (typeof signEvent !== 'function') throw new ValidationError('SIGN_EVENT_SHOULD_BE_A_FUNCTION')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libp2r2p",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "Peer-to-relay-to-peer",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"p2r2p",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
],
|
|
48
48
|
"scripts": {
|
|
49
49
|
"test": "node --test --experimental-test-module-mocks 'tests/**/*.test.js'",
|
|
50
|
+
"test:files": "node --test --experimental-test-module-mocks",
|
|
50
51
|
"test:only": "node --test --test-only --experimental-test-module-mocks 'tests/**/*.test.js'"
|
|
51
52
|
},
|
|
52
53
|
"exports": {
|
|
@@ -92,6 +93,9 @@
|
|
|
92
93
|
"@scure/base": "2.0.0"
|
|
93
94
|
},
|
|
94
95
|
"devDependencies": {
|
|
95
|
-
"
|
|
96
|
+
"eslint": "^9.39.5",
|
|
97
|
+
"fake-indexeddb": "6.2.5",
|
|
98
|
+
"globals": "^17.8.0",
|
|
99
|
+
"neostandard": "^0.13.0"
|
|
96
100
|
}
|
|
97
101
|
}
|
|
@@ -25,6 +25,7 @@ clearing state owned by another instance of the same principal identity.
|
|
|
25
25
|
function deferred () {
|
|
26
26
|
let resolve
|
|
27
27
|
let reject
|
|
28
|
+
// eslint-disable-next-line promise/param-names
|
|
28
29
|
const promise = new Promise((nextResolve, nextReject) => {
|
|
29
30
|
resolve = nextResolve
|
|
30
31
|
reject = nextReject
|
package/relay/constants/index.js
CHANGED
|
@@ -4,7 +4,9 @@ export const seedRelays = [
|
|
|
4
4
|
'wss://purplepag.es',
|
|
5
5
|
'wss://user.kindpag.es',
|
|
6
6
|
'wss://relay.nos.social',
|
|
7
|
-
|
|
7
|
+
// Disabled 2026-08-05: accepted kind:10002 with OK but did not broadcast it
|
|
8
|
+
// to a live subscription within 15 seconds. Keep for future retesting.
|
|
9
|
+
// 'wss://nostr.land',
|
|
8
10
|
'wss://indexer.coracle.social'
|
|
9
11
|
]
|
|
10
12
|
|
|
@@ -13,6 +15,12 @@ export const seedRelays = [
|
|
|
13
15
|
export const freeRelays = [
|
|
14
16
|
'wss://relay.44billion.net',
|
|
15
17
|
'wss://nos.lol',
|
|
16
|
-
'wss://relay.primal.net'
|
|
17
|
-
|
|
18
|
+
'wss://relay.primal.net'
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
// Shared app-discovery relays used by Nostr app launchers and uploaders.
|
|
22
|
+
export const nappRelays = [
|
|
23
|
+
'wss://relay.44billion.net',
|
|
24
|
+
'wss://relay.ditto.pub',
|
|
25
|
+
'wss://relay.dreamith.to'
|
|
18
26
|
]
|
package/relay/helpers/publish.js
CHANGED
|
@@ -40,6 +40,7 @@ export function createPublishSettlements (promises, timeout, { onSettled } = {})
|
|
|
40
40
|
let isFinished = false
|
|
41
41
|
let resolve
|
|
42
42
|
|
|
43
|
+
// eslint-disable-next-line promise/param-names
|
|
43
44
|
const promise = new Promise(nextResolve => { resolve = nextResolve })
|
|
44
45
|
const finish = () => {
|
|
45
46
|
if (isFinished) return
|
package/relay/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { freeRelays, seedRelays } from './constants/index.js'
|
|
1
|
+
export { freeRelays, nappRelays, seedRelays } from './constants/index.js'
|
|
2
2
|
export { pickRelaysForPubkeys } from './helpers/routing.js'
|
|
3
3
|
export { RelayPool, relayPool } from './services/relay-pool.js'
|
|
4
4
|
export { getRelaysByPubkey, subscribeRelayListUpdates } from './services/query.js'
|
|
@@ -175,7 +175,7 @@ export class RelayPool {
|
|
|
175
175
|
|
|
176
176
|
// Disconnect from a relay
|
|
177
177
|
async disconnect (url) {
|
|
178
|
-
const normalizedUrl =
|
|
178
|
+
const normalizedUrl = normalizeRelayUrl(url)
|
|
179
179
|
if (this.#relays.has(normalizedUrl)) {
|
|
180
180
|
const relay = this.#relays.get(normalizedUrl)
|
|
181
181
|
if (relay.ws?.readyState < 2) await relay.close()?.catch(console.log)
|
|
@@ -414,6 +414,7 @@ export class RelayPool {
|
|
|
414
414
|
this.#getRelay(url).then(relay => {
|
|
415
415
|
if (isResolved || !pending.has(url)) return
|
|
416
416
|
let hasEvents = false
|
|
417
|
+
// eslint-disable-next-line prefer-const
|
|
417
418
|
let sub
|
|
418
419
|
|
|
419
420
|
// Actual EOSE and filter satisfaction share the same graceful close path.
|
|
@@ -658,14 +659,13 @@ export class RelayPool {
|
|
|
658
659
|
// the historical gap is yielded before newer socket events.
|
|
659
660
|
let liveBuffer = (gapSince !== null && gapSince > 0) ? [] : null
|
|
660
661
|
let liveEose = false
|
|
661
|
-
let liveSub
|
|
662
662
|
|
|
663
663
|
// Open the live sub first so the relay starts buffering incoming events
|
|
664
664
|
// before we scan its database for the reconnect gap fill.
|
|
665
665
|
// Forward until to the relay so it can enforce the boundary server-side.
|
|
666
666
|
const liveFilter = { ...baseFilter, since: now, limit: 0 }
|
|
667
667
|
if (filterUntil !== null) liveFilter.until = filterUntil
|
|
668
|
-
liveSub = relay.subscribe([liveFilter], {
|
|
668
|
+
const liveSub = relay.subscribe([liveFilter], {
|
|
669
669
|
onevent: (event) => {
|
|
670
670
|
// A limit:0 relay may still send retained events before EOSE. Do not
|
|
671
671
|
// expose them from a strictly-live stream.
|