macaroons: pass root key ID in context

This commit is contained in:
Oliver Gugger 2020-12-09 11:02:37 +01:00
parent 54d22d41ac
commit 7f1f29cf58
No known key found for this signature in database
GPG key ID: 8E4256593F177720

View file

@ -169,14 +169,19 @@ func (s *Server) startMacaroonService() error {
// Create macaroon files for pool CLI to use if they don't exist.
if !lnrpc.FileExists(s.cfg.MacaroonPath) {
ctx := context.Background()
// We don't offer the ability to rotate macaroon root keys yet,
// so just use the default one since the service expects some
// value to be set.
idCtx := macaroons.ContextWithRootKeyID(
context.Background(), macaroons.DefaultRootKeyID,
)
// We only generate one default macaroon that contains all
// existing permissions (equivalent to the admin.macaroon in
// lnd). Custom macaroons can be created through the bakery
// RPC.
poolMac, err := s.macaroonService.Oven.NewMacaroon(
ctx, bakery.LatestVersion, nil, allPermissions...,
idCtx, bakery.LatestVersion, nil, allPermissions...,
)
if err != nil {
return err