mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-08 16:28:49 +00:00
Readme: Instructions to convert sk to hex
This commit is contained in:
@@ -25,6 +25,15 @@ let sk = generateSecretKey() // `sk` is a Uint8Array
|
|||||||
let pk = getPublicKey(sk) // `pk` is a hex string
|
let pk = getPublicKey(sk) // `pk` is a hex string
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To get the secret key in hex format, use
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { bytestohex, hexToBytes } from '@noble/hashes/utils' // already an installed dependency
|
||||||
|
|
||||||
|
let skHex = bytestohex(sk)
|
||||||
|
let backToBytes = hexToBytes(skHex)
|
||||||
|
```
|
||||||
|
|
||||||
### Creating, signing and verifying events
|
### Creating, signing and verifying events
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
Reference in New Issue
Block a user