gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-kotlin] branch master updated: Provide a blocking API for


From: gnunet
Subject: [taler-wallet-kotlin] branch master updated: Provide a blocking API for iOS (until Kotlin 1.4 is out)
Date: Mon, 17 Aug 2020 21:31:08 +0200

This is an automated email from the git hooks/post-receive script.

torsten-grote pushed a commit to branch master
in repository wallet-kotlin.

The following commit(s) were added to refs/heads/master by this push:
     new dade047  Provide a blocking API for iOS (until Kotlin 1.4 is out)
dade047 is described below

commit dade0470c7e378c72ac2f2fd2a623416dadbff10
Author: Torsten Grote <t@grobox.de>
AuthorDate: Mon Aug 17 09:29:54 2020 -0300

    Provide a blocking API for iOS (until Kotlin 1.4 is out)
    
    and put base crypto into dedicated package (to be split out later).
---
 .../taler/lib/{wallet => }/crypto/CryptoFactory.kt |  2 +-
 .../taler/lib/{wallet => }/crypto/RsaBlinding.kt   |  2 +-
 .../net/taler/lib/wallet/api/WalletFactory.kt}     | 15 +++---
 .../taler/lib/{wallet => }/crypto/PlanchetTest.kt  |  4 +-
 .../taler/lib/{wallet => }/crypto/RefreshTest.kt   |  4 +-
 .../lib/{wallet => }/crypto/RsaBlindingTest.kt     |  3 +-
 .../lib/{wallet => crypto}/Base32Crockford.kt      |  2 +-
 .../net/taler/lib/{wallet => }/crypto/Crypto.kt    |  2 +-
 .../taler/lib/{wallet => }/crypto/CryptoImpl.kt    |  2 +-
 .../net/taler/lib/{wallet => }/crypto/Deposit.kt   |  4 +-
 .../net/taler/lib/{wallet => }/crypto/Kdf.kt       |  2 +-
 .../kotlin/net/taler/lib/wallet/Amount.kt          |  2 +-
 .../commonMain/kotlin/net/taler/lib/wallet/Time.kt |  2 +-
 .../kotlin/net/taler/lib/wallet/api/Exchanges.kt   | 55 +++++++++++++++++++
 .../net/taler/lib/wallet/{ => api}/Version.kt      |  2 +-
 .../lib/wallet/{Amount.kt => api/WalletApi.kt}     | 15 +++---
 .../wallet/{WalletApi.kt => api/WalletFactory.kt}  | 34 ++++++------
 .../kotlin/net/taler/lib/wallet/api/Withdrawal.kt  | 53 +++++++++++++++++++
 .../kotlin/net/taler/lib/wallet/crypto/Planchet.kt |  7 ++-
 .../kotlin/net/taler/lib/wallet/crypto/Recoup.kt   |  6 ++-
 .../kotlin/net/taler/lib/wallet/crypto/Refresh.kt  |  4 +-
 .../net/taler/lib/wallet/crypto/Signature.kt       |  5 +-
 .../net/taler/lib/wallet/exchange/Denomination.kt  |  2 +-
 .../net/taler/lib/wallet/exchange/Exchange.kt      | 43 ++-------------
 .../net/taler/lib/wallet/operations/Withdraw.kt    | 44 ++--------------
 .../lib/{wallet => crypto}/Base32CrockfordTest.kt  |  2 +-
 .../lib/{wallet => }/crypto/EllipticCurveTest.kt   |  3 +-
 .../net/taler/lib/{wallet => }/crypto/KdfTest.kt   |  7 ++-
 .../taler/lib/{wallet => }/crypto/Sha256Test.kt    |  2 +-
 .../taler/lib/{wallet => }/crypto/Sha512Test.kt    |  3 +-
 .../kotlin/net/taler/lib/wallet/AmountTest.kt      |  1 +
 .../kotlin/net/taler/lib/wallet/TimestampTest.kt   |  1 +
 .../taler/lib/wallet/{ => api}/WalletApiTest.kt    |  5 +-
 .../net/taler/lib/wallet/crypto/DepositTest.kt     |  6 ++-
 .../net/taler/lib/wallet/crypto/RecoupTest.kt      |  1 +
 .../taler/lib/wallet/crypto/RefreshPlanchetTest.kt |  4 +-
 .../net/taler/lib/wallet/crypto/SignatureTest.kt   |  3 +-
 .../taler/lib/{wallet => }/crypto/CryptoFactory.kt |  2 +-
 .../net/taler/lib/wallet/api/WalletFactory.kt}     | 15 +++---
 .../taler/lib/{wallet => }/crypto/CryptoFactory.kt |  2 +-
 .../net/taler/lib/wallet/api/WalletFactory.kt      | 61 ++++++++++++++++++++++
 41 files changed, 273 insertions(+), 161 deletions(-)

diff --git 
a/wallet/src/androidMain/kotlin/net/taler/lib/wallet/crypto/CryptoFactory.kt 
b/wallet/src/androidMain/kotlin/net/taler/lib/crypto/CryptoFactory.kt
similarity index 99%
rename from 
wallet/src/androidMain/kotlin/net/taler/lib/wallet/crypto/CryptoFactory.kt
rename to wallet/src/androidMain/kotlin/net/taler/lib/crypto/CryptoFactory.kt
index 1f6c7a8..85c159e 100644
--- a/wallet/src/androidMain/kotlin/net/taler/lib/wallet/crypto/CryptoFactory.kt
+++ b/wallet/src/androidMain/kotlin/net/taler/lib/crypto/CryptoFactory.kt
@@ -14,7 +14,7 @@
  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-package net.taler.lib.wallet.crypto
+package net.taler.lib.crypto
 
 import com.goterl.lazycode.lazysodium.LazySodiumJava
 import com.goterl.lazycode.lazysodium.SodiumJava
diff --git 
a/wallet/src/androidMain/kotlin/net/taler/lib/wallet/crypto/RsaBlinding.kt 
b/wallet/src/androidMain/kotlin/net/taler/lib/crypto/RsaBlinding.kt
similarity index 99%
rename from 
wallet/src/androidMain/kotlin/net/taler/lib/wallet/crypto/RsaBlinding.kt
rename to wallet/src/androidMain/kotlin/net/taler/lib/crypto/RsaBlinding.kt
index 70c7c78..732ac10 100644
--- a/wallet/src/androidMain/kotlin/net/taler/lib/wallet/crypto/RsaBlinding.kt
+++ b/wallet/src/androidMain/kotlin/net/taler/lib/crypto/RsaBlinding.kt
@@ -14,7 +14,7 @@
  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-package net.taler.lib.wallet.crypto
+package net.taler.lib.crypto
 
 import java.math.BigInteger
 import kotlin.math.abs
diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Version.kt 
b/wallet/src/androidMain/kotlin/net/taler/lib/wallet/api/WalletFactory.kt
similarity index 76%
copy from wallet/src/commonMain/kotlin/net/taler/lib/wallet/Version.kt
copy to wallet/src/androidMain/kotlin/net/taler/lib/wallet/api/WalletFactory.kt
index ba9be3c..c8e1f0f 100644
--- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Version.kt
+++ b/wallet/src/androidMain/kotlin/net/taler/lib/wallet/api/WalletFactory.kt
@@ -14,13 +14,10 @@
  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-package net.taler.lib.wallet
+package net.taler.lib.wallet.api
 
-import net.taler.lib.common.Version
-
-class SupportedVersions(
-    val walletVersion: Version,
-    val exchangeVersion: Version,
-    val bankVersion: Version,
-    val merchantVersion: Version
-)
+actual class WalletFactory {
+    actual fun createWalletApi(): WalletApi {
+        TODO("Not yet implemented")
+    }
+}
\ No newline at end of file
diff --git 
a/wallet/src/androidTest/kotlin/net/taler/lib/wallet/crypto/PlanchetTest.kt 
b/wallet/src/androidTest/kotlin/net/taler/lib/crypto/PlanchetTest.kt
similarity index 99%
rename from 
wallet/src/androidTest/kotlin/net/taler/lib/wallet/crypto/PlanchetTest.kt
rename to wallet/src/androidTest/kotlin/net/taler/lib/crypto/PlanchetTest.kt
index c58d40d..37ec653 100644
--- a/wallet/src/androidTest/kotlin/net/taler/lib/wallet/crypto/PlanchetTest.kt
+++ b/wallet/src/androidTest/kotlin/net/taler/lib/crypto/PlanchetTest.kt
@@ -14,10 +14,10 @@
  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-package net.taler.lib.wallet.crypto
+package net.taler.lib.crypto
 
 import net.taler.lib.common.Amount
-import net.taler.lib.wallet.Base32Crockford
+import net.taler.lib.wallet.crypto.Planchet
 import net.taler.lib.wallet.crypto.Planchet.CreationRequest
 import net.taler.lib.wallet.crypto.Planchet.CreationResult
 import kotlin.random.Random
diff --git 
a/wallet/src/androidTest/kotlin/net/taler/lib/wallet/crypto/RefreshTest.kt 
b/wallet/src/androidTest/kotlin/net/taler/lib/crypto/RefreshTest.kt
similarity index 99%
rename from 
wallet/src/androidTest/kotlin/net/taler/lib/wallet/crypto/RefreshTest.kt
rename to wallet/src/androidTest/kotlin/net/taler/lib/crypto/RefreshTest.kt
index 981c978..e97ea46 100644
--- a/wallet/src/androidTest/kotlin/net/taler/lib/wallet/crypto/RefreshTest.kt
+++ b/wallet/src/androidTest/kotlin/net/taler/lib/crypto/RefreshTest.kt
@@ -14,14 +14,14 @@
  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-package net.taler.lib.wallet.crypto
+package net.taler.lib.crypto
 
 import net.taler.lib.common.Amount
 import net.taler.lib.common.Timestamp
-import net.taler.lib.wallet.Base32Crockford
 import net.taler.lib.wallet.CoinRecord
 import net.taler.lib.wallet.CoinSourceType.WITHDRAW
 import net.taler.lib.wallet.CoinStatus.DORMANT
+import net.taler.lib.wallet.crypto.Refresh
 import net.taler.lib.wallet.crypto.Refresh.RefreshPlanchetRecord
 import net.taler.lib.wallet.crypto.Refresh.RefreshSessionRecord
 import net.taler.lib.wallet.exchange.DenominationRecord
diff --git 
a/wallet/src/androidTest/kotlin/net/taler/lib/wallet/crypto/RsaBlindingTest.kt 
b/wallet/src/androidTest/kotlin/net/taler/lib/crypto/RsaBlindingTest.kt
similarity index 99%
rename from 
wallet/src/androidTest/kotlin/net/taler/lib/wallet/crypto/RsaBlindingTest.kt
rename to wallet/src/androidTest/kotlin/net/taler/lib/crypto/RsaBlindingTest.kt
index 2ee5f1a..613e11f 100644
--- 
a/wallet/src/androidTest/kotlin/net/taler/lib/wallet/crypto/RsaBlindingTest.kt
+++ b/wallet/src/androidTest/kotlin/net/taler/lib/crypto/RsaBlindingTest.kt
@@ -14,9 +14,8 @@
  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-package net.taler.lib.wallet.crypto
+package net.taler.lib.crypto
 
-import net.taler.lib.wallet.Base32Crockford
 import kotlin.test.Test
 import kotlin.test.assertEquals
 import kotlin.test.assertTrue
diff --git 
a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Base32Crockford.kt 
b/wallet/src/commonMain/kotlin/net/taler/lib/crypto/Base32Crockford.kt
similarity index 99%
rename from wallet/src/commonMain/kotlin/net/taler/lib/wallet/Base32Crockford.kt
rename to wallet/src/commonMain/kotlin/net/taler/lib/crypto/Base32Crockford.kt
index 2517e85..b73f508 100644
--- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Base32Crockford.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/crypto/Base32Crockford.kt
@@ -14,7 +14,7 @@
  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-package net.taler.lib.wallet
+package net.taler.lib.crypto
 
 
 class EncodingException : Exception("Invalid encoding")
diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Crypto.kt 
b/wallet/src/commonMain/kotlin/net/taler/lib/crypto/Crypto.kt
similarity index 98%
rename from wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Crypto.kt
rename to wallet/src/commonMain/kotlin/net/taler/lib/crypto/Crypto.kt
index cbb486a..7ca2ba8 100644
--- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Crypto.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/crypto/Crypto.kt
@@ -14,7 +14,7 @@
  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-package net.taler.lib.wallet.crypto
+package net.taler.lib.crypto
 
 internal interface Crypto {
     fun sha256(input: ByteArray): ByteArray
diff --git 
a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/CryptoImpl.kt 
b/wallet/src/commonMain/kotlin/net/taler/lib/crypto/CryptoImpl.kt
similarity index 98%
rename from 
wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/CryptoImpl.kt
rename to wallet/src/commonMain/kotlin/net/taler/lib/crypto/CryptoImpl.kt
index 6b7cb8e..085b44b 100644
--- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/CryptoImpl.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/crypto/CryptoImpl.kt
@@ -14,7 +14,7 @@
  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-package net.taler.lib.wallet.crypto
+package net.taler.lib.crypto
 
 abstract class CryptoImpl : Crypto {
 
diff --git 
a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Deposit.kt 
b/wallet/src/commonMain/kotlin/net/taler/lib/crypto/Deposit.kt
similarity index 98%
rename from wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Deposit.kt
rename to wallet/src/commonMain/kotlin/net/taler/lib/crypto/Deposit.kt
index 66255d8..d63d034 100644
--- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Deposit.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/crypto/Deposit.kt
@@ -14,11 +14,11 @@
  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-package net.taler.lib.wallet.crypto
+package net.taler.lib.crypto
 
 import net.taler.lib.common.Amount
 import net.taler.lib.common.Timestamp
-import net.taler.lib.wallet.Base32Crockford
+import net.taler.lib.wallet.crypto.Signature
 import net.taler.lib.wallet.crypto.Signature.Companion.WALLET_COIN_DEPOSIT
 import net.taler.lib.wallet.roundedToByteArray
 import net.taler.lib.wallet.toByteArray
diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Kdf.kt 
b/wallet/src/commonMain/kotlin/net/taler/lib/crypto/Kdf.kt
similarity index 98%
rename from wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Kdf.kt
rename to wallet/src/commonMain/kotlin/net/taler/lib/crypto/Kdf.kt
index 2d714f8..ffdefb5 100644
--- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Kdf.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/crypto/Kdf.kt
@@ -14,7 +14,7 @@
  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-package net.taler.lib.wallet.crypto
+package net.taler.lib.crypto
 
 import kotlin.experimental.xor
 import kotlin.math.ceil
diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Amount.kt 
b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Amount.kt
index 7273dba..e7ee929 100644
--- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Amount.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Amount.kt
@@ -17,7 +17,7 @@
 package net.taler.lib.wallet
 
 import net.taler.lib.common.Amount
-import net.taler.lib.wallet.crypto.CryptoImpl.Companion.toByteArray
+import net.taler.lib.crypto.CryptoImpl.Companion.toByteArray
 
 fun Amount.toByteArray() = ByteArray(8 + 4 + 12).apply {
     value.toByteArray().copyInto(this, 0, 0, 8)
diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Time.kt 
b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Time.kt
index e67474b..6cb5a5c 100644
--- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Time.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Time.kt
@@ -17,7 +17,7 @@
 package net.taler.lib.wallet
 
 import net.taler.lib.common.Timestamp
-import net.taler.lib.wallet.crypto.CryptoImpl.Companion.toByteArray
+import net.taler.lib.crypto.CryptoImpl.Companion.toByteArray
 
 fun Timestamp.roundedToByteArray(): ByteArray = ByteArray(8).apply {
     (truncateSeconds().ms * 1000L).toByteArray().copyInto(this)
diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/Exchanges.kt 
b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/Exchanges.kt
new file mode 100644
index 0000000..2542dd6
--- /dev/null
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/Exchanges.kt
@@ -0,0 +1,55 @@
+/*
+ * This file is part of GNU Taler
+ * (C) 2020 Taler Systems S.A.
+ *
+ * GNU Taler is free software; you can redistribute it and/or modify it under 
the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 3, or (at your option) any later version.
+ *
+ * GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
FOR
+ * A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
+ */
+
+package net.taler.lib.wallet.api
+
+import net.taler.lib.wallet.exchange.ExchangeRecord
+
+data class ExchangeListItem(
+    val exchangeBaseUrl: String,
+    val currency: String,
+    val paytoUris: List<String>
+) {
+    companion object {
+        fun fromExchangeRecord(exchange: ExchangeRecord): ExchangeListItem? {
+            return if (exchange.details == null || exchange.wireInfo == null) 
null
+            else ExchangeListItem(
+                exchangeBaseUrl = exchange.baseUrl,
+                currency = exchange.details.currency,
+                paytoUris = exchange.wireInfo.accounts.map {
+                    it.paytoUri
+                }
+            )
+        }
+    }
+}
+
+data class GetExchangeTosResult(
+    /**
+     * Markdown version of the current ToS.
+     */
+    val tos: String,
+
+    /**
+     * Version tag of the current ToS.
+     */
+    val currentEtag: String,
+
+    /**
+     * Version tag of the last ToS that the user has accepted, if any.
+     */
+    val acceptedEtag: String? = null
+)
diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Version.kt 
b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/Version.kt
similarity index 96%
copy from wallet/src/commonMain/kotlin/net/taler/lib/wallet/Version.kt
copy to wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/Version.kt
index ba9be3c..12916d3 100644
--- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Version.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/Version.kt
@@ -14,7 +14,7 @@
  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-package net.taler.lib.wallet
+package net.taler.lib.wallet.api
 
 import net.taler.lib.common.Version
 
diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Amount.kt 
b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/WalletApi.kt
similarity index 57%
copy from wallet/src/commonMain/kotlin/net/taler/lib/wallet/Amount.kt
copy to wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/WalletApi.kt
index 7273dba..026c682 100644
--- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Amount.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/WalletApi.kt
@@ -14,13 +14,16 @@
  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-package net.taler.lib.wallet
+package net.taler.lib.wallet.api
 
 import net.taler.lib.common.Amount
-import net.taler.lib.wallet.crypto.CryptoImpl.Companion.toByteArray
 
-fun Amount.toByteArray() = ByteArray(8 + 4 + 12).apply {
-    value.toByteArray().copyInto(this, 0, 0, 8)
-    fraction.toByteArray().copyInto(this, 8, 0, 4)
-    currency.encodeToByteArray().copyInto(this, 12)
+public interface WalletApi {
+    fun getVersions(): SupportedVersions
+    fun getWithdrawalDetailsForUri(talerWithdrawUri: String): 
WithdrawalDetailsForUri
+    fun getWithdrawalDetailsForAmount(exchangeBaseUrl: String, amount: 
Amount): WithdrawalDetails
+    fun listExchanges(): List<ExchangeListItem>
+    fun addExchange(exchangeBaseUrl: String): ExchangeListItem
+    fun getExchangeTos(exchangeBaseUrl: String): GetExchangeTosResult
+    fun setExchangeTosAccepted(exchangeBaseUrl: String, acceptedEtag: String)
 }
diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/WalletApi.kt 
b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/WalletFactory.kt
similarity index 78%
rename from wallet/src/commonMain/kotlin/net/taler/lib/wallet/WalletApi.kt
rename to wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/WalletFactory.kt
index bfe2825..d56f80c 100644
--- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/WalletApi.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/WalletFactory.kt
@@ -14,23 +14,27 @@
  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-package net.taler.lib.wallet
+package net.taler.lib.wallet.api
 
 import io.ktor.client.HttpClient
 import net.taler.lib.common.Amount
 import net.taler.lib.common.Timestamp
 import net.taler.lib.common.Version
-import net.taler.lib.wallet.crypto.Crypto
-import net.taler.lib.wallet.crypto.CryptoFactory
+import net.taler.lib.crypto.Crypto
+import net.taler.lib.crypto.CryptoFactory
+import net.taler.lib.wallet.Db
+import net.taler.lib.wallet.DbFactory
 import net.taler.lib.wallet.crypto.Signature
 import net.taler.lib.wallet.exchange.Exchange
-import net.taler.lib.wallet.exchange.ExchangeListItem
-import net.taler.lib.wallet.exchange.GetExchangeTosResult
+import net.taler.lib.wallet.getDefaultHttpClient
 import net.taler.lib.wallet.operations.Withdraw
-import net.taler.lib.wallet.operations.WithdrawalDetails
-import net.taler.lib.wallet.operations.WithdrawalDetailsForUri
 
-public class WalletApi {
+
+public expect class WalletFactory {
+    fun createWalletApi(): WalletApi
+}
+
+internal class WalletApiImpl {
 
     private val httpClient: HttpClient = getDefaultHttpClient()
     private val db: Db = DbFactory().openDb()
@@ -39,7 +43,7 @@ public class WalletApi {
     private val exchangeManager: Exchange = Exchange(crypto, signature, 
httpClient, db = db)
     private val withdrawManager = Withdraw(httpClient, db, crypto, signature, 
exchangeManager)
 
-    public fun getVersions(): SupportedVersions {
+    fun getVersions(): SupportedVersions {
         return SupportedVersions(
             walletVersion = Version(8, 0, 0),
             exchangeVersion = Version(8, 0, 0),
@@ -48,7 +52,7 @@ public class WalletApi {
         )
     }
 
-    public suspend fun getWithdrawalDetailsForUri(talerWithdrawUri: String): 
WithdrawalDetailsForUri {
+    suspend fun getWithdrawalDetailsForUri(talerWithdrawUri: String): 
WithdrawalDetailsForUri {
         val bankInfo = withdrawManager.getBankInfo(talerWithdrawUri)
         return WithdrawalDetailsForUri(
             amount = bankInfo.amount,
@@ -57,7 +61,7 @@ public class WalletApi {
         )
     }
 
-    public suspend fun getWithdrawalDetailsForAmount(
+    suspend fun getWithdrawalDetailsForAmount(
         exchangeBaseUrl: String,
         amount: Amount
     ): WithdrawalDetails {
@@ -69,19 +73,19 @@ public class WalletApi {
         )
     }
 
-    public suspend fun listExchanges(): List<ExchangeListItem> {
+    suspend fun listExchanges(): List<ExchangeListItem> {
         return db.listExchanges().mapNotNull { exchange ->
             ExchangeListItem.fromExchangeRecord(exchange)
         }
     }
 
-    public suspend fun addExchange(exchangeBaseUrl: String): ExchangeListItem {
+    suspend fun addExchange(exchangeBaseUrl: String): ExchangeListItem {
         val exchange = exchangeManager.updateFromUrl(exchangeBaseUrl)
         db.put(exchange)
         return ExchangeListItem.fromExchangeRecord(exchange) ?: TODO("error 
handling")
     }
 
-    public suspend fun getExchangeTos(exchangeBaseUrl: String): 
GetExchangeTosResult {
+    suspend fun getExchangeTos(exchangeBaseUrl: String): GetExchangeTosResult {
         val record = db.getExchangeByBaseUrl(exchangeBaseUrl) ?: TODO("error 
handling")
         return GetExchangeTosResult(
             tos = record.termsOfServiceText ?: TODO("error handling"),
@@ -90,7 +94,7 @@ public class WalletApi {
         )
     }
 
-    public suspend fun setExchangeTosAccepted(exchangeBaseUrl: String, 
acceptedEtag: String) {
+    suspend fun setExchangeTosAccepted(exchangeBaseUrl: String, acceptedEtag: 
String) {
         db.transaction {
             val record = getExchangeByBaseUrl(exchangeBaseUrl) ?: TODO("error 
handling")
             val updatedRecord = record.copy(
diff --git 
a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/Withdrawal.kt 
b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/Withdrawal.kt
new file mode 100644
index 0000000..88c96a4
--- /dev/null
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/Withdrawal.kt
@@ -0,0 +1,53 @@
+/*
+ * This file is part of GNU Taler
+ * (C) 2020 Taler Systems S.A.
+ *
+ * GNU Taler is free software; you can redistribute it and/or modify it under 
the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 3, or (at your option) any later version.
+ *
+ * GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
FOR
+ * A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
+ */
+
+package net.taler.lib.wallet.api
+
+import net.taler.lib.common.Amount
+
+public data class WithdrawalDetailsForUri(
+    /**
+     * The amount that the user wants to withdraw
+     */
+    val amount: Amount,
+
+    /**
+     * Exchange suggested by the wallet
+     */
+    val defaultExchangeBaseUrl: String?,
+
+    /**
+     * A list of exchanges that can be used for this withdrawal
+     */
+    val possibleExchanges: List<ExchangeListItem>
+)
+
+public data class WithdrawalDetails(
+    /**
+     * Did the user accept the current version of the exchange's terms of 
service?
+     */
+    val tosAccepted: Boolean,
+
+    /**
+     * Amount that will be transferred to the exchange.
+     */
+    val amountRaw: Amount,
+
+    /**
+     * Amount that will be added to the user's wallet balance.
+     */
+    val amountEffective: Amount
+)
diff --git 
a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Planchet.kt 
b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Planchet.kt
index 22aa786..fa87348 100644
--- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Planchet.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Planchet.kt
@@ -17,7 +17,10 @@
 package net.taler.lib.wallet.crypto
 
 import net.taler.lib.common.Amount
-import net.taler.lib.wallet.Base32Crockford
+import net.taler.lib.crypto.Crypto
+import net.taler.lib.crypto.EddsaKeyPair
+import net.taler.lib.wallet.crypto.Signature.PurposeBuilder
+import net.taler.lib.crypto.Base32Crockford
 import net.taler.lib.wallet.toByteArray
 
 internal class Planchet(private val crypto: Crypto) {
@@ -53,7 +56,7 @@ internal class Planchet(private val crypto: Crypto) {
         val denomPubHash = crypto.sha512(denomPub)
         val evHash = crypto.sha512(ev)
 
-        val withdrawRequest = 
Signature.PurposeBuilder(Signature.RESERVE_WITHDRAW)
+        val withdrawRequest = PurposeBuilder(Signature.RESERVE_WITHDRAW)
             .put(reservePub)
             .put(amountWithFee.toByteArray())
             .put(req.feeWithdraw.toByteArray())
diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Recoup.kt 
b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Recoup.kt
index c7678e4..b87eff2 100644
--- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Recoup.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Recoup.kt
@@ -16,10 +16,12 @@
 
 package net.taler.lib.wallet.crypto
 
-import net.taler.lib.wallet.Base32Crockford
+import net.taler.lib.crypto.Crypto
+import net.taler.lib.crypto.Base32Crockford
 import net.taler.lib.wallet.CoinRecord
 import net.taler.lib.wallet.CoinSourceType.REFRESH
 import net.taler.lib.wallet.crypto.Signature.Companion.WALLET_COIN_RECOUP
+import net.taler.lib.wallet.crypto.Signature.PurposeBuilder
 
 internal class Recoup(private val crypto: Crypto) {
 
@@ -64,7 +66,7 @@ internal class Recoup(private val crypto: Crypto) {
      * Create and sign a message to recoup a coin.
      */
     fun createRequest(coin: CoinRecord): Request {
-        val p = Signature.PurposeBuilder(WALLET_COIN_RECOUP)
+        val p = PurposeBuilder(WALLET_COIN_RECOUP)
             .put(Base32Crockford.decode(coin.coinPub))
             .put(Base32Crockford.decode(coin.denomPubHash))
             .put(Base32Crockford.decode(coin.blindingKey))
diff --git 
a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Refresh.kt 
b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Refresh.kt
index 90478ef..8098437 100644
--- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Refresh.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Refresh.kt
@@ -17,9 +17,11 @@
 package net.taler.lib.wallet.crypto
 
 import net.taler.lib.common.Amount
-import net.taler.lib.wallet.Base32Crockford
+import net.taler.lib.crypto.Base32Crockford
 import net.taler.lib.wallet.CoinRecord
 import net.taler.lib.common.Timestamp
+import net.taler.lib.crypto.Crypto
+import net.taler.lib.crypto.EcdheKeyPair
 import net.taler.lib.wallet.crypto.Signature.Companion.WALLET_COIN_LINK
 import net.taler.lib.wallet.crypto.Signature.Companion.WALLET_COIN_MELT
 import net.taler.lib.wallet.crypto.Signature.PurposeBuilder
diff --git 
a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Signature.kt 
b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Signature.kt
index 006c004..8828509 100644
--- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Signature.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Signature.kt
@@ -16,8 +16,9 @@
 
 package net.taler.lib.wallet.crypto
 
-import net.taler.lib.wallet.Base32Crockford
-import net.taler.lib.wallet.crypto.CryptoImpl.Companion.toByteArray
+import net.taler.lib.crypto.Crypto
+import net.taler.lib.crypto.Base32Crockford
+import net.taler.lib.crypto.CryptoImpl.Companion.toByteArray
 import net.taler.lib.wallet.exchange.DenominationRecord
 import net.taler.lib.wallet.exchange.WireFee
 import net.taler.lib.wallet.roundedToByteArray
diff --git 
a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Denomination.kt 
b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Denomination.kt
index fca9e3f..a515d96 100644
--- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Denomination.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Denomination.kt
@@ -20,7 +20,7 @@ import kotlinx.serialization.Serializable
 import net.taler.lib.common.Amount
 import net.taler.lib.common.Duration
 import net.taler.lib.common.Timestamp
-import net.taler.lib.wallet.Base32Crockford
+import net.taler.lib.crypto.Base32Crockford
 import net.taler.lib.wallet.exchange.DenominationStatus.Unverified
 import net.taler.lib.wallet.exchange.DenominationStatus.VerifiedGood
 
diff --git 
a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Exchange.kt 
b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Exchange.kt
index 4d89cd6..e685040 100644
--- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Exchange.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Exchange.kt
@@ -27,11 +27,11 @@ import io.ktor.http.HttpStatusCode
 import net.taler.lib.common.Amount
 import net.taler.lib.common.Timestamp
 import net.taler.lib.common.Version
-import net.taler.lib.wallet.Base32Crockford
+import net.taler.lib.crypto.Base32Crockford
 import net.taler.lib.wallet.Db
 import net.taler.lib.wallet.DbFactory
-import net.taler.lib.wallet.crypto.Crypto
-import net.taler.lib.wallet.crypto.CryptoFactory
+import net.taler.lib.crypto.Crypto
+import net.taler.lib.crypto.CryptoFactory
 import net.taler.lib.wallet.crypto.Signature
 import net.taler.lib.wallet.exchange.DenominationStatus.Unverified
 import net.taler.lib.wallet.exchange.ExchangeUpdateReason.Initial
@@ -223,40 +223,3 @@ internal class Exchange(
     }
 
 }
-
-
-data class ExchangeListItem(
-    val exchangeBaseUrl: String,
-    val currency: String,
-    val paytoUris: List<String>
-) {
-    companion object {
-        fun fromExchangeRecord(exchange: ExchangeRecord): ExchangeListItem? {
-            return if (exchange.details == null || exchange.wireInfo == null) 
null
-            else ExchangeListItem(
-                exchangeBaseUrl = exchange.baseUrl,
-                currency = exchange.details.currency,
-                paytoUris = exchange.wireInfo.accounts.map {
-                    it.paytoUri
-                }
-            )
-        }
-    }
-}
-
-data class GetExchangeTosResult(
-    /**
-     * Markdown version of the current ToS.
-     */
-    val tos: String,
-
-    /**
-     * Version tag of the current ToS.
-     */
-    val currentEtag: String,
-
-    /**
-     * Version tag of the last ToS that the user has accepted, if any.
-     */
-    val acceptedEtag: String? = null
-)
diff --git 
a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/operations/Withdraw.kt 
b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/operations/Withdraw.kt
index 69c68d1..84851ba 100644
--- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/operations/Withdraw.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/operations/Withdraw.kt
@@ -23,12 +23,11 @@ import kotlinx.serialization.Serializable
 import net.taler.lib.common.Amount
 import net.taler.lib.common.TalerUri.parseWithdrawUri
 import net.taler.lib.common.Timestamp
-import net.taler.lib.common.Version
 import net.taler.lib.common.Version.VersionMatchResult
+import net.taler.lib.crypto.Crypto
+import net.taler.lib.crypto.CryptoFactory
 import net.taler.lib.wallet.Db
 import net.taler.lib.wallet.DbFactory
-import net.taler.lib.wallet.crypto.Crypto
-import net.taler.lib.wallet.crypto.CryptoFactory
 import net.taler.lib.wallet.crypto.Signature
 import net.taler.lib.wallet.exchange.DenominationRecord
 import net.taler.lib.wallet.exchange.DenominationSelectionInfo
@@ -36,7 +35,6 @@ import 
net.taler.lib.wallet.exchange.DenominationStatus.Unverified
 import net.taler.lib.wallet.exchange.DenominationStatus.VerifiedBad
 import net.taler.lib.wallet.exchange.DenominationStatus.VerifiedGood
 import net.taler.lib.wallet.exchange.Exchange
-import net.taler.lib.wallet.exchange.ExchangeListItem
 import net.taler.lib.wallet.exchange.ExchangeRecord
 import net.taler.lib.wallet.exchange.ExchangeWireInfo
 import net.taler.lib.wallet.exchange.SelectedDenomination
@@ -46,7 +44,9 @@ internal class Withdraw(
     private val httpClient: HttpClient = getDefaultHttpClient(),
     private val db: Db = DbFactory().openDb(),
     private val crypto: Crypto = CryptoFactory.getCrypto(),
-    private val signature: Signature = Signature(crypto),
+    private val signature: Signature = Signature(
+        crypto
+    ),
     private val exchange: Exchange = Exchange(crypto, signature, httpClient, 
db = db)
 ) {
 
@@ -270,37 +270,3 @@ internal class Withdraw(
     }
 
 }
-
-data class WithdrawalDetailsForUri(
-    /**
-     * The amount that the user wants to withdraw
-     */
-    val amount: Amount,
-
-    /**
-     * Exchange suggested by the wallet
-     */
-    val defaultExchangeBaseUrl: String?,
-
-    /**
-     * A list of exchanges that can be used for this withdrawal
-     */
-    val possibleExchanges: List<ExchangeListItem>
-)
-
-data class WithdrawalDetails(
-    /**
-     * Did the user accept the current version of the exchange's terms of 
service?
-     */
-    val tosAccepted: Boolean,
-
-    /**
-     * Amount that will be transferred to the exchange.
-     */
-    val amountRaw: Amount,
-
-    /**
-     * Amount that will be added to the user's wallet balance.
-     */
-    val amountEffective: Amount
-)
diff --git 
a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/Base32CrockfordTest.kt 
b/wallet/src/commonTest/kotlin/net/taler/lib/crypto/Base32CrockfordTest.kt
similarity index 99%
rename from 
wallet/src/commonTest/kotlin/net/taler/lib/wallet/Base32CrockfordTest.kt
rename to 
wallet/src/commonTest/kotlin/net/taler/lib/crypto/Base32CrockfordTest.kt
index 0f16971..f1c5be1 100644
--- a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/Base32CrockfordTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/crypto/Base32CrockfordTest.kt
@@ -14,7 +14,7 @@
  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-package net.taler.lib.wallet
+package net.taler.lib.crypto
 
 import kotlin.test.Ignore
 import kotlin.test.Test
diff --git 
a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/EllipticCurveTest.kt 
b/wallet/src/commonTest/kotlin/net/taler/lib/crypto/EllipticCurveTest.kt
similarity index 98%
rename from 
wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/EllipticCurveTest.kt
rename to wallet/src/commonTest/kotlin/net/taler/lib/crypto/EllipticCurveTest.kt
index 10fbcc1..4cdd5b9 100644
--- 
a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/EllipticCurveTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/crypto/EllipticCurveTest.kt
@@ -14,9 +14,8 @@
  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-package net.taler.lib.wallet.crypto
+package net.taler.lib.crypto
 
-import net.taler.lib.wallet.Base32Crockford
 import kotlin.random.Random
 import kotlin.test.Test
 import kotlin.test.assertEquals
diff --git 
a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/KdfTest.kt 
b/wallet/src/commonTest/kotlin/net/taler/lib/crypto/KdfTest.kt
similarity index 98%
rename from wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/KdfTest.kt
rename to wallet/src/commonTest/kotlin/net/taler/lib/crypto/KdfTest.kt
index 291930d..c75f484 100644
--- a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/KdfTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/crypto/KdfTest.kt
@@ -14,11 +14,10 @@
  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-package net.taler.lib.wallet.crypto
+package net.taler.lib.crypto
 
-import net.taler.lib.wallet.Base32Crockford
-import net.taler.lib.wallet.crypto.Kdf.HMAC_SHA256_BLOCK_SIZE
-import net.taler.lib.wallet.crypto.Kdf.HMAC_SHA512_BLOCK_SIZE
+import net.taler.lib.crypto.Kdf.HMAC_SHA256_BLOCK_SIZE
+import net.taler.lib.crypto.Kdf.HMAC_SHA512_BLOCK_SIZE
 import kotlin.test.Test
 import kotlin.test.assertEquals
 import kotlin.test.assertTrue
diff --git 
a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/Sha256Test.kt 
b/wallet/src/commonTest/kotlin/net/taler/lib/crypto/Sha256Test.kt
similarity index 98%
rename from 
wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/Sha256Test.kt
rename to wallet/src/commonTest/kotlin/net/taler/lib/crypto/Sha256Test.kt
index a71734a..9c47806 100644
--- a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/Sha256Test.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/crypto/Sha256Test.kt
@@ -14,7 +14,7 @@
  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-package net.taler.lib.wallet.crypto
+package net.taler.lib.crypto
 
 import kotlin.test.Test
 import kotlin.test.assertEquals
diff --git 
a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/Sha512Test.kt 
b/wallet/src/commonTest/kotlin/net/taler/lib/crypto/Sha512Test.kt
similarity index 98%
rename from 
wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/Sha512Test.kt
rename to wallet/src/commonTest/kotlin/net/taler/lib/crypto/Sha512Test.kt
index 59fd730..a3e817f 100644
--- a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/Sha512Test.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/crypto/Sha512Test.kt
@@ -14,9 +14,8 @@
  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-package net.taler.lib.wallet.crypto
+package net.taler.lib.crypto
 
-import net.taler.lib.wallet.Base32Crockford
 import kotlin.random.Random
 import kotlin.test.Test
 import kotlin.test.assertEquals
diff --git a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/AmountTest.kt 
b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/AmountTest.kt
index ccee992..fbfd4e7 100644
--- a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/AmountTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/AmountTest.kt
@@ -17,6 +17,7 @@
 package net.taler.lib.wallet
 
 import net.taler.lib.common.Amount
+import net.taler.lib.crypto.Base32Crockford
 import kotlin.test.Test
 import kotlin.test.assertEquals
 
diff --git a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/TimestampTest.kt 
b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/TimestampTest.kt
index b0f3b32..b3709b7 100644
--- a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/TimestampTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/TimestampTest.kt
@@ -17,6 +17,7 @@
 package net.taler.lib.wallet
 
 import net.taler.lib.common.Timestamp
+import net.taler.lib.crypto.Base32Crockford
 import kotlin.random.Random
 import kotlin.test.Test
 import kotlin.test.assertEquals
diff --git a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/WalletApiTest.kt 
b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/api/WalletApiTest.kt
similarity index 96%
rename from wallet/src/commonTest/kotlin/net/taler/lib/wallet/WalletApiTest.kt
rename to wallet/src/commonTest/kotlin/net/taler/lib/wallet/api/WalletApiTest.kt
index 511eb79..e4abf0f 100644
--- a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/WalletApiTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/api/WalletApiTest.kt
@@ -14,9 +14,10 @@
  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-package net.taler.lib.wallet
+package net.taler.lib.wallet.api
 
 import net.taler.lib.common.Amount
+import net.taler.lib.wallet.runCoroutine
 import kotlin.test.Ignore
 import kotlin.test.Test
 import kotlin.test.assertEquals
@@ -25,7 +26,7 @@ import kotlin.test.assertTrue
 @Ignore // Live-Test which fails when test environment changes or is not 
available
 class WalletApiTest {
 
-    private val api = WalletApi()
+    private val api = WalletApiImpl()
 
     private val exchangeBaseUrl = "https://exchange.test.taler.net/";
     private val withdrawUri =
diff --git 
a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/DepositTest.kt 
b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/DepositTest.kt
index e3017a3..28354c9 100644
--- a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/DepositTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/DepositTest.kt
@@ -18,8 +18,10 @@ package net.taler.lib.wallet.crypto
 
 import net.taler.lib.common.Amount
 import net.taler.lib.common.Timestamp
-import net.taler.lib.wallet.crypto.Deposit.CoinDepositPermission
-import net.taler.lib.wallet.crypto.Deposit.DepositInfo
+import net.taler.lib.crypto.CryptoFactory
+import net.taler.lib.crypto.Deposit
+import net.taler.lib.crypto.Deposit.CoinDepositPermission
+import net.taler.lib.crypto.Deposit.DepositInfo
 import kotlin.test.Test
 import kotlin.test.assertEquals
 
diff --git 
a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/RecoupTest.kt 
b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/RecoupTest.kt
index 035b7d7..4e18391 100644
--- a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/RecoupTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/RecoupTest.kt
@@ -17,6 +17,7 @@
 package net.taler.lib.wallet.crypto
 
 import net.taler.lib.common.Amount
+import net.taler.lib.crypto.CryptoFactory
 import net.taler.lib.wallet.CoinRecord
 import net.taler.lib.wallet.CoinSourceType.REFRESH
 import net.taler.lib.wallet.CoinSourceType.WITHDRAW
diff --git 
a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/RefreshPlanchetTest.kt
 
b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/RefreshPlanchetTest.kt
index a56d191..830fef1 100644
--- 
a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/RefreshPlanchetTest.kt
+++ 
b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/RefreshPlanchetTest.kt
@@ -16,7 +16,9 @@
 
 package net.taler.lib.wallet.crypto
 
-import net.taler.lib.wallet.Base32Crockford
+import net.taler.lib.crypto.CryptoFactory
+import net.taler.lib.crypto.FreshCoin
+import net.taler.lib.crypto.Base32Crockford
 import kotlin.test.Test
 import kotlin.test.assertEquals
 
diff --git 
a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/SignatureTest.kt 
b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/SignatureTest.kt
index b3228b9..59a9fd5 100644
--- a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/SignatureTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/SignatureTest.kt
@@ -18,7 +18,8 @@ package net.taler.lib.wallet.crypto
 
 import net.taler.lib.common.Amount
 import net.taler.lib.common.Timestamp
-import net.taler.lib.wallet.Base32Crockford
+import net.taler.lib.crypto.CryptoFactory
+import net.taler.lib.crypto.Base32Crockford
 import net.taler.lib.wallet.crypto.Signature.PurposeBuilder
 import net.taler.lib.wallet.exchange.DenominationRecord
 import net.taler.lib.wallet.exchange.DenominationStatus.Unverified
diff --git 
a/wallet/src/jsMain/kotlin/net/taler/lib/wallet/crypto/CryptoFactory.kt 
b/wallet/src/jsMain/kotlin/net/taler/lib/crypto/CryptoFactory.kt
similarity index 99%
rename from 
wallet/src/jsMain/kotlin/net/taler/lib/wallet/crypto/CryptoFactory.kt
rename to wallet/src/jsMain/kotlin/net/taler/lib/crypto/CryptoFactory.kt
index e5f9531..bfe909b 100644
--- a/wallet/src/jsMain/kotlin/net/taler/lib/wallet/crypto/CryptoFactory.kt
+++ b/wallet/src/jsMain/kotlin/net/taler/lib/crypto/CryptoFactory.kt
@@ -14,7 +14,7 @@
  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-package net.taler.lib.wallet.crypto
+package net.taler.lib.crypto
 
 import org.khronos.webgl.Uint8Array
 import org.khronos.webgl.get
diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Version.kt 
b/wallet/src/jsMain/kotlin/net/taler/lib/wallet/api/WalletFactory.kt
similarity index 76%
rename from wallet/src/commonMain/kotlin/net/taler/lib/wallet/Version.kt
rename to wallet/src/jsMain/kotlin/net/taler/lib/wallet/api/WalletFactory.kt
index ba9be3c..c8e1f0f 100644
--- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Version.kt
+++ b/wallet/src/jsMain/kotlin/net/taler/lib/wallet/api/WalletFactory.kt
@@ -14,13 +14,10 @@
  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-package net.taler.lib.wallet
+package net.taler.lib.wallet.api
 
-import net.taler.lib.common.Version
-
-class SupportedVersions(
-    val walletVersion: Version,
-    val exchangeVersion: Version,
-    val bankVersion: Version,
-    val merchantVersion: Version
-)
+actual class WalletFactory {
+    actual fun createWalletApi(): WalletApi {
+        TODO("Not yet implemented")
+    }
+}
\ No newline at end of file
diff --git 
a/wallet/src/nativeMain/kotlin/net/taler/lib/wallet/crypto/CryptoFactory.kt 
b/wallet/src/nativeMain/kotlin/net/taler/lib/crypto/CryptoFactory.kt
similarity index 99%
rename from 
wallet/src/nativeMain/kotlin/net/taler/lib/wallet/crypto/CryptoFactory.kt
rename to wallet/src/nativeMain/kotlin/net/taler/lib/crypto/CryptoFactory.kt
index 61646a0..1486fcb 100644
--- a/wallet/src/nativeMain/kotlin/net/taler/lib/wallet/crypto/CryptoFactory.kt
+++ b/wallet/src/nativeMain/kotlin/net/taler/lib/crypto/CryptoFactory.kt
@@ -14,7 +14,7 @@
  * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 
-package net.taler.lib.wallet.crypto
+package net.taler.lib.crypto
 
 import kotlinx.cinterop.CValuesRef
 import kotlinx.cinterop.UByteVar
diff --git 
a/wallet/src/nativeMain/kotlin/net/taler/lib/wallet/api/WalletFactory.kt 
b/wallet/src/nativeMain/kotlin/net/taler/lib/wallet/api/WalletFactory.kt
new file mode 100644
index 0000000..9fdf7e7
--- /dev/null
+++ b/wallet/src/nativeMain/kotlin/net/taler/lib/wallet/api/WalletFactory.kt
@@ -0,0 +1,61 @@
+/*
+ * This file is part of GNU Taler
+ * (C) 2020 Taler Systems S.A.
+ *
+ * GNU Taler is free software; you can redistribute it and/or modify it under 
the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 3, or (at your option) any later version.
+ *
+ * GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
FOR
+ * A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
+ */
+
+package net.taler.lib.wallet.api
+
+import kotlinx.coroutines.runBlocking
+import net.taler.lib.common.Amount
+
+actual class WalletFactory {
+    actual fun createWalletApi(): WalletApi {
+        return WalletApiBlocking()
+    }
+}
+
+internal class WalletApiBlocking : WalletApi {
+
+    private val api = WalletApiImpl()
+
+    override fun getVersions(): SupportedVersions {
+        return api.getVersions()
+    }
+
+    override fun getWithdrawalDetailsForUri(talerWithdrawUri: String): 
WithdrawalDetailsForUri = runBlocking {
+        api.getWithdrawalDetailsForUri(talerWithdrawUri)
+    }
+
+    override fun getWithdrawalDetailsForAmount(exchangeBaseUrl: String, 
amount: Amount): WithdrawalDetails =
+        runBlocking {
+            api.getWithdrawalDetailsForAmount(exchangeBaseUrl, amount)
+        }
+
+    override fun listExchanges(): List<ExchangeListItem> = runBlocking {
+        api.listExchanges()
+    }
+
+    override fun addExchange(exchangeBaseUrl: String): ExchangeListItem = 
runBlocking {
+        api.addExchange(exchangeBaseUrl)
+    }
+
+    override fun getExchangeTos(exchangeBaseUrl: String): GetExchangeTosResult 
= runBlocking {
+        api.getExchangeTos(exchangeBaseUrl)
+    }
+
+    override fun setExchangeTosAccepted(exchangeBaseUrl: String, acceptedEtag: 
String) = runBlocking {
+        api.setExchangeTosAccepted(exchangeBaseUrl, acceptedEtag)
+    }
+
+}

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]