Readme: Instructions to convert sk to hex

This commit is contained in:
abhay-raizada 2024-03-23 18:00:23 +05:30 committed by fiatjaf_
parent 7aed747bb2
commit 02da1dc036
1 changed files with 9 additions and 0 deletions

View File

@ -25,6 +25,15 @@ let sk = generateSecretKey() // `sk` is a Uint8Array
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
```js