@@ -18,9 +18,12 @@ import (
1818 gateway "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
1919 flags "github.com/jessevdk/go-flags"
2020 "github.com/lightninglabs/aperture/auth"
21+ "github.com/lightninglabs/aperture/challenger"
2122 "github.com/lightninglabs/aperture/mint"
2223 "github.com/lightninglabs/aperture/proxy"
24+ "github.com/lightninglabs/aperture/secrets"
2325 "github.com/lightninglabs/lightning-node-connect/hashmailrpc"
26+ "github.com/lightninglabs/lndclient"
2427 "github.com/lightningnetwork/lnd"
2528 "github.com/lightningnetwork/lnd/build"
2629 "github.com/lightningnetwork/lnd/cert"
@@ -42,14 +45,6 @@ import (
4245)
4346
4447const (
45- // topLevelKey is the top level key for an etcd cluster where we'll
46- // store all LSAT proxy related data.
47- topLevelKey = "lsat/proxy"
48-
49- // etcdKeyDelimeter is the delimeter we'll use for all etcd keys to
50- // represent a path-like structure.
51- etcdKeyDelimeter = "/"
52-
5348 // selfSignedCertOrganization is the static string that we encode in the
5449 // organization field of a certificate if we create it ourselves.
5550 selfSignedCertOrganization = "aperture autogenerated cert"
@@ -160,7 +155,7 @@ type Aperture struct {
160155 cfg * Config
161156
162157 etcdClient * clientv3.Client
163- challenger * LndChallenger
158+ challenger * challenger. LndChallenger
164159 httpsServer * http.Server
165160 torHTTPServer * http.Server
166161 proxy * proxy.Proxy
@@ -229,8 +224,17 @@ func (a *Aperture) Start(errChan chan error) error {
229224 }
230225
231226 if ! a .cfg .Authenticator .Disable {
232- a .challenger , err = NewLndChallenger (
233- a .cfg .Authenticator , genInvoiceReq , errChan ,
227+ client , err := lndclient .NewBasicClient (
228+ a .cfg .Authenticator .LndHost , a .cfg .Authenticator .TLSPath ,
229+ a .cfg .Authenticator .MacDir , a .cfg .Authenticator .Network ,
230+ lndclient .MacFilename (challenger .InvoiceMacaroonName ),
231+ )
232+ if err != nil {
233+ return err
234+ }
235+
236+ a .challenger , err = challenger .NewLndChallenger (
237+ genInvoiceReq , errChan , client ,
234238 )
235239 if err != nil {
236240 return err
@@ -655,12 +659,12 @@ func initTorListener(cfg *Config, etcd *clientv3.Client) (*tor.Controller, error
655659}
656660
657661// createProxy creates the proxy with all the services it needs.
658- func createProxy (cfg * Config , challenger * LndChallenger ,
662+ func createProxy (cfg * Config , challenger * challenger. LndChallenger ,
659663 etcdClient * clientv3.Client ) (* proxy.Proxy , func (), error ) {
660664
661665 minter := mint .New (& mint.Config {
662666 Challenger : challenger ,
663- Secrets : newSecretStore (etcdClient ),
667+ Secrets : secrets . NewSecretStore (etcdClient ),
664668 ServiceLimiter : newStaticServiceLimiter (cfg .Services ),
665669 })
666670 authenticator := auth .NewLsatAuthenticator (minter , challenger )
0 commit comments