mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-12-15 23:31:19 +01:00
macaroons: futher abstract NewService from root key store impl
In this commit, we modify the `macaroons.NewService` consturctor to accept the main interface rather than the raw DB. This allows us to use other backends other than bolt or the kvdb interface to store the macaroon root keys. We also create a new ExtendedRootKeyStore interface that implements some of the more advanced features we use such as macaroon encryption and password rotation.
This commit is contained in:
@@ -394,8 +394,12 @@ func (d *DefaultWalletImpl) BuildWalletConfig(ctx context.Context,
|
||||
var macaroonService *macaroons.Service
|
||||
if !d.cfg.NoMacaroons {
|
||||
// Create the macaroon authentication/authorization service.
|
||||
rootKeyStore, err := macaroons.NewRootKeyStorage(dbs.MacaroonDB)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
macaroonService, err = macaroons.NewService(
|
||||
dbs.MacaroonDB, "lnd", walletInitParams.StatelessInit,
|
||||
rootKeyStore, "lnd", walletInitParams.StatelessInit,
|
||||
macaroons.IPLockChecker,
|
||||
macaroons.CustomChecker(interceptorChain),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user