nostr-tools 2.3.0 → 2.3.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.
Files changed (89) hide show
  1. package/README.md +5 -1
  2. package/lib/cjs/abstract-pool.js +9 -6
  3. package/lib/cjs/abstract-pool.js.map +2 -2
  4. package/lib/cjs/abstract-relay.js +9 -6
  5. package/lib/cjs/abstract-relay.js.map +2 -2
  6. package/lib/cjs/filter.js.map +2 -2
  7. package/lib/cjs/index.js +60 -53
  8. package/lib/cjs/index.js.map +3 -3
  9. package/lib/cjs/kinds.js.map +2 -2
  10. package/lib/cjs/nip04.js.map +2 -2
  11. package/lib/cjs/nip11.js.map +2 -2
  12. package/lib/cjs/nip13.js.map +2 -2
  13. package/lib/cjs/nip18.js.map +2 -2
  14. package/lib/cjs/nip19.js.map +2 -2
  15. package/lib/cjs/nip21.js.map +2 -2
  16. package/lib/cjs/nip25.js.map +2 -2
  17. package/lib/cjs/nip27.js.map +2 -2
  18. package/lib/cjs/nip28.js.map +2 -2
  19. package/lib/cjs/nip29.js.map +2 -2
  20. package/lib/cjs/nip30.js.map +2 -2
  21. package/lib/cjs/nip42.js.map +1 -1
  22. package/lib/cjs/nip44.js +51 -47
  23. package/lib/cjs/nip44.js.map +2 -2
  24. package/lib/cjs/nip46.js +20 -9
  25. package/lib/cjs/nip46.js.map +3 -3
  26. package/lib/cjs/nip47.js.map +2 -2
  27. package/lib/cjs/nip57.js.map +2 -2
  28. package/lib/cjs/nip75.js.map +1 -1
  29. package/lib/cjs/nip94.js.map +1 -1
  30. package/lib/cjs/nip96.js +3 -5
  31. package/lib/cjs/nip96.js.map +2 -2
  32. package/lib/cjs/nip98.js.map +2 -2
  33. package/lib/cjs/nip99.js.map +1 -1
  34. package/lib/cjs/pool.js +9 -6
  35. package/lib/cjs/pool.js.map +2 -2
  36. package/lib/cjs/pure.js.map +2 -2
  37. package/lib/cjs/references.js.map +2 -2
  38. package/lib/cjs/relay.js +9 -6
  39. package/lib/cjs/relay.js.map +2 -2
  40. package/lib/cjs/utils.js.map +2 -2
  41. package/lib/esm/abstract-pool.js +9 -6
  42. package/lib/esm/abstract-pool.js.map +2 -2
  43. package/lib/esm/abstract-relay.js +9 -6
  44. package/lib/esm/abstract-relay.js.map +2 -2
  45. package/lib/esm/filter.js.map +2 -2
  46. package/lib/esm/index.js +60 -53
  47. package/lib/esm/index.js.map +3 -3
  48. package/lib/esm/kinds.js.map +2 -2
  49. package/lib/esm/nip04.js.map +2 -2
  50. package/lib/esm/nip11.js.map +2 -2
  51. package/lib/esm/nip13.js.map +2 -2
  52. package/lib/esm/nip18.js.map +2 -2
  53. package/lib/esm/nip19.js.map +2 -2
  54. package/lib/esm/nip21.js.map +2 -2
  55. package/lib/esm/nip25.js.map +2 -2
  56. package/lib/esm/nip27.js.map +2 -2
  57. package/lib/esm/nip28.js.map +2 -2
  58. package/lib/esm/nip29.js.map +2 -2
  59. package/lib/esm/nip30.js.map +2 -2
  60. package/lib/esm/nip42.js.map +1 -1
  61. package/lib/esm/nip44.js +53 -47
  62. package/lib/esm/nip44.js.map +2 -2
  63. package/lib/esm/nip46.js +20 -9
  64. package/lib/esm/nip46.js.map +3 -3
  65. package/lib/esm/nip47.js.map +2 -2
  66. package/lib/esm/nip57.js.map +2 -2
  67. package/lib/esm/nip75.js.map +1 -1
  68. package/lib/esm/nip94.js.map +1 -1
  69. package/lib/esm/nip96.js +5 -5
  70. package/lib/esm/nip96.js.map +3 -3
  71. package/lib/esm/nip98.js.map +2 -2
  72. package/lib/esm/nip99.js.map +1 -1
  73. package/lib/esm/pool.js +9 -6
  74. package/lib/esm/pool.js.map +2 -2
  75. package/lib/esm/pure.js.map +2 -2
  76. package/lib/esm/references.js.map +2 -2
  77. package/lib/esm/relay.js +9 -6
  78. package/lib/esm/relay.js.map +2 -2
  79. package/lib/esm/utils.js.map +2 -2
  80. package/lib/nostr.bundle.js +60 -53
  81. package/lib/nostr.bundle.js.map +3 -3
  82. package/lib/types/abstract-relay.d.ts +1 -0
  83. package/lib/types/nip44.d.ts +27 -53
  84. package/lib/types/nip46.d.ts +2 -1
  85. package/lib/types/nip47.d.ts +6 -3
  86. package/lib/types/nip96.d.ts +2 -0
  87. package/lib/types/test-helpers.d.ts +0 -1
  88. package/lib/types/utils.d.ts +1 -0
  89. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ /// <reference types="bun-types" />
1
2
  import type { Event, EventTemplate, VerifiedEvent, Nostr } from './core.ts';
2
3
  import { type Filter } from './filter.ts';
3
4
  export declare function useWebSocketImplementation(websocketImplementation: any): void;
@@ -1,58 +1,32 @@
1
1
  import { utf8ToBytes } from '@noble/hashes/utils';
2
- declare function encrypt(plaintext: string, conversationKey: Uint8Array, nonce?: Uint8Array): string;
3
- declare function decrypt(payload: string, conversationKey: Uint8Array): string;
4
- export declare const v2: {
5
- utils: {
6
- minPlaintextSize: number;
7
- maxPlaintextSize: number;
8
- utf8Encode: typeof utf8ToBytes;
9
- utf8Decode(bytes: Uint8Array): string;
10
- getConversationKey(privkeyA: string, pubkeyB: string): Uint8Array;
11
- getMessageKeys(conversationKey: Uint8Array, nonce: Uint8Array): {
12
- chacha_key: Uint8Array;
13
- chacha_nonce: Uint8Array;
14
- hmac_key: Uint8Array;
15
- };
16
- calcPaddedLen(len: number): number;
17
- writeU16BE(num: number): Uint8Array;
18
- pad(plaintext: string): Uint8Array;
19
- unpad(padded: Uint8Array): string;
20
- hmacAad(key: Uint8Array, message: Uint8Array, aad: Uint8Array): Uint8Array;
21
- decodePayload(payload: string): {
22
- nonce: Uint8Array;
23
- ciphertext: Uint8Array;
24
- mac: Uint8Array;
25
- };
2
+ declare class u {
3
+ static minPlaintextSize: number;
4
+ static maxPlaintextSize: number;
5
+ static utf8Encode: typeof utf8ToBytes;
6
+ static utf8Decode(bytes: Uint8Array): string;
7
+ static getConversationKey(privkeyA: string, pubkeyB: string): Uint8Array;
8
+ static getMessageKeys(conversationKey: Uint8Array, nonce: Uint8Array): {
9
+ chacha_key: Uint8Array;
10
+ chacha_nonce: Uint8Array;
11
+ hmac_key: Uint8Array;
26
12
  };
27
- encrypt: typeof encrypt;
28
- decrypt: typeof decrypt;
29
- };
30
- declare const _default: {
31
- v2: {
32
- utils: {
33
- minPlaintextSize: number;
34
- maxPlaintextSize: number;
35
- utf8Encode: typeof utf8ToBytes;
36
- utf8Decode(bytes: Uint8Array): string;
37
- getConversationKey(privkeyA: string, pubkeyB: string): Uint8Array;
38
- getMessageKeys(conversationKey: Uint8Array, nonce: Uint8Array): {
39
- chacha_key: Uint8Array;
40
- chacha_nonce: Uint8Array;
41
- hmac_key: Uint8Array;
42
- };
43
- calcPaddedLen(len: number): number;
44
- writeU16BE(num: number): Uint8Array;
45
- pad(plaintext: string): Uint8Array;
46
- unpad(padded: Uint8Array): string;
47
- hmacAad(key: Uint8Array, message: Uint8Array, aad: Uint8Array): Uint8Array;
48
- decodePayload(payload: string): {
49
- nonce: Uint8Array;
50
- ciphertext: Uint8Array;
51
- mac: Uint8Array;
52
- };
53
- };
54
- encrypt: typeof encrypt;
55
- decrypt: typeof decrypt;
13
+ static calcPaddedLen(len: number): number;
14
+ static writeU16BE(num: number): Uint8Array;
15
+ static pad(plaintext: string): Uint8Array;
16
+ static unpad(padded: Uint8Array): string;
17
+ static hmacAad(key: Uint8Array, message: Uint8Array, aad: Uint8Array): Uint8Array;
18
+ static decodePayload(payload: string): {
19
+ nonce: Uint8Array;
20
+ ciphertext: Uint8Array;
21
+ mac: Uint8Array;
56
22
  };
23
+ }
24
+ export declare class v2 {
25
+ static utils: typeof u;
26
+ static encrypt(plaintext: string, conversationKey: Uint8Array, nonce?: Uint8Array): string;
27
+ static decrypt(payload: string, conversationKey: Uint8Array): string;
28
+ }
29
+ declare const _default: {
30
+ v2: typeof v2;
57
31
  };
58
32
  export default _default;
@@ -78,11 +78,12 @@ export declare class BunkerSigner {
78
78
  * @returns A Promise that resolves to the auth_url that the client should follow to create an account.
79
79
  */
80
80
  export declare function createAccount(bunker: BunkerProfile, params: BunkerSignerParams, username: string, domain: string, email?: string): Promise<BunkerSigner>;
81
+ export declare const fetchCustodialBunkers: typeof fetchBunkerProviders;
81
82
  /**
82
83
  * Fetches info on available providers that announce themselves using NIP-89 events.
83
84
  * @returns A promise that resolves to an array of available bunker objects.
84
85
  */
85
- export declare function fetchCustodialBunkers(pool: AbstractSimplePool, relays: string[]): Promise<BunkerProfile[]>;
86
+ export declare function fetchBunkerProviders(pool: AbstractSimplePool, relays: string[]): Promise<BunkerProfile[]>;
86
87
  export type BunkerProfile = {
87
88
  bunkerPointer: BunkerPointer;
88
89
  domain: string;
@@ -1,6 +1,9 @@
1
- export declare function parseConnectionString(connectionString: string): {
1
+ import { type VerifiedEvent } from './pure.ts';
2
+ interface NWCConnection {
2
3
  pubkey: string;
3
4
  relay: string;
4
5
  secret: string;
5
- };
6
- export declare function makeNwcRequestEvent(pubkey: string, secretKey: Uint8Array, invoice: string): Promise<import("./core.ts").VerifiedEvent>;
6
+ }
7
+ export declare function parseConnectionString(connectionString: string): NWCConnection;
8
+ export declare function makeNwcRequestEvent(pubkey: string, secretKey: Uint8Array, invoice: string): Promise<VerifiedEvent>;
9
+ export {};
@@ -1,3 +1,5 @@
1
+ /// <reference types="bun-types" />
2
+ /// <reference types="node" />
1
3
  import { EventTemplate } from './core';
2
4
  /**
3
5
  * Represents the configuration for a server compliant with NIP-96.
@@ -1,4 +1,3 @@
1
- /// <reference types="mock-socket/index" />
2
1
  import { WebSocket } from 'mock-socket';
3
2
  import { type Event } from './pure.ts';
4
3
  export declare const MockWebSocketClient: typeof WebSocket;
@@ -1,3 +1,4 @@
1
+ /// <reference types="bun-types" />
1
2
  import type { Event } from './core.ts';
2
3
  export declare const utf8Decoder: TextDecoder;
3
4
  export declare const utf8Encoder: TextEncoder;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "nostr-tools",
4
- "version": "2.3.0",
4
+ "version": "2.3.2",
5
5
  "description": "Tools for making a Nostr client.",
6
6
  "repository": {
7
7
  "type": "git",