Merge pull request #4427 from yyforyongyu/customize-root-key-id

macaroons: customize root key ID
This commit is contained in:
Olaoluwa Osuntokun
2020-08-21 19:34:15 -07:00
committed by GitHub
24 changed files with 2144 additions and 777 deletions

12
lnd.go
View File

@ -863,8 +863,8 @@ func genMacaroons(ctx context.Context, svc *macaroons.Service,
// access invoice related calls. This is useful for merchants and other
// services to allow an isolated instance that can only query and
// modify invoices.
invoiceMac, err := svc.Oven.NewMacaroon(
ctx, bakery.LatestVersion, nil, invoicePermissions...,
invoiceMac, err := svc.NewMacaroon(
ctx, macaroons.DefaultRootKeyID, invoicePermissions...,
)
if err != nil {
return err
@ -880,8 +880,8 @@ func genMacaroons(ctx context.Context, svc *macaroons.Service,
}
// Generate the read-only macaroon and write it to a file.
roMacaroon, err := svc.Oven.NewMacaroon(
ctx, bakery.LatestVersion, nil, readPermissions...,
roMacaroon, err := svc.NewMacaroon(
ctx, macaroons.DefaultRootKeyID, readPermissions...,
)
if err != nil {
return err
@ -897,8 +897,8 @@ func genMacaroons(ctx context.Context, svc *macaroons.Service,
// Generate the admin macaroon and write it to a file.
adminPermissions := append(readPermissions, writePermissions...)
admMacaroon, err := svc.Oven.NewMacaroon(
ctx, bakery.LatestVersion, nil, adminPermissions...,
admMacaroon, err := svc.NewMacaroon(
ctx, macaroons.DefaultRootKeyID, adminPermissions...,
)
if err != nil {
return err