mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-09 16:48:50 +00:00
build esm module that can be imported from browsers.
closes https://github.com/fiatjaf/nostr-tools/issues/14
This commit is contained in:
17
README.md
17
README.md
@@ -70,3 +70,20 @@ pool.addRelay('<url>')
|
||||
All functions expect bytearrays as hex strings and output bytearrays as hex strings.
|
||||
|
||||
For other utils please read the source (for now).
|
||||
|
||||
### Using from the browser (if you don't want to use a bundler)
|
||||
|
||||
You can import nostr-tools as an ES module. Just add a script tag like this:
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import {generatePrivateKey} from 'https://unpkg.com/nostr-tools/nostr.js'
|
||||
console.log(generatePrivateKey())
|
||||
</script>
|
||||
```
|
||||
|
||||
And import whatever function you would import from `"nostr-tools"` in a bundler.
|
||||
|
||||
## License
|
||||
|
||||
Public domain.
|
||||
|
||||
Reference in New Issue
Block a user