@@ -30,6 +30,7 @@ import (
30
30
pool "github.com/lightninglabs/pool/perms"
31
31
"github.com/lightninglabs/pool/poolrpc"
32
32
tap "github.com/lightninglabs/taproot-assets/perms"
33
+ "github.com/lightninglabs/taproot-assets/taprpc"
33
34
"github.com/lightningnetwork/lnd/keychain"
34
35
"github.com/lightningnetwork/lnd/lnrpc"
35
36
"github.com/lightningnetwork/lnd/lnrpc/routerrpc"
@@ -146,6 +147,15 @@ var (
146
147
poolMacaroonFn = func (cfg * LitNodeConfig ) string {
147
148
return cfg .PoolMacPath
148
149
}
150
+ tapRequestFn = func (ctx context.Context ,
151
+ c grpc.ClientConnInterface ) (proto.Message , error ) {
152
+
153
+ tapConn := taprpc .NewTaprootAssetsClient (c )
154
+ return tapConn .ListAssets (ctx , & taprpc.ListAssetRequest {})
155
+ }
156
+ tapMacaroonFn = func (cfg * LitNodeConfig ) string {
157
+ return cfg .TapMacPath
158
+ }
149
159
litSessionRequestFn = func (ctx context.Context ,
150
160
c grpc.ClientConnInterface ) (proto.Message , error ) {
151
161
@@ -234,6 +244,14 @@ var (
234
244
allowedThroughLNC : true ,
235
245
grpcWebURI : "/poolrpc.Trader/GetInfo" ,
236
246
restWebURI : "/v1/pool/info" ,
247
+ }, {
248
+ name : "taprpc" ,
249
+ macaroonFn : tapMacaroonFn ,
250
+ requestFn : tapRequestFn ,
251
+ successPattern : "\" assets\" :[]" ,
252
+ allowedThroughLNC : true ,
253
+ grpcWebURI : "/taprpc.TaprootAssets/ListAssets" ,
254
+ restWebURI : "/v1/taproot-assets/assets" ,
237
255
}, {
238
256
name : "litrpc-sessions" ,
239
257
macaroonFn : litMacaroonFn ,
@@ -644,7 +662,13 @@ func runGRPCAuthTest(t *testing.T, hostPort, tlsCertPath, macPath string,
644
662
ctxm = macaroonContext (ctxt , dummyMacBytes )
645
663
_ , err = makeRequest (ctxm , rawConn )
646
664
require .Error (t , err )
647
- require .Contains (t , err .Error (), "cannot get macaroon: root key with" )
665
+
666
+ errStr := err .Error ()
667
+ err1 := strings .Contains (errStr , "cannot get macaroon: root" )
668
+ err2 := strings .Contains (errStr , "cannot get macaroon: sql: no" )
669
+ require .Truef (
670
+ t , err1 || err2 , "no macaroon, got unexpected error: %v" , err ,
671
+ )
648
672
649
673
// Then finally we try with the correct macaroon which should now
650
674
// succeed.
@@ -692,7 +716,9 @@ func runUIPasswordCheck(t *testing.T, hostPort, tlsCertPath, uiPassword string,
692
716
errStr := err .Error ()
693
717
err1 := strings .Contains (errStr , "invalid auth: invalid basic auth" )
694
718
err2 := strings .Contains (errStr , "cannot get macaroon: root key with" )
695
- require .True (t , err1 || err2 , "wrong UI password and dummy mac" )
719
+ err3 := strings .Contains (errStr , "cannot get macaroon: sql: no rows" )
720
+ require .Truef (t , err1 || err2 || err3 , "wrong UI password and dummy " +
721
+ "mac, got unexpected error: %v" , err )
696
722
697
723
// Using the correct UI password should work for all requests.
698
724
ctxm = uiPasswordContext (ctxt , uiPassword , false )
@@ -712,9 +738,11 @@ func runUIPasswordCheck(t *testing.T, hostPort, tlsCertPath, uiPassword string,
712
738
_ , err = makeRequest (ctxm , rawConn )
713
739
714
740
require .Error (t , err )
715
- require .Contains (
716
- t , err .Error (), "cannot get macaroon: root" ,
717
- )
741
+ errStr := err .Error ()
742
+ err1 := strings .Contains (errStr , "cannot get macaroon: root" )
743
+ err2 := strings .Contains (errStr , "cannot get macaroon: sql: no" )
744
+ require .Truef (t , err1 || err2 , "no macaroon, got unexpected " +
745
+ "error: %v" , err )
718
746
return
719
747
}
720
748
@@ -1097,6 +1125,7 @@ func bakeSuperMacaroon(cfg *LitNodeConfig, readOnly bool) (string, error) {
1097
1125
1098
1126
permsMgr .RegisterSubServer (subservers .LOOP , loop .RequiredPermissions )
1099
1127
permsMgr .RegisterSubServer (subservers .POOL , pool .RequiredPermissions )
1128
+ permsMgr .RegisterSubServer (subservers .TAP , tap .RequiredPermissions )
1100
1129
permsMgr .RegisterSubServer (
1101
1130
subservers .FARADAY , faraday .RequiredPermissions ,
1102
1131
)
0 commit comments