From c82253494c1365cef2570ab6f9b32a14e685c546 Mon Sep 17 00:00:00 2001 From: juligasa <11684004+juligasa@users.noreply.github.com> Date: Tue, 25 Jun 2024 17:40:28 +0200 Subject: [PATCH] fix(daemon): lndhub tests --- backend/lndhub/lndhub.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/backend/lndhub/lndhub.go b/backend/lndhub/lndhub.go index 968050ac8..2b1fd6aff 100644 --- a/backend/lndhub/lndhub.go +++ b/backend/lndhub/lndhub.go @@ -131,11 +131,15 @@ func (c *Client) GetLndaddressDomain() string { // fail otherwise). func (c *Client) Create(ctx context.Context, connectionURL, login, pass, nickname string) (createResponse, error) { var resp createResponse - pubKey, err := c.keyStorage.GetKey(ctx, c.keyName) + kp, err := c.keyStorage.GetKey(ctx, c.keyName) if err != nil { return resp, fmt.Errorf("could not get signing key, is account initialized?: %w", err) } - pubKeyBytes, err := pubKey.PublicKey.MarshalBinary() + pubKey, err := kp.ID().ExtractPublicKey() + if err != nil { + return resp, fmt.Errorf("Invalid pubkey: %w", err) + } + pubKeyBytes, err := pubKey.Raw() if err != nil { return resp, fmt.Errorf("Invalid pubkey: %w", err) } @@ -172,7 +176,7 @@ func (c *Client) UpdateNickname(ctx context.Context, nickname string) error { return fmt.Errorf("Nickname cannot contain uppercase letters %s", nickname) } } - pubKey, err := c.keyStorage.GetKey(ctx, c.keyName) + kp, err := c.keyStorage.GetKey(ctx, c.keyName) if err != nil { return fmt.Errorf("could not get signing key, is account initialized?: %w", err) } @@ -196,7 +200,11 @@ func (c *Client) UpdateNickname(ctx context.Context, nickname string) error { if err != nil { return err } - pubKeyBytes, err := pubKey.PublicKey.MarshalBinary() + pubKey, err := kp.ID().ExtractPublicKey() + if err != nil { + return fmt.Errorf("Invalid pubkey: %w", err) + } + pubKeyBytes, err := pubKey.Raw() if err != nil { return fmt.Errorf("Invalid pubkey: %w", err) }