pool/chaninfo/scb_keyring.go
Oliver Gugger 30c7ef6531
multi: bump lnd+lndclient compile time dependency
This commit bumps the compile time dependency of lnd and lndclient to
the 0.16.x branch. This makes the code forward compatible but does not
yet change anything with respect to the minimum required version the
user needs to run.
2023-03-08 17:42:04 +01:00

34 lines
1.1 KiB
Go

package chaninfo
import "github.com/lightningnetwork/lnd/keychain"
// scbEncryptionKeyLocator is the key locator used to obtain the key with which
// a channel backup is encrypted with.
var scbEncryptionKeyLocator = keychain.KeyLocator{
Family: keychain.KeyFamilyBaseEncryption,
Index: 0,
}
// scbKeyRing is a wrapper struct we'll use for decrypting retrieve channel
// backups. This keyring implementation will always return the node's channel
// backup encryption key descriptor, but it must be obtained before creation.
type scbKeyRing struct {
encryptionKey keychain.KeyDescriptor
}
// A compile-time constraint to ensure scbKeyRing satisfies keychain.KeyRing.
var _ keychain.KeyRing = (*scbKeyRing)(nil)
// DeriveNextKey retruns the node's channel backup encryption key descriptor.
func (k *scbKeyRing) DeriveNextKey(
keychain.KeyFamily) (keychain.KeyDescriptor, error) {
return k.encryptionKey, nil
}
// DeriveKey retruns the node's channel backup encryption key descriptor.
func (k *scbKeyRing) DeriveKey(
keychain.KeyLocator) (keychain.KeyDescriptor, error) {
return k.encryptionKey, nil
}