Skip to content

Commit 6dc733e

Browse files
committed
perms: move perms.go into taprpc
The Lightning Node Connect WASM client requires access to `perms.go` for RPC endpoint-related permissions. We move it into taprpc so that the WASM build only needs to depend on the taprpc module, without importing the entire taproot-assets module.
1 parent fff39bc commit 6dc733e

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

server.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"github.com/lightninglabs/taproot-assets/address"
1818
"github.com/lightninglabs/taproot-assets/fn"
1919
"github.com/lightninglabs/taproot-assets/monitoring"
20-
"github.com/lightninglabs/taproot-assets/perms"
2120
"github.com/lightninglabs/taproot-assets/rfqmsg"
2221
"github.com/lightninglabs/taproot-assets/rpcperms"
2322
"github.com/lightninglabs/taproot-assets/tapchannel"
@@ -133,7 +132,7 @@ func (s *Server) initialize(interceptorChain *rpcperms.InterceptorChain) error {
133132
Checkers: []macaroons.Checker{
134133
macaroons.IPLockChecker,
135134
},
136-
RequiredPerms: perms.RequiredPermissions,
135+
RequiredPerms: taprpc.RequiredPermissions,
137136
},
138137
)
139138
if err != nil {
@@ -158,7 +157,7 @@ func (s *Server) initialize(interceptorChain *rpcperms.InterceptorChain) error {
158157

159158
// Register all our known permission with the macaroon
160159
// service.
161-
for method, ops := range perms.RequiredPermissions {
160+
for method, ops := range taprpc.RequiredPermissions {
162161
err := interceptorChain.AddPermission(
163162
method, ops,
164163
)
@@ -311,7 +310,7 @@ func (s *Server) RunUntilShutdown(mainErrChan <-chan error) error {
311310
serverOpts := s.cfg.GrpcServerOpts
312311

313312
// Get RPC endpoints which don't require macaroons.
314-
macaroonWhitelist := perms.MacaroonWhitelist(
313+
macaroonWhitelist := taprpc.MacaroonWhitelist(
315314
s.cfg.UniversePublicAccess.IsReadAccessGranted(),
316315
s.cfg.UniversePublicAccess.IsWriteAccessGranted(),
317316
s.cfg.RPCConfig.AllowPublicUniProofCourier,

taprpc/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ require (
99
github.com/lightningnetwork/lnd v0.19.0-beta.rc2.0.20250423092132-a35ace7371af
1010
google.golang.org/grpc v1.59.0
1111
google.golang.org/protobuf v1.33.0
12+
gopkg.in/macaroon-bakery.v2 v2.1.0
1213
)
1314

1415
require (
@@ -168,7 +169,6 @@ require (
168169
google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b // indirect
169170
google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 // indirect
170171
gopkg.in/errgo.v1 v1.0.1 // indirect
171-
gopkg.in/macaroon-bakery.v2 v2.0.1 // indirect
172172
gopkg.in/macaroon.v2 v2.0.0 // indirect
173173
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
174174
gopkg.in/yaml.v2 v2.4.0 // indirect

taprpc/go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -722,8 +722,8 @@ gopkg.in/errgo.v1 v1.0.1/go.mod h1:3NjfXwocQRYAPTq4/fzX+CwUhPRcR/azYRhj8G+LqMo=
722722
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
723723
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
724724
gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s=
725-
gopkg.in/macaroon-bakery.v2 v2.0.1 h1:0N1TlEdfLP4HXNCg7MQUMp5XwvOoxk+oe9Owr2cpvsc=
726-
gopkg.in/macaroon-bakery.v2 v2.0.1/go.mod h1:B4/T17l+ZWGwxFSZQmlBwp25x+og7OkhETfr3S9MbIA=
725+
gopkg.in/macaroon-bakery.v2 v2.1.0 h1:9Jw/+9XHBSutkaeVpWhDx38IcSNLJwWUICkOK98DHls=
726+
gopkg.in/macaroon-bakery.v2 v2.1.0/go.mod h1:B4/T17l+ZWGwxFSZQmlBwp25x+og7OkhETfr3S9MbIA=
727727
gopkg.in/macaroon.v2 v2.0.0 h1:LVWycAfeJBUjCIqfR9gqlo7I8vmiXRr51YEOZ1suop8=
728728
gopkg.in/macaroon.v2 v2.0.0/go.mod h1:+I6LnTMkm/uV5ew/0nsulNjL16SK4+C8yDmRUzHR17I=
729729
gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=

perms/perms.go renamed to taprpc/perms.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package perms
1+
package taprpc
22

33
import "gopkg.in/macaroon-bakery.v2/bakery"
44

0 commit comments

Comments
 (0)