nostr-crypto-utils 0.4.14 → 0.4.15

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 (173) hide show
  1. package/package.json +10 -27
  2. package/dist/esm/__tests__/setup.d.ts +0 -6
  3. package/dist/esm/__tests__/setup.d.ts.map +0 -1
  4. package/dist/esm/constants.d.ts +0 -50
  5. package/dist/esm/constants.d.ts.map +0 -1
  6. package/dist/esm/core/constants.d.ts +0 -90
  7. package/dist/esm/core/constants.d.ts.map +0 -1
  8. package/dist/esm/core/errors.d.ts +0 -78
  9. package/dist/esm/core/errors.d.ts.map +0 -1
  10. package/dist/esm/core/index.d.ts +0 -8
  11. package/dist/esm/core/index.d.ts.map +0 -1
  12. package/dist/esm/core/types/crypto.d.ts +0 -46
  13. package/dist/esm/core/types/crypto.d.ts.map +0 -1
  14. package/dist/esm/core/types/events.d.ts +0 -59
  15. package/dist/esm/core/types/events.d.ts.map +0 -1
  16. package/dist/esm/core/types/index.d.ts +0 -8
  17. package/dist/esm/core/types/index.d.ts.map +0 -1
  18. package/dist/esm/core/types/protocol.d.ts +0 -73
  19. package/dist/esm/core/types/protocol.d.ts.map +0 -1
  20. package/dist/esm/crypto-utils.d.ts +0 -8
  21. package/dist/esm/crypto-utils.d.ts.map +0 -1
  22. package/dist/esm/crypto.d.ts +0 -106
  23. package/dist/esm/crypto.d.ts.map +0 -1
  24. package/dist/esm/encoding/base64.d.ts +0 -94
  25. package/dist/esm/encoding/base64.d.ts.map +0 -1
  26. package/dist/esm/encoding/binary.d.ts +0 -97
  27. package/dist/esm/encoding/binary.d.ts.map +0 -1
  28. package/dist/esm/encoding/hex.d.ts +0 -93
  29. package/dist/esm/encoding/hex.d.ts.map +0 -1
  30. package/dist/esm/encoding/index.d.ts +0 -23
  31. package/dist/esm/encoding/index.d.ts.map +0 -1
  32. package/dist/esm/event/creation.d.ts +0 -30
  33. package/dist/esm/event/creation.d.ts.map +0 -1
  34. package/dist/esm/event/index.d.ts +0 -7
  35. package/dist/esm/event/index.d.ts.map +0 -1
  36. package/dist/esm/event/signing.d.ts +0 -31
  37. package/dist/esm/event/signing.d.ts.map +0 -1
  38. package/dist/esm/index.d.ts +0 -15
  39. package/dist/esm/index.d.ts.map +0 -1
  40. package/dist/esm/integration/index.d.ts +0 -14
  41. package/dist/esm/integration/index.d.ts.map +0 -1
  42. package/dist/esm/nips/index.d.ts +0 -20
  43. package/dist/esm/nips/index.d.ts.map +0 -1
  44. package/dist/esm/nips/nip-01.d.ts +0 -56
  45. package/dist/esm/nips/nip-01.d.ts.map +0 -1
  46. package/dist/esm/nips/nip-04.d.ts +0 -42
  47. package/dist/esm/nips/nip-04.d.ts.map +0 -1
  48. package/dist/esm/nips/nip-19.d.ts +0 -77
  49. package/dist/esm/nips/nip-19.d.ts.map +0 -1
  50. package/dist/esm/nips/nip-26.d.ts +0 -51
  51. package/dist/esm/nips/nip-26.d.ts.map +0 -1
  52. package/dist/esm/protocol/constants.d.ts +0 -100
  53. package/dist/esm/protocol/constants.d.ts.map +0 -1
  54. package/dist/esm/protocol/index.d.ts +0 -124
  55. package/dist/esm/protocol/index.d.ts.map +0 -1
  56. package/dist/esm/protocol/transport.d.ts +0 -15
  57. package/dist/esm/protocol/transport.d.ts.map +0 -1
  58. package/dist/esm/transport/index.d.ts +0 -31
  59. package/dist/esm/transport/index.d.ts.map +0 -1
  60. package/dist/esm/types/base.d.ts +0 -124
  61. package/dist/esm/types/base.d.ts.map +0 -1
  62. package/dist/esm/types/guards.d.ts +0 -30
  63. package/dist/esm/types/guards.d.ts.map +0 -1
  64. package/dist/esm/types/index.d.ts +0 -75
  65. package/dist/esm/types/index.d.ts.map +0 -1
  66. package/dist/esm/types/messages.d.ts +0 -3
  67. package/dist/esm/types/messages.d.ts.map +0 -1
  68. package/dist/esm/types/protocol.d.ts +0 -7
  69. package/dist/esm/types/protocol.d.ts.map +0 -1
  70. package/dist/esm/utils/encoding.d.ts +0 -28
  71. package/dist/esm/utils/encoding.d.ts.map +0 -1
  72. package/dist/esm/utils/events.d.ts +0 -36
  73. package/dist/esm/utils/events.d.ts.map +0 -1
  74. package/dist/esm/utils/functions.d.ts +0 -40
  75. package/dist/esm/utils/functions.d.ts.map +0 -1
  76. package/dist/esm/utils/index.d.ts +0 -9
  77. package/dist/esm/utils/index.d.ts.map +0 -1
  78. package/dist/esm/utils/integration.d.ts +0 -77
  79. package/dist/esm/utils/integration.d.ts.map +0 -1
  80. package/dist/esm/utils/logger.d.ts +0 -40
  81. package/dist/esm/utils/logger.d.ts.map +0 -1
  82. package/dist/esm/utils/validation.d.ts +0 -62
  83. package/dist/esm/utils/validation.d.ts.map +0 -1
  84. package/dist/esm/validation/index.d.ts +0 -111
  85. package/dist/esm/validation/index.d.ts.map +0 -1
  86. package/dist/esm/validation/keys.d.ts +0 -7
  87. package/dist/esm/validation/keys.d.ts.map +0 -1
  88. /package/dist/{cjs → types}/__tests__/setup.d.ts +0 -0
  89. /package/dist/{cjs → types}/__tests__/setup.d.ts.map +0 -0
  90. /package/dist/{cjs → types}/constants.d.ts +0 -0
  91. /package/dist/{cjs → types}/constants.d.ts.map +0 -0
  92. /package/dist/{cjs → types}/core/constants.d.ts +0 -0
  93. /package/dist/{cjs → types}/core/constants.d.ts.map +0 -0
  94. /package/dist/{cjs → types}/core/errors.d.ts +0 -0
  95. /package/dist/{cjs → types}/core/errors.d.ts.map +0 -0
  96. /package/dist/{cjs → types}/core/index.d.ts +0 -0
  97. /package/dist/{cjs → types}/core/index.d.ts.map +0 -0
  98. /package/dist/{cjs → types}/core/types/crypto.d.ts +0 -0
  99. /package/dist/{cjs → types}/core/types/crypto.d.ts.map +0 -0
  100. /package/dist/{cjs → types}/core/types/events.d.ts +0 -0
  101. /package/dist/{cjs → types}/core/types/events.d.ts.map +0 -0
  102. /package/dist/{cjs → types}/core/types/index.d.ts +0 -0
  103. /package/dist/{cjs → types}/core/types/index.d.ts.map +0 -0
  104. /package/dist/{cjs → types}/core/types/protocol.d.ts +0 -0
  105. /package/dist/{cjs → types}/core/types/protocol.d.ts.map +0 -0
  106. /package/dist/{cjs → types}/crypto-utils.d.ts +0 -0
  107. /package/dist/{cjs → types}/crypto-utils.d.ts.map +0 -0
  108. /package/dist/{cjs → types}/crypto.d.ts +0 -0
  109. /package/dist/{cjs → types}/crypto.d.ts.map +0 -0
  110. /package/dist/{cjs → types}/encoding/base64.d.ts +0 -0
  111. /package/dist/{cjs → types}/encoding/base64.d.ts.map +0 -0
  112. /package/dist/{cjs → types}/encoding/binary.d.ts +0 -0
  113. /package/dist/{cjs → types}/encoding/binary.d.ts.map +0 -0
  114. /package/dist/{cjs → types}/encoding/hex.d.ts +0 -0
  115. /package/dist/{cjs → types}/encoding/hex.d.ts.map +0 -0
  116. /package/dist/{cjs → types}/encoding/index.d.ts +0 -0
  117. /package/dist/{cjs → types}/encoding/index.d.ts.map +0 -0
  118. /package/dist/{cjs → types}/event/creation.d.ts +0 -0
  119. /package/dist/{cjs → types}/event/creation.d.ts.map +0 -0
  120. /package/dist/{cjs → types}/event/index.d.ts +0 -0
  121. /package/dist/{cjs → types}/event/index.d.ts.map +0 -0
  122. /package/dist/{cjs → types}/event/signing.d.ts +0 -0
  123. /package/dist/{cjs → types}/event/signing.d.ts.map +0 -0
  124. /package/dist/{cjs → types}/index.d.ts +0 -0
  125. /package/dist/{cjs → types}/index.d.ts.map +0 -0
  126. /package/dist/{cjs → types}/integration/index.d.ts +0 -0
  127. /package/dist/{cjs → types}/integration/index.d.ts.map +0 -0
  128. /package/dist/{cjs → types}/nips/index.d.ts +0 -0
  129. /package/dist/{cjs → types}/nips/index.d.ts.map +0 -0
  130. /package/dist/{cjs → types}/nips/nip-01.d.ts +0 -0
  131. /package/dist/{cjs → types}/nips/nip-01.d.ts.map +0 -0
  132. /package/dist/{cjs → types}/nips/nip-04.d.ts +0 -0
  133. /package/dist/{cjs → types}/nips/nip-04.d.ts.map +0 -0
  134. /package/dist/{cjs → types}/nips/nip-19.d.ts +0 -0
  135. /package/dist/{cjs → types}/nips/nip-19.d.ts.map +0 -0
  136. /package/dist/{cjs → types}/nips/nip-26.d.ts +0 -0
  137. /package/dist/{cjs → types}/nips/nip-26.d.ts.map +0 -0
  138. /package/dist/{cjs → types}/protocol/constants.d.ts +0 -0
  139. /package/dist/{cjs → types}/protocol/constants.d.ts.map +0 -0
  140. /package/dist/{cjs → types}/protocol/index.d.ts +0 -0
  141. /package/dist/{cjs → types}/protocol/index.d.ts.map +0 -0
  142. /package/dist/{cjs → types}/protocol/transport.d.ts +0 -0
  143. /package/dist/{cjs → types}/protocol/transport.d.ts.map +0 -0
  144. /package/dist/{cjs → types}/transport/index.d.ts +0 -0
  145. /package/dist/{cjs → types}/transport/index.d.ts.map +0 -0
  146. /package/dist/{cjs → types}/types/base.d.ts +0 -0
  147. /package/dist/{cjs → types}/types/base.d.ts.map +0 -0
  148. /package/dist/{cjs → types}/types/guards.d.ts +0 -0
  149. /package/dist/{cjs → types}/types/guards.d.ts.map +0 -0
  150. /package/dist/{cjs → types}/types/index.d.ts +0 -0
  151. /package/dist/{cjs → types}/types/index.d.ts.map +0 -0
  152. /package/dist/{cjs → types}/types/messages.d.ts +0 -0
  153. /package/dist/{cjs → types}/types/messages.d.ts.map +0 -0
  154. /package/dist/{cjs → types}/types/protocol.d.ts +0 -0
  155. /package/dist/{cjs → types}/types/protocol.d.ts.map +0 -0
  156. /package/dist/{cjs → types}/utils/encoding.d.ts +0 -0
  157. /package/dist/{cjs → types}/utils/encoding.d.ts.map +0 -0
  158. /package/dist/{cjs → types}/utils/events.d.ts +0 -0
  159. /package/dist/{cjs → types}/utils/events.d.ts.map +0 -0
  160. /package/dist/{cjs → types}/utils/functions.d.ts +0 -0
  161. /package/dist/{cjs → types}/utils/functions.d.ts.map +0 -0
  162. /package/dist/{cjs → types}/utils/index.d.ts +0 -0
  163. /package/dist/{cjs → types}/utils/index.d.ts.map +0 -0
  164. /package/dist/{cjs → types}/utils/integration.d.ts +0 -0
  165. /package/dist/{cjs → types}/utils/integration.d.ts.map +0 -0
  166. /package/dist/{cjs → types}/utils/logger.d.ts +0 -0
  167. /package/dist/{cjs → types}/utils/logger.d.ts.map +0 -0
  168. /package/dist/{cjs → types}/utils/validation.d.ts +0 -0
  169. /package/dist/{cjs → types}/utils/validation.d.ts.map +0 -0
  170. /package/dist/{cjs → types}/validation/index.d.ts +0 -0
  171. /package/dist/{cjs → types}/validation/index.d.ts.map +0 -0
  172. /package/dist/{cjs → types}/validation/keys.d.ts +0 -0
  173. /package/dist/{cjs → types}/validation/keys.d.ts.map +0 -0
@@ -1,94 +0,0 @@
1
- /**
2
- * Base64 encoding utilities for Nostr
3
- * Provides consistent base64 encoding/decoding across all Nostr-related projects
4
- */
5
- /**
6
- * Convert string to base64
7
- * @param str String to convert
8
- * @returns Base64 string
9
- */
10
- export declare function stringToBase64(str: string): string;
11
- /**
12
- * Convert base64 to string
13
- * @param base64 Base64 string to convert
14
- * @returns UTF-8 string
15
- * @throws Error if base64 string is invalid
16
- */
17
- export declare function base64ToString(base64: string): string;
18
- /**
19
- * Convert buffer to base64
20
- * @param buffer Buffer to convert
21
- * @returns Base64 string
22
- */
23
- export declare function bufferToBase64(buffer: Buffer): string;
24
- /**
25
- * Convert base64 to buffer
26
- * @param base64 Base64 string to convert
27
- * @returns Buffer
28
- * @throws Error if base64 string is invalid
29
- */
30
- export declare function base64ToBuffer(base64: string): Buffer;
31
- /**
32
- * Check if string is valid base64
33
- * @param base64 String to check
34
- * @returns True if valid base64
35
- */
36
- export declare function isValidBase64(base64: string): boolean;
37
- /**
38
- * Convert base64 to URL-safe base64
39
- * @param base64 Standard base64 string
40
- * @returns URL-safe base64 string
41
- */
42
- export declare function toBase64Url(base64: string): string;
43
- /**
44
- * Convert URL-safe base64 to standard base64
45
- * @param base64url URL-safe base64 string
46
- * @returns Standard base64 string
47
- */
48
- export declare function fromBase64Url(base64url: string): string;
49
- /**
50
- * Convert hex string to base64
51
- * @param hex Hex string to convert
52
- * @returns Base64 string
53
- * @throws Error if hex string is invalid
54
- */
55
- export declare function hexToBase64(hex: string): string;
56
- /**
57
- * Convert base64 to hex string
58
- * @param base64 Base64 string to convert
59
- * @returns Hex string
60
- * @throws Error if base64 string is invalid
61
- */
62
- export declare function base64ToHex(base64: string): string;
63
- /**
64
- * Create base64 string from byte array
65
- * @param bytes Byte array
66
- * @returns Base64 string
67
- */
68
- export declare function bytesToBase64(bytes: Uint8Array): string;
69
- /**
70
- * Convert base64 to byte array
71
- * @param base64 Base64 string
72
- * @returns Byte array
73
- * @throws Error if base64 string is invalid
74
- */
75
- export declare function base64ToBytes(base64: string): Uint8Array;
76
- /**
77
- * Calculate padded length for base64 string
78
- * @param dataLength Length of raw data
79
- * @returns Length of padded base64 string
80
- */
81
- export declare function calculateBase64Length(dataLength: number): number;
82
- /**
83
- * Remove base64 padding
84
- * @param base64 Base64 string
85
- * @returns Base64 string without padding
86
- */
87
- export declare function removeBase64Padding(base64: string): string;
88
- /**
89
- * Add base64 padding
90
- * @param base64 Base64 string without padding
91
- * @returns Properly padded base64 string
92
- */
93
- export declare function addBase64Padding(base64: string): string;
94
- //# sourceMappingURL=base64.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../../src/encoding/base64.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKrD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKrD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAMrD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAIvD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKlD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAEvD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAKxD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAGvD"}
@@ -1,97 +0,0 @@
1
- /**
2
- * Binary data handling utilities for Nostr
3
- * Provides consistent binary data handling across all Nostr-related projects
4
- */
5
- /**
6
- * Convert string to byte array
7
- * @param str String to convert
8
- * @returns Byte array
9
- */
10
- export declare function stringToBytes(str: string): Uint8Array;
11
- /**
12
- * Convert byte array to string
13
- * @param bytes Byte array to convert
14
- * @returns UTF-8 string
15
- */
16
- export declare function bytesToString(bytes: Uint8Array): string;
17
- /**
18
- * Convert buffer to byte array
19
- * @param buffer Buffer to convert
20
- * @returns Byte array
21
- */
22
- export declare function bufferToBytes(buffer: Buffer): Uint8Array;
23
- /**
24
- * Convert byte array to buffer
25
- * @param bytes Byte array to convert
26
- * @returns Buffer
27
- */
28
- export declare function bytesToBuffer(bytes: Uint8Array): Buffer;
29
- /**
30
- * Concatenate multiple byte arrays
31
- * @param arrays Arrays to concatenate
32
- * @returns Concatenated byte array
33
- */
34
- export declare function concatenateBytes(arrays: Uint8Array[]): Uint8Array;
35
- /**
36
- * Compare two byte arrays for equality
37
- * @param a First byte array
38
- * @param b Second byte array
39
- * @returns True if arrays are equal
40
- */
41
- export declare function compareBytes(a: Uint8Array, b: Uint8Array): boolean;
42
- /**
43
- * Create byte array filled with zeros
44
- * @param length Length of array
45
- * @returns Zero-filled byte array
46
- */
47
- export declare function zeroBytes(length: number): Uint8Array;
48
- /**
49
- * Create byte array with random values
50
- * @param length Length of array
51
- * @returns Random byte array
52
- */
53
- export declare function randomBytes(length: number): Uint8Array;
54
- /**
55
- * Convert number to byte array
56
- * @param num Number to convert
57
- * @param length Length of resulting array (default: minimum needed)
58
- * @param littleEndian Whether to use little-endian encoding (default: false)
59
- * @returns Byte array
60
- */
61
- export declare function numberToBytes(num: number, length?: number, littleEndian?: boolean): Uint8Array;
62
- /**
63
- * Convert byte array to number
64
- * @param bytes Byte array to convert
65
- * @param littleEndian Whether to use little-endian encoding (default: false)
66
- * @returns Number
67
- * @throws Error if number is larger than MAX_SAFE_INTEGER
68
- */
69
- export declare function bytesToNumber(bytes: Uint8Array, littleEndian?: boolean): number;
70
- /**
71
- * Split byte array into chunks
72
- * @param bytes Byte array to split
73
- * @param chunkSize Size of each chunk
74
- * @returns Array of byte arrays
75
- */
76
- export declare function splitBytes(bytes: Uint8Array, chunkSize: number): Uint8Array[];
77
- /**
78
- * Create a view of the byte array without copying
79
- * @param bytes Source byte array
80
- * @param start Start index
81
- * @param end End index
82
- * @returns View of the byte array
83
- */
84
- export declare function bytesView(bytes: Uint8Array, start?: number, end?: number): Uint8Array;
85
- /**
86
- * Check if value is a valid byte array
87
- * @param value Value to check
88
- * @returns True if value is a Uint8Array
89
- */
90
- export declare function isByteArray(value: unknown): value is Uint8Array;
91
- /**
92
- * Create a copy of a byte array
93
- * @param bytes Byte array to copy
94
- * @returns Copy of the byte array
95
- */
96
- export declare function copyBytes(bytes: Uint8Array): Uint8Array;
97
- //# sourceMappingURL=binary.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"binary.d.ts","sourceRoot":"","sources":["../../../src/encoding/binary.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAErD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAEvD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAExD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAEvD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAWjE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,OAAO,CAGlE;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAItD;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,MAAM,EACf,YAAY,UAAQ,GACnB,UAAU,CAkBZ;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,YAAY,UAAQ,GAAG,MAAM,CAc7E;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU,EAAE,CAQ7E;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,UAAU,EACjB,KAAK,CAAC,EAAE,MAAM,EACd,GAAG,CAAC,EAAE,MAAM,GACX,UAAU,CAGZ;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAE/D;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAEvD"}
@@ -1,93 +0,0 @@
1
- /**
2
- * Hex encoding utilities for Nostr
3
- * Provides consistent hex encoding/decoding across all Nostr-related projects
4
- */
5
- /**
6
- * Convert a string to hex format
7
- * @param str String to convert to hex
8
- * @returns Hex string
9
- */
10
- export declare function stringToHex(str: string): string;
11
- /**
12
- * Convert hex string to UTF-8 string
13
- * @param hex Hex string to convert
14
- * @returns UTF-8 string
15
- * @throws Error if hex string is invalid
16
- */
17
- export declare function hexToString(hex: string): string;
18
- /**
19
- * Convert buffer to hex string
20
- * @param buffer Buffer to convert
21
- * @returns Hex string
22
- */
23
- export declare function bufferToHex(buffer: Buffer): string;
24
- /**
25
- * Convert hex string to buffer
26
- * @param hex Hex string to convert
27
- * @returns Buffer
28
- * @throws Error if hex string is invalid
29
- */
30
- export declare function hexToBuffer(hex: string): Buffer;
31
- /**
32
- * Check if string is valid hex
33
- * @param hex String to check
34
- * @returns True if valid hex
35
- */
36
- export declare function isValidHex(hex: string): boolean;
37
- /**
38
- * Normalize hex string (lowercase, no 0x prefix)
39
- * @param hex Hex string to normalize
40
- * @returns Normalized hex string
41
- * @throws Error if hex string is invalid
42
- */
43
- export declare function normalizeHex(hex: string): string;
44
- /**
45
- * Add 0x prefix to hex string if not present
46
- * @param hex Hex string
47
- * @returns Hex string with 0x prefix
48
- * @throws Error if hex string is invalid
49
- */
50
- export declare function addHexPrefix(hex: string): string;
51
- /**
52
- * Remove 0x prefix from hex string if present
53
- * @param hex Hex string
54
- * @returns Hex string without 0x prefix
55
- */
56
- export declare function removeHexPrefix(hex: string): string;
57
- /**
58
- * Pad hex string to specified length
59
- * @param hex Hex string to pad
60
- * @param length Desired length in bytes (will be doubled for hex chars)
61
- * @param padEnd Whether to pad at end (default: false, pad at start)
62
- * @returns Padded hex string
63
- */
64
- export declare function padHex(hex: string, length: number, padEnd?: boolean): string;
65
- /**
66
- * Convert number to hex string
67
- * @param num Number to convert
68
- * @param padToBytes Optional padding length in bytes
69
- * @returns Hex string
70
- */
71
- export declare function numberToHex(num: number, padToBytes?: number): string;
72
- /**
73
- * Convert hex string to number
74
- * @param hex Hex string to convert
75
- * @returns Number
76
- * @throws Error if hex string is invalid or too large
77
- */
78
- export declare function hexToNumber(hex: string): number;
79
- /**
80
- * Concatenate multiple hex strings
81
- * @param hexStrings Array of hex strings to concatenate
82
- * @returns Concatenated hex string
83
- * @throws Error if any hex string is invalid
84
- */
85
- export declare function concatenateHex(hexStrings: string[]): string;
86
- /**
87
- * Split hex string into chunks of specified size
88
- * @param hex Hex string to split
89
- * @param chunkSize Size of each chunk in bytes
90
- * @returns Array of hex strings
91
- */
92
- export declare function splitHex(hex: string, chunkSize: number): string[];
93
- //# sourceMappingURL=hex.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hex.d.ts","sourceRoot":"","sources":["../../../src/encoding/hex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAOhD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGhD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAAQ,GAAG,MAAM,CAQ1E;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAGpE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAO/C;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,CAE3D;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAUjE"}
@@ -1,23 +0,0 @@
1
- /**
2
- * Encoding utilities for Nostr
3
- * @module encoding
4
- */
5
- /**
6
- * Utility functions for encoding and decoding data
7
- */
8
- export * from './hex';
9
- export * from './base64';
10
- export * from './binary';
11
- /**
12
- * Convert a hex string to Uint8Array
13
- * @param hex Hex string to convert
14
- * @returns Uint8Array of bytes
15
- */
16
- export declare function hexToBytes(hex: string): Uint8Array;
17
- /**
18
- * Convert Uint8Array to hex string
19
- * @param bytes Uint8Array to convert
20
- * @returns Hex string
21
- */
22
- export declare function bytesToHex(bytes: Uint8Array): string;
23
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/encoding/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AAEzB;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAMlD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAIpD"}
@@ -1,30 +0,0 @@
1
- /**
2
- * @module event/creation
3
- * @description Event creation and serialization utilities for Nostr
4
- */
5
- import type { NostrEvent, NostrEventKind } from '../types/index';
6
- /**
7
- * Creates a new Nostr event with the specified parameters
8
- * @param params - Event parameters
9
- * @returns Created event
10
- */
11
- export declare function createEvent(params: {
12
- kind: NostrEventKind;
13
- content: string;
14
- tags?: string[][];
15
- created_at?: number;
16
- pubkey?: string;
17
- }): NostrEvent;
18
- /**
19
- * Serializes a Nostr event for signing/hashing (NIP-01)
20
- * @param event - Event to serialize
21
- * @returns Serialized event JSON string
22
- */
23
- export declare function serializeEvent(event: NostrEvent): string;
24
- /**
25
- * Calculates the hash of a Nostr event (NIP-01)
26
- * @param event - Event to hash
27
- * @returns Event hash in hex format
28
- */
29
- export declare function getEventHash(event: NostrEvent): Promise<string>;
30
- //# sourceMappingURL=creation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"creation.d.ts","sourceRoot":"","sources":["../../../src/event/creation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEjE;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE;IAClC,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,UAAU,CAgBb;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CASxD;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CASrE"}
@@ -1,7 +0,0 @@
1
- /**
2
- * @module event
3
- * @description Event handling utilities for Nostr
4
- */
5
- export { createEvent, serializeEvent, getEventHash } from './creation';
6
- export { validateEvent, calculateEventId } from './signing';
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/event/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
@@ -1,31 +0,0 @@
1
- /**
2
- * @module event/signing
3
- * @description Event signing and verification utilities for Nostr
4
- */
5
- import type { NostrEvent, SignedNostrEvent } from '../types';
6
- /**
7
- * Signs a Nostr event with a private key (NIP-01)
8
- * @param event - Event to sign
9
- * @param privateKey - Private key in hex format
10
- * @returns Signed event
11
- */
12
- export declare function signEvent(event: NostrEvent, privateKey: string): Promise<SignedNostrEvent>;
13
- /**
14
- * Verifies the signature of a signed Nostr event (NIP-01)
15
- * @param event - Event to verify
16
- * @returns True if signature is valid
17
- */
18
- export declare function verifySignature(event: SignedNostrEvent): boolean;
19
- /**
20
- * Validates a Nostr event
21
- * @param event - Event to validate
22
- * @returns True if event is valid
23
- */
24
- export declare function validateEvent(event: SignedNostrEvent): boolean;
25
- /**
26
- * Calculates the event ID for a Nostr event
27
- * @param event - Event to calculate ID for
28
- * @returns Event ID
29
- */
30
- export declare function calculateEventId(event: NostrEvent): Promise<string>;
31
- //# sourceMappingURL=signing.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"signing.d.ts","sourceRoot":"","sources":["../../../src/event/signing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE7D;;;;;GAKG;AACH,wBAAsB,SAAS,CAC7B,KAAK,EAAE,UAAU,EACjB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,gBAAgB,CAAC,CAc3B;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAWhE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAa9D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAEnE"}
@@ -1,15 +0,0 @@
1
- /**
2
- * @module nostr-crypto-utils
3
- * @description Core cryptographic utilities for Nostr protocol
4
- */
5
- export type { NostrEvent, UnsignedNostrEvent, SignedNostrEvent, NostrFilter, NostrSubscription, PublicKey, KeyPair, NostrMessageTuple, } from './types';
6
- export { NostrEventKind, NostrMessageType } from './types';
7
- export { generateKeyPair, getPublicKey, validateKeyPair, createEvent, signEvent, verifySignature, encrypt, decrypt, } from './crypto';
8
- export { validateEvent, calculateEventId, } from './event';
9
- export { computeSharedSecret, encryptMessage, decryptMessage, } from './nips/nip-04';
10
- export * as nip01 from './nips/nip-01';
11
- export * as nip04 from './nips/nip-04';
12
- export * as nip19 from './nips/nip-19';
13
- export * as nip26 from './nips/nip-26';
14
- export { hexToBytes, bytesToHex, utf8ToBytes, bytesToUtf8, } from './utils/encoding';
15
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EACV,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,SAAS,EACT,OAAO,EACP,iBAAiB,GAClB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG3D,OAAO,EACL,eAAe,EACf,YAAY,EACZ,eAAe,EACf,WAAW,EACX,SAAS,EACT,eAAe,EACf,OAAO,EACP,OAAO,GACR,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,aAAa,EACb,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,cAAc,GACf,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AAGvC,OAAO,EACL,UAAU,EACV,UAAU,EACV,WAAW,EACX,WAAW,GACZ,MAAM,kBAAkB,CAAC"}
@@ -1,14 +0,0 @@
1
- /**
2
- * @module integration
3
- * @description Integration tests for Nostr crypto utilities
4
- */
5
- import { SignedNostrEvent } from '../types/index.js';
6
- /**
7
- * Create and sign a test event
8
- */
9
- export declare function createTestEvent(): Promise<SignedNostrEvent>;
10
- /**
11
- * Verify a test event
12
- */
13
- export declare function verifyTestEvent(event: SignedNostrEvent): Promise<boolean>;
14
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integration/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAc,gBAAgB,EAAkB,MAAM,mBAAmB,CAAC;AAEjF;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAUjE;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,CAE/E"}
@@ -1,20 +0,0 @@
1
- /**
2
- * @module nips
3
- * @description Exports for all NIP implementations
4
- */
5
- export { npubEncode, nsecEncode, noteEncode, nprofileEncode, neventEncode, naddrEncode, nrelayEncode, decode, type Nip19Data, type Nip19DataType } from './nip-19';
6
- /**
7
- * @module nips
8
- * @description Core NIP implementations for cryptographic operations
9
- *
10
- * Includes:
11
- * - NIP-01: Basic protocol flow description
12
- * - NIP-04: Encrypted Direct Messages
13
- * - NIP-19: bech32-encoded entities
14
- * - NIP-26: Delegated Event Signing
15
- */
16
- export * from './nip-01';
17
- export * from './nip-04';
18
- export * from './nip-19';
19
- export * from './nip-26';
20
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/nips/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,UAAU,EACV,UAAU,EACV,UAAU,EACV,cAAc,EACd,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,MAAM,EACN,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,UAAU,CAAC;AAElB;;;;;;;;;GASG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
@@ -1,56 +0,0 @@
1
- /**
2
- * @module nips/nip-01
3
- * @description Implementation of NIP-01: Basic Protocol Flow Description
4
- * @see https://github.com/nostr-protocol/nips/blob/master/01.md
5
- */
6
- import type { NostrEvent, SignedNostrEvent } from '../types';
7
- /**
8
- * Creates a new Nostr event with the specified parameters (NIP-01)
9
- * @param params - Event parameters
10
- * @returns Created event
11
- */
12
- export declare function createEvent(params: {
13
- kind: number;
14
- content: string;
15
- tags?: string[][];
16
- created_at?: number;
17
- pubkey?: string;
18
- }): NostrEvent;
19
- /**
20
- * Serializes a Nostr event for signing/hashing (NIP-01)
21
- * @param event - Event to serialize
22
- * @returns Serialized event JSON string
23
- */
24
- export declare function serializeEvent(event: NostrEvent): string;
25
- /**
26
- * Calculates the hash of a Nostr event (NIP-01)
27
- * @param event - Event to hash
28
- * @returns Event hash in hex format
29
- */
30
- export declare function getEventHash(event: NostrEvent): Promise<string>;
31
- /**
32
- * Signs a Nostr event with a private key (NIP-01)
33
- * @param event - Event to sign
34
- * @param privateKey - Private key in hex format
35
- * @returns Signed event
36
- */
37
- export declare function signEvent(event: NostrEvent, privateKey: string): Promise<SignedNostrEvent>;
38
- /**
39
- * Verifies the signature of a signed Nostr event (NIP-01)
40
- * @param event - Event to verify
41
- * @returns True if signature is valid
42
- */
43
- export declare function verifySignature(event: SignedNostrEvent): boolean;
44
- /**
45
- * Calculates the event ID according to NIP-01
46
- * @param event - Event to calculate ID for
47
- * @returns Event ID in hex format
48
- */
49
- export declare function calculateEventId(event: NostrEvent): string;
50
- /**
51
- * Validates a Nostr event structure (NIP-01)
52
- * @param event - Event to validate
53
- * @returns True if event structure is valid
54
- */
55
- export declare function validateEvent(event: NostrEvent): boolean;
56
- //# sourceMappingURL=nip-01.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nip-01.d.ts","sourceRoot":"","sources":["../../../src/nips/nip-01.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE7D;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,UAAU,CAgBb;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CASxD;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CASrE;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAC7B,KAAK,EAAE,UAAU,EACjB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,gBAAgB,CAAC,CAc3B;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAkBhE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAI1D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAoBxD"}
@@ -1,42 +0,0 @@
1
- /**
2
- * @module nips/nip-04
3
- * @description Implementation of NIP-04 (Encrypted Direct Messages)
4
- * @see https://github.com/nostr-protocol/nips/blob/master/04.md
5
- */
6
- import type { CryptoSubtle } from '../crypto';
7
- declare global {
8
- interface Window {
9
- crypto: CryptoSubtle;
10
- }
11
- interface Global {
12
- crypto: CryptoSubtle;
13
- }
14
- }
15
- interface SharedSecret {
16
- sharedSecret: Uint8Array;
17
- }
18
- /**
19
- * Encrypts a message using NIP-04 encryption
20
- * @param message - Message to encrypt
21
- * @param senderPrivKey - Sender's private key
22
- * @param recipientPubKey - Recipient's public key
23
- * @returns Encrypted message string
24
- */
25
- export declare function encryptMessage(message: string, senderPrivKey: string, recipientPubKey: string): Promise<string>;
26
- /**
27
- * Decrypts a message using NIP-04 decryption
28
- * @param encryptedMessage - Encrypted message string
29
- * @param recipientPrivKey - Recipient's private key
30
- * @param senderPubKey - Sender's public key
31
- * @returns Decrypted message string
32
- */
33
- export declare function decryptMessage(encryptedMessage: string, recipientPrivKey: string, senderPubKey: string): Promise<string>;
34
- /**
35
- * Generates a shared secret for NIP-04 encryption
36
- * @param privateKey - Private key
37
- * @param publicKey - Public key
38
- * @returns Shared secret
39
- */
40
- export declare function generateSharedSecret(privateKey: string, publicKey: string): SharedSecret;
41
- export { generateSharedSecret as computeSharedSecret };
42
- //# sourceMappingURL=nip-04.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nip-04.d.ts","sourceRoot":"","sources":["../../../src/nips/nip-04.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAI9C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,YAAY,CAAC;KACtB;IACD,UAAU,MAAM;QACd,MAAM,EAAE,YAAY,CAAC;KACtB;CACF;AAsDD,UAAU,YAAY;IACpB,YAAY,EAAE,UAAU,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,MAAM,CAAC,CAiDjB;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,EAAE,MAAM,EACxB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,MAAM,CAAC,CA8CjB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,YAAY,CAuBd;AAED,OAAO,EAAE,oBAAoB,IAAI,mBAAmB,EAAE,CAAC"}
@@ -1,77 +0,0 @@
1
- /**
2
- * NIP-19: bech32-encoded entities
3
- * Implements encoding and decoding of Nostr entities using bech32 format
4
- */
5
- export type Nip19DataType = 'npub' | 'nsec' | 'note' | 'nprofile' | 'nevent' | 'naddr' | 'nrelay';
6
- export interface Nip19Data {
7
- type: Nip19DataType;
8
- data: string;
9
- relays?: string[];
10
- author?: string;
11
- kind?: number;
12
- identifier?: string;
13
- }
14
- /**
15
- * Encode a public key as an npub
16
- * @param pubkey Public key in hex format
17
- * @returns bech32-encoded npub string
18
- * @throws {Error} If pubkey is invalid
19
- */
20
- export declare function npubEncode(pubkey: string): string;
21
- /**
22
- * Encode a private key as an nsec
23
- * @param privkey Private key in hex format
24
- * @returns bech32-encoded nsec string
25
- * @throws {Error} If privkey is invalid
26
- */
27
- export declare function nsecEncode(privkey: string): string;
28
- /**
29
- * Encode an event ID as a note
30
- * @param eventId Event ID in hex format
31
- * @returns bech32-encoded note string
32
- * @throws {Error} If eventId is invalid
33
- */
34
- export declare function noteEncode(eventId: string): string;
35
- /**
36
- * Encode profile information
37
- * @param pubkey Public key in hex format
38
- * @param relays Optional relay URLs
39
- * @returns bech32-encoded nprofile string
40
- * @throws {Error} If pubkey is invalid or relays are malformed
41
- */
42
- export declare function nprofileEncode(pubkey: string, relays?: string[]): string;
43
- /**
44
- * Encode event information
45
- * @param eventId Event ID in hex format
46
- * @param relays Optional relay URLs
47
- * @param author Optional author public key
48
- * @param kind Optional event kind
49
- * @returns bech32-encoded nevent string
50
- * @throws {Error} If parameters are invalid
51
- */
52
- export declare function neventEncode(eventId: string, relays?: string[], author?: string, kind?: number): string;
53
- /**
54
- * Encode an address (NIP-33)
55
- * @param pubkey Author's public key
56
- * @param kind Event kind
57
- * @param identifier String identifier
58
- * @param relays Optional relay URLs
59
- * @returns bech32-encoded naddr string
60
- * @throws {Error} If parameters are invalid
61
- */
62
- export declare function naddrEncode(pubkey: string, kind: number, identifier: string, relays?: string[]): string;
63
- /**
64
- * Encode a relay URL
65
- * @param url Relay URL
66
- * @returns bech32-encoded nrelay string
67
- * @throws {Error} If URL is invalid
68
- */
69
- export declare function nrelayEncode(url: string): string;
70
- /**
71
- * Decode a bech32-encoded Nostr entity
72
- * @param str bech32-encoded string
73
- * @returns Decoded data with type and metadata
74
- * @throws {Error} If string is invalid or malformed
75
- */
76
- export declare function decode(str: string): Nip19Data;
77
- //# sourceMappingURL=nip-19.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nip-19.d.ts","sourceRoot":"","sources":["../../../src/nips/nip-19.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;AAIlG,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAWD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKjD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKlD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKlD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAYxE;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,EAAE,EACjB,MAAM,CAAC,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,GACZ,MAAM,CAoBR;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,EAAE,GAChB,MAAM,CAoBR;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKhD;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAiD7C"}