Documentation ¶
Index ¶
- Variables
- func UseLogger(logger *zap.SugaredLogger)
- type KeyDescriptor
- type KeyLocator
- type KeyRing
- func (k *KeyRing) ECDH(keyDesc KeyDescriptor, pub *btcec.PublicKey) ([32]byte, error)
- func (k *KeyRing) SignMessage(keyLoc KeyLocator, msg []byte, doubleHash bool, compact bool) ([]byte, error)
- func (k *KeyRing) SignMessageSchnorr(keyLoc KeyLocator, msg []byte, doubleHash bool, taprootTweak []byte) (*schnorr.Signature, error)
- func (k *KeyRing) SignPsbt(packet *psbt.Packet) ([]uint32, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoSignatureReturned = errors.New("vault returned no signature") ErrNoPubkeyReturned = errors.New("vault returned no pubkey") )
Functions ¶
func UseLogger ¶
func UseLogger(logger *zap.SugaredLogger)
UseLogger uses a specified Logger to output package logging info.
Types ¶
type KeyDescriptor ¶
type KeyDescriptor struct { // KeyLocator is the internal KeyLocator of the descriptor. KeyLocator // PubKey is an optional public key that fully describes a target key. // If this is nil, the KeyLocator MUST NOT be empty. PubKey *btcec.PublicKey }
type KeyLocator ¶
type KeyRing ¶
type KeyRing struct {
// contains filtered or unexported fields
}
KeyRing is an HD keyring backed by pre-derived in-memory account keys from which index keys can be quickly derived on demand.
func NewKeyRing ¶
NewKeyRing returns a vault-backed key ring.
func (*KeyRing) ECDH ¶
func (k *KeyRing) ECDH(keyDesc KeyDescriptor, pub *btcec.PublicKey) ([32]byte, error)
ECDH performs a scalar multiplication (ECDH-like operation) between the target key descriptor and remote public key. The output returned will be the sha256 of the resulting shared point serialized in compressed format. If k is our private key, and P is the public key, we perform the following operation:
sx := k*P s := sha256(sx.SerializeCompressed())
func (*KeyRing) SignMessage ¶
func (k *KeyRing) SignMessage(keyLoc KeyLocator, msg []byte, doubleHash bool, compact bool) ([]byte, error)
SignMessage signs the given message, single or double SHA256 hashing it first, with the private key described in the key locator.
func (*KeyRing) SignMessageSchnorr ¶
func (k *KeyRing) SignMessageSchnorr(keyLoc KeyLocator, msg []byte, doubleHash bool, taprootTweak []byte) (*schnorr.Signature, error)
SignMessageSchnorr signs the given message, single or double SHA256 hashing it first, with the private key described in the key locator and the optional Taproot tweak applied to the private key.