mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-14 18:30:52 +02:00
macaroons: use constraint layer for macaroon tweaking
This commit is contained in:
committed by
Olaoluwa Osuntokun
parent
5c3493bd30
commit
a6b9155150
8
lnd.go
8
lnd.go
@@ -20,7 +20,6 @@ import (
|
||||
"time"
|
||||
|
||||
"gopkg.in/macaroon-bakery.v1/bakery"
|
||||
"gopkg.in/macaroon-bakery.v1/bakery/checkers"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
|
||||
@@ -569,11 +568,8 @@ func genMacaroons(svc *bakery.Service, admFile, roFile string) error {
|
||||
}
|
||||
|
||||
// Generate the read-only macaroon and write it to a file.
|
||||
caveat := checkers.AllowCaveat(roPermissions...)
|
||||
roMacaroon := admMacaroon.Clone()
|
||||
if err = svc.AddCaveat(roMacaroon, caveat); err != nil {
|
||||
return err
|
||||
}
|
||||
roMacaroon := macaroons.AddConstraints(admMacaroon,
|
||||
macaroons.PermissionsConstraint(roPermissions...))
|
||||
roBytes, err := roMacaroon.MarshalBinary()
|
||||
if err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user