@@ -218,11 +218,7 @@ func (g *LightningTerminal) Run() error {
218
218
),
219
219
}
220
220
allOpts = append (allOpts , opts ... )
221
- mailboxGrpcServer := grpc .NewServer (allOpts ... )
222
-
223
- _ = g .RegisterGrpcSubserver (mailboxGrpcServer )
224
-
225
- return mailboxGrpcServer
221
+ return grpc .NewServer (allOpts ... )
226
222
},
227
223
)
228
224
g .sessionRpcServer = & sessionRpcServer {
@@ -509,7 +505,10 @@ func (g *LightningTerminal) startSubservers() error {
509
505
// faraday, loop, and pool, all at the same time.
510
506
ctx := context .Background ()
511
507
superMacaroon , err := bakeSuperMacaroon (
512
- ctx , g .basicClient , 0 , getAllPermissions (false ), nil ,
508
+ ctx , g .basicClient , session .NewSuperMacaroonRootKeyID (
509
+ [4 ]byte {},
510
+ ),
511
+ getAllPermissions (false ), nil ,
513
512
)
514
513
if err != nil {
515
514
return err
@@ -654,8 +653,7 @@ func (g *LightningTerminal) ValidateMacaroon(ctx context.Context,
654
653
// which we can just pass straight to lnd for validation. But the user
655
654
// might still be using a specific macaroon, which should be handled the
656
655
// same as before.
657
- isSuperMacaroon := macHex == g .rpcProxy .superMacaroon
658
- if g .cfg .LndMode == ModeIntegrated && isSuperMacaroon {
656
+ if g .cfg .LndMode == ModeIntegrated && session .IsSuperMacaroon (macHex ) {
659
657
macBytes , err := hex .DecodeString (macHex )
660
658
if err != nil {
661
659
return err
@@ -1160,23 +1158,18 @@ func bakeSuperMacaroon(ctx context.Context, lnd lnrpc.LightningClient,
1160
1158
return "" , err
1161
1159
}
1162
1160
1163
- macBytes , err := hex . DecodeString (res .Macaroon )
1161
+ mac , err := session . ParseMacaroon (res .Macaroon )
1164
1162
if err != nil {
1165
1163
return "" , err
1166
1164
}
1167
1165
1168
- var mac macaroon.Macaroon
1169
- if err := mac .UnmarshalBinary (macBytes ); err != nil {
1170
- return "" , err
1171
- }
1172
-
1173
1166
for _ , caveat := range caveats {
1174
1167
if err := mac .AddFirstPartyCaveat (caveat .Id ); err != nil {
1175
1168
return "" , err
1176
1169
}
1177
1170
}
1178
1171
1179
- macBytes , err = mac .MarshalBinary ()
1172
+ macBytes , err : = mac .MarshalBinary ()
1180
1173
if err != nil {
1181
1174
return "" , err
1182
1175
}
0 commit comments