Skip to content

Commit

Permalink
Merge pull request #74 from horizontalsystems/optional-secret
Browse files Browse the repository at this point in the history
Make Infura secret key optional.
  • Loading branch information
rafaelekol authored May 13, 2019
2 parents a7d43fb + 583332c commit b5db537
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class EthereumKit(
class ApiSyncMode : SyncMode()
}

data class InfuraCredentials(val projectId: String, val secretKey: String)
data class InfuraCredentials(val projectId: String, val secretKey: String?)

enum class NetworkType {
MainNet,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ class InfuraService(private val networkType: NetworkType, private val infuraCred

val headersInterceptor = Interceptor { chain ->
val requestBuilder = chain.request().newBuilder()
requestBuilder.header("Authorization", Credentials.basic("", infuraCredentials.secretKey))
infuraCredentials.secretKey?.let { secretKey ->
requestBuilder.header("Authorization", Credentials.basic("", secretKey))
}
requestBuilder.header("Content-Type", "application/json")
requestBuilder.header("Accept", "application/json")
chain.proceed(requestBuilder.build())
Expand Down

0 comments on commit b5db537

Please sign in to comment.