-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #130 from MetaMask/session-persistence
feat: Session persistence v2
- Loading branch information
Showing
8 changed files
with
134 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
metamask-android-sdk/src/main/java/io/metamask/androidsdk/CommunicationClientModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package io.metamask.androidsdk | ||
|
||
import android.content.Context | ||
|
||
class CommunicationClientModule(private val context: Context): CommunicationClientModuleInterface { | ||
override fun provideKeyStorage(): KeyStorage { | ||
return KeyStorage(context) | ||
} | ||
|
||
override fun provideSessionManager(keyStorage: SecureStorage): SessionManager { | ||
return SessionManager(keyStorage) | ||
} | ||
|
||
override fun provideKeyExchange(): KeyExchange { | ||
return KeyExchange() | ||
} | ||
|
||
override fun provideLogger(): Logger { | ||
return DefaultLogger | ||
} | ||
|
||
override fun provideCommunicationClient(callback: EthereumEventCallback?): CommunicationClient { | ||
val keyStorage = provideKeyStorage() | ||
val sessionManager = provideSessionManager(keyStorage) | ||
val keyExchange = provideKeyExchange() | ||
val logger = provideLogger() | ||
return CommunicationClient(context, callback, sessionManager, keyExchange, logger) | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...sk-android-sdk/src/main/java/io/metamask/androidsdk/CommunicationClientModuleInterface.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package io.metamask.androidsdk | ||
|
||
interface CommunicationClientModuleInterface { | ||
fun provideKeyStorage(): SecureStorage | ||
fun provideSessionManager(keyStorage: SecureStorage): SessionManager | ||
fun provideKeyExchange(): KeyExchange | ||
fun provideLogger(): Logger | ||
fun provideCommunicationClient(callback: EthereumEventCallback?): CommunicationClient | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.