cmdruid / tapscript

A humble library for working with Tapscript and Bitcoin Transactions.
https://www.npmjs.com/package/@cmdcode/tapscript
Creative Commons Zero v1.0 Universal
196 stars 50 forks source link

How to generate secret keys #17

Closed PomegranateApps closed 1 year ago

PomegranateApps commented 1 year ago

I'm familiar with generating secret keys randomly and also from a secret phrase using bitcoinjs-lib.

How do I do the same thing with Tapscript? For instance, I have my secret phrase but I'm not sure how to format it to a hex string as shown in the examples.

cmdruid commented 1 year ago

I apologize for the delay. Please check out my crypto-tools library. There is a tool for creating secret keys. You can also create it from a phrase by using an encoder such as my Buff library, or new TextEncoder.encode() in order to convert a string into bytes, then use that string as a secret key.