multi: expose l402 id in grpc interface

This commit adds an additional field to the tokens in order to fetch the
relevant l402 ids for the users tokens.
This commit is contained in:
sputn1ck 2023-06-22 17:30:33 +02:00
parent eaad220800
commit ca032b1f1d
No known key found for this signature in database
GPG key ID: 671103D881A5F0E4
5 changed files with 36 additions and 10 deletions

View file

@ -1,13 +1,11 @@
package main
import (
"bytes"
"context"
"encoding/hex"
"fmt"
"time"
"github.com/lightninglabs/aperture/lsat"
"github.com/lightninglabs/loop/looprpc"
"github.com/urfave/cli"
"gopkg.in/macaroon.v2"
@ -55,13 +53,9 @@ func listAuth(ctx *cli.Context) error {
return fmt.Errorf("unable to unmarshal macaroon: %v",
err)
}
id, err := lsat.DecodeIdentifier(bytes.NewReader(mac.Id()))
if err != nil {
return fmt.Errorf("unable to decode macaroon ID: %v",
err)
}
tokens[i] = &printableToken{
ID: hex.EncodeToString(id.TokenID[:]),
ID: t.Id,
ValidUntil: "",
BaseMacaroon: hex.EncodeToString(t.BaseMacaroon),
PaymentHash: hex.EncodeToString(t.PaymentHash),