Skip to content

Commit 534275d

Browse files
committed
fix: update nostr-crypto-utils to use NPM package
- Replace local file dependency with NPM package version - Update to version 0.3.12 - Use nostr-crypto-utils ^0.4.10 from NPM registry - Ensure compatibility with published package
1 parent 1e90f0e commit 534275d

40 files changed

+139
-180
lines changed

package-lock.json

Lines changed: 34 additions & 79 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nostr-websocket-utils",
3-
"version": "0.3.11",
3+
"version": "0.3.12",
44
"description": "Robust WebSocket utilities for Nostr applications with automatic reconnection, supporting both ESM and CommonJS. Features channel-based messaging, heartbeat monitoring, message queueing, and comprehensive error handling with type-safe handlers.",
55
"main": "./dist/cjs/index.js",
66
"module": "./dist/index.js",
@@ -55,7 +55,7 @@
5555
"homepage": "https://github.com/HumanjavaEnterprises/nostr-websocket-utils#readme",
5656
"dependencies": {
5757
"@types/uuid": "^10.0.0",
58-
"nostr-crypto-utils": "file:../nostr-crypto-utils",
58+
"nostr-crypto-utils": "^0.4.10",
5959
"pino": "^8.17.2",
6060
"uuid": "^11.0.3",
6161
"ws": "^8.16.0"

src/__mocks__/mockserver.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { vi } from 'vitest';
22
import { EventEmitter } from 'events';
3-
import type { NostrWSMessage } from '../types/messages';
4-
import type { NostrWSSocket } from '../types/socket';
3+
import type { NostrWSMessage } from '../types/messages.js';
4+
import type { NostrWSSocket } from '../types/socket.js';
55
import type { IncomingMessage } from 'http';
66
import type { Socket } from 'net';
77
import type { WebSocket } from 'ws';
8-
import { ExtendedWsMock } from './extendedWsMock';
8+
import { ExtendedWsMock } from './extendedWsMock.js';
99

1010
interface MockServerOptions {
1111
port?: number;

src/core/client.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import WebSocket from 'ws';
22
import {
33
NostrWSMessage,
44
ConnectionState
5-
} from '../types';
6-
import { NostrWSClientOptions } from '../types/websocket';
7-
import { MessageQueue } from './queue';
8-
import { createLogger } from '../utils/logger';
5+
} from '../types/index.js';
6+
import { NostrWSClientOptions } from '../types/websocket.js';
7+
import { MessageQueue } from './queue.js';
8+
import { createLogger } from '../utils/logger.js';
99
import { Logger } from 'pino';
1010

1111
/**

src/core/queue.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* @module core/queue
44
*/
55

6-
import { NostrWSMessage, MessagePriority, QueueItem } from '../types';
7-
import { createLogger } from '../utils/logger';
6+
import { NostrWSMessage, MessagePriority, QueueItem } from '../types/index.js';
7+
import { createLogger } from '../utils/logger.js';
88
import { Logger } from 'pino';
99

1010
/**

src/crypto/handlers.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* @module crypto/handlers
44
*/
55

6-
import { getLogger } from '../utils/logger';
7-
import type { NostrWSMessage } from '../types/messages';
8-
import { MESSAGE_TYPES } from '../types/messages';
9-
import type { NostrEvent, SignedNostrEvent } from '../types/events';
10-
import { validateEvent, verifySignature } from 'nostr-crypto-utils';
6+
import { getLogger } from '../utils/logger.js';
7+
import type { NostrWSMessage } from '../types/messages.js';
8+
import { MESSAGE_TYPES } from '../types/messages.js';
9+
import type { NostrEvent, SignedNostrEvent } from '../types/events.js';
10+
import { validateRelayMessage as validateEvent, verifySignature } from 'nostr-crypto-utils';
1111

1212
const logger = getLogger('crypto');
1313

src/endpoints/metrics.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*/
55

66
import { createServer, IncomingMessage, ServerResponse } from 'http';
7-
import { metricsTracker } from '../utils/metrics';
8-
import { getLogger } from '../utils/logger';
7+
import { metricsTracker } from '../utils/metrics.js';
8+
import { getLogger } from '../utils/logger.js';
99

1010
const logger = getLogger('MetricsEndpoint');
1111

src/nips/index.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,46 @@
44
*/
55

66
// Basic protocol flow
7-
export * from './nip-01';
7+
export * from './nip-01.js';
88

99
// Contact List and Petnames
10-
export * from './nip-02';
10+
export * from './nip-02.js';
1111

1212
// Encrypted Direct Messages
13-
export * from './nip-04';
13+
export * from './nip-04.js';
1414

1515
// DNS Identity Verification
16-
export * from './nip-05';
16+
export * from './nip-05.js';
1717

1818
// Event Deletion
19-
export * from './nip-09';
19+
export * from './nip-09.js';
2020

2121
// bech32-encoded entities
22-
export * from './nip-19';
22+
export * from './nip-19.js';
2323

2424
// Delegated Event Signing
25-
export * from './nip-26';
25+
export * from './nip-26.js';
2626

2727
// Relay Information Document
28-
export * from './nip-11';
28+
export * from './nip-11.js';
2929

3030
// Command Results
31-
export * from './nip-20';
31+
export * from './nip-20.js';
3232

3333
// Proof of Work
34-
export * from './nip-13';
34+
export * from './nip-13.js';
3535

3636
// Event Treatment
37-
export * from './nip-16';
37+
export * from './nip-16.js';
3838

3939
// End of Stored Events Notice
40-
export * from './nip-15';
40+
export * from './nip-15.js';
4141

4242
// Event Created At Limits
43-
export * from './nip-22';
43+
export * from './nip-22.js';
4444

4545
// Public Chat
46-
export * from './nip-28';
46+
export * from './nip-28.js';
4747

4848
// Parameterized Replaceable Events
49-
export * from './nip-33';
49+
export * from './nip-33.js';

src/nips/nip-01.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* @module nips/nip-01
44
*/
55

6-
import { getLogger } from '../utils/logger';
7-
import type { NostrWSMessage, NostrEvent } from '../types/messages';
8-
import { MESSAGE_TYPES } from '../types/messages';
6+
import { getLogger } from '../utils/logger.js';
7+
import type { NostrWSMessage, NostrEvent } from '../types/messages.js';
8+
import { MESSAGE_TYPES } from '../types/messages.js';
99

1010
const logger = getLogger('NIP-01');
1111

src/nips/nip-02.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* @see https://github.com/nostr-protocol/nips/blob/master/02.md
55
*/
66

7-
import type { NostrWSMessage } from '../types/messages';
8-
import type { Logger } from '../types/logger';
7+
import type { NostrWSMessage } from '../types/messages.js';
8+
import type { Logger } from '../types/logger.js';
99

1010
/**
1111
* Contact list event kind

src/nips/nip-04.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
*/
66

77
import { encryptMessage, decryptMessage } from 'nostr-crypto-utils';
8-
import type { NostrWSMessage, NostrEvent } from '../types/messages';
9-
import type { Logger } from '../types/logger';
8+
import type { NostrWSMessage, NostrEvent } from '../types/messages.js';
9+
import type { Logger } from '../types/logger.js';
1010

1111
/**
1212
* Kind value for encrypted direct messages

src/nips/nip-05.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @see https://github.com/nostr-protocol/nips/blob/master/05.md
55
*/
66

7-
import { fetchJson } from '../utils/http';
7+
import { fetchJson } from '../utils/http.js';
88
import { Logger } from 'pino';
99

1010
/**

src/nips/nip-09.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @see https://github.com/nostr-protocol/nips/blob/master/09.md
55
*/
66

7-
import type { NostrEvent, NostrSubscriptionEvent } from '../types/events';
7+
import type { NostrEvent, NostrSubscriptionEvent } from '../types/events.js';
88

99
/**
1010
* Represents the result of a deletion operation

src/nips/nip-11.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* @see https://github.com/nostr-protocol/nips/blob/master/11.md
55
*/
66

7-
import { getLogger } from '../utils/logger';
8-
import { fetchJson } from '../utils/http';
7+
import { getLogger } from '../utils/logger.js';
8+
import { fetchJson } from '../utils/http.js';
99

1010
const logger = getLogger('NIP-11');
1111

src/nips/nip-13.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
*/
66

77
import { createHash } from 'crypto';
8-
import type { NostrWSMessage } from '../types/messages';
9-
import type { Logger } from '../types/logger';
8+
import type { NostrWSMessage } from '../types/messages.js';
9+
import type { Logger } from '../types/logger.js';
1010

1111
/**
1212
* Calculates the number of leading zero bits in a hex string

src/nips/nip-15.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* @see https://github.com/nostr-protocol/nips/blob/master/15.md
55
*/
66

7-
import type { NostrWSMessage } from '../types/messages';
8-
import type { Logger } from '../types/logger';
7+
import type { NostrWSMessage } from '../types/messages.js';
8+
import type { Logger } from '../types/logger.js';
99

1010
/**
1111
* Creates an EOSE (End of Stored Events) message

0 commit comments

Comments
 (0)