lnd: add WalletUnlockerAuthOptions

Similar to what was done for the regular RPC server, we add auth dial
options for the wallet unlocker, as it also requires TLS now.
This commit is contained in:
Johan T. Halseth 2020-01-13 12:21:13 +01:00
parent a0639c234f
commit a870ed5fb7
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

19
lnd.go
View File

@ -60,6 +60,25 @@ var (
networkDir string
)
// WalletUnlockerAuthOptions returns a list of DialOptions that can be used to
// authenticate with the wallet unlocker service.
//
// NOTE: This should only be called after the WalletUnlocker listener has
// signaled it is ready.
func WalletUnlockerAuthOptions() ([]grpc.DialOption, error) {
creds, err := credentials.NewClientTLSFromFile(cfg.TLSCertPath, "")
if err != nil {
return nil, fmt.Errorf("unable to read TLS cert: %v", err)
}
// Create a dial options array with the TLS credentials.
opts := []grpc.DialOption{
grpc.WithTransportCredentials(creds),
}
return opts, nil
}
// AdminAuthOptions returns a list of DialOptions that can be used to
// authenticate with the RPC server with admin capabilities.
//