nostr-crypto-utils 0.5.0 → 0.5.1

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 (142) hide show
  1. package/README.md +84 -75
  2. package/dist/browser/116.nostr-crypto-utils.min.js +2 -0
  3. package/dist/browser/126.nostr-crypto-utils.min.js +2 -0
  4. package/dist/browser/{330.nostr-crypto-utils.min.js.LICENSE.txt → 126.nostr-crypto-utils.min.js.LICENSE.txt} +2 -0
  5. package/dist/browser/287.nostr-crypto-utils.min.js +1 -1
  6. package/dist/browser/343.nostr-crypto-utils.min.js +1 -0
  7. package/dist/browser/348.nostr-crypto-utils.min.js +2 -0
  8. package/dist/browser/524.nostr-crypto-utils.min.js +1 -0
  9. package/dist/browser/575.nostr-crypto-utils.min.js +2 -0
  10. package/dist/browser/615.nostr-crypto-utils.min.js +2 -0
  11. package/dist/browser/668.nostr-crypto-utils.min.js +1 -1
  12. package/dist/browser/705.nostr-crypto-utils.min.js +1 -1
  13. package/dist/browser/732.nostr-crypto-utils.min.js +1 -0
  14. package/dist/browser/843.nostr-crypto-utils.min.js +2 -0
  15. package/dist/browser/{430.nostr-crypto-utils.min.js.LICENSE.txt → 843.nostr-crypto-utils.min.js.LICENSE.txt} +2 -0
  16. package/dist/browser/crypto.nostr-crypto-utils.min.js +1 -1
  17. package/dist/browser/main-31743c5a.nostr-crypto-utils.min.js +1 -0
  18. package/dist/browser/main-96d4916e.nostr-crypto-utils.min.js +1 -1
  19. package/dist/browser/main-9fdc67c2.nostr-crypto-utils.min.js +1 -0
  20. package/dist/browser/nip-44.nostr-crypto-utils.min.js +2 -0
  21. package/dist/browser/nip-46.nostr-crypto-utils.min.js +2 -0
  22. package/dist/browser/nip-46.nostr-crypto-utils.min.js.LICENSE.txt +1 -0
  23. package/dist/browser/nip-49.nostr-crypto-utils.min.js +1 -0
  24. package/dist/browser/protocol.nostr-crypto-utils.min.js +1 -1
  25. package/dist/browser/validation.nostr-crypto-utils.min.js +1 -1
  26. package/dist/cjs/crypto.js +65 -41
  27. package/dist/cjs/crypto.js.map +1 -1
  28. package/dist/cjs/index.js +5 -3
  29. package/dist/cjs/index.js.map +1 -1
  30. package/dist/cjs/nips/index.js +5 -2
  31. package/dist/cjs/nips/index.js.map +1 -1
  32. package/dist/cjs/nips/nip-04.js +35 -21
  33. package/dist/cjs/nips/nip-04.js.map +1 -1
  34. package/dist/cjs/nips/nip-26.js +14 -13
  35. package/dist/cjs/nips/nip-26.js.map +1 -1
  36. package/dist/cjs/nips/nip-44.js +11 -11
  37. package/dist/cjs/nips/nip-44.js.map +1 -1
  38. package/dist/cjs/nips/nip-46.js +334 -0
  39. package/dist/cjs/nips/nip-46.js.map +1 -0
  40. package/dist/cjs/nips/nip-49.js +3 -3
  41. package/dist/cjs/nips/nip-49.js.map +1 -1
  42. package/dist/cjs/types/index.js +3 -0
  43. package/dist/cjs/types/index.js.map +1 -1
  44. package/dist/cjs/types/nip46.js +24 -0
  45. package/dist/cjs/types/nip46.js.map +1 -0
  46. package/dist/cjs/utils/validation.js +5 -2
  47. package/dist/cjs/utils/validation.js.map +1 -1
  48. package/dist/esm/crypto.js +64 -37
  49. package/dist/esm/crypto.js.map +1 -1
  50. package/dist/esm/index.js +4 -3
  51. package/dist/esm/index.js.map +1 -1
  52. package/dist/esm/nips/index.js +5 -2
  53. package/dist/esm/nips/index.js.map +1 -1
  54. package/dist/esm/nips/nip-04.js +35 -18
  55. package/dist/esm/nips/nip-04.js.map +1 -1
  56. package/dist/esm/nips/nip-26.js +13 -12
  57. package/dist/esm/nips/nip-26.js.map +1 -1
  58. package/dist/esm/nips/nip-44.js +2 -2
  59. package/dist/esm/nips/nip-44.js.map +1 -1
  60. package/dist/esm/nips/nip-46.js +309 -0
  61. package/dist/esm/nips/nip-46.js.map +1 -0
  62. package/dist/esm/nips/nip-49.js +1 -1
  63. package/dist/esm/nips/nip-49.js.map +1 -1
  64. package/dist/esm/types/index.js +3 -0
  65. package/dist/esm/types/index.js.map +1 -1
  66. package/dist/esm/types/nip46.js +21 -0
  67. package/dist/esm/types/nip46.js.map +1 -0
  68. package/dist/esm/utils/validation.js +5 -2
  69. package/dist/esm/utils/validation.js.map +1 -1
  70. package/dist/types/crypto.d.ts +13 -13
  71. package/dist/types/crypto.d.ts.map +1 -1
  72. package/dist/types/index.d.ts +4 -2
  73. package/dist/types/index.d.ts.map +1 -1
  74. package/dist/types/nips/index.d.ts +5 -0
  75. package/dist/types/nips/index.d.ts.map +1 -1
  76. package/dist/types/nips/nip-04.d.ts.map +1 -1
  77. package/dist/types/nips/nip-26.d.ts +3 -3
  78. package/dist/types/nips/nip-26.d.ts.map +1 -1
  79. package/dist/types/nips/nip-44.d.ts.map +1 -1
  80. package/dist/types/nips/nip-46.d.ts +146 -0
  81. package/dist/types/nips/nip-46.d.ts.map +1 -0
  82. package/dist/types/types/index.d.ts +3 -0
  83. package/dist/types/types/index.d.ts.map +1 -1
  84. package/dist/types/types/nip46.d.ts +75 -0
  85. package/dist/types/types/nip46.d.ts.map +1 -0
  86. package/dist/types/utils/validation.d.ts.map +1 -1
  87. package/examples/basic-usage.ts +33 -0
  88. package/examples/nip-04.ts +35 -0
  89. package/examples/nip-19.ts +46 -0
  90. package/package.json +40 -23
  91. package/src/__tests__/nips/nip-44.test.ts +67 -87
  92. package/src/__tests__/nips/nip-46.test.ts +340 -0
  93. package/src/__tests__/nips/nip-49.test.ts +43 -63
  94. package/src/crypto.ts +77 -45
  95. package/src/index.ts +12 -3
  96. package/src/nips/index.ts +6 -3
  97. package/src/nips/nip-04.ts +40 -18
  98. package/src/nips/nip-26.ts +15 -13
  99. package/src/nips/nip-44.ts +7 -3
  100. package/src/nips/nip-46.ts +372 -0
  101. package/src/nips/nip-49.ts +1 -1
  102. package/src/types/index.ts +4 -0
  103. package/src/types/nip46.ts +81 -0
  104. package/src/utils/validation.ts +5 -2
  105. package/dist/browser/128.nostr-crypto-utils.min.js +0 -1
  106. package/dist/browser/156.nostr-crypto-utils.min.js +0 -1
  107. package/dist/browser/158.nostr-crypto-utils.min.js +0 -1
  108. package/dist/browser/26.nostr-crypto-utils.min.js +0 -1
  109. package/dist/browser/310.nostr-crypto-utils.min.js +0 -1
  110. package/dist/browser/324.nostr-crypto-utils.min.js +0 -2
  111. package/dist/browser/330.nostr-crypto-utils.min.js +0 -2
  112. package/dist/browser/344.nostr-crypto-utils.min.js +0 -1
  113. package/dist/browser/389.nostr-crypto-utils.min.js +0 -2
  114. package/dist/browser/404.nostr-crypto-utils.min.js +0 -1
  115. package/dist/browser/419.nostr-crypto-utils.min.js +0 -1
  116. package/dist/browser/430.nostr-crypto-utils.min.js +0 -2
  117. package/dist/browser/473.nostr-crypto-utils.min.js +0 -1
  118. package/dist/browser/490.nostr-crypto-utils.min.js +0 -1
  119. package/dist/browser/503.nostr-crypto-utils.min.js +0 -1
  120. package/dist/browser/509.nostr-crypto-utils.min.js +0 -1
  121. package/dist/browser/510.nostr-crypto-utils.min.js +0 -2
  122. package/dist/browser/529.nostr-crypto-utils.min.js +0 -2
  123. package/dist/browser/529.nostr-crypto-utils.min.js.LICENSE.txt +0 -1
  124. package/dist/browser/54.nostr-crypto-utils.min.js +0 -1
  125. package/dist/browser/613.nostr-crypto-utils.min.js +0 -1
  126. package/dist/browser/636.nostr-crypto-utils.min.js +0 -1
  127. package/dist/browser/657.nostr-crypto-utils.min.js +0 -2
  128. package/dist/browser/761.nostr-crypto-utils.min.js +0 -2
  129. package/dist/browser/801.nostr-crypto-utils.min.js +0 -1
  130. package/dist/browser/802.nostr-crypto-utils.min.js +0 -2
  131. package/dist/browser/802.nostr-crypto-utils.min.js.LICENSE.txt +0 -1
  132. package/dist/browser/829.nostr-crypto-utils.min.js +0 -1
  133. package/dist/browser/851.nostr-crypto-utils.min.js +0 -1
  134. package/dist/browser/890.nostr-crypto-utils.min.js +0 -1
  135. package/dist/browser/985.nostr-crypto-utils.min.js +0 -1
  136. package/dist/browser/995.nostr-crypto-utils.min.js +0 -1
  137. package/dist/browser/main-43dd7041.nostr-crypto-utils.min.js +0 -1
  138. /package/dist/browser/{324.nostr-crypto-utils.min.js.LICENSE.txt → 116.nostr-crypto-utils.min.js.LICENSE.txt} +0 -0
  139. /package/dist/browser/{510.nostr-crypto-utils.min.js.LICENSE.txt → 348.nostr-crypto-utils.min.js.LICENSE.txt} +0 -0
  140. /package/dist/browser/{657.nostr-crypto-utils.min.js.LICENSE.txt → 575.nostr-crypto-utils.min.js.LICENSE.txt} +0 -0
  141. /package/dist/browser/{389.nostr-crypto-utils.min.js.LICENSE.txt → 615.nostr-crypto-utils.min.js.LICENSE.txt} +0 -0
  142. /package/dist/browser/{761.nostr-crypto-utils.min.js.LICENSE.txt → nip-44.nostr-crypto-utils.min.js.LICENSE.txt} +0 -0
package/README.md CHANGED
@@ -10,6 +10,9 @@ This library provides essential cryptographic operations and utilities required
10
10
  - Key management and validation
11
11
  - Event signing and verification
12
12
  - Encrypted direct messages (NIP-04)
13
+ - Versioned encrypted payloads (NIP-44)
14
+ - Remote signing / Nostr Connect (NIP-46)
15
+ - Private key encryption / ncryptsec (NIP-49)
13
16
  - Bech32-encoded entities (NIP-19)
14
17
  - Delegated event signing (NIP-26)
15
18
  - Authentication protocol (NIP-42)
@@ -37,6 +40,9 @@ This library provides essential cryptographic operations and utilities required
37
40
  - NIP-19: Bech32-Encoded Entities
38
41
  - NIP-26: Delegated Event Signing
39
42
  - NIP-42: Authentication Protocol
43
+ - NIP-44: Versioned Encrypted Payloads
44
+ - NIP-46: Nostr Connect (Remote Signing)
45
+ - NIP-49: Private Key Encryption (ncryptsec)
40
46
 
41
47
  ## Project Structure
42
48
 
@@ -63,7 +69,7 @@ This library provides essential cryptographic operations and utilities required
63
69
  - Supports both ESM and CJS formats
64
70
  - Cross-platform compatible (Node.js and browser environments)
65
71
 
66
- [![npm version](https://badge.fury.io/js/%40humanjavaenterprises%2Fnostr-crypto-utils.svg)](https://www.npmjs.com/package/@humanjavaenterprises/nostr-crypto-utils)
72
+ [![npm version](https://badge.fury.io/js/nostr-crypto-utils.svg)](https://www.npmjs.com/package/nostr-crypto-utils)
67
73
  [![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)
68
74
  [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/HumanjavaEnterprises/nostr-crypto-utils/blob/main/LICENSE)
69
75
  [![Documentation](https://img.shields.io/badge/docs-TypeDoc-blue.svg)](https://humanjavaenterprises.github.io/nostr-crypto-utils/)
@@ -77,6 +83,12 @@ This library provides essential cryptographic operations and utilities required
77
83
 
78
84
  If you discover a security vulnerability, please follow our [Security Policy](SECURITY.md) and report it through [GitHub's Security Advisory feature](https://github.com/humanjavaenterprises/nostr-crypto-utils/security/advisories/new).
79
85
 
86
+ ### Dependency Vulnerability Status
87
+
88
+ We actively monitor and address security vulnerabilities in this codebase. **`npm audit --omit=dev` reports zero vulnerabilities** for this package — there are no known security issues in production dependencies.
89
+
90
+ Any remaining `npm audit` findings are in development-only tooling (eslint, typescript-eslint, vitest, etc.) and stem from transitive dependencies with no upstream fix available. These are devDependencies that are never included in the published package and pose no risk to consumers of this library. We monitor upstream fixes and update promptly when they become available.
91
+
80
92
  ## Why Choose nostr-crypto-utils?
81
93
 
82
94
  - **Lightweight**: Only 208.7KB unpacked, focusing on essential cryptographic operations
@@ -108,6 +120,9 @@ This library implements the following Nostr Implementation Possibilities (NIPs):
108
120
  | [NIP-19](https://github.com/nostr-protocol/nips/blob/master/19.md) | bech32-encoded Entities | Human-readable encoding for keys, events, and other entities | ✅ Complete |
109
121
  | [NIP-26](https://github.com/nostr-protocol/nips/blob/master/26.md) | Delegated Event Signing | Create and verify delegated event signing capabilities | ✅ Complete |
110
122
  | [NIP-42](https://github.com/nostr-protocol/nips/blob/master/42.md) | Authentication | Client-relay authentication protocol | ✅ Complete |
123
+ | [NIP-44](https://github.com/nostr-protocol/nips/blob/master/44.md) | Versioned Encrypted Payloads | Modern encryption replacing NIP-04 (ChaCha20 + HMAC) | ✅ Complete |
124
+ | [NIP-46](https://github.com/nostr-protocol/nips/blob/master/46.md) | Nostr Connect (Remote Signing) | Protocol layer for remote signing via bunker | ✅ Complete |
125
+ | [NIP-49](https://github.com/nostr-protocol/nips/blob/master/49.md) | Private Key Encryption | ncryptsec password-encrypted key storage | ✅ Complete |
111
126
 
112
127
  ### NIP-01 Features
113
128
  - Event creation and serialization
@@ -148,7 +163,7 @@ import {
148
163
  naddrEncode,
149
164
  nrelayEncode,
150
165
  decode
151
- } from '@humanjavaenterprises/nostr-crypto-utils';
166
+ } from 'nostr-crypto-utils';
152
167
 
153
168
  // Encode a public key
154
169
  const npub = npubEncode('7f3b6c2444c526fc7b3a48b0a1e38fb6a5a4062d4a097c9e96feb3c1df2f36d0');
@@ -202,6 +217,62 @@ try {
202
217
  } catch (error) {
203
218
  console.error(error); // Error: Invalid hex string
204
219
  }
220
+ ```
221
+
222
+ ### NIP-44 Usage (Encrypted Payloads)
223
+
224
+ ```typescript
225
+ import { nip44 } from 'nostr-crypto-utils';
226
+ // Or via subpath: import * as nip44 from 'nostr-crypto-utils/nip44';
227
+
228
+ // Derive a conversation key from ECDH
229
+ const conversationKey = nip44.getConversationKey(myPrivKeyBytes, theirPubkeyHex);
230
+
231
+ // Encrypt
232
+ const encrypted = nip44.encrypt('Hello!', conversationKey);
233
+
234
+ // Decrypt
235
+ const plaintext = nip44.decrypt(encrypted, conversationKey);
236
+ ```
237
+
238
+ ### NIP-46 Usage (Remote Signing)
239
+
240
+ ```typescript
241
+ import { nip46 } from 'nostr-crypto-utils';
242
+ // Or via subpath: import * as nip46 from 'nostr-crypto-utils/nip46';
243
+
244
+ // Parse a bunker:// URI
245
+ const bunker = nip46.parseBunkerURI('bunker://pubkey...?relay=wss://relay.example.com&secret=abc');
246
+
247
+ // Create a session (ephemeral keypair + NIP-44 conversation key)
248
+ const session = nip46.createSession(bunker.remotePubkey);
249
+
250
+ // Build a request
251
+ const req = nip46.connectRequest(bunker.remotePubkey, bunker.secret);
252
+
253
+ // Wrap into a kind 24133 encrypted event (ready to publish to relay)
254
+ const event = await nip46.wrapEvent(req, session, bunker.remotePubkey);
255
+
256
+ // On receiving a response event, unwrap it
257
+ const response = nip46.unwrapEvent(responseEvent, session);
258
+
259
+ // Create a filter for subscribing to responses
260
+ const filter = nip46.createResponseFilter(session.clientPubkey);
261
+ ```
262
+
263
+ ### NIP-49 Usage (ncryptsec Key Encryption)
264
+
265
+ ```typescript
266
+ import { nip49 } from 'nostr-crypto-utils';
267
+ // Or via subpath: import * as nip49 from 'nostr-crypto-utils/nip49';
268
+
269
+ // Encrypt a private key with a password
270
+ const ncryptsec = nip49.encrypt(secretKeyBytes, 'my-password');
271
+ // Returns: 'ncryptsec1...'
272
+
273
+ // Decrypt it back
274
+ const secretKey = nip49.decrypt(ncryptsec, 'my-password');
275
+ ```
205
276
 
206
277
  ### Type System
207
278
 
@@ -448,11 +519,11 @@ These examples demonstrate real-world usage patterns from production Nostr appli
448
519
 
449
520
  ## Integration with nostr-nsec-seedphrase
450
521
 
451
- This library is designed to work seamlessly with [@humanjavaenterprises/nostr-nsec-seedphrase](https://github.com/HumanjavaEnterprises/nostr-nsec-seedphrase) to provide a complete solution for Nostr key management and cryptographic operations:
522
+ This library is designed to work seamlessly with [nostr-nsec-seedphrase](https://github.com/HumanjavaEnterprises/nostr-nsec-seedphrase) to provide a complete solution for Nostr key management and cryptographic operations:
452
523
 
453
524
  ```typescript
454
- import { generateSeedPhrase } from '@humanjavaenterprises/nostr-nsec-seedphrase';
455
- import { createTextNoteEvent, signEvent } from '@humanjavaenterprises/nostr-crypto-utils';
525
+ import { generateSeedPhrase } from 'nostr-nsec-seedphrase';
526
+ import { createTextNoteEvent, signEvent } from 'nostr-crypto-utils';
456
527
 
457
528
  // Generate keys using nostr-nsec-seedphrase
458
529
  const seedPhrase = generateSeedPhrase();
@@ -481,7 +552,7 @@ You can use this library to create delegate tokens for use on web servers or oth
481
552
  ### Basic Delegation Example
482
553
 
483
554
  ```typescript
484
- import { createDelegation, validateDelegation } from '@humanjavaenterprises/nostr-crypto-utils';
555
+ import { createDelegation, validateDelegation } from 'nostr-crypto-utils';
485
556
 
486
557
  // Create a delegation token (delegator's perspective)
487
558
  const delegatorKeyPair = await generateKeyPair();
@@ -510,7 +581,7 @@ const isValid = await validateDelegation({
510
581
  Here's how to use delegation tokens in a web server context:
511
582
 
512
583
  ```typescript
513
- import { createEvent, signEventWithDelegation } from '@humanjavaenterprises/nostr-crypto-utils';
584
+ import { createEvent, signEventWithDelegation } from 'nostr-crypto-utils';
514
585
 
515
586
  // On your server, store these securely
516
587
  const DELEGATE_PRIVKEY = 'nsec1...'; // Your server's private key
@@ -589,7 +660,7 @@ For more details on delegation, see the [NIP-26 specification](https://github.co
589
660
  Enable debug mode to get detailed logging:
590
661
 
591
662
  ```typescript
592
- import { setDebugLevel } from '@humanjavaenterprises/nostr-crypto-utils';
663
+ import { setDebugLevel } from 'nostr-crypto-utils';
593
664
 
594
665
  // Enable debug logging
595
666
  setDebugLevel('debug');
@@ -671,53 +742,6 @@ const testEventSigning = async (event, delegation) => {
671
742
 
672
743
  For more help, join our [Discord community](https://discord.gg/nostr) or [open an issue](https://github.com/humanjavaenterprises/nostr-crypto-utils/issues).
673
744
 
674
- ## Installation
675
-
676
- ```bash
677
- npm install @humanjavaenterprises/nostr-crypto-utils
678
- ```
679
-
680
- ## Quick Start
681
-
682
- ```typescript
683
- import { createKeyPair, createTextNoteEvent, signEvent } from '@humanjavaenterprises/nostr-crypto-utils';
684
-
685
- // Generate a new key pair
686
- const keyPair = createKeyPair();
687
-
688
- // Create a text note event
689
- const event = createTextNoteEvent({
690
- content: 'Hello Nostr!',
691
- pubkey: keyPair.publicKey,
692
- created_at: Math.floor(Date.now() / 1000)
693
- });
694
-
695
- // Sign the event
696
- const signedEvent = signEvent(event, keyPair.privateKey);
697
- ```
698
-
699
- ## Documentation
700
-
701
- Comprehensive documentation is available at [https://humanjavaenterprises.github.io/nostr-crypto-utils/](https://humanjavaenterprises.github.io/nostr-crypto-utils/)
702
-
703
- ## Type Safety
704
-
705
- This library is written in TypeScript and provides comprehensive type definitions for all functions and data structures. Type checking is enforced at compile time to catch potential errors early.
706
-
707
- ```typescript
708
- import { NostrEvent, NostrFilter, ValidationResult } from '@humanjavaenterprises/nostr-crypto-utils';
709
-
710
- // All types are properly defined
711
- const filter: NostrFilter = {
712
- kinds: [NostrEventKind.TEXT_NOTE],
713
- "#t": ["nostr", "crypto"], // Filter by custom tag
714
- limit: 10
715
- };
716
-
717
- // Validation results include type information
718
- const result: ValidationResult = validateEvent(event);
719
- ```
720
-
721
745
  ## Contributing
722
746
 
723
747
  We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.
@@ -728,29 +752,14 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
728
752
 
729
753
  ## Changelog
730
754
 
731
- ### v0.3.0 (2024-12-28)
732
- - 🔒 Improved type safety with stricter TypeScript checks
733
- - 🐛 Fixed crypto implementation for cross-platform compatibility
734
- - ✨ Added comprehensive validation for all message types
735
- - 📝 Updated documentation with more examples
736
-
737
- ### v0.2.0 (2024-12-26)
738
- - 🎉 Initial public release
739
- - ✨ Added support for NIP-01 and NIP-04
740
- - 🔑 Implemented key pair generation and management
741
- - 📝 Added comprehensive documentation
755
+ See [CHANGELOG.md](CHANGELOG.md) for a detailed history of changes.
742
756
 
743
757
  ## Support
744
758
 
745
- - 📖 [Documentation](https://humanjavaenterprises.github.io/nostr-crypto-utils/)
746
- - 🐛 [Issue Tracker](https://github.com/humanjavaenterprises/nostr-crypto-utils/issues)
747
- - 💬 [Discussions](https://github.com/humanjavaenterprises/nostr-crypto-utils/discussions)
759
+ - [Documentation](https://humanjavaenterprises.github.io/nostr-crypto-utils/)
760
+ - [Issue Tracker](https://github.com/HumanjavaEnterprises/nostr-crypto-utils/issues)
761
+ - [Discussions](https://github.com/HumanjavaEnterprises/nostr-crypto-utils/discussions)
748
762
 
749
763
  ## Related Projects
750
764
 
751
- - [@humanjavaenterprises/nostr-nsec-seedphrase](https://github.com/HumanjavaEnterprises/nostr-nsec-seedphrase) - Generate and manage Nostr private keys using BIP-39 seed phrases
752
-
753
- ---
754
- <div align="center">
755
- Made with ❤️ by <a href="https://github.com/humanjavaenterprises">Humanjava Enterprises</a>
756
- </div>
765
+ - [nostr-nsec-seedphrase](https://github.com/HumanjavaEnterprises/nostr-nsec-seedphrase) - Generate and manage Nostr private keys using BIP-39 seed phrases
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 116.nostr-crypto-utils.min.js.LICENSE.txt */
2
+ "use strict";(this.webpackChunkNostrCryptoUtils=this.webpackChunkNostrCryptoUtils||[]).push([[116],{116(r,e,n){function o(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&"Uint8Array"===r.constructor.name}function t(r){if(!o(r))throw new Error("Uint8Array expected")}function i(r,e){return!!Array.isArray(e)&&(0===e.length||(r?e.every(r=>"string"==typeof r):e.every(r=>Number.isSafeInteger(r))))}function c(r){if("function"!=typeof r)throw new Error("function expected");return!0}function d(r,e){if("string"!=typeof e)throw new Error(`${r}: string expected`);return!0}function a(r){if(!Number.isSafeInteger(r))throw new Error(`invalid integer: ${r}`)}function f(r){if(!Array.isArray(r))throw new Error("array expected")}function s(r,e){if(!i(!0,e))throw new Error(`${r}: array of strings expected`)}function u(r,e){if(!i(!1,e))throw new Error(`${r}: array of numbers expected`)}function h(...r){const e=r=>r,n=(r,e)=>n=>r(e(n));return{encode:r.map(r=>r.encode).reduceRight(n,e),decode:r.map(r=>r.decode).reduce(n,e)}}function w(r){const e="string"==typeof r?r.split(""):r,n=e.length;s("alphabet",e);const o=new Map(e.map((r,e)=>[r,e]));return{encode:o=>(f(o),o.map(o=>{if(!Number.isSafeInteger(o)||o<0||o>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${o}". Allowed: ${r}`);return e[o]})),decode:e=>(f(e),e.map(e=>{d("alphabet.decode",e);const n=o.get(e);if(void 0===n)throw new Error(`Unknown letter: "${e}". Allowed: ${r}`);return n}))}}function l(r=""){return d("join",r),{encode:e=>(s("join.decode",e),e.join(r)),decode:e=>(d("join.decode",e),e.split(r))}}function p(r,e="="){return a(r),d("padding",e),{encode(n){for(s("padding.encode",n);n.length*r%8;)n.push(e);return n},decode(n){s("padding.decode",n);let o=n.length;if(o*r%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;o>0&&n[o-1]===e;o--)if((o-1)*r%8==0)throw new Error("padding: invalid, string has too much padding");return n.slice(0,o)}}}function g(r){return c(r),{encode:r=>r,decode:e=>r(e)}}function y(r,e,n){if(e<2)throw new Error(`convertRadix: invalid from=${e}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: invalid to=${n}, base cannot be less than 2`);if(f(r),!r.length)return[];let o=0;const t=[],i=Array.from(r,r=>{if(a(r),r<0||r>=e)throw new Error(`invalid integer: ${r}`);return r}),c=i.length;for(;;){let r=0,d=!0;for(let t=o;t<c;t++){const c=i[t],a=e*r,f=a+c;if(!Number.isSafeInteger(f)||a/e!==r||f-c!==a)throw new Error("convertRadix: carry overflow");const s=f/n;r=f%n;const u=Math.floor(s);if(i[t]=u,!Number.isSafeInteger(u)||u*n+r!==f)throw new Error("convertRadix: carry overflow");d&&(u?d=!1:o=t)}if(t.push(r),d)break}for(let e=0;e<r.length-1&&0===r[e];e++)t.push(0);return t.reverse()}n.d(e,{K3:()=>C});const E=(r,e)=>0===e?r:E(e,r%e),b=(r,e)=>r+(e-E(r,e)),m=(()=>{let r=[];for(let e=0;e<40;e++)r.push(2**e);return r})();function x(r,e,n,o){if(f(r),e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(b(e,n)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${n} carryBits=${b(e,n)}`);let t=0,i=0;const c=m[e],d=m[n]-1,s=[];for(const o of r){if(a(o),o>=c)throw new Error(`convertRadix2: invalid data word=${o} from=${e}`);if(t=t<<e|o,i+e>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${e}`);for(i+=e;i>=n;i-=n)s.push((t>>i-n&d)>>>0);const r=m[i];if(void 0===r)throw new Error("invalid carry");t&=r-1}if(t=t<<n-i&d,!o&&i>=e)throw new Error("Excess padding");if(!o&&t>0)throw new Error(`Non-zero padding: ${t}`);return o&&i>0&&s.push(t>>>0),s}function v(r,e=!1){if(a(r),r<=0||r>32)throw new Error("radix2: bits should be in (0..32]");if(b(8,r)>32||b(r,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!o(n))throw new Error("radix2.encode input should be Uint8Array");return x(Array.from(n),8,r,!e)},decode:n=>(u("radix2.decode",n),Uint8Array.from(x(n,r,8,e)))}}function A(r){return c(r),function(...e){try{return r.apply(null,e)}catch(r){}}}h(v(4),w("0123456789ABCDEF"),l("")),h(v(5),w("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),p(5),l(""));const $=(h(v(5),w("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),l("")),h(v(5),w("0123456789ABCDEFGHIJKLMNOPQRSTUV"),p(5),l("")),h(v(5),w("0123456789ABCDEFGHIJKLMNOPQRSTUV"),l("")),h(v(5),w("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),l(""),g(r=>r.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),(()=>"function"==typeof Uint8Array.from([]).toBase64&&"function"==typeof Uint8Array.fromBase64)()),U=(r,e)=>{d("base64",r);const n=e?/^[A-Za-z0-9=_-]+$/:/^[A-Za-z0-9=+/]+$/,o=e?"base64url":"base64";if(r.length>0&&!n.test(r))throw new Error("invalid base64");return Uint8Array.fromBase64(r,{alphabet:o,lastChunkHandling:"strict"})},C=$?{encode:r=>(t(r),r.toBase64()),decode:r=>U(r,!1)}:h(v(6),w("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),p(6),l("")),R=(h(v(6),w("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),l("")),$||h(v(6),w("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),p(6),l("")),h(v(6),w("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),l("")),r=>{return h((a(e=58),{encode:r=>{if(!o(r))throw new Error("radix.encode input should be Uint8Array");return y(Array.from(r),256,e)},decode:r=>(u("radix.decode",r),Uint8Array.from(y(r,e,256)))}),w(r),l(""));var e}),B=(R("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),R("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),R("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"),h(w("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),l(""))),N=[996825010,642813549,513874426,1027748829,705979059];function I(r){const e=r>>25;let n=(33554431&r)<<5;for(let r=0;r<N.length;r++)1==(e>>r&1)&&(n^=N[r]);return n}function S(r,e,n=1){const o=r.length;let t=1;for(let e=0;e<o;e++){const n=r.charCodeAt(e);if(n<33||n>126)throw new Error(`Invalid prefix (${r})`);t=I(t)^n>>5}t=I(t);for(let e=0;e<o;e++)t=I(t)^31&r.charCodeAt(e);for(let r of e)t=I(t)^r;for(let r=0;r<6;r++)t=I(t);return t^=n,B.encode(x([t%m[30]],30,5,!1))}function L(r){const e="bech32"===r?1:734539939,n=v(5),t=n.decode,i=n.encode,c=A(t);function a(r,n,t=90){d("bech32.encode prefix",r),o(n)&&(n=Array.from(n)),u("bech32.encode",n);const i=r.length;if(0===i)throw new TypeError(`Invalid prefix length ${i}`);const c=i+7+n.length;if(!1!==t&&c>t)throw new TypeError(`Length ${c} exceeds limit ${t}`);const a=r.toLowerCase(),f=S(a,n,e);return`${a}1${B.encode(n)}${f}`}function f(r,n=90){d("bech32.decode input",r);const o=r.length;if(o<8||!1!==n&&o>n)throw new TypeError(`invalid string length: ${o} (${r}). Expected (8..${n})`);const t=r.toLowerCase();if(r!==t&&r!==r.toUpperCase())throw new Error("String must be lowercase or uppercase");const i=t.lastIndexOf("1");if(0===i||-1===i)throw new Error('Letter "1" must be present between prefix and data only');const c=t.slice(0,i),a=t.slice(i+1);if(a.length<6)throw new Error("Data must be at least 6 characters long");const f=B.decode(a).slice(0,-6),s=S(c,f,e);if(!a.endsWith(s))throw new Error(`Invalid checksum in ${r}: expected "${s}"`);return{prefix:c,words:f}}return{encode:a,decode:f,encodeFromBytes:function(r,e){return a(r,i(e))},decodeToBytes:function(r){const{prefix:e,words:n}=f(r,!1);return{prefix:e,words:n,bytes:t(n)}},decodeUnsafe:A(f),fromWords:t,fromWordsUnsafe:c,toWords:i}}L("bech32"),L("bech32m");(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)()||h(v(4),w("0123456789abcdef"),l(""),g(r=>{if("string"!=typeof r||r.length%2!=0)throw new TypeError(`hex.decode: expected string, got ${typeof r} with length ${r.length}`);return r.toLowerCase()}))}}]);
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 126.nostr-crypto-utils.min.js.LICENSE.txt */
2
+ "use strict";(this.webpackChunkNostrCryptoUtils=this.webpackChunkNostrCryptoUtils||[]).push([[126,615],{139(t,e,n){e.o6=function(t,e,n){return(0,o.ahash)(t),void 0===n&&(n=new Uint8Array(t.outputLen)),(0,r.hmac)(t,(0,o.toBytes)(n),(0,o.toBytes)(e))},e.fT=function(t,e,n,c=32){(0,o.ahash)(t),(0,o.anumber)(c);const a=t.outputLen;if(c>255*a)throw new Error("Length should be <= 255*HashLen");const u=Math.ceil(c/a);void 0===n&&(n=s);const h=new Uint8Array(u*a),f=r.hmac.create(t,e),d=f._cloneInto(),p=new Uint8Array(f.outputLen);for(let t=0;t<u;t++)i[0]=t+1,d.update(0===t?s:p).update(n).update(i).digestInto(p),h.set(p,a*t),f._cloneInto(d);return f.destroy(),d.destroy(),(0,o.clean)(p,i),h.slice(0,c)};const r=n(615),o=n(175);const i=Uint8Array.from([0]),s=Uint8Array.of()},615(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const r=n(175);class o extends r.Hash{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,(0,r.ahash)(t);const n=(0,r.toBytes)(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,i=new Uint8Array(o);i.set(n.length>o?t.create().update(n).digest():n);for(let t=0;t<i.length;t++)i[t]^=54;this.iHash.update(i),this.oHash=t.create();for(let t=0;t<i.length;t++)i[t]^=106;this.oHash.update(i),(0,r.clean)(i)}update(t){return(0,r.aexists)(this),this.iHash.update(t),this}digestInto(t){(0,r.aexists)(this),(0,r.abytes)(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:n,finished:r,destroyed:o,blockLen:i,outputLen:s}=this;return t.finished=r,t.destroyed=o,t.blockLen=i,t.outputLen=s,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.HMAC=o,e.hmac=(t,e,n)=>new o(t,e).update(n).digest(),e.hmac.create=(t,e)=>new o(t,e)},623(t,e,n){e.sc=void 0;const r=n(76);r.SHA256,e.sc=r.sha256,r.SHA224,r.sha224},175(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.Hash=e.nextTick=e.swap32IfBE=e.byteSwapIfBE=e.swap8IfBE=e.isLE=void 0,e.isBytes=o,e.anumber=i,e.abytes=s,e.ahash=function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.createHasher");i(t.outputLen),i(t.blockLen)},e.aexists=function(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")},e.aoutput=function(t,e){s(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)},e.u8=function(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)},e.u32=function(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))},e.clean=function(...t){for(let e=0;e<t.length;e++)t[e].fill(0)},e.createView=function(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)},e.rotr=function(t,e){return t<<32-e|t>>>e},e.rotl=function(t,e){return t<<e|t>>>32-e>>>0},e.byteSwap=c,e.byteSwap32=a,e.bytesToHex=function(t){if(s(t),u)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=h[t[n]];return e},e.hexToBytes=function(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);if(u)return Uint8Array.fromHex(t);const e=t.length,n=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let e=0,o=0;e<n;e++,o+=2){const n=f(t.charCodeAt(o)),i=f(t.charCodeAt(o+1));if(void 0===n||void 0===i){const e=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+e+'" at index '+o)}r[e]=16*n+i}return r},e.asyncLoop=async function(t,n,r){let o=Date.now();for(let i=0;i<t;i++){r(i);const t=Date.now()-o;t>=0&&t<n||(await(0,e.nextTick)(),o+=t)}},e.utf8ToBytes=d,e.bytesToUtf8=function(t){return(new TextDecoder).decode(t)},e.toBytes=p,e.kdfInputToBytes=function(t){return"string"==typeof t&&(t=d(t)),s(t),t},e.concatBytes=function(...t){let e=0;for(let n=0;n<t.length;n++){const r=t[n];s(r),e+=r.length}const n=new Uint8Array(e);for(let e=0,r=0;e<t.length;e++){const o=t[e];n.set(o,r),r+=o.length}return n},e.checkOpts=function(t,e){if(void 0!==e&&"[object Object]"!=={}.toString.call(e))throw new Error("options should be object or undefined");return Object.assign(t,e)},e.createHasher=y,e.createOptHasher=l,e.createXOFer=w,e.randomBytes=function(t=32){if(r.crypto&&"function"==typeof r.crypto.getRandomValues)return r.crypto.getRandomValues(new Uint8Array(t));if(r.crypto&&"function"==typeof r.crypto.randomBytes)return Uint8Array.from(r.crypto.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")};const r=n(145);function o(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name}function i(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function s(t,...e){if(!o(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function c(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function a(t){for(let e=0;e<t.length;e++)t[e]=c(t[e]);return t}e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],e.swap8IfBE=e.isLE?t=>t:t=>c(t),e.byteSwapIfBE=e.swap8IfBE,e.swap32IfBE=e.isLE?t=>t:a;const u=(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),h=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function f(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:void 0}function d(t){if("string"!=typeof t)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(t))}function p(t){return"string"==typeof t&&(t=d(t)),s(t),t}function y(t){const e=e=>t().update(p(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function l(t){const e=(e,n)=>t(n).update(p(e)).digest(),n=t({});return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=e=>t(e),e}function w(t){const e=(e,n)=>t(n).update(p(e)).digest(),n=t({});return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=e=>t(e),e}e.nextTick=async()=>{},e.Hash=class{},e.wrapConstructor=y,e.wrapConstructorWithOpts=l,e.wrapXOFConstructorWithOpts=w},246(t,e,n){function r(t){if("boolean"!=typeof t)throw new Error(`boolean expected, not ${t}`)}function o(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function i(t,e,n=""){const r=(o=t)instanceof Uint8Array||ArrayBuffer.isView(o)&&"Uint8Array"===o.constructor.name;var o;const i=t?.length,s=void 0!==e;if(!r||s&&i!==e)throw new Error((n&&`"${n}" `)+"expected Uint8Array"+(s?` of length ${e}`:"")+", got "+(r?`length=${i}`:"type="+typeof t));return t}function s(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function c(t,e){i(t,void 0,"output");const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function a(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function u(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}n.d(e,{CC:()=>s,DH:()=>a,DO:()=>i,Fe:()=>o,Ht:()=>c,N$:()=>y,Pg:()=>l,e8:()=>r,ex:()=>d,nC:()=>w,qn:()=>p,tY:()=>f,uH:()=>u});const h=(()=>68===new Uint8Array(new Uint32Array([287454020]).buffer)[0])();function f(t,e){if(null==e||"object"!=typeof e)throw new Error("options must be defined");return Object.assign(t,e)}function d(t,e){if(t.length!==e.length)return!1;let n=0;for(let r=0;r<t.length;r++)n|=t[r]^e[r];return 0===n}const p=(t,e)=>{function n(n,...r){if(i(n,void 0,"key"),!h)throw new Error("Non little-endian hardware is not yet supported");void 0!==t.nonceLength&&i(r[0],t.varSizeNonce?void 0:t.nonceLength,"nonce");const o=t.tagLength;o&&void 0!==r[1]&&i(r[1],void 0,"AAD");const s=e(n,...r),c=(t,e)=>{if(void 0!==e){if(2!==t)throw new Error("cipher output not supported");i(e,void 0,"output")}};let a=!1;return{encrypt(t,e){if(a)throw new Error("cannot encrypt() twice with same key + nonce");return a=!0,i(t),c(s.encrypt.length,e),s.encrypt(t,e)},decrypt(t,e){if(i(t),o&&t.length<o)throw new Error('"ciphertext" expected length bigger than tagLength='+o);return c(s.decrypt.length,e),s.decrypt(t,e)}}}return Object.assign(n,t),n};function y(t,e,n=!0){if(void 0===e)return new Uint8Array(t);if(e.length!==t)throw new Error('"output" expected Uint8Array of length '+t+", got: "+e.length);if(n&&e.byteOffset%4!=0)throw new Error("invalid output, must be aligned");return e}function l(t,e,n){r(n);const o=new Uint8Array(16),i=(s=o,new DataView(s.buffer,s.byteOffset,s.byteLength));var s;return i.setBigUint64(0,BigInt(e),n),i.setBigUint64(8,BigInt(t),n),o}function w(t){return Uint8Array.from(t)}}}]);
@@ -1 +1,3 @@
1
1
  /*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */
2
+
3
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see 287.nostr-crypto-utils.min.js.LICENSE.txt */
2
- "use strict";(this.webpackChunkNostrCryptoUtils=this.webpackChunkNostrCryptoUtils||[]).push([[287,668],{8287:(t,e,r)=>{const n=r(7526),i=r(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50;const f=2147483647;function s(t){if(t>f)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return a(t)}return h(t,e,r)}function h(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|g(t,e);let n=s(r);const i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(J(t,Uint8Array)){const e=new Uint8Array(t);return l(e.buffer,e.byteOffset,e.byteLength)}return p(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(J(t,ArrayBuffer)||t&&J(t.buffer,ArrayBuffer))return l(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(J(t,SharedArrayBuffer)||t&&J(t.buffer,SharedArrayBuffer)))return l(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);const i=function(t){if(u.isBuffer(t)){const e=0|y(t.length),r=s(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||Z(t.length)?s(0):p(t):"Buffer"===t.type&&Array.isArray(t.data)?p(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function a(t){return c(t),s(t<0?0:0|y(t))}function p(t){const e=t.length<0?0:0|y(t.length),r=s(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function l(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function y(t){if(t>=f)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+f.toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||J(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(t).length;default:if(i)return n?-1:q(t).length;e=(""+e).toLowerCase(),i=!0}}function w(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return S(this,e,r);case"utf8":case"utf-8":return R(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return L(this,e,r);case"base64":return v(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function d(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Z(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:B(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):B(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function B(t,e,r,n,i){let o,f=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;f=2,s/=2,u/=2,r/=2}function h(t,e){return 1===f?t[e]:t.readUInt16BE(e*f)}if(i){let n=-1;for(o=r;o<s;o++)if(h(t,o)===h(e,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*f}else-1!==n&&(o-=o-n),n=-1}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){let r=!0;for(let n=0;n<u;n++)if(h(t,o+n)!==h(e,n)){r=!1;break}if(r)return o}return-1}function E(t,e,r,n){r=Number(r)||0;const i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=e.length;let f;for(n>o/2&&(n=o/2),f=0;f<n;++f){const n=parseInt(e.substr(2*f,2),16);if(Z(n))return f;t[r+f]=n}return f}function m(t,e,r,n){return X(q(e,t.length-r),t,r,n)}function I(t,e,r,n){return X(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function U(t,e,r,n){return X(W(e),t,r,n)}function A(t,e,r,n){return X(function(t,e){let r,n,i;const o=[];for(let f=0;f<t.length&&!((e-=2)<0);++f)r=t.charCodeAt(f),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function v(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function R(t,e,r){r=Math.min(t.length,r);const n=[];let i=e;for(;i<r;){const e=t[i];let o=null,f=e>239?4:e>223?3:e>191?2:1;if(i+f<=r){let r,n,s,u;switch(f){case 1:e<128&&(o=e);break;case 2:r=t[i+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(o=u));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=t[i+1],n=t[i+2],s=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&s)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&s,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,f=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=f}return function(t){const e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=T));return r}(n)}e.kMaxLength=f,u.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return h(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return c(t),t<=0?s(t):void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(t)}(t,e,r)},u.allocUnsafe=function(t){return a(t)},u.allocUnsafeSlow=function(t){return a(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(J(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),J(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=u.allocUnsafe(e);let i=0;for(r=0;r<t.length;++r){let e=t[r];if(J(e,Uint8Array))i+e.length>n.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else{if(!u.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i)}i+=e.length}return n},u.byteLength=g,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)d(this,e,e+1);return this},u.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)d(this,e,e+3),d(this,e+1,e+2);return this},u.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)d(this,e,e+7),d(this,e+1,e+6),d(this,e+2,e+5),d(this,e+3,e+4);return this},u.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?R(this,0,t):w.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){let t="";const r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(J(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;let o=(i>>>=0)-(n>>>=0),f=(r>>>=0)-(e>>>=0);const s=Math.min(o,f),h=this.slice(n,i),c=t.slice(e,r);for(let t=0;t<s;++t)if(h[t]!==c[t]){o=h[t],f=c[t];break}return o<f?-1:f<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return E(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":case"latin1":case"binary":return I(this,t,e,r);case"base64":return U(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const T=4096;function O(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function L(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function S(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n<r;++n)i+=H[t[n]];return i}function _(t,e,r){const n=t.slice(e,r);let i="";for(let t=0;t<n.length-1;t+=2)i+=String.fromCharCode(n[t]+256*n[t+1]);return i}function $(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function x(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function C(t,e,r,n,i){z(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;let f=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=f,f>>=8,t[r++]=f,f>>=8,t[r++]=f,f>>=8,t[r++]=f,r}function P(t,e,r,n,i){z(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;let f=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=f,f>>=8,t[r+2]=f,f>>=8,t[r+1]=f,f>>=8,t[r]=f,r+8}function k(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function N(t,e,r,n,o){return e=+e,r>>>=0,o||k(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function F(t,e,r,n,o){return e=+e,r>>>=0,o||k(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||$(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||$(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||$(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||$(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||$(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||$(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||$(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=K((function(t){Y(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),u.prototype.readBigUInt64BE=K((function(t){Y(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||$(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||$(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||$(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||$(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||$(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||$(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||$(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=K((function(t){Y(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),u.prototype.readBigInt64BE=K((function(t){Y(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),u.prototype.readFloatLE=function(t,e){return t>>>=0,e||$(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||$(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||$(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||$(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||x(this,t,e,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||x(this,t,e,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigUInt64LE=K((function(t,e=0){return C(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=K((function(t,e=0){return P(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);x(this,t,e,r,n-1,-n)}let i=0,o=1,f=0;for(this[e]=255&t;++i<r&&(o*=256);)t<0&&0===f&&0!==this[e+i-1]&&(f=1),this[e+i]=(t/o|0)-f&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);x(this,t,e,r,n-1,-n)}let i=r-1,o=1,f=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===f&&0!==this[e+i+1]&&(f=1),this[e+i]=(t/o|0)-f&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigInt64LE=K((function(t,e=0){return C(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=K((function(t,e=0){return P(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(t,e,r){return N(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return N(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return F(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return F(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{const o=u.isBuffer(t)?t:u.from(t,n),f=o.length;if(0===f)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=o[i%f]}return this};const M={};function j(t,e,r){M[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function D(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function z(t,e,r,n,i,o){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new M.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,r){Y(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||G(e,t.length-(r+1))}(n,i,o)}function Y(t,e){if("number"!=typeof t)throw new M.ERR_INVALID_ARG_TYPE(e,"number",t)}function G(t,e,r){if(Math.floor(t)!==t)throw Y(t,r),new M.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new M.ERR_BUFFER_OUT_OF_BOUNDS;throw new M.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}j("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),j("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),j("ERR_OUT_OF_RANGE",(function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=D(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=D(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n}),RangeError);const V=/[^+/0-9A-Za-z-_]/g;function q(t,e){let r;e=e||1/0;const n=t.length;let i=null;const o=[];for(let f=0;f<n;++f){if(r=t.charCodeAt(f),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(f+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function W(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function X(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function J(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Z(t){return t!=t}const H=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function K(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}}}]);
2
+ "use strict";(this.webpackChunkNostrCryptoUtils=this.webpackChunkNostrCryptoUtils||[]).push([[287,668],{287(t,e,r){const n=r(526),i=r(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=u,e.IS=50;const f=2147483647;function s(t){if(t>f)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return a(t)}return h(t,e,r)}function h(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|g(t,e);let n=s(r);const i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Z(t,Uint8Array)){const e=new Uint8Array(t);return l(e.buffer,e.byteOffset,e.byteLength)}return p(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Z(t,ArrayBuffer)||t&&Z(t.buffer,ArrayBuffer))return l(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Z(t,SharedArrayBuffer)||t&&Z(t.buffer,SharedArrayBuffer)))return l(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);const i=function(t){if(u.isBuffer(t)){const e=0|y(t.length),r=s(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||H(t.length)?s(0):p(t):"Buffer"===t.type&&Array.isArray(t.data)?p(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function a(t){return c(t),s(t<0?0:0|y(t))}function p(t){const e=t.length<0?0:0|y(t.length),r=s(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function l(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function y(t){if(t>=f)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+f.toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Z(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(t).length;default:if(i)return n?-1:q(t).length;e=(""+e).toLowerCase(),i=!0}}function w(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return S(this,e,r);case"utf8":case"utf-8":return R(this,e,r);case"ascii":return T(this,e,r);case"latin1":case"binary":return L(this,e,r);case"base64":return v(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function d(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),H(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:B(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):B(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function B(t,e,r,n,i){let o,f=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;f=2,s/=2,u/=2,r/=2}function h(t,e){return 1===f?t[e]:t.readUInt16BE(e*f)}if(i){let n=-1;for(o=r;o<s;o++)if(h(t,o)===h(e,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*f}else-1!==n&&(o-=o-n),n=-1}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){let r=!0;for(let n=0;n<u;n++)if(h(t,o+n)!==h(e,n)){r=!1;break}if(r)return o}return-1}function E(t,e,r,n){r=Number(r)||0;const i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=e.length;let f;for(n>o/2&&(n=o/2),f=0;f<n;++f){const n=parseInt(e.substr(2*f,2),16);if(H(n))return f;t[r+f]=n}return f}function m(t,e,r,n){return J(q(e,t.length-r),t,r,n)}function I(t,e,r,n){return J(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function U(t,e,r,n){return J(W(e),t,r,n)}function A(t,e,r,n){return J(function(t,e){let r,n,i;const o=[];for(let f=0;f<t.length&&!((e-=2)<0);++f)r=t.charCodeAt(f),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function v(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function R(t,e,r){r=Math.min(t.length,r);const n=[];let i=e;for(;i<r;){const e=t[i];let o=null,f=e>239?4:e>223?3:e>191?2:1;if(i+f<=r){let r,n,s,u;switch(f){case 1:e<128&&(o=e);break;case 2:r=t[i+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(o=u));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=t[i+1],n=t[i+2],s=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&s)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&s,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,f=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=f}return function(t){const e=t.length;if(e<=O)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=O));return r}(n)}u.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return h(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return c(t),t<=0?s(t):void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(t)}(t,e,r)},u.allocUnsafe=function(t){return a(t)},u.allocUnsafeSlow=function(t){return a(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(Z(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),Z(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=u.allocUnsafe(e);let i=0;for(r=0;r<t.length;++r){let e=t[r];if(Z(e,Uint8Array))i+e.length>n.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else{if(!u.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i)}i+=e.length}return n},u.byteLength=g,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)d(this,e,e+1);return this},u.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)d(this,e,e+3),d(this,e+1,e+2);return this},u.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)d(this,e,e+7),d(this,e+1,e+6),d(this,e+2,e+5),d(this,e+3,e+4);return this},u.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?R(this,0,t):w.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){let t="";const r=e.IS;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(Z(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;let o=(i>>>=0)-(n>>>=0),f=(r>>>=0)-(e>>>=0);const s=Math.min(o,f),h=this.slice(n,i),c=t.slice(e,r);for(let t=0;t<s;++t)if(h[t]!==c[t]){o=h[t],f=c[t];break}return o<f?-1:f<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return E(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":case"latin1":case"binary":return I(this,t,e,r);case"base64":return U(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const O=4096;function T(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function L(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function S(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n<r;++n)i+=K[t[n]];return i}function _(t,e,r){const n=t.slice(e,r);let i="";for(let t=0;t<n.length-1;t+=2)i+=String.fromCharCode(n[t]+256*n[t+1]);return i}function $(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function x(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function C(t,e,r,n,i){z(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;let f=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=f,f>>=8,t[r++]=f,f>>=8,t[r++]=f,f>>=8,t[r++]=f,r}function k(t,e,r,n,i){z(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;let f=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=f,f>>=8,t[r+2]=f,f>>=8,t[r+1]=f,f>>=8,t[r]=f,r+8}function P(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function N(t,e,r,n,o){return e=+e,r>>>=0,o||P(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function F(t,e,r,n,o){return e=+e,r>>>=0,o||P(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||$(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||$(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||$(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||$(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||$(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||$(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||$(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=Q(function(t){G(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||Y(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))}),u.prototype.readBigUInt64BE=Q(function(t){G(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||Y(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)}),u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||$(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||$(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||$(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||$(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||$(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||$(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||$(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=Q(function(t){G(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||Y(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)}),u.prototype.readBigInt64BE=Q(function(t){G(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||Y(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)}),u.prototype.readFloatLE=function(t,e){return t>>>=0,e||$(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||$(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||$(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||$(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||x(this,t,e,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||x(this,t,e,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigUInt64LE=Q(function(t,e=0){return C(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=Q(function(t,e=0){return k(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);x(this,t,e,r,n-1,-n)}let i=0,o=1,f=0;for(this[e]=255&t;++i<r&&(o*=256);)t<0&&0===f&&0!==this[e+i-1]&&(f=1),this[e+i]=(t/o|0)-f&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);x(this,t,e,r,n-1,-n)}let i=r-1,o=1,f=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===f&&0!==this[e+i+1]&&(f=1),this[e+i]=(t/o|0)-f&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||x(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigInt64LE=Q(function(t,e=0){return C(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=Q(function(t,e=0){return k(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeFloatLE=function(t,e,r){return N(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return N(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return F(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return F(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{const o=u.isBuffer(t)?t:u.from(t,n),f=o.length;if(0===f)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=o[i%f]}return this};const j={};function M(t,e,r){j[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function D(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function z(t,e,r,n,i,o){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new j.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,r){G(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||Y(e,t.length-(r+1))}(n,i,o)}function G(t,e){if("number"!=typeof t)throw new j.ERR_INVALID_ARG_TYPE(e,"number",t)}function Y(t,e,r){if(Math.floor(t)!==t)throw G(t,r),new j.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}M("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),M("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError),M("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=D(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=D(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);const V=/[^+/0-9A-Za-z-_]/g;function q(t,e){let r;e=e||1/0;const n=t.length;let i=null;const o=[];for(let f=0;f<n;++f){if(r=t.charCodeAt(f),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(f+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function W(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function J(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Z(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function H(t){return t!=t}const K=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Q(t){return"undefined"==typeof BigInt?X:t}function X(){throw new Error("BigInt not supported")}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(this.webpackChunkNostrCryptoUtils=this.webpackChunkNostrCryptoUtils||[]).push([[343],{343(t,r){const e="qpzry9x8gf2tvdw0s3jn54khce6mua7l",n={};for(let t=0;t<32;t++){const r=e.charAt(t);n[r]=t}function o(t){const r=t>>25;return(33554431&t)<<5^996825010&-(1&r)^642813549&-(r>>1&1)^513874426&-(r>>2&1)^1027748829&-(r>>3&1)^705979059&-(r>>4&1)}function i(t){let r=1;for(let e=0;e<t.length;++e){const n=t.charCodeAt(e);if(n<33||n>126)return"Invalid prefix ("+t+")";r=o(r)^n>>5}r=o(r);for(let e=0;e<t.length;++e){const n=t.charCodeAt(e);r=o(r)^31&n}return r}function s(t,r,e,n){let o=0,i=0;const s=(1<<e)-1,c=[];for(let n=0;n<t.length;++n)for(o=o<<r|t[n],i+=r;i>=e;)i-=e,c.push(o>>i&s);if(n)i>0&&c.push(o<<e-i&s);else{if(i>=r)return"Excess padding";if(o<<e-i&s)return"Non-zero padding"}return c}function c(t){return s(t,8,5,!0)}function f(t){const r=s(t,5,8,!1);if(Array.isArray(r))return r}function u(t){const r=s(t,5,8,!1);if(Array.isArray(r))return r;throw new Error(r)}function h(t){let r;function s(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";const s=t.toLowerCase(),c=t.toUpperCase();if(t!==s&&t!==c)return"Mixed-case string "+t;const f=(t=s).lastIndexOf("1");if(-1===f)return"No separator character for "+t;if(0===f)return"Missing prefix for "+t;const u=t.slice(0,f),h=t.slice(f+1);if(h.length<6)return"Data too short";let l=i(u);if("string"==typeof l)return l;const a=[];for(let t=0;t<h.length;++t){const r=h.charAt(t),e=n[r];if(void 0===e)return"Unknown character "+r;l=o(l)^e,t+6>=h.length||a.push(e)}return l!==r?"Invalid checksum for "+t:{prefix:u,words:a}}return r="bech32"===t?1:734539939,{decodeUnsafe:function(t,r){const e=s(t,r);if("object"==typeof e)return e},decode:function(t,r){const e=s(t,r);if("object"==typeof e)return e;throw new Error(e)},encode:function(t,n,s){if(s=s||90,t.length+7+n.length>s)throw new TypeError("Exceeds length limit");let c=i(t=t.toLowerCase());if("string"==typeof c)throw new Error(c);let f=t+"1";for(let t=0;t<n.length;++t){const r=n[t];if(r>>5)throw new Error("Non 5-bit word");c=o(c)^r,f+=e.charAt(r)}for(let t=0;t<6;++t)c=o(c);c^=r;for(let t=0;t<6;++t)f+=e.charAt(c>>5*(5-t)&31);return f},toWords:c,fromWordsUnsafe:f,fromWords:u}}h("bech32"),h("bech32m")}}]);
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 348.nostr-crypto-utils.min.js.LICENSE.txt */
2
+ "use strict";(this.webpackChunkNostrCryptoUtils=this.webpackChunkNostrCryptoUtils||[]).push([[348],{967(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.isNegativeLE=void 0,t.mod=b,t.pow=function(e,t,n){return v(x(n),e,t)},t.pow2=function(e,t,n){let r=e;for(;t-- >o;)r*=r,r%=n;return r},t.invert=g,t.tonelliShanks=w,t.FpSqrt=E,t.validateField=function(e){const t=B.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"});return(0,r._validateObject)(e,t),e},t.FpPow=v,t.FpInvertBatch=O,t.FpDiv=function(e,t,n){return e.mul(t,"bigint"==typeof n?g(n,e.ORDER):e.inv(n))},t.FpLegendre=T,t.FpIsSquare=function(e,t){return 1===T(e,t)},t.nLength=q,t.Field=x,t.FpSqrtOdd=function(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const n=e.sqrt(t);return e.isOdd(n)?n:e.neg(n)},t.FpSqrtEven=function(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const n=e.sqrt(t);return e.isOdd(n)?e.neg(n):n},t.hashToPrivateScalar=function(e,t,n=!1){const o=(e=(0,r.ensureBytes)("privateHash",e)).length,s=q(t).nByteLength+8;if(s<24||o<s||o>1024)throw new Error("hashToPrivateScalar: expected "+s+"-1024 bytes of input, got "+o);return b(n?(0,r.bytesToNumberLE)(e):(0,r.bytesToNumberBE)(e),t-i)+i},t.getFieldBytesLength=N,t.getMinHashLength=I,t.mapHashToField=function(e,t,n=!1){const o=e.length,s=N(t),u=I(t);if(o<16||o<u||o>1024)throw new Error("expected "+u+"-1024 bytes of input, got "+o);const f=b(n?(0,r.bytesToNumberLE)(e):(0,r.bytesToNumberBE)(e),t-i)+i;return n?(0,r.numberToBytesLE)(f,s):(0,r.numberToBytesBE)(f,s)};const r=n(627),o=BigInt(0),i=BigInt(1),s=BigInt(2),u=BigInt(3),f=BigInt(4),c=BigInt(5),l=BigInt(7),a=BigInt(8),d=BigInt(9),y=BigInt(16);function b(e,t){const n=e%t;return n>=o?n:t+n}function g(e,t){if(e===o)throw new Error("invert: expected non-zero number");if(t<=o)throw new Error("invert: expected positive modulus, got "+t);let n=b(e,t),r=t,s=o,u=i,f=i,c=o;for(;n!==o;){const e=r/n,t=r%n,o=s-f*e,i=u-c*e;r=n,n=t,s=f,u=c,f=o,c=i}if(r!==i)throw new Error("invert: does not exist");return b(s,t)}function h(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function p(e,t){const n=(e.ORDER+i)/f,r=e.pow(t,n);return h(e,r,t),r}function m(e,t){const n=(e.ORDER-c)/a,r=e.mul(t,s),o=e.pow(r,n),i=e.mul(t,o),u=e.mul(e.mul(i,s),o),f=e.mul(i,e.sub(u,e.ONE));return h(e,f,t),f}function w(e){if(e<u)throw new Error("sqrt is not defined for small field");let t=e-i,n=0;for(;t%s===o;)t/=s,n++;let r=s;const f=x(e);for(;1===T(f,r);)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(1===n)return p;let c=f.pow(r,t);const l=(t+i)/s;return function(e,r){if(e.is0(r))return r;if(1!==T(e,r))throw new Error("Cannot find square root");let o=n,s=e.mul(e.ONE,c),u=e.pow(r,t),f=e.pow(r,l);for(;!e.eql(u,e.ONE);){if(e.is0(u))return e.ZERO;let t=1,n=e.sqr(u);for(;!e.eql(n,e.ONE);)if(t++,n=e.sqr(n),t===o)throw new Error("Cannot find square root");const r=i<<BigInt(o-t-1),c=e.pow(s,r);o=t,s=e.sqr(c),u=e.mul(u,s),f=e.mul(f,c)}return f}}function E(e){return e%f===u?p:e%a===c?m:e%y===d?function(e){const t=x(e),n=w(e),r=n(t,t.neg(t.ONE)),o=n(t,r),i=n(t,t.neg(r)),s=(e+l)/y;return(e,t)=>{let n=e.pow(t,s),u=e.mul(n,r);const f=e.mul(n,o),c=e.mul(n,i),l=e.eql(e.sqr(u),t),a=e.eql(e.sqr(f),t);n=e.cmov(n,u,l),u=e.cmov(c,f,a);const d=e.eql(e.sqr(u),t),y=e.cmov(n,u,d);return h(e,y,t),y}}(e):w(e)}t.isNegativeLE=(e,t)=>(b(e,t)&i)===i;const B=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function v(e,t,n){if(n<o)throw new Error("invalid exponent, negatives unsupported");if(n===o)return e.ONE;if(n===i)return t;let r=e.ONE,s=t;for(;n>o;)n&i&&(r=e.mul(r,s)),s=e.sqr(s),n>>=i;return r}function O(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),o=t.reduce((t,n,o)=>e.is0(n)?t:(r[o]=t,e.mul(t,n)),e.ONE),i=e.inv(o);return t.reduceRight((t,n,o)=>e.is0(n)?t:(r[o]=e.mul(t,r[o]),e.mul(t,n)),i),r}function T(e,t){const n=(e.ORDER-i)/s,r=e.pow(t,n),o=e.eql(r,e.ONE),u=e.eql(r,e.ZERO),f=e.eql(r,e.neg(e.ONE));if(!o&&!u&&!f)throw new Error("invalid Legendre symbol result");return o?1:u?0:-1}function q(e,t){void 0!==t&&(0,r.anumber)(t);const n=void 0!==t?t:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function x(e,t,n=!1,s={}){if(e<=o)throw new Error("invalid field: expected ORDER > 0, got "+e);let u,f,c,l=!1;if("object"==typeof t&&null!=t){if(s.sqrt||n)throw new Error("cannot specify opts in two arguments");const e=t;e.BITS&&(u=e.BITS),e.sqrt&&(f=e.sqrt),"boolean"==typeof e.isLE&&(n=e.isLE),"boolean"==typeof e.modFromBytes&&(l=e.modFromBytes),c=e.allowedLengths}else"number"==typeof t&&(u=t),s.sqrt&&(f=s.sqrt);const{nBitLength:a,nByteLength:d}=q(e,u);if(d>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let y;const h=Object.freeze({ORDER:e,isLE:n,BITS:a,BYTES:d,MASK:(0,r.bitMask)(a),ZERO:o,ONE:i,allowedLengths:c,create:t=>b(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("invalid field element: expected bigint, got "+typeof t);return o<=t&&t<e},is0:e=>e===o,isValidNot0:e=>!h.is0(e)&&h.isValid(e),isOdd:e=>(e&i)===i,neg:t=>b(-t,e),eql:(e,t)=>e===t,sqr:t=>b(t*t,e),add:(t,n)=>b(t+n,e),sub:(t,n)=>b(t-n,e),mul:(t,n)=>b(t*n,e),pow:(e,t)=>v(h,e,t),div:(t,n)=>b(t*g(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>g(t,e),sqrt:f||(t=>(y||(y=E(e)),y(h,t))),toBytes:e=>n?(0,r.numberToBytesLE)(e,d):(0,r.numberToBytesBE)(e,d),fromBytes:(t,o=!0)=>{if(c){if(!c.includes(t.length)||t.length>d)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+t.length);const e=new Uint8Array(d);e.set(t,n?0:e.length-t.length),t=e}if(t.length!==d)throw new Error("Field.fromBytes: expected "+d+" bytes, got "+t.length);let i=n?(0,r.bytesToNumberLE)(t):(0,r.bytesToNumberBE)(t);if(l&&(i=b(i,e)),!o&&!h.isValid(i))throw new Error("invalid field element: outside of range 0..ORDER");return i},invertBatch:e=>O(h,e),cmov:(e,t,n)=>n?t:e});return Object.freeze(h)}function N(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function I(e){const t=N(e);return t+Math.ceil(t/2)}},627(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.notImplemented=t.bitMask=t.utf8ToBytes=t.randomBytes=t.isBytes=t.hexToBytes=t.concatBytes=t.bytesToUtf8=t.bytesToHex=t.anumber=t.abytes=void 0,t.abool=function(e,t){if("boolean"!=typeof t)throw new Error(e+" boolean expected, got "+t)},t._abool2=function(e,t=""){if("boolean"!=typeof e)throw new Error((t&&`"${t}"`)+"expected boolean, got type="+typeof e);return e},t._abytes2=function(e,t,n=""){const o=(0,r.isBytes)(e),i=e?.length,s=void 0!==t;if(!o||s&&i!==t)throw new Error((n&&`"${n}" `)+"expected Uint8Array"+(s?` of length ${t}`:"")+", got "+(o?`length=${i}`:"type="+typeof e));return e},t.numberToHexUnpadded=u,t.hexToNumber=f,t.bytesToNumberBE=function(e){return f((0,r.bytesToHex)(e))},t.bytesToNumberLE=function(e){return(0,r.abytes)(e),f((0,r.bytesToHex)(Uint8Array.from(e).reverse()))},t.numberToBytesBE=c,t.numberToBytesLE=function(e,t){return c(e,t).reverse()},t.numberToVarBytesBE=function(e){return(0,r.hexToBytes)(u(e))},t.ensureBytes=function(e,t,n){let o;if("string"==typeof t)try{o=(0,r.hexToBytes)(t)}catch(t){throw new Error(e+" must be hex string or Uint8Array, cause: "+t)}else{if(!(0,r.isBytes)(t))throw new Error(e+" must be hex string or Uint8Array");o=Uint8Array.from(t)}const i=o.length;if("number"==typeof n&&i!==n)throw new Error(e+" of length "+n+" expected, got "+i);return o},t.equalBytes=function(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return 0===n},t.copyBytes=function(e){return Uint8Array.from(e)},t.asciiToBytes=function(e){return Uint8Array.from(e,(t,n)=>{const r=t.charCodeAt(0);if(1!==t.length||r>127)throw new Error(`string contains non-ASCII character "${e[n]}" with code ${r} at position ${n}`);return r})},t.inRange=a,t.aInRange=function(e,t,n,r){if(!a(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)},t.bitLen=function(e){let t;for(t=0;e>i;e>>=s,t+=1);return t},t.bitGet=function(e,t){return e>>BigInt(t)&s},t.bitSet=function(e,t,n){return e|(n?s:i)<<BigInt(t)},t.createHmacDrbg=function(e,t,n){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");const o=e=>new Uint8Array(e),i=e=>Uint8Array.of(e);let s=o(e),u=o(e),f=0;const c=()=>{s.fill(1),u.fill(0),f=0},l=(...e)=>n(u,s,...e),a=(e=o(0))=>{u=l(i(0),e),s=l(),0!==e.length&&(u=l(i(1),e),s=l())},d=()=>{if(f++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const n=[];for(;e<t;){s=l();const t=s.slice();n.push(t),e+=s.length}return(0,r.concatBytes)(...n)};return(e,t)=>{let n;for(c(),a(e);!(n=t(d()));)a();return c(),n}},t.validateObject=function(e,t,n={}){const r=(t,n,r)=>{const o=d[n];if("function"!=typeof o)throw new Error("invalid validator function");const i=e[t];if(!(r&&void 0===i||o(i,e)))throw new Error("param "+String(t)+" is invalid. Expected "+n+", got "+i)};for(const[e,n]of Object.entries(t))r(e,n,!1);for(const[e,t]of Object.entries(n))r(e,t,!0);return e},t.isHash=function(e){return"function"==typeof e&&Number.isSafeInteger(e.outputLen)},t._validateObject=function(e,t,n={}){if(!e||"object"!=typeof e)throw new Error("expected valid options object");function r(t,n,r){const o=e[t];if(r&&void 0===o)return;const i=typeof o;if(i!==n||null===o)throw new Error(`param "${t}" is invalid: expected ${n}, got ${i}`)}Object.entries(t).forEach(([e,t])=>r(e,t,!1)),Object.entries(n).forEach(([e,t])=>r(e,t,!0))},t.memoized=function(e){const t=new WeakMap;return(n,...r)=>{const o=t.get(n);if(void 0!==o)return o;const i=e(n,...r);return t.set(n,i),i}};const r=n(175);var o=n(175);Object.defineProperty(t,"abytes",{enumerable:!0,get:function(){return o.abytes}}),Object.defineProperty(t,"anumber",{enumerable:!0,get:function(){return o.anumber}}),Object.defineProperty(t,"bytesToHex",{enumerable:!0,get:function(){return o.bytesToHex}}),Object.defineProperty(t,"bytesToUtf8",{enumerable:!0,get:function(){return o.bytesToUtf8}}),Object.defineProperty(t,"concatBytes",{enumerable:!0,get:function(){return o.concatBytes}}),Object.defineProperty(t,"hexToBytes",{enumerable:!0,get:function(){return o.hexToBytes}}),Object.defineProperty(t,"isBytes",{enumerable:!0,get:function(){return o.isBytes}}),Object.defineProperty(t,"randomBytes",{enumerable:!0,get:function(){return o.randomBytes}}),Object.defineProperty(t,"utf8ToBytes",{enumerable:!0,get:function(){return o.utf8ToBytes}});const i=BigInt(0),s=BigInt(1);function u(e){const t=e.toString(16);return 1&t.length?"0"+t:t}function f(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return""===e?i:BigInt("0x"+e)}function c(e,t){return(0,r.hexToBytes)(e.toString(16).padStart(2*t,"0"))}const l=e=>"bigint"==typeof e&&i<=e;function a(e,t,n){return l(e)&&l(t)&&l(n)&&t<=e&&e<n}t.bitMask=e=>(s<<BigInt(e))-s;const d={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||(0,r.isBytes)(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};t.notImplemented=()=>{throw new Error("not implemented")}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(this.webpackChunkNostrCryptoUtils=this.webpackChunkNostrCryptoUtils||[]).push([[524],{202(t,s,h){Object.defineProperty(s,"__esModule",{value:!0}),s.SHA512_IV=s.SHA384_IV=s.SHA224_IV=s.SHA256_IV=s.HashMD=void 0,s.setBigUint64=r,s.Chi=function(t,s,h){return t&s^~t&h},s.Maj=function(t,s,h){return t&s^t&h^s&h};const e=h(175);function r(t,s,h,e){if("function"==typeof t.setBigUint64)return t.setBigUint64(s,h,e);const r=BigInt(32),i=BigInt(4294967295),o=Number(h>>r&i),c=Number(h&i),a=e?4:0,n=e?0:4;t.setUint32(s+a,o,e),t.setUint32(s+n,c,e)}class i extends e.Hash{constructor(t,s,h,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=s,this.padOffset=h,this.isLE=r,this.buffer=new Uint8Array(t),this.view=(0,e.createView)(this.buffer)}update(t){(0,e.aexists)(this),t=(0,e.toBytes)(t),(0,e.abytes)(t);const{view:s,buffer:h,blockLen:r}=this,i=t.length;for(let o=0;o<i;){const c=Math.min(r-this.pos,i-o);if(c===r){const s=(0,e.createView)(t);for(;r<=i-o;o+=r)this.process(s,o);continue}h.set(t.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===r&&(this.process(s,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){(0,e.aexists)(this),(0,e.aoutput)(t,this),this.finished=!0;const{buffer:s,view:h,blockLen:i,isLE:o}=this;let{pos:c}=this;s[c++]=128,(0,e.clean)(this.buffer.subarray(c)),this.padOffset>i-c&&(this.process(h,0),c=0);for(let t=c;t<i;t++)s[t]=0;r(h,i-8,BigInt(8*this.length),o),this.process(h,0);const a=(0,e.createView)(t),n=this.outputLen;if(n%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const d=n/4,l=this.get();if(d>l.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<d;t++)a.setUint32(4*t,l[t],o)}digest(){const{buffer:t,outputLen:s}=this;this.digestInto(t);const h=t.slice(0,s);return this.destroy(),h}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:s,buffer:h,length:e,finished:r,destroyed:i,pos:o}=this;return t.destroyed=i,t.finished=r,t.length=e,t.pos=o,e%s&&t.buffer.set(h),t}clone(){return this._cloneInto()}}s.HashMD=i,s.SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),s.SHA224_IV=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),s.SHA384_IV=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),s.SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209])},318(t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.toBig=s.shrSL=s.shrSH=s.rotrSL=s.rotrSH=s.rotrBL=s.rotrBH=s.rotr32L=s.rotr32H=s.rotlSL=s.rotlSH=s.rotlBL=s.rotlBH=s.add5L=s.add5H=s.add4L=s.add4H=s.add3L=s.add3H=void 0,s.add=_,s.fromBig=r,s.split=i;const h=BigInt(2**32-1),e=BigInt(32);function r(t,s=!1){return s?{h:Number(t&h),l:Number(t>>e&h)}:{h:0|Number(t>>e&h),l:0|Number(t&h)}}function i(t,s=!1){const h=t.length;let e=new Uint32Array(h),i=new Uint32Array(h);for(let o=0;o<h;o++){const{h,l:c}=r(t[o],s);[e[o],i[o]]=[h,c]}return[e,i]}const o=(t,s)=>BigInt(t>>>0)<<e|BigInt(s>>>0);s.toBig=o;const c=(t,s,h)=>t>>>h;s.shrSH=c;const a=(t,s,h)=>t<<32-h|s>>>h;s.shrSL=a;const n=(t,s,h)=>t>>>h|s<<32-h;s.rotrSH=n;const d=(t,s,h)=>t<<32-h|s>>>h;s.rotrSL=d;const l=(t,s,h)=>t<<64-h|s>>>h-32;s.rotrBH=l;const H=(t,s,h)=>t>>>h-32|s<<64-h;s.rotrBL=H;const f=(t,s)=>s;s.rotr32H=f;const b=(t,s)=>t;s.rotr32L=b;const A=(t,s,h)=>t<<h|s>>>32-h;s.rotlSH=A;const S=(t,s,h)=>s<<h|t>>>32-h;s.rotlSL=S;const x=(t,s,h)=>s<<h-32|t>>>64-h;s.rotlBH=x;const u=(t,s,h)=>t<<h-32|s>>>64-h;function _(t,s,h,e){const r=(s>>>0)+(e>>>0);return{h:t+h+(r/2**32|0)|0,l:0|r}}s.rotlBL=u;const I=(t,s,h)=>(t>>>0)+(s>>>0)+(h>>>0);s.add3L=I;const B=(t,s,h,e)=>s+h+e+(t/2**32|0)|0;s.add3H=B;const V=(t,s,h,e)=>(t>>>0)+(s>>>0)+(h>>>0)+(e>>>0);s.add4L=V;const L=(t,s,h,e,r)=>s+h+e+r+(t/2**32|0)|0;s.add4H=L;const p=(t,s,h,e,r)=>(t>>>0)+(s>>>0)+(h>>>0)+(e>>>0)+(r>>>0);s.add5L=p;const g=(t,s,h,e,r,i)=>s+h+e+r+i+(t/2**32|0)|0;s.add5H=g;const y={fromBig:r,split:i,toBig:o,shrSH:c,shrSL:a,rotrSH:n,rotrSL:d,rotrBH:l,rotrBL:H,rotr32H:f,rotr32L:b,rotlSH:A,rotlSL:S,rotlBH:x,rotlBL:u,add:_,add3L:I,add3H:B,add4L:V,add4H:L,add5H:g,add5L:p};s.default=y},145(t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.crypto=void 0,s.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},76(t,s,h){Object.defineProperty(s,"__esModule",{value:!0}),s.sha512_224=s.sha512_256=s.sha384=s.sha512=s.sha224=s.sha256=s.SHA512_256=s.SHA512_224=s.SHA384=s.SHA512=s.SHA224=s.SHA256=void 0;const e=h(202),r=h(318),i=h(175),o=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),c=new Uint32Array(64);class a extends e.HashMD{constructor(t=32){super(64,t,8,!1),this.A=0|e.SHA256_IV[0],this.B=0|e.SHA256_IV[1],this.C=0|e.SHA256_IV[2],this.D=0|e.SHA256_IV[3],this.E=0|e.SHA256_IV[4],this.F=0|e.SHA256_IV[5],this.G=0|e.SHA256_IV[6],this.H=0|e.SHA256_IV[7]}get(){const{A:t,B:s,C:h,D:e,E:r,F:i,G:o,H:c}=this;return[t,s,h,e,r,i,o,c]}set(t,s,h,e,r,i,o,c){this.A=0|t,this.B=0|s,this.C=0|h,this.D=0|e,this.E=0|r,this.F=0|i,this.G=0|o,this.H=0|c}process(t,s){for(let h=0;h<16;h++,s+=4)c[h]=t.getUint32(s,!1);for(let t=16;t<64;t++){const s=c[t-15],h=c[t-2],e=(0,i.rotr)(s,7)^(0,i.rotr)(s,18)^s>>>3,r=(0,i.rotr)(h,17)^(0,i.rotr)(h,19)^h>>>10;c[t]=r+c[t-7]+e+c[t-16]|0}let{A:h,B:r,C:a,D:n,E:d,F:l,G:H,H:f}=this;for(let t=0;t<64;t++){const s=f+((0,i.rotr)(d,6)^(0,i.rotr)(d,11)^(0,i.rotr)(d,25))+(0,e.Chi)(d,l,H)+o[t]+c[t]|0,b=((0,i.rotr)(h,2)^(0,i.rotr)(h,13)^(0,i.rotr)(h,22))+(0,e.Maj)(h,r,a)|0;f=H,H=l,l=d,d=n+s|0,n=a,a=r,r=h,h=s+b|0}h=h+this.A|0,r=r+this.B|0,a=a+this.C|0,n=n+this.D|0,d=d+this.E|0,l=l+this.F|0,H=H+this.G|0,f=f+this.H|0,this.set(h,r,a,n,d,l,H,f)}roundClean(){(0,i.clean)(c)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,i.clean)(this.buffer)}}s.SHA256=a;class n extends a{constructor(){super(28),this.A=0|e.SHA224_IV[0],this.B=0|e.SHA224_IV[1],this.C=0|e.SHA224_IV[2],this.D=0|e.SHA224_IV[3],this.E=0|e.SHA224_IV[4],this.F=0|e.SHA224_IV[5],this.G=0|e.SHA224_IV[6],this.H=0|e.SHA224_IV[7]}}s.SHA224=n;const d=(()=>r.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))))(),l=(()=>d[0])(),H=(()=>d[1])(),f=new Uint32Array(80),b=new Uint32Array(80);class A extends e.HashMD{constructor(t=64){super(128,t,16,!1),this.Ah=0|e.SHA512_IV[0],this.Al=0|e.SHA512_IV[1],this.Bh=0|e.SHA512_IV[2],this.Bl=0|e.SHA512_IV[3],this.Ch=0|e.SHA512_IV[4],this.Cl=0|e.SHA512_IV[5],this.Dh=0|e.SHA512_IV[6],this.Dl=0|e.SHA512_IV[7],this.Eh=0|e.SHA512_IV[8],this.El=0|e.SHA512_IV[9],this.Fh=0|e.SHA512_IV[10],this.Fl=0|e.SHA512_IV[11],this.Gh=0|e.SHA512_IV[12],this.Gl=0|e.SHA512_IV[13],this.Hh=0|e.SHA512_IV[14],this.Hl=0|e.SHA512_IV[15]}get(){const{Ah:t,Al:s,Bh:h,Bl:e,Ch:r,Cl:i,Dh:o,Dl:c,Eh:a,El:n,Fh:d,Fl:l,Gh:H,Gl:f,Hh:b,Hl:A}=this;return[t,s,h,e,r,i,o,c,a,n,d,l,H,f,b,A]}set(t,s,h,e,r,i,o,c,a,n,d,l,H,f,b,A){this.Ah=0|t,this.Al=0|s,this.Bh=0|h,this.Bl=0|e,this.Ch=0|r,this.Cl=0|i,this.Dh=0|o,this.Dl=0|c,this.Eh=0|a,this.El=0|n,this.Fh=0|d,this.Fl=0|l,this.Gh=0|H,this.Gl=0|f,this.Hh=0|b,this.Hl=0|A}process(t,s){for(let h=0;h<16;h++,s+=4)f[h]=t.getUint32(s),b[h]=t.getUint32(s+=4);for(let t=16;t<80;t++){const s=0|f[t-15],h=0|b[t-15],e=r.rotrSH(s,h,1)^r.rotrSH(s,h,8)^r.shrSH(s,h,7),i=r.rotrSL(s,h,1)^r.rotrSL(s,h,8)^r.shrSL(s,h,7),o=0|f[t-2],c=0|b[t-2],a=r.rotrSH(o,c,19)^r.rotrBH(o,c,61)^r.shrSH(o,c,6),n=r.rotrSL(o,c,19)^r.rotrBL(o,c,61)^r.shrSL(o,c,6),d=r.add4L(i,n,b[t-7],b[t-16]),l=r.add4H(d,e,a,f[t-7],f[t-16]);f[t]=0|l,b[t]=0|d}let{Ah:h,Al:e,Bh:i,Bl:o,Ch:c,Cl:a,Dh:n,Dl:d,Eh:A,El:S,Fh:x,Fl:u,Gh:_,Gl:I,Hh:B,Hl:V}=this;for(let t=0;t<80;t++){const s=r.rotrSH(A,S,14)^r.rotrSH(A,S,18)^r.rotrBH(A,S,41),L=r.rotrSL(A,S,14)^r.rotrSL(A,S,18)^r.rotrBL(A,S,41),p=A&x^~A&_,g=S&u^~S&I,y=r.add5L(V,L,g,H[t],b[t]),C=r.add5H(y,B,s,p,l[t],f[t]),D=0|y,E=r.rotrSH(h,e,28)^r.rotrBH(h,e,34)^r.rotrBH(h,e,39),w=r.rotrSL(h,e,28)^r.rotrBL(h,e,34)^r.rotrBL(h,e,39),U=h&i^h&c^i&c,F=e&o^e&a^o&a;B=0|_,V=0|I,_=0|x,I=0|u,x=0|A,u=0|S,({h:A,l:S}=r.add(0|n,0|d,0|C,0|D)),n=0|c,d=0|a,c=0|i,a=0|o,i=0|h,o=0|e;const G=r.add3L(D,w,F);h=r.add3H(G,C,E,U),e=0|G}({h,l:e}=r.add(0|this.Ah,0|this.Al,0|h,0|e)),({h:i,l:o}=r.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:c,l:a}=r.add(0|this.Ch,0|this.Cl,0|c,0|a)),({h:n,l:d}=r.add(0|this.Dh,0|this.Dl,0|n,0|d)),({h:A,l:S}=r.add(0|this.Eh,0|this.El,0|A,0|S)),({h:x,l:u}=r.add(0|this.Fh,0|this.Fl,0|x,0|u)),({h:_,l:I}=r.add(0|this.Gh,0|this.Gl,0|_,0|I)),({h:B,l:V}=r.add(0|this.Hh,0|this.Hl,0|B,0|V)),this.set(h,e,i,o,c,a,n,d,A,S,x,u,_,I,B,V)}roundClean(){(0,i.clean)(f,b)}destroy(){(0,i.clean)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}s.SHA512=A;class S extends A{constructor(){super(48),this.Ah=0|e.SHA384_IV[0],this.Al=0|e.SHA384_IV[1],this.Bh=0|e.SHA384_IV[2],this.Bl=0|e.SHA384_IV[3],this.Ch=0|e.SHA384_IV[4],this.Cl=0|e.SHA384_IV[5],this.Dh=0|e.SHA384_IV[6],this.Dl=0|e.SHA384_IV[7],this.Eh=0|e.SHA384_IV[8],this.El=0|e.SHA384_IV[9],this.Fh=0|e.SHA384_IV[10],this.Fl=0|e.SHA384_IV[11],this.Gh=0|e.SHA384_IV[12],this.Gl=0|e.SHA384_IV[13],this.Hh=0|e.SHA384_IV[14],this.Hl=0|e.SHA384_IV[15]}}s.SHA384=S;const x=Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),u=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class _ extends A{constructor(){super(28),this.Ah=0|x[0],this.Al=0|x[1],this.Bh=0|x[2],this.Bl=0|x[3],this.Ch=0|x[4],this.Cl=0|x[5],this.Dh=0|x[6],this.Dl=0|x[7],this.Eh=0|x[8],this.El=0|x[9],this.Fh=0|x[10],this.Fl=0|x[11],this.Gh=0|x[12],this.Gl=0|x[13],this.Hh=0|x[14],this.Hl=0|x[15]}}s.SHA512_224=_;class I extends A{constructor(){super(32),this.Ah=0|u[0],this.Al=0|u[1],this.Bh=0|u[2],this.Bl=0|u[3],this.Ch=0|u[4],this.Cl=0|u[5],this.Dh=0|u[6],this.Dl=0|u[7],this.Eh=0|u[8],this.El=0|u[9],this.Fh=0|u[10],this.Fl=0|u[11],this.Gh=0|u[12],this.Gl=0|u[13],this.Hh=0|u[14],this.Hl=0|u[15]}}s.SHA512_256=I,s.sha256=(0,i.createHasher)(()=>new a),s.sha224=(0,i.createHasher)(()=>new n),s.sha512=(0,i.createHasher)(()=>new A),s.sha384=(0,i.createHasher)(()=>new S),s.sha512_256=(0,i.createHasher)(()=>new I),s.sha512_224=(0,i.createHasher)(()=>new _)}}]);
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 575.nostr-crypto-utils.min.js.LICENSE.txt */
2
+ "use strict";(this.webpackChunkNostrCryptoUtils=this.webpackChunkNostrCryptoUtils||[]).push([[575],{562(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.getHash=function(e){return{hash:e}},t.createCurve=function(e,t){const r=t=>(0,n.weierstrass)({...e,hash:t});return{...r(t),create:r}};const n=r(705)},422(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.wNAF=void 0,t.negateCt=a,t.normalizeZ=function(e,t){const r=(0,o.FpInvertBatch)(e.Fp,t.map(e=>e.Z));return t.map((t,n)=>e.fromAffine(t.toAffine(r[n])))},t.mulEndoUnsafe=function(e,t,r,n){let o=t,a=e.ZERO,c=e.ZERO;for(;r>i||n>i;)r&s&&(a=a.add(o)),n&s&&(c=c.add(o)),o=o.double(),r>>=s,n>>=s;return{p1:a,p2:c}},t.pippenger=function(e,t,r,o){d(r,e),l(o,t);const i=r.length,s=o.length;if(i!==s)throw new Error("arrays of points and scalars must have equal length");const a=e.ZERO,c=(0,n.bitLen)(BigInt(i));let f=1;c>12?f=c-3:c>4?f=c-2:c>0&&(f=2);const u=(0,n.bitMask)(f),h=new Array(Number(u)+1).fill(a);let p=a;for(let e=Math.floor((t.BITS-1)/f)*f;e>=0;e-=f){h.fill(a);for(let t=0;t<s;t++){const n=o[t],i=Number(n>>BigInt(e)&u);h[i]=h[i].add(r[t])}let t=a;for(let e=h.length-1,r=a;e>0;e--)r=r.add(h[e]),t=t.add(r);if(p=p.add(t),0!==e)for(let e=0;e<f;e++)p=p.double()}return p},t.precomputeMSMUnsafe=function(e,t,r,o){c(o,t.BITS),d(r,e);const i=e.ZERO,s=2**o-1,a=Math.ceil(t.BITS/o),f=(0,n.bitMask)(o),u=r.map(e=>{const t=[];for(let r=0,n=e;r<s;r++)t.push(n),n=n.add(e);return t});return e=>{if(l(e,t),e.length>r.length)throw new Error("array of scalars must be smaller than array of points");let n=i;for(let t=0;t<a;t++){if(n!==i)for(let e=0;e<o;e++)n=n.double();const r=BigInt(a*o-(t+1)*o);for(let t=0;t<e.length;t++){const o=e[t],i=Number(o>>r&f);i&&(n=n.add(u[t][i-1]))}}return n}},t.validateBasic=function(e){return(0,o.validateField)(e.Fp),(0,n.validateObject)(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,o.nLength)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})},t._createCurveFields=function(e,t,r={},n){if(void 0===n&&(n="edwards"===e),!t||"object"!=typeof t)throw new Error(`expected valid ${e} CURVE object`);for(const e of["p","n","h"]){const r=t[e];if(!("bigint"==typeof r&&r>i))throw new Error(`CURVE.${e} must be positive bigint`)}const o=b(t.p,r.Fp,n),s=b(t.n,r.Fn,n),a=["Gx","Gy","a","weierstrass"===e?"b":"d"];for(const e of a)if(!o.isValid(t[e]))throw new Error(`CURVE.${e} must be valid field element of CURVE.Fp`);return{CURVE:t=Object.freeze(Object.assign({},t)),Fp:o,Fn:s}};const n=r(627),o=r(967),i=BigInt(0),s=BigInt(1);function a(e,t){const r=t.negate();return e?r:t}function c(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function f(e,t){c(e,t);const r=2**e;return{windows:Math.ceil(t/e)+1,windowSize:2**(e-1),mask:(0,n.bitMask)(e),maxNumber:r,shiftBy:BigInt(e)}}function u(e,t,r){const{windowSize:n,mask:o,maxNumber:i,shiftBy:a}=r;let c=Number(e&o),f=e>>a;c>n&&(c-=i,f+=s);const u=t*n;return{nextN:f,offset:u+Math.abs(c)-1,isZero:0===c,isNeg:c<0,isNegF:t%2!=0,offsetF:u}}function d(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((e,r)=>{if(!(e instanceof t))throw new Error("invalid point at index "+r)})}function l(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((e,r)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+r)})}const h=new WeakMap,p=new WeakMap;function w(e){return p.get(e)||1}function g(e){if(e!==i)throw new Error("invalid wNAF")}function b(e,t,r){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return(0,o.validateField)(t),t}return(0,o.Field)(e,{isLE:r})}t.wNAF=class{constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,r=this.ZERO){let n=e;for(;t>i;)t&s&&(r=r.add(n)),n=n.double(),t>>=s;return r}precomputeWindow(e,t){const{windows:r,windowSize:n}=f(t,this.bits),o=[];let i=e,s=i;for(let e=0;e<r;e++){s=i,o.push(s);for(let e=1;e<n;e++)s=s.add(i),o.push(s);i=s.double()}return o}wNAF(e,t,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let n=this.ZERO,o=this.BASE;const i=f(e,this.bits);for(let e=0;e<i.windows;e++){const{nextN:s,offset:c,isZero:f,isNeg:d,isNegF:l,offsetF:h}=u(r,e,i);r=s,f?o=o.add(a(l,t[h])):n=n.add(a(d,t[c]))}return g(r),{p:n,f:o}}wNAFUnsafe(e,t,r,n=this.ZERO){const o=f(e,this.bits);for(let e=0;e<o.windows&&r!==i;e++){const{nextN:i,offset:s,isZero:a,isNeg:c}=u(r,e,o);if(r=i,!a){const e=t[s];n=n.add(c?e.negate():e)}}return g(r),n}getPrecomputes(e,t,r){let n=h.get(t);return n||(n=this.precomputeWindow(t,e),1!==e&&("function"==typeof r&&(n=r(n)),h.set(t,n))),n}cached(e,t,r){const n=w(e);return this.wNAF(n,this.getPrecomputes(n,e,r),t)}unsafe(e,t,r,n){const o=w(e);return 1===o?this._unsafeLadder(e,t,n):this.wNAFUnsafe(o,this.getPrecomputes(o,e,r),t,n)}createCache(e,t){c(t,this.bits),p.set(e,t),h.delete(e)}hasCache(e){return 1!==w(e)}}},761(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t._DST_scalar=void 0,t.expand_message_xmd=u,t.expand_message_xof=d,t.hash_to_field=l,t.isogenyMap=function(e,t){const r=t.map(e=>Array.from(e).reverse());return(t,n)=>{const[i,s,a,c]=r.map(r=>r.reduce((r,n)=>e.add(e.mul(r,t),n))),[f,u]=(0,o.FpInvertBatch)(e,[s,c],!0);return t=e.mul(i,f),n=e.mul(n,e.mul(a,u)),{x:t,y:n}}},t.createHasher=function(e,r,n){if("function"!=typeof r)throw new Error("mapToCurve() must be defined");function o(t){return e.fromAffine(r(t))}function i(t){const r=t.clearCofactor();return r.equals(e.ZERO)?e.ZERO:(r.assertValidity(),r)}return{defaults:n,hashToCurve(e,t){const r=l(e,2,Object.assign({},n,t)),s=o(r[0]),a=o(r[1]);return i(s.add(a))},encodeToCurve(e,t){const r=n.encodeDST?{DST:n.encodeDST}:{};return i(o(l(e,1,Object.assign({},n,r,t))[0]))},mapToCurve(e){if(!Array.isArray(e))throw new Error("expected array of bigints");for(const t of e)if("bigint"!=typeof t)throw new Error("expected array of bigints");return i(o(e))},hashToScalar(r,o){const i=e.Fn.ORDER;return l(r,1,Object.assign({},n,{p:i,m:1,DST:t._DST_scalar},o))[0][0]}}};const n=r(627),o=r(967),i=n.bytesToNumberBE;function s(e,t){if(c(e),c(t),e<0||e>=1<<8*t)throw new Error("invalid I2OSP input: "+e);const r=Array.from({length:t}).fill(0);for(let n=t-1;n>=0;n--)r[n]=255&e,e>>>=8;return new Uint8Array(r)}function a(e,t){const r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e[n]^t[n];return r}function c(e){if(!Number.isSafeInteger(e))throw new Error("number expected")}function f(e){if(!(0,n.isBytes)(e)&&"string"!=typeof e)throw new Error("DST must be Uint8Array or string");return"string"==typeof e?(0,n.utf8ToBytes)(e):e}function u(e,t,r,o){(0,n.abytes)(e),c(r),(t=f(t)).length>255&&(t=o((0,n.concatBytes)((0,n.utf8ToBytes)("H2C-OVERSIZE-DST-"),t)));const{outputLen:i,blockLen:u}=o,d=Math.ceil(r/i);if(r>65535||d>255)throw new Error("expand_message_xmd: invalid lenInBytes");const l=(0,n.concatBytes)(t,s(t.length,1)),h=s(0,u),p=s(r,2),w=new Array(d),g=o((0,n.concatBytes)(h,e,p,s(0,1),l));w[0]=o((0,n.concatBytes)(g,s(1,1),l));for(let e=1;e<=d;e++){const t=[a(g,w[e-1]),s(e+1,1),l];w[e]=o((0,n.concatBytes)(...t))}return(0,n.concatBytes)(...w).slice(0,r)}function d(e,t,r,o,i){if((0,n.abytes)(e),c(r),(t=f(t)).length>255){const e=Math.ceil(2*o/8);t=i.create({dkLen:e}).update((0,n.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(t).digest()}if(r>65535||t.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return i.create({dkLen:r}).update(e).update(s(r,2)).update(t).update(s(t.length,1)).digest()}function l(e,t,r){(0,n._validateObject)(r,{p:"bigint",m:"number",k:"number",hash:"function"});const{p:s,k:a,m:f,hash:l,expand:h,DST:p}=r;if(!(0,n.isHash)(r.hash))throw new Error("expected valid hash");(0,n.abytes)(e),c(t);const w=s.toString(2).length,g=Math.ceil((w+a)/8),b=t*f*g;let m;if("xmd"===h)m=u(e,p,b,l);else if("xof"===h)m=d(e,p,b,a,l);else{if("_internal_pass"!==h)throw new Error('expand must be "xmd" or "xof"');m=e}const y=new Array(t);for(let e=0;e<t;e++){const t=new Array(f);for(let r=0;r<f;r++){const n=g*(r+e*f),a=m.subarray(n,n+g);t[r]=(0,o.mod)(i(a),s)}y[e]=t}return y}t._DST_scalar=(0,n.utf8ToBytes)("HashToScalar-")}}]);
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 615.nostr-crypto-utils.min.js.LICENSE.txt */
2
+ "use strict";(this.webpackChunkNostrCryptoUtils=this.webpackChunkNostrCryptoUtils||[]).push([[615],{615(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const r=n(175);class o extends r.Hash{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,(0,r.ahash)(t);const n=(0,r.toBytes)(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(n.length>o?t.create().update(n).digest():n);for(let t=0;t<s.length;t++)s[t]^=54;this.iHash.update(s),this.oHash=t.create();for(let t=0;t<s.length;t++)s[t]^=106;this.oHash.update(s),(0,r.clean)(s)}update(t){return(0,r.aexists)(this),this.iHash.update(t),this}digestInto(t){(0,r.aexists)(this),(0,r.abytes)(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:n,finished:r,destroyed:o,blockLen:s,outputLen:i}=this;return t.finished=r,t.destroyed=o,t.blockLen=s,t.outputLen=i,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.HMAC=o,e.hmac=(t,e,n)=>new o(t,e).update(n).digest(),e.hmac.create=(t,e)=>new o(t,e)},175(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.Hash=e.nextTick=e.swap32IfBE=e.byteSwapIfBE=e.swap8IfBE=e.isLE=void 0,e.isBytes=o,e.anumber=s,e.abytes=i,e.ahash=function(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.createHasher");s(t.outputLen),s(t.blockLen)},e.aexists=function(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")},e.aoutput=function(t,e){i(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)},e.u8=function(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)},e.u32=function(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))},e.clean=function(...t){for(let e=0;e<t.length;e++)t[e].fill(0)},e.createView=function(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)},e.rotr=function(t,e){return t<<32-e|t>>>e},e.rotl=function(t,e){return t<<e|t>>>32-e>>>0},e.byteSwap=a,e.byteSwap32=c,e.bytesToHex=function(t){if(i(t),u)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=h[t[n]];return e},e.hexToBytes=function(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);if(u)return Uint8Array.fromHex(t);const e=t.length,n=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let e=0,o=0;e<n;e++,o+=2){const n=f(t.charCodeAt(o)),s=f(t.charCodeAt(o+1));if(void 0===n||void 0===s){const e=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+e+'" at index '+o)}r[e]=16*n+s}return r},e.asyncLoop=async function(t,n,r){let o=Date.now();for(let s=0;s<t;s++){r(s);const t=Date.now()-o;t>=0&&t<n||(await(0,e.nextTick)(),o+=t)}},e.utf8ToBytes=d,e.bytesToUtf8=function(t){return(new TextDecoder).decode(t)},e.toBytes=p,e.kdfInputToBytes=function(t){return"string"==typeof t&&(t=d(t)),i(t),t},e.concatBytes=function(...t){let e=0;for(let n=0;n<t.length;n++){const r=t[n];i(r),e+=r.length}const n=new Uint8Array(e);for(let e=0,r=0;e<t.length;e++){const o=t[e];n.set(o,r),r+=o.length}return n},e.checkOpts=function(t,e){if(void 0!==e&&"[object Object]"!=={}.toString.call(e))throw new Error("options should be object or undefined");return Object.assign(t,e)},e.createHasher=y,e.createOptHasher=l,e.createXOFer=w,e.randomBytes=function(t=32){if(r.crypto&&"function"==typeof r.crypto.getRandomValues)return r.crypto.getRandomValues(new Uint8Array(t));if(r.crypto&&"function"==typeof r.crypto.randomBytes)return Uint8Array.from(r.crypto.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")};const r=n(145);function o(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name}function s(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function i(t,...e){if(!o(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function a(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function c(t){for(let e=0;e<t.length;e++)t[e]=a(t[e]);return t}e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],e.swap8IfBE=e.isLE?t=>t:t=>a(t),e.byteSwapIfBE=e.swap8IfBE,e.swap32IfBE=e.isLE?t=>t:c;const u=(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),h=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function f(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:void 0}function d(t){if("string"!=typeof t)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(t))}function p(t){return"string"==typeof t&&(t=d(t)),i(t),t}function y(t){const e=e=>t().update(p(e)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function l(t){const e=(e,n)=>t(n).update(p(e)).digest(),n=t({});return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=e=>t(e),e}function w(t){const e=(e,n)=>t(n).update(p(e)).digest(),n=t({});return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=e=>t(e),e}e.nextTick=async()=>{},e.Hash=class{},e.wrapConstructor=y,e.wrapConstructorWithOpts=l,e.wrapXOFConstructorWithOpts=w}}]);