summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorsten Grote <t@grobox.de>2020-08-14 17:33:22 -0300
committerTorsten Grote <t@grobox.de>2020-08-14 17:33:22 -0300
commita307a498dc8a42df129e8eaff591e9144ed96298 (patch)
treea55182b4793b673e433d0e431e9d971d45c9a6a7
parent2ac13b19a5c7fc3531447333fe1772a78ca35795 (diff)
downloadwallet-kotlin-a307a498dc8a42df129e8eaff591e9144ed96298.tar.gz
wallet-kotlin-a307a498dc8a42df129e8eaff591e9144ed96298.tar.bz2
wallet-kotlin-a307a498dc8a42df129e8eaff591e9144ed96298.zip
Make the wallet lib actually use the common lib
-rw-r--r--.idea/.gitignore4
-rw-r--r--.idea/compiler.xml14
-rw-r--r--.idea/jarRepositories.xml5
-rw-r--r--.idea/misc.xml78
-rw-r--r--.idea/wallet-kotlin.iml19
-rw-r--r--common/.gradle/5.5.1/fileChanges/last-build.binbin1 -> 0 bytes
-rw-r--r--common/.gradle/5.5.1/fileHashes/fileHashes.lockbin17 -> 0 bytes
-rw-r--r--common/.gradle/5.5.1/gc.properties0
-rw-r--r--common/.gradle/buildOutputCleanup/buildOutputCleanup.lockbin17 -> 0 bytes
-rw-r--r--common/.gradle/buildOutputCleanup/cache.properties2
-rw-r--r--common/.gradle/vcs-1/gc.properties0
-rw-r--r--common/build.gradle1
-rw-r--r--common/src/commonMain/kotlin/net/taler/lib/common/Amount.kt (renamed from common/src/commonMain/kotlin/net/taler/common/Amount.kt)2
-rw-r--r--common/src/commonMain/kotlin/net/taler/lib/common/TalerUri.kt (renamed from common/src/commonMain/kotlin/net/taler/common/TalerUri.kt)4
-rw-r--r--common/src/commonMain/kotlin/net/taler/lib/common/Time.kt (renamed from common/src/commonMain/kotlin/net/taler/common/Time.kt)9
-rw-r--r--common/src/commonMain/kotlin/net/taler/lib/common/Version.kt (renamed from common/src/commonMain/kotlin/net/taler/common/Version.kt)2
-rw-r--r--common/src/commonTest/kotlin/net/taler/lib/common/AmountTest.kt (renamed from common/src/commonTest/kotlin/net/taler/common/AmountTest.kt)15
-rw-r--r--common/src/commonTest/kotlin/net/taler/lib/common/TalerUriTest.kt (renamed from common/src/commonTest/kotlin/net/taler/common/TalerUriTest.kt)6
-rw-r--r--common/src/commonTest/kotlin/net/taler/lib/common/TestUtils.kt (renamed from common/src/commonTest/kotlin/net/taler/common/TestUtils.kt)16
-rw-r--r--common/src/commonTest/kotlin/net/taler/lib/common/TimeTest.kt (renamed from common/src/commonTest/kotlin/net/taler/common/TimeTest.kt)4
-rw-r--r--common/src/commonTest/kotlin/net/taler/lib/common/VersionTest.kt (renamed from common/src/commonTest/kotlin/net/taler/common/VersionTest.kt)2
-rw-r--r--gradle.properties5
-rw-r--r--wallet/build.gradle6
-rw-r--r--wallet/src/androidMain/AndroidManifest.xml2
-rw-r--r--wallet/src/androidMain/kotlin/net/taler/lib/wallet/Db.kt (renamed from wallet/src/androidMain/kotlin/net/taler/wallet/kotlin/Db.kt)2
-rw-r--r--wallet/src/androidMain/kotlin/net/taler/lib/wallet/crypto/CryptoFactory.kt (renamed from wallet/src/androidMain/kotlin/net/taler/wallet/kotlin/crypto/CryptoFactory.kt)2
-rw-r--r--wallet/src/androidMain/kotlin/net/taler/lib/wallet/crypto/RsaBlinding.kt (renamed from wallet/src/androidMain/kotlin/net/taler/wallet/kotlin/crypto/RsaBlinding.kt)2
-rw-r--r--wallet/src/androidTest/kotlin/net/taler/lib/wallet/TestUtilsAndroid.kt (renamed from wallet/src/androidTest/kotlin/net/taler/wallet/kotlin/TestUtilsAndroid.kt)2
-rw-r--r--wallet/src/androidTest/kotlin/net/taler/lib/wallet/crypto/PlanchetTest.kt (renamed from wallet/src/androidTest/kotlin/net/taler/wallet/kotlin/crypto/PlanchetTest.kt)10
-rw-r--r--wallet/src/androidTest/kotlin/net/taler/lib/wallet/crypto/RefreshTest.kt (renamed from wallet/src/androidTest/kotlin/net/taler/wallet/kotlin/crypto/RefreshTest.kt)26
-rw-r--r--wallet/src/androidTest/kotlin/net/taler/lib/wallet/crypto/RsaBlindingTest.kt (renamed from wallet/src/androidTest/kotlin/net/taler/wallet/kotlin/crypto/RsaBlindingTest.kt)4
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/Amount.kt (renamed from common/src/jvmMain/kotlin/net/taler/common/Time.kt)11
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/Base32Crockford.kt (renamed from wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Base32Crockford.kt)2
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/Db.kt (renamed from wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Db.kt)6
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/PaytoUri.kt (renamed from wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/PaytoUri.kt)2
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/Time.kt (renamed from common/src/jsMain/kotlin/net/taler/common/Time.kt)9
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/Types.kt (renamed from wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Types.kt)3
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/Utils.kt (renamed from wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Utils.kt)2
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/Version.kt (renamed from common/src/nativeMain/kotlin/net/taler/common/Time.kt)13
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/WalletApi.kt (renamed from wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/WalletApi.kt)23
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Crypto.kt (renamed from wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/Crypto.kt)2
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/CryptoImpl.kt (renamed from wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/CryptoImpl.kt)4
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Deposit.kt (renamed from wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/Deposit.kt)12
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Kdf.kt (renamed from wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/Kdf.kt)2
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Planchet.kt (renamed from wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/Planchet.kt)7
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Recoup.kt (renamed from wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/Recoup.kt)10
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Refresh.kt (renamed from wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/Refresh.kt)23
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Signature.kt (renamed from wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/Signature.kt)12
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Auditor.kt (renamed from wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/exchange/Auditor.kt)2
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Denomination.kt (renamed from wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/exchange/Denomination.kt)14
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Exchange.kt (renamed from wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/exchange/Exchange.kt)40
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/ExchangeRecord.kt (renamed from wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/exchange/ExchangeRecord.kt)4
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Keys.kt (renamed from wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/exchange/Keys.kt)4
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Wire.kt (renamed from wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/exchange/Wire.kt)6
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/operations/Withdraw.kt (renamed from wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/operations/Withdraw.kt)43
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Amount.kt210
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/TalerUri.kt60
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Time.kt85
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Version.kt78
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/lib/wallet/AmountTest.kt64
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/lib/wallet/Base32CrockfordTest.kt (renamed from wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/Base32CrockfordTest.kt)2
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/lib/wallet/DbTest.kt (renamed from wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/DbTest.kt)17
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/lib/wallet/PaytoUriTest.kt (renamed from wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/PaytoUriTest.kt)2
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/lib/wallet/TestUtils.kt (renamed from wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/TestUtils.kt)2
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/lib/wallet/TimestampTest.kt (renamed from wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/TimestampTest.kt)3
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/lib/wallet/WalletApiTest.kt (renamed from wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/WalletApiTest.kt)3
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/DepositTest.kt (renamed from wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/crypto/DepositTest.kt)10
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/EllipticCurveTest.kt (renamed from wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/crypto/EllipticCurveTest.kt)4
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/KdfTest.kt (renamed from wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/crypto/KdfTest.kt)8
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/RecoupTest.kt (renamed from wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/crypto/RecoupTest.kt)14
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/RefreshPlanchetTest.kt (renamed from wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/crypto/RefreshPlanchetTest.kt)4
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/Sha256Test.kt (renamed from wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/crypto/Sha256Test.kt)3
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/Sha512Test.kt (renamed from wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/crypto/Sha512Test.kt)4
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/SignatureTest.kt (renamed from wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/crypto/SignatureTest.kt)18
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/lib/wallet/exchange/DenominationTest.kt (renamed from wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/exchange/DenominationTest.kt)20
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/lib/wallet/exchange/Denominations.kt (renamed from wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/exchange/Denominations.kt)10
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/lib/wallet/exchange/KeysTest.kt (renamed from wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/exchange/KeysTest.kt)12
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/lib/wallet/exchange/UpdateTest.kt (renamed from wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/exchange/UpdateTest.kt)4
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/lib/wallet/exchange/WireTest.kt (renamed from wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/exchange/WireTest.kt)12
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/lib/wallet/operations/WithdrawTest.kt (renamed from wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/operations/WithdrawTest.kt)32
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/AmountTest.kt276
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/TalerUriTest.kt65
-rw-r--r--wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/VersionTest.kt57
-rw-r--r--wallet/src/jsMain/kotlin/net/taler/lib/wallet/Db.kt (renamed from wallet/src/jsMain/kotlin/net/taler/wallet/kotlin/Db.kt)2
-rw-r--r--wallet/src/jsMain/kotlin/net/taler/lib/wallet/crypto/CryptoFactory.kt (renamed from wallet/src/jsMain/kotlin/net/taler/wallet/kotlin/crypto/CryptoFactory.kt)2
-rw-r--r--wallet/src/jsTest/kotlin/net/taler/lib/wallet/TestUtils.kt (renamed from wallet/src/jsTest/kotlin/net/taler/wallet/kotlin/TestUtils.kt)2
-rw-r--r--wallet/src/nativeMain/kotlin/net/taler/lib/wallet/Db.kt (renamed from wallet/src/nativeMain/kotlin/net/taler/wallet/kotlin/Db.kt)2
-rw-r--r--wallet/src/nativeMain/kotlin/net/taler/lib/wallet/crypto/CryptoFactory.kt (renamed from wallet/src/nativeMain/kotlin/net/taler/wallet/kotlin/crypto/CryptoFactory.kt)2
-rw-r--r--wallet/src/nativeTest/kotlin/net/taler/lib/wallet/TestUtils.kt (renamed from wallet/src/nativeTest/kotlin/net/taler/wallet/kotlin/TestUtils.kt)2
89 files changed, 368 insertions, 1223 deletions
diff --git a/.idea/.gitignore b/.idea/.gitignore
index 8eae92b..e7afc6a 100644
--- a/.idea/.gitignore
+++ b/.idea/.gitignore
@@ -1,6 +1,7 @@
# Default ignored files
/shelf/
/artifacts
+/caches
/modules*
/workspace.xml
/gradle.xml
@@ -11,4 +12,5 @@
/vcs.xml
/compiler.xml
/jarRepositories.xml
-/misc.xml \ No newline at end of file
+/misc.xml
+/$CACHE_FILE$
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 72e41ea..7c0bb6d 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,23 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
- <wildcardResourcePatterns>
- <entry name="!?*.java" />
- <entry name="!?*.form" />
- <entry name="!?*.class" />
- <entry name="!?*.groovy" />
- <entry name="!?*.scala" />
- <entry name="!?*.flex" />
- <entry name="!?*.kt" />
- <entry name="!?*.clj" />
- </wildcardResourcePatterns>
<bytecodeTargetLevel target="1.8">
<module name="wallet-kotlin.common.jvmMain" target="1.6" />
- <module name="wallet-kotlin.common.jvmMain~1" target="1.6" />
<module name="wallet-kotlin.common.jvmTest" target="1.6" />
- <module name="wallet-kotlin.common.jvmTest~1" target="1.6" />
- <module name="wallet-kotlin_androidMain" target="1.6" />
- <module name="wallet-kotlin_androidTest" target="1.6" />
</bytecodeTargetLevel>
</component>
</project> \ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index 59912a9..e9f6aa8 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -27,11 +27,6 @@
<option name="url" value="https://dl.bintray.com/terl/lazysodium-maven" />
</remote-repository>
<remote-repository>
- <option name="id" value="MavenLocal" />
- <option name="name" value="MavenLocal" />
- <option name="url" value="file:$MAVEN_REPOSITORY$/" />
- </remote-repository>
- <remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 21353ae..b0051c8 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,79 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
- <component name="CMakeSettings">
- <configurations>
- <configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
- </configurations>
- </component>
- <component name="MarkdownProjectSettings">
- <PreviewSettings splitEditorLayout="SPLIT" splitEditorPreview="PREVIEW" useGrayscaleRendering="false" zoomFactor="1.0" maxImageWidth="0" showGitHubPageIfSynced="false" allowBrowsingInPreview="false" synchronizePreviewPosition="true" highlightPreviewType="NONE" highlightFadeOut="5" highlightOnTyping="true" synchronizeSourcePosition="true">
- <PanelProvider>
- <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.panel" providerName="Default - Swing" />
- </PanelProvider>
- </PreviewSettings>
- <ParserSettings>
- <PegdownExtensions>
- <option name="ABBREVIATIONS" value="false" />
- <option name="ANCHORLINKS" value="true" />
- <option name="ATXHEADERSPACE" value="true" />
- <option name="AUTOLINKS" value="true" />
- <option name="DEFINITIONS" value="false" />
- <option name="FENCED_CODE_BLOCKS" value="true" />
- <option name="FOOTNOTES" value="false" />
- <option name="HARDWRAPS" value="false" />
- <option name="INSERTED" value="false" />
- <option name="QUOTES" value="false" />
- <option name="RELAXEDHRULES" value="true" />
- <option name="SMARTS" value="false" />
- <option name="STRIKETHROUGH" value="true" />
- <option name="SUBSCRIPT" value="false" />
- <option name="SUPERSCRIPT" value="false" />
- <option name="SUPPRESS_HTML_BLOCKS" value="false" />
- <option name="SUPPRESS_INLINE_HTML" value="false" />
- <option name="TABLES" value="true" />
- <option name="TASKLISTITEMS" value="true" />
- <option name="TOC" value="false" />
- <option name="WIKILINKS" value="true" />
- </PegdownExtensions>
- <ParserOptions>
- <option name="COMMONMARK_LISTS" value="false" />
- <option name="DUMMY" value="false" />
- <option name="EMOJI_SHORTCUTS" value="true" />
- <option name="FLEXMARK_FRONT_MATTER" value="false" />
- <option name="GFM_TABLE_RENDERING" value="true" />
- <option name="GITBOOK_URL_ENCODING" value="false" />
- <option name="GITHUB_EMOJI_URL" value="false" />
- <option name="GITHUB_LISTS" value="true" />
- <option name="GITHUB_WIKI_LINKS" value="true" />
- <option name="JEKYLL_FRONT_MATTER" value="false" />
- <option name="SIM_TOC_BLANK_LINE_SPACER" value="true" />
- </ParserOptions>
- </ParserSettings>
- <HtmlSettings headerTopEnabled="false" headerBottomEnabled="false" bodyTopEnabled="false" bodyBottomEnabled="false" embedUrlContent="false" addPageHeader="true">
- <GeneratorProvider>
- <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.generator" providerName="Default Swing HTML Generator" />
- </GeneratorProvider>
- <headerTop />
- <headerBottom />
- <bodyTop />
- <bodyBottom />
- </HtmlSettings>
- <CssSettings previewScheme="UI_SCHEME" cssUri="" isCssUriEnabled="false" isCssTextEnabled="false" isDynamicPageWidth="true">
- <StylesheetProvider>
- <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.css" providerName="Default Swing Stylesheet" />
- </StylesheetProvider>
- <ScriptProviders />
- <cssText />
- </CssSettings>
- <HtmlExportSettings updateOnSave="false" parentDir="$ProjectFileDir$" targetDir="$ProjectFileDir$" cssDir="" scriptDir="" plainHtml="false" imageDir="" copyLinkedImages="false" imageUniquifyType="0" targetExt="" useTargetExt="false" noCssNoScripts="false" linkToExportedHtml="true" exportOnSettingsChange="true" regenerateOnProjectOpen="false" />
- <LinkMapSettings>
- <textMaps />
- </LinkMapSettings>
- </component>
- <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
- <output url="file://$PROJECT_DIR$/build/classes" />
- </component>
- <component name="ProjectType">
- <option name="id" value="Android" />
- </component>
+ <component name="ExternalStorageConfigurationManager" enabled="true" />
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
</project> \ No newline at end of file
diff --git a/.idea/wallet-kotlin.iml b/.idea/wallet-kotlin.iml
deleted file mode 100644
index 57eb384..0000000
--- a/.idea/wallet-kotlin.iml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module external.linked.project.id="wallet-kotlin" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
- <component name="FacetManager">
- <facet type="java-gradle" name="Java-Gradle">
- <configuration>
- <option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
- <option name="BUILDABLE" value="false" />
- </configuration>
- </facet>
- </component>
- <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
- <exclude-output />
- <content url="file://$MODULE_DIR$">
- <excludeFolder url="file://$MODULE_DIR$/.gradle" />
- </content>
- <orderEntry type="inheritedJdk" />
- <orderEntry type="sourceFolder" forTests="false" />
- </component>
-</module> \ No newline at end of file
diff --git a/common/.gradle/5.5.1/fileChanges/last-build.bin b/common/.gradle/5.5.1/fileChanges/last-build.bin
deleted file mode 100644
index f76dd23..0000000
--- a/common/.gradle/5.5.1/fileChanges/last-build.bin
+++ /dev/null
Binary files differ
diff --git a/common/.gradle/5.5.1/fileHashes/fileHashes.lock b/common/.gradle/5.5.1/fileHashes/fileHashes.lock
deleted file mode 100644
index 34525bf..0000000
--- a/common/.gradle/5.5.1/fileHashes/fileHashes.lock
+++ /dev/null
Binary files differ
diff --git a/common/.gradle/5.5.1/gc.properties b/common/.gradle/5.5.1/gc.properties
deleted file mode 100644
index e69de29..0000000
--- a/common/.gradle/5.5.1/gc.properties
+++ /dev/null
diff --git a/common/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/common/.gradle/buildOutputCleanup/buildOutputCleanup.lock
deleted file mode 100644
index 04431dd..0000000
--- a/common/.gradle/buildOutputCleanup/buildOutputCleanup.lock
+++ /dev/null
Binary files differ
diff --git a/common/.gradle/buildOutputCleanup/cache.properties b/common/.gradle/buildOutputCleanup/cache.properties
deleted file mode 100644
index df9e847..0000000
--- a/common/.gradle/buildOutputCleanup/cache.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-#Thu Jul 30 09:16:47 BRT 2020
-gradle.version=5.5.1
diff --git a/common/.gradle/vcs-1/gc.properties b/common/.gradle/vcs-1/gc.properties
deleted file mode 100644
index e69de29..0000000
--- a/common/.gradle/vcs-1/gc.properties
+++ /dev/null
diff --git a/common/build.gradle b/common/build.gradle
index efc1fe0..9ceffc4 100644
--- a/common/build.gradle
+++ b/common/build.gradle
@@ -47,6 +47,7 @@ kotlin {
dependencies {
implementation kotlin('stdlib-common')
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serialization_version"
+ implementation "com.soywiz.korlibs.klock:klock:1.11.12"
}
}
commonTest {
diff --git a/common/src/commonMain/kotlin/net/taler/common/Amount.kt b/common/src/commonMain/kotlin/net/taler/lib/common/Amount.kt
index 84d10c5..213abb3 100644
--- a/common/src/commonMain/kotlin/net/taler/common/Amount.kt
+++ b/common/src/commonMain/kotlin/net/taler/lib/common/Amount.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.common
+package net.taler.lib.common
import kotlinx.serialization.Decoder
import kotlinx.serialization.Encoder
diff --git a/common/src/commonMain/kotlin/net/taler/common/TalerUri.kt b/common/src/commonMain/kotlin/net/taler/lib/common/TalerUri.kt
index 9f121d3..8255dc0 100644
--- a/common/src/commonMain/kotlin/net/taler/common/TalerUri.kt
+++ b/common/src/commonMain/kotlin/net/taler/lib/common/TalerUri.kt
@@ -14,9 +14,9 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.common
+package net.taler.lib.common
-internal object TalerUri {
+object TalerUri {
private const val SCHEME = "taler://"
private const val SCHEME_INSECURE = "taler+http://"
diff --git a/common/src/commonMain/kotlin/net/taler/common/Time.kt b/common/src/commonMain/kotlin/net/taler/lib/common/Time.kt
index 37b6606..0e5e07c 100644
--- a/common/src/commonMain/kotlin/net/taler/common/Time.kt
+++ b/common/src/commonMain/kotlin/net/taler/lib/common/Time.kt
@@ -14,8 +14,9 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.common
+package net.taler.lib.common
+import com.soywiz.klock.DateTime
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.builtins.serializer
@@ -24,11 +25,9 @@ import kotlinx.serialization.json.JsonPrimitive
import kotlinx.serialization.json.JsonTransformingSerializer
import kotlinx.serialization.json.contentOrNull
import kotlinx.serialization.json.longOrNull
-import net.taler.common.Duration.Companion.FOREVER
+import net.taler.lib.common.Duration.Companion.FOREVER
import kotlin.math.max
-expect fun nowMillis(): Long
-
@Serializable
data class Timestamp(
@SerialName("t_ms")
@@ -38,7 +37,7 @@ data class Timestamp(
companion object {
const val NEVER: Long = -1
- fun now(): Timestamp = Timestamp(nowMillis())
+ fun now(): Timestamp = Timestamp(DateTime.nowUnixLong())
}
/**
diff --git a/common/src/commonMain/kotlin/net/taler/common/Version.kt b/common/src/commonMain/kotlin/net/taler/lib/common/Version.kt
index 8774115..d3f0ad2 100644
--- a/common/src/commonMain/kotlin/net/taler/common/Version.kt
+++ b/common/src/commonMain/kotlin/net/taler/lib/common/Version.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.common
+package net.taler.lib.common
import kotlin.math.sign
diff --git a/common/src/commonTest/kotlin/net/taler/common/AmountTest.kt b/common/src/commonTest/kotlin/net/taler/lib/common/AmountTest.kt
index e184307..90b0569 100644
--- a/common/src/commonTest/kotlin/net/taler/common/AmountTest.kt
+++ b/common/src/commonTest/kotlin/net/taler/lib/common/AmountTest.kt
@@ -14,14 +14,13 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.common
+package net.taler.lib.common
import kotlin.random.Random
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertTrue
-import kotlin.test.fail
class AmountTest {
@@ -219,16 +218,4 @@ class AmountTest {
}
}
- private inline fun <reified T : Throwable> assertThrows(
- msg: String? = null,
- function: () -> Any
- ) {
- try {
- function.invoke()
- fail(msg)
- } catch (e: Exception) {
- assertTrue(e is T)
- }
- }
-
}
diff --git a/common/src/commonTest/kotlin/net/taler/common/TalerUriTest.kt b/common/src/commonTest/kotlin/net/taler/lib/common/TalerUriTest.kt
index f996fa9..ca3430d 100644
--- a/common/src/commonTest/kotlin/net/taler/common/TalerUriTest.kt
+++ b/common/src/commonTest/kotlin/net/taler/lib/common/TalerUriTest.kt
@@ -14,10 +14,10 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.common
+package net.taler.lib.common
-import net.taler.common.TalerUri.WithdrawUriResult
-import net.taler.common.TalerUri.parseWithdrawUri
+import net.taler.lib.common.TalerUri.WithdrawUriResult
+import net.taler.lib.common.TalerUri.parseWithdrawUri
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNull
diff --git a/common/src/commonTest/kotlin/net/taler/common/TestUtils.kt b/common/src/commonTest/kotlin/net/taler/lib/common/TestUtils.kt
index e3a6c17..837de27 100644
--- a/common/src/commonTest/kotlin/net/taler/common/TestUtils.kt
+++ b/common/src/commonTest/kotlin/net/taler/lib/common/TestUtils.kt
@@ -14,9 +14,11 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.common
+package net.taler.lib.common
import kotlin.random.Random
+import kotlin.test.assertTrue
+import kotlin.test.fail
private val charPool: List<Char> = ('a'..'z') + ('A'..'Z') + ('0'..'9')
fun getRandomString(minLength: Int = 1, maxLength: Int = Random.nextInt(0, 1337)) =
@@ -24,3 +26,15 @@ fun getRandomString(minLength: Int = 1, maxLength: Int = Random.nextInt(0, 1337)
.map { Random.nextInt(0, charPool.size) }
.map(charPool::get)
.joinToString("")
+
+inline fun <reified T : Throwable> assertThrows(
+ msg: String? = null,
+ function: () -> Any
+) {
+ try {
+ function.invoke()
+ fail(msg)
+ } catch (e: Exception) {
+ assertTrue(e is T)
+ }
+}
diff --git a/common/src/commonTest/kotlin/net/taler/common/TimeTest.kt b/common/src/commonTest/kotlin/net/taler/lib/common/TimeTest.kt
index 3ee0a99..647e439 100644
--- a/common/src/commonTest/kotlin/net/taler/common/TimeTest.kt
+++ b/common/src/commonTest/kotlin/net/taler/lib/common/TimeTest.kt
@@ -14,12 +14,12 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.common
+package net.taler.lib.common
import kotlinx.serialization.UnstableDefault
import kotlinx.serialization.json.Json.Default.parse
import kotlinx.serialization.json.Json.Default.stringify
-import net.taler.common.Timestamp.Companion.NEVER
+import net.taler.lib.common.Timestamp.Companion.NEVER
import kotlin.random.Random
import kotlin.test.Test
import kotlin.test.assertEquals
diff --git a/common/src/commonTest/kotlin/net/taler/common/VersionTest.kt b/common/src/commonTest/kotlin/net/taler/lib/common/VersionTest.kt
index f4f17ea..b10b4bf 100644
--- a/common/src/commonTest/kotlin/net/taler/common/VersionTest.kt
+++ b/common/src/commonTest/kotlin/net/taler/lib/common/VersionTest.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.common
+package net.taler.lib.common
import kotlin.test.Test
import kotlin.test.assertEquals
diff --git a/gradle.properties b/gradle.properties
index aaf152a..1b92c41 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,4 +1,9 @@
+org.gradle.caching=true
+
kotlin.code.style=official
# prevent parallel execution of several compiler instances
kotlin.native.disableCompilerDaemon=true
+
+kotlin.parallel.tasks.in.project=true
+kotlin.incremental.multiplatform=true
diff --git a/wallet/build.gradle b/wallet/build.gradle
index aacd0b3..2e58d15 100644
--- a/wallet/build.gradle
+++ b/wallet/build.gradle
@@ -68,21 +68,19 @@ kotlin {
def ktor_version = "1.3.2"
all {
languageSettings {
+ progressiveMode = true
useExperimentalAnnotation('kotlin.ExperimentalStdlibApi')
}
- dependencies {
- }
}
commonMain {
dependencies {
implementation kotlin('stdlib-common')
- implementation project(":common")
+ api project(path: ":common")
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutines_version"
implementation "io.ktor:ktor-client-core:$ktor_version"
implementation "io.ktor:ktor-client-logging:$ktor_version"
implementation "io.ktor:ktor-client-serialization:$ktor_version"
- implementation "com.soywiz.korlibs.klock:klock:1.11.12"
}
}
commonTest {
diff --git a/wallet/src/androidMain/AndroidManifest.xml b/wallet/src/androidMain/AndroidManifest.xml
index 77fbf4a..6873320 100644
--- a/wallet/src/androidMain/AndroidManifest.xml
+++ b/wallet/src/androidMain/AndroidManifest.xml
@@ -15,7 +15,7 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="net.taler.wallet.kotlin">
+ package="net.taler.lib.wallet">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
diff --git a/wallet/src/androidMain/kotlin/net/taler/wallet/kotlin/Db.kt b/wallet/src/androidMain/kotlin/net/taler/lib/wallet/Db.kt
index 45cbfc3..39394b8 100644
--- a/wallet/src/androidMain/kotlin/net/taler/wallet/kotlin/Db.kt
+++ b/wallet/src/androidMain/kotlin/net/taler/lib/wallet/Db.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin
+package net.taler.lib.wallet
internal actual class DbFactory {
actual fun openDb(): Db {
diff --git a/wallet/src/androidMain/kotlin/net/taler/wallet/kotlin/crypto/CryptoFactory.kt b/wallet/src/androidMain/kotlin/net/taler/lib/wallet/crypto/CryptoFactory.kt
index 502b8a0..1f6c7a8 100644
--- a/wallet/src/androidMain/kotlin/net/taler/wallet/kotlin/crypto/CryptoFactory.kt
+++ b/wallet/src/androidMain/kotlin/net/taler/lib/wallet/crypto/CryptoFactory.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.crypto
+package net.taler.lib.wallet.crypto
import com.goterl.lazycode.lazysodium.LazySodiumJava
import com.goterl.lazycode.lazysodium.SodiumJava
diff --git a/wallet/src/androidMain/kotlin/net/taler/wallet/kotlin/crypto/RsaBlinding.kt b/wallet/src/androidMain/kotlin/net/taler/lib/wallet/crypto/RsaBlinding.kt
index 458a089..70c7c78 100644
--- a/wallet/src/androidMain/kotlin/net/taler/wallet/kotlin/crypto/RsaBlinding.kt
+++ b/wallet/src/androidMain/kotlin/net/taler/lib/wallet/crypto/RsaBlinding.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.crypto
+package net.taler.lib.wallet.crypto
import java.math.BigInteger
import kotlin.math.abs
diff --git a/wallet/src/androidTest/kotlin/net/taler/wallet/kotlin/TestUtilsAndroid.kt b/wallet/src/androidTest/kotlin/net/taler/lib/wallet/TestUtilsAndroid.kt
index a362874..58e04ce 100644
--- a/wallet/src/androidTest/kotlin/net/taler/wallet/kotlin/TestUtilsAndroid.kt
+++ b/wallet/src/androidTest/kotlin/net/taler/lib/wallet/TestUtilsAndroid.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin
+package net.taler.lib.wallet
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.runBlocking
diff --git a/wallet/src/androidTest/kotlin/net/taler/wallet/kotlin/crypto/PlanchetTest.kt b/wallet/src/androidTest/kotlin/net/taler/lib/wallet/crypto/PlanchetTest.kt
index d7f1dae..c58d40d 100644
--- a/wallet/src/androidTest/kotlin/net/taler/wallet/kotlin/crypto/PlanchetTest.kt
+++ b/wallet/src/androidTest/kotlin/net/taler/lib/wallet/crypto/PlanchetTest.kt
@@ -14,12 +14,12 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.crypto
+package net.taler.lib.wallet.crypto
-import net.taler.wallet.kotlin.Amount
-import net.taler.wallet.kotlin.Base32Crockford
-import net.taler.wallet.kotlin.crypto.Planchet.CreationRequest
-import net.taler.wallet.kotlin.crypto.Planchet.CreationResult
+import net.taler.lib.common.Amount
+import net.taler.lib.wallet.Base32Crockford
+import net.taler.lib.wallet.crypto.Planchet.CreationRequest
+import net.taler.lib.wallet.crypto.Planchet.CreationResult
import kotlin.random.Random
import kotlin.test.Test
import kotlin.test.assertEquals
diff --git a/wallet/src/androidTest/kotlin/net/taler/wallet/kotlin/crypto/RefreshTest.kt b/wallet/src/androidTest/kotlin/net/taler/lib/wallet/crypto/RefreshTest.kt
index 6cdad75..981c978 100644
--- a/wallet/src/androidTest/kotlin/net/taler/wallet/kotlin/crypto/RefreshTest.kt
+++ b/wallet/src/androidTest/kotlin/net/taler/lib/wallet/crypto/RefreshTest.kt
@@ -14,20 +14,20 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.crypto
+package net.taler.lib.wallet.crypto
-import net.taler.wallet.kotlin.Amount
-import net.taler.wallet.kotlin.Base32Crockford
-import net.taler.wallet.kotlin.CoinRecord
-import net.taler.wallet.kotlin.CoinSourceType.WITHDRAW
-import net.taler.wallet.kotlin.CoinStatus.DORMANT
-import net.taler.wallet.kotlin.Timestamp
-import net.taler.wallet.kotlin.crypto.Refresh.RefreshPlanchetRecord
-import net.taler.wallet.kotlin.crypto.Refresh.RefreshSessionRecord
-import net.taler.wallet.kotlin.exchange.DenominationRecord
-import net.taler.wallet.kotlin.exchange.DenominationSelectionInfo
-import net.taler.wallet.kotlin.exchange.DenominationStatus.VerifiedGood
-import net.taler.wallet.kotlin.exchange.SelectedDenomination
+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.RefreshPlanchetRecord
+import net.taler.lib.wallet.crypto.Refresh.RefreshSessionRecord
+import net.taler.lib.wallet.exchange.DenominationRecord
+import net.taler.lib.wallet.exchange.DenominationSelectionInfo
+import net.taler.lib.wallet.exchange.DenominationStatus.VerifiedGood
+import net.taler.lib.wallet.exchange.SelectedDenomination
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
diff --git a/wallet/src/androidTest/kotlin/net/taler/wallet/kotlin/crypto/RsaBlindingTest.kt b/wallet/src/androidTest/kotlin/net/taler/lib/wallet/crypto/RsaBlindingTest.kt
index 0ced114..2ee5f1a 100644
--- a/wallet/src/androidTest/kotlin/net/taler/wallet/kotlin/crypto/RsaBlindingTest.kt
+++ b/wallet/src/androidTest/kotlin/net/taler/lib/wallet/crypto/RsaBlindingTest.kt
@@ -14,9 +14,9 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.crypto
+package net.taler.lib.wallet.crypto
-import net.taler.wallet.kotlin.Base32Crockford
+import net.taler.lib.wallet.Base32Crockford
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
diff --git a/common/src/jvmMain/kotlin/net/taler/common/Time.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Amount.kt
index 6cd9040..7273dba 100644
--- a/common/src/jvmMain/kotlin/net/taler/common/Time.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Amount.kt
@@ -14,8 +14,13 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.common
+package net.taler.lib.wallet
-actual fun nowMillis(): Long {
- return System.currentTimeMillis()
+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)
}
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Base32Crockford.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Base32Crockford.kt
index 9043731..2517e85 100644
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Base32Crockford.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Base32Crockford.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin
+package net.taler.lib.wallet
class EncodingException : Exception("Invalid encoding")
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Db.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Db.kt
index 3a5ecd6..df809c7 100644
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Db.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Db.kt
@@ -14,12 +14,12 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin
+package net.taler.lib.wallet
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
-import net.taler.wallet.kotlin.exchange.DenominationRecord
-import net.taler.wallet.kotlin.exchange.ExchangeRecord
+import net.taler.lib.wallet.exchange.DenominationRecord
+import net.taler.lib.wallet.exchange.ExchangeRecord
internal interface Db {
suspend fun put(exchange: ExchangeRecord)
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/PaytoUri.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/PaytoUri.kt
index f6b11d2..2ae9813 100644
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/PaytoUri.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/PaytoUri.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin
+package net.taler.lib.wallet
data class PaytoUri(
val targetType: String,
diff --git a/common/src/jsMain/kotlin/net/taler/common/Time.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Time.kt
index b114022..e67474b 100644
--- a/common/src/jsMain/kotlin/net/taler/common/Time.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Time.kt
@@ -14,10 +14,11 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.common
+package net.taler.lib.wallet
-import kotlin.js.Date
+import net.taler.lib.common.Timestamp
+import net.taler.lib.wallet.crypto.CryptoImpl.Companion.toByteArray
-actual fun nowMillis(): Long {
- return Date().getMilliseconds().toLong()
+fun Timestamp.roundedToByteArray(): ByteArray = ByteArray(8).apply {
+ (truncateSeconds().ms * 1000L).toByteArray().copyInto(this)
}
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Types.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Types.kt
index 04b17e7..b068bda 100644
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Types.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Types.kt
@@ -14,8 +14,9 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin
+package net.taler.lib.wallet
+import net.taler.lib.common.Amount
class CoinRecord(
/**
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Utils.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Utils.kt
index 2549195..498b8a8 100644
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Utils.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Utils.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin
+package net.taler.lib.wallet
import io.ktor.client.HttpClient
import io.ktor.client.features.json.JsonFeature
diff --git a/common/src/nativeMain/kotlin/net/taler/common/Time.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Version.kt
index 8a4091a..ba9be3c 100644
--- a/common/src/nativeMain/kotlin/net/taler/common/Time.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Version.kt
@@ -14,10 +14,13 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.common
+package net.taler.lib.wallet
-import kotlin.system.getTimeMillis
+import net.taler.lib.common.Version
-actual fun nowMillis(): Long {
- return getTimeMillis()
-}
+class SupportedVersions(
+ val walletVersion: Version,
+ val exchangeVersion: Version,
+ val bankVersion: Version,
+ val merchantVersion: Version
+)
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/WalletApi.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/WalletApi.kt
index 11fd181..bfe2825 100644
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/WalletApi.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/WalletApi.kt
@@ -14,18 +14,21 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin
+package net.taler.lib.wallet
import io.ktor.client.HttpClient
-import net.taler.wallet.kotlin.crypto.Crypto
-import net.taler.wallet.kotlin.crypto.CryptoFactory
-import net.taler.wallet.kotlin.crypto.Signature
-import net.taler.wallet.kotlin.exchange.Exchange
-import net.taler.wallet.kotlin.exchange.ExchangeListItem
-import net.taler.wallet.kotlin.exchange.GetExchangeTosResult
-import net.taler.wallet.kotlin.operations.Withdraw
-import net.taler.wallet.kotlin.operations.WithdrawalDetails
-import net.taler.wallet.kotlin.operations.WithdrawalDetailsForUri
+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.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.operations.Withdraw
+import net.taler.lib.wallet.operations.WithdrawalDetails
+import net.taler.lib.wallet.operations.WithdrawalDetailsForUri
public class WalletApi {
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/Crypto.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Crypto.kt
index 226aa64..cbb486a 100644
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/Crypto.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Crypto.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.crypto
+package net.taler.lib.wallet.crypto
internal interface Crypto {
fun sha256(input: ByteArray): ByteArray
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/CryptoImpl.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/CryptoImpl.kt
index 0780e45..6b7cb8e 100644
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/CryptoImpl.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/CryptoImpl.kt
@@ -14,9 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.crypto
-
-import net.taler.wallet.kotlin.crypto.CryptoImpl.Companion.toByteArray
+package net.taler.lib.wallet.crypto
abstract class CryptoImpl : Crypto {
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/Deposit.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Deposit.kt
index 3156d3f..66255d8 100644
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/Deposit.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Deposit.kt
@@ -14,12 +14,14 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.crypto
+package net.taler.lib.wallet.crypto
-import net.taler.wallet.kotlin.Amount
-import net.taler.wallet.kotlin.Base32Crockford
-import net.taler.wallet.kotlin.Timestamp
-import net.taler.wallet.kotlin.crypto.Signature.Companion.WALLET_COIN_DEPOSIT
+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.Companion.WALLET_COIN_DEPOSIT
+import net.taler.lib.wallet.roundedToByteArray
+import net.taler.lib.wallet.toByteArray
/**
* Deposit operations are requested by a merchant during a transaction.
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/Kdf.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Kdf.kt
index 44f55cc..2d714f8 100644
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/Kdf.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Kdf.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.crypto
+package net.taler.lib.wallet.crypto
import kotlin.experimental.xor
import kotlin.math.ceil
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/Planchet.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Planchet.kt
index b29007e..22aa786 100644
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/Planchet.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Planchet.kt
@@ -14,10 +14,11 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.crypto
+package net.taler.lib.wallet.crypto
-import net.taler.wallet.kotlin.Amount
-import net.taler.wallet.kotlin.Base32Crockford
+import net.taler.lib.common.Amount
+import net.taler.lib.wallet.Base32Crockford
+import net.taler.lib.wallet.toByteArray
internal class Planchet(private val crypto: Crypto) {
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/Recoup.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Recoup.kt
index 0f2b6df..c7678e4 100644
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/Recoup.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Recoup.kt
@@ -14,12 +14,12 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.crypto
+package net.taler.lib.wallet.crypto
-import net.taler.wallet.kotlin.Base32Crockford
-import net.taler.wallet.kotlin.CoinRecord
-import net.taler.wallet.kotlin.CoinSourceType.REFRESH
-import net.taler.wallet.kotlin.crypto.Signature.Companion.WALLET_COIN_RECOUP
+import net.taler.lib.wallet.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
internal class Recoup(private val crypto: Crypto) {
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/Refresh.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Refresh.kt
index cd24b07..90478ef 100644
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/Refresh.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Refresh.kt
@@ -14,17 +14,18 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.crypto
-
-import net.taler.wallet.kotlin.Amount
-import net.taler.wallet.kotlin.Base32Crockford
-import net.taler.wallet.kotlin.CoinRecord
-import net.taler.wallet.kotlin.Timestamp
-import net.taler.wallet.kotlin.crypto.Signature.Companion.WALLET_COIN_LINK
-import net.taler.wallet.kotlin.crypto.Signature.Companion.WALLET_COIN_MELT
-import net.taler.wallet.kotlin.crypto.Signature.PurposeBuilder
-import net.taler.wallet.kotlin.exchange.DenominationSelectionInfo
-import net.taler.wallet.kotlin.exchange.SelectedDenomination
+package net.taler.lib.wallet.crypto
+
+import net.taler.lib.common.Amount
+import net.taler.lib.wallet.Base32Crockford
+import net.taler.lib.wallet.CoinRecord
+import net.taler.lib.common.Timestamp
+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
+import net.taler.lib.wallet.exchange.DenominationSelectionInfo
+import net.taler.lib.wallet.exchange.SelectedDenomination
+import net.taler.lib.wallet.toByteArray
internal class Refresh(private val crypto: Crypto) {
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/Signature.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Signature.kt
index 9b06756..006c004 100644
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/crypto/Signature.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Signature.kt
@@ -14,12 +14,14 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.crypto
+package net.taler.lib.wallet.crypto
-import net.taler.wallet.kotlin.Base32Crockford
-import net.taler.wallet.kotlin.crypto.CryptoImpl.Companion.toByteArray
-import net.taler.wallet.kotlin.exchange.DenominationRecord
-import net.taler.wallet.kotlin.exchange.WireFee
+import net.taler.lib.wallet.Base32Crockford
+import net.taler.lib.wallet.crypto.CryptoImpl.Companion.toByteArray
+import net.taler.lib.wallet.exchange.DenominationRecord
+import net.taler.lib.wallet.exchange.WireFee
+import net.taler.lib.wallet.roundedToByteArray
+import net.taler.lib.wallet.toByteArray
internal class Signature(private val crypto: Crypto) {
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/exchange/Auditor.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Auditor.kt
index 4df0bdf..248da8d 100644
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/exchange/Auditor.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Auditor.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.exchange
+package net.taler.lib.wallet.exchange
import kotlinx.serialization.Serializable
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/exchange/Denomination.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Denomination.kt
index 88a81fd..fca9e3f 100644
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/exchange/Denomination.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Denomination.kt
@@ -14,15 +14,15 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.exchange
+package net.taler.lib.wallet.exchange
import kotlinx.serialization.Serializable
-import net.taler.wallet.kotlin.Amount
-import net.taler.wallet.kotlin.Base32Crockford
-import net.taler.wallet.kotlin.Duration
-import net.taler.wallet.kotlin.Timestamp
-import net.taler.wallet.kotlin.exchange.DenominationStatus.Unverified
-import net.taler.wallet.kotlin.exchange.DenominationStatus.VerifiedGood
+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.wallet.exchange.DenominationStatus.Unverified
+import net.taler.lib.wallet.exchange.DenominationStatus.VerifiedGood
/**
* Denomination as found in the /keys response from the exchange.
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/exchange/Exchange.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Exchange.kt
index 7a6ac7f..4d89cd6 100644
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/exchange/Exchange.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Exchange.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.exchange
+package net.taler.lib.wallet.exchange
import io.ktor.client.HttpClient
import io.ktor.client.request.accept
@@ -24,23 +24,23 @@ import io.ktor.client.statement.readText
import io.ktor.http.ContentType
import io.ktor.http.HttpHeaders
import io.ktor.http.HttpStatusCode
-import net.taler.wallet.kotlin.Amount
-import net.taler.wallet.kotlin.Base32Crockford
-import net.taler.wallet.kotlin.Db
-import net.taler.wallet.kotlin.DbFactory
-import net.taler.wallet.kotlin.Timestamp
-import net.taler.wallet.kotlin.compareVersions
-import net.taler.wallet.kotlin.crypto.Crypto
-import net.taler.wallet.kotlin.crypto.CryptoFactory
-import net.taler.wallet.kotlin.crypto.Signature
-import net.taler.wallet.kotlin.exchange.DenominationStatus.Unverified
-import net.taler.wallet.kotlin.exchange.ExchangeUpdateReason.Initial
-import net.taler.wallet.kotlin.exchange.ExchangeUpdateStatus.FetchKeys
-import net.taler.wallet.kotlin.exchange.ExchangeUpdateStatus.FetchTerms
-import net.taler.wallet.kotlin.exchange.ExchangeUpdateStatus.FetchWire
-import net.taler.wallet.kotlin.exchange.ExchangeUpdateStatus.FinalizeUpdate
-import net.taler.wallet.kotlin.exchange.ExchangeUpdateStatus.Finished
-import net.taler.wallet.kotlin.getDefaultHttpClient
+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.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.DenominationStatus.Unverified
+import net.taler.lib.wallet.exchange.ExchangeUpdateReason.Initial
+import net.taler.lib.wallet.exchange.ExchangeUpdateStatus.FetchKeys
+import net.taler.lib.wallet.exchange.ExchangeUpdateStatus.FetchTerms
+import net.taler.lib.wallet.exchange.ExchangeUpdateStatus.FetchWire
+import net.taler.lib.wallet.exchange.ExchangeUpdateStatus.FinalizeUpdate
+import net.taler.lib.wallet.exchange.ExchangeUpdateStatus.Finished
+import net.taler.lib.wallet.getDefaultHttpClient
internal class Exchange(
private val crypto: Crypto = CryptoFactory.getCrypto(),
@@ -53,8 +53,8 @@ internal class Exchange(
) {
companion object {
- private const val PROTOCOL_VERSION = "8:0:0"
- fun getVersionMatch(version: String) = compareVersions(PROTOCOL_VERSION, version)
+ private val PROTOCOL_VERSION = Version(8, 0, 0)
+ fun getVersionMatch(version: String) = PROTOCOL_VERSION.compare(Version.parse(version))
fun normalizeUrl(exchangeBaseUrl: String): String {
var url = exchangeBaseUrl
if (!url.startsWith("http")) url = "http://$url"
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/exchange/ExchangeRecord.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/ExchangeRecord.kt
index 9bfd649..bb8bbd1 100644
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/exchange/ExchangeRecord.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/ExchangeRecord.kt
@@ -14,9 +14,9 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.exchange
+package net.taler.lib.wallet.exchange
-import net.taler.wallet.kotlin.Timestamp
+import net.taler.lib.common.Timestamp
/**
* Exchange record as stored in the wallet's database.
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/exchange/Keys.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Keys.kt
index 54806f9..12b29db 100644
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/exchange/Keys.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Keys.kt
@@ -14,12 +14,12 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.exchange
+package net.taler.lib.wallet.exchange
import io.ktor.client.HttpClient
import io.ktor.client.request.get
import kotlinx.serialization.Serializable
-import net.taler.wallet.kotlin.Timestamp
+import net.taler.lib.common.Timestamp
/**
* Structure that the exchange gives us in /keys.
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/exchange/Wire.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Wire.kt
index c8fae88..0dca4dd 100644
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/exchange/Wire.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Wire.kt
@@ -14,14 +14,14 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.exchange
+package net.taler.lib.wallet.exchange
import io.ktor.client.HttpClient
import io.ktor.client.request.get
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
-import net.taler.wallet.kotlin.Amount
-import net.taler.wallet.kotlin.Timestamp
+import net.taler.lib.common.Amount
+import net.taler.lib.common.Timestamp
@Serializable
internal data class Wire(
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/operations/Withdraw.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/operations/Withdraw.kt
index e51e9ec..69c68d1 100644
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/operations/Withdraw.kt
+++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/operations/Withdraw.kt
@@ -14,32 +14,33 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.operations
+package net.taler.lib.wallet.operations
import io.ktor.client.HttpClient
import io.ktor.client.request.get
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
-import net.taler.wallet.kotlin.Amount
-import net.taler.wallet.kotlin.Db
-import net.taler.wallet.kotlin.DbFactory
-import net.taler.wallet.kotlin.TalerUri.parseWithdrawUri
-import net.taler.wallet.kotlin.Timestamp
-import net.taler.wallet.kotlin.VersionMatchResult
-import net.taler.wallet.kotlin.crypto.Crypto
-import net.taler.wallet.kotlin.crypto.CryptoFactory
-import net.taler.wallet.kotlin.crypto.Signature
-import net.taler.wallet.kotlin.exchange.DenominationRecord
-import net.taler.wallet.kotlin.exchange.DenominationSelectionInfo
-import net.taler.wallet.kotlin.exchange.DenominationStatus.Unverified
-import net.taler.wallet.kotlin.exchange.DenominationStatus.VerifiedBad
-import net.taler.wallet.kotlin.exchange.DenominationStatus.VerifiedGood
-import net.taler.wallet.kotlin.exchange.Exchange
-import net.taler.wallet.kotlin.exchange.ExchangeListItem
-import net.taler.wallet.kotlin.exchange.ExchangeRecord
-import net.taler.wallet.kotlin.exchange.ExchangeWireInfo
-import net.taler.wallet.kotlin.exchange.SelectedDenomination
-import net.taler.wallet.kotlin.getDefaultHttpClient
+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.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
+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
+import net.taler.lib.wallet.getDefaultHttpClient
internal class Withdraw(
private val httpClient: HttpClient = getDefaultHttpClient(),
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Amount.kt b/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Amount.kt
deleted file mode 100644
index 2d39bb3..0000000
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Amount.kt
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * 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.wallet.kotlin
-
-import kotlinx.serialization.Decoder
-import kotlinx.serialization.Encoder
-import kotlinx.serialization.KSerializer
-import kotlinx.serialization.Serializable
-import kotlinx.serialization.Serializer
-import net.taler.wallet.kotlin.crypto.CryptoImpl.Companion.toByteArray
-import kotlin.math.floor
-import kotlin.math.pow
-import kotlin.math.roundToInt
-
-class AmountParserException(msg: String? = null, cause: Throwable? = null) : Exception(msg, cause)
-class AmountOverflowException(msg: String? = null, cause: Throwable? = null) : Exception(msg, cause)
-
-@Serializable
-data class Amount(
- /**
- * name of the currency using either a three-character ISO 4217 currency code,
- * or a regional currency identifier starting with a "*" followed by at most 10 characters.
- * ISO 4217 exponents in the name are not supported,
- * although the "fraction" is corresponds to an ISO 4217 exponent of 6.
- */
- val currency: String,
-
- /**
- * The integer part may be at most 2^52.
- * Note that "1" here would correspond to 1 EUR or 1 USD, depending on currency, not 1 cent.
- */
- val value: Long,
-
- /**
- * Unsigned 32 bit fractional value to be added to value representing
- * an additional currency fraction, in units of one hundred millionth (1e-8)
- * of the base currency value. For example, a fraction
- * of 50_000_000 would correspond to 50 cents.
- */
- val fraction: Int
-) : Comparable<Amount> {
-
- @Serializer(forClass = Amount::class)
- companion object : KSerializer<Amount> {
-
- private const val FRACTIONAL_BASE: Int = 100000000 // 1e8
-
- @Suppress("unused")
- private val REGEX = Regex("""^[-_*A-Za-z0-9]{1,12}:([0-9]+)\.?([0-9]+)?$""")
- private val REGEX_CURRENCY = Regex("""^[-_*A-Za-z0-9]{1,12}$""")
- internal val MAX_VALUE = 2.0.pow(52).toLong()
- private const val MAX_FRACTION_LENGTH = 8
- internal const val MAX_FRACTION = 99_999_999
-
- fun zero(currency: String): Amount {
- return Amount(checkCurrency(currency), 0, 0)
- }
-
- fun fromJSONString(str: String): Amount {
- val split = str.split(":")
- if (split.size != 2) throw AmountParserException("Invalid Amount Format")
- return fromString(split[0], split[1])
- }
-
- fun fromString(currency: String, str: String): Amount {
- // value
- val valueSplit = str.split(".")
- val value = checkValue(valueSplit[0].toLongOrNull())
- // fraction
- val fraction: Int = if (valueSplit.size > 1) {
- val fractionStr = valueSplit[1]
- if (fractionStr.length > MAX_FRACTION_LENGTH)
- throw AmountParserException("Fraction $fractionStr too long")
- val fraction = "0.$fractionStr".toDoubleOrNull()
- ?.times(FRACTIONAL_BASE)
- ?.roundToInt()
- checkFraction(fraction)
- } else 0
- return Amount(checkCurrency(currency), value, fraction)
- }
-
- fun min(currency: String): Amount = Amount(currency, 0, 1)
- fun max(currency: String): Amount = Amount(currency, MAX_VALUE, MAX_FRACTION)
-
-// fun fromJsonObject(json: JSONObject): Amount {
-// val currency = checkCurrency(json.optString("currency"))
-// val value = checkValue(json.optString("value").toLongOrNull())
-// val fraction = checkFraction(json.optString("fraction").toIntOrNull())
-// return Amount(currency, value, fraction)
-// }
-
- private fun checkCurrency(currency: String): String {
- if (!REGEX_CURRENCY.matches(currency))
- throw AmountParserException("Invalid currency: $currency")
- return currency
- }
-
- private fun checkValue(value: Long?): Long {
- if (value == null || value > MAX_VALUE)
- throw AmountParserException("Value $value greater than $MAX_VALUE")
- return value
- }
-
- private fun checkFraction(fraction: Int?): Int {
- if (fraction == null || fraction > MAX_FRACTION)
- throw AmountParserException("Fraction $fraction greater than $MAX_FRACTION")
- return fraction
- }
-
- override fun serialize(encoder: Encoder, value: Amount) {
- encoder.encodeString(value.toJSONString())
- }
-
- override fun deserialize(decoder: Decoder): Amount {
- return fromJSONString(decoder.decodeString())
- }
- }
-
- val amountStr: String
- get() = if (fraction == 0) "$value" else {
- var f = fraction
- var fractionStr = ""
- while (f > 0) {
- fractionStr += f / (FRACTIONAL_BASE / 10)
- f = (f * 10) % FRACTIONAL_BASE
- }
- "$value.$fractionStr"
- }
-
- operator fun plus(other: Amount): Amount {
- check(currency == other.currency) { "Can only subtract from same currency" }
- val resultValue = value + other.value + floor((fraction + other.fraction).toDouble() / FRACTIONAL_BASE).toLong()
- if (resultValue > MAX_VALUE)
- throw AmountOverflowException()
- val resultFraction = (fraction + other.fraction) % FRACTIONAL_BASE
- return Amount(currency, resultValue, resultFraction)
- }
-
- operator fun times(factor: Int): Amount {
- // TODO consider replacing with a faster implementation
- if (factor == 0) return zero(currency)
- var result = this
- for (i in 1 until factor) result += this
- return result
- }
-
- operator fun minus(other: Amount): Amount {
- check(currency == other.currency) { "Can only subtract from same currency" }
- var resultValue = value
- var resultFraction = fraction
- if (resultFraction < other.fraction) {
- if (resultValue < 1L)
- throw AmountOverflowException()
- resultValue--
- resultFraction += FRACTIONAL_BASE
- }
- check(resultFraction >= other.fraction)
- resultFraction -= other.fraction
- if (resultValue < other.value)
- throw AmountOverflowException()
- resultValue -= other.value
- return Amount(currency, resultValue, resultFraction)
- }
-
- fun isZero(): Boolean {
- return value == 0L && fraction == 0
- }
-
- fun toJSONString(): String {
- return "$currency:$amountStr"
- }
-
- fun 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)
- }
-
- override fun toString(): String {
- return "$amountStr $currency"
- }
-
- override fun compareTo(other: Amount): Int {
- check(currency == other.currency) { "Can only compare amounts with the same currency" }
- when {
- value == other.value -> {
- if (fraction < other.fraction) return -1
- if (fraction > other.fraction) return 1
- return 0
- }
- value < other.value -> return -1
- else -> return 1
- }
- }
-
-}
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/TalerUri.kt b/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/TalerUri.kt
deleted file mode 100644
index c489d71..0000000
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/TalerUri.kt
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.wallet.kotlin
-
-internal object TalerUri {
-
- private const val SCHEME = "taler://"
- private const val SCHEME_INSECURE = "taler+http://"
- private const val AUTHORITY_PAY = "pay"
- private const val AUTHORITY_WITHDRAW = "withdraw"
- private const val AUTHORITY_REFUND = "refund"
- private const val AUTHORITY_TIP = "tip"
-
- data class WithdrawUriResult(
- val bankIntegrationApiBaseUrl: String,
- val withdrawalOperationId: String
- )
-
- /**
- * Parses a withdraw URI and returns a bank status URL or null if the URI was invalid.
- */
- fun parseWithdrawUri(uri: String): WithdrawUriResult? {
- val (resultScheme, prefix) = when {
- uri.startsWith(SCHEME, ignoreCase = true) -> {
- Pair("https://", "${SCHEME}${AUTHORITY_WITHDRAW}/")
- }
- uri.startsWith(SCHEME_INSECURE, ignoreCase = true) -> {
- Pair("http://", "${SCHEME_INSECURE}${AUTHORITY_WITHDRAW}/")
- }
- else -> return null
- }
- if (!uri.startsWith(prefix)) return null
- val parts = uri.let {
- (if (it.endsWith("/")) it.dropLast(1) else it).substring(prefix.length).split('/')
- }
- if (parts.size < 2) return null
- val host = parts[0].toLowerCase()
- val pathSegments = parts.slice(1 until parts.size - 1).joinToString("/")
- val withdrawId = parts.last()
- if (withdrawId.isBlank()) return null
- val url = "${resultScheme}${host}/${pathSegments}"
-
- return WithdrawUriResult(url, withdrawId)
- }
-
-}
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Time.kt b/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Time.kt
deleted file mode 100644
index 4143389..0000000
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Time.kt
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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.wallet.kotlin
-
-import com.soywiz.klock.DateTime
-import kotlinx.serialization.SerialName
-import kotlinx.serialization.Serializable
-import net.taler.wallet.kotlin.Duration.Companion.FOREVER
-import net.taler.wallet.kotlin.crypto.CryptoImpl.Companion.toByteArray
-import kotlin.math.max
-
-@Serializable
-data class Timestamp(
- @SerialName("t_ms")
- val ms: Long
-) : Comparable<Timestamp> {
-
- companion object {
- const val NEVER: Long = -1 // TODO or UINT64_MAX?
- fun now(): Timestamp = Timestamp(DateTime.now().unixMillisLong)
- }
-
- /**
- * Returns a copy of this [Timestamp] rounded to seconds.
- */
- fun truncateSeconds(): Timestamp {
- if (ms == NEVER) return Timestamp(ms)
- return Timestamp((ms / 1000L) * 1000L)
- }
-
- fun roundedToByteArray(): ByteArray = ByteArray(8).apply {
- (truncateSeconds().ms * 1000L).toByteArray().copyInto(this)
- }
-
- operator fun minus(other: Timestamp): Duration = when {
- ms == NEVER -> Duration(FOREVER)
- other.ms == NEVER -> throw Error("Invalid argument for timestamp comparision")
- ms < other.ms -> Duration(0)
- else -> Duration(ms - other.ms)
- }
-
- operator fun minus(other: Duration): Timestamp = when {
- ms == NEVER -> this
- other.ms == FOREVER -> Timestamp(0)
- else -> Timestamp(max(0, ms - other.ms))
- }
-
- override fun compareTo(other: Timestamp): Int {
- return if (ms == NEVER) {
- if (other.ms == NEVER) 0
- else 1
- } else {
- if (other.ms == NEVER) -1
- else ms.compareTo(other.ms)
- }
- }
-
-}
-
-@Serializable
-data class Duration(
- /**
- * Duration in milliseconds.
- */
- @SerialName("d_ms")
- val ms: Long
-) {
- companion object {
- const val FOREVER: Long = -1 // TODO or UINT64_MAX?
- }
-}
diff --git a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Version.kt b/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Version.kt
deleted file mode 100644
index 45e7840..0000000
--- a/wallet/src/commonMain/kotlin/net/taler/wallet/kotlin/Version.kt
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.wallet.kotlin
-
-import kotlin.math.sign
-
-/**
- * Semantic versioning, but libtool-style.
- * See https://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html
- */
-
-/**
- * Result of comparing two libtool versions.
- */
-data class VersionMatchResult(
- /**
- * Is the first version compatible with the second?
- */
- val compatible: Boolean,
- /**
- * Is the first version older (-1), newer (+1) or identical (0)?
- */
- val currentCmp: Int
-)
-
-data class Version(
- val current: Int,
- val revision: Int,
- val age: Int
-)
-
-/**
- * Compare two libtool-style version strings.
- */
-fun compareVersions(me: String,other: String): VersionMatchResult? {
- val meVer = parseVersion (me)
- val otherVer = parseVersion (other)
- if (meVer == null || otherVer == null) return null
-
- val compatible = meVer.current - meVer.age <= otherVer.current &&
- meVer.current >= otherVer.current - otherVer.age
-
- val currentCmp = sign((meVer.current - otherVer.current).toDouble()).toInt()
-
- return VersionMatchResult(compatible, currentCmp)
-}
-
-fun parseVersion(v: String): Version? {
- val elements = v.split(":")
- if (elements.size != 3) return null
- val (currentStr, revisionStr, ageStr) = elements
- val current = currentStr.toIntOrNull()
- val revision = revisionStr.toIntOrNull()
- val age = ageStr.toIntOrNull()
- if (current == null || revision == null || age == null) return null
- return Version(current, revision, age)
-}
-
-class SupportedVersions(
- val walletVersion: Version,
- val exchangeVersion: Version,
- val bankVersion: Version,
- val merchantVersion: Version
-)
diff --git a/wallet/src/commonTest/kotlin/net/taler/lib/wallet/AmountTest.kt b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/AmountTest.kt
new file mode 100644
index 0000000..ccee992
--- /dev/null
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/AmountTest.kt
@@ -0,0 +1,64 @@
+/*
+ * 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
+
+import net.taler.lib.common.Amount
+import kotlin.test.Test
+import kotlin.test.assertEquals
+
+class AmountTest {
+
+ @Test
+ fun testToByteArray() {
+ val vectors = listOf(
+ Pair("ceicWVf9GhJ:3902026702525079.40496378", "006XSQV3G899E0K9XKX66SB9CDBNCSHS8XM4M00"),
+ Pair("asYDLuK2A:3800267550024600.02072907", "006R0MNXBVHSG00ZM55P2WTS8H67AJSJ8400000"),
+ Pair("pV1m:1347558259914570.09786232", "002CK66VCNVMM04NADW70NHHDM0000000000000"),
+ Pair("geO82l:553744321840253.41004983", "000ZF855K627T0KHNYVPESAF70S6R0000000000"),
+ Pair("B9bWK7WPEO:3663912678613976.12122563", "006G8KS5P9HXG05RZ71M4EB2AX5KENTG8N7G000"),
+ Pair("X:1537372109907438.77850768", "002QCETPFYJYW153X285G000000000000000000"),
+ Pair("5:4271492725553118.39728399", "007JSSK6J4VXW0JY6M7KA000000000000000000"),
+ Pair("OSdV:801656289790342.08256189", "001DJ6H6CA4RC03XZAYMYMV4AR0000000000000"),
+ Pair("Y6:2908617536334646.94126271", "0055AQTB19NKC1CW82ZNJDG0000000000000000"),
+ Pair("kSHoOZj:2610656582865206.00292046", "004MCR6T828KC004EK76PMT8DX7NMTG00000000"),
+ Pair("GkhLXrlGES:4246330707533398.83874252", "007HC0Z9DFF5C17ZT764ETV89HC74V278N9G000"),
+ Pair("CNS09:738124490298524.71259462", "0019YMG01DA9R11ZAN346KJK60WG00000000000"),
+ Pair("sw0b1tKXZym:2132978464977419.28199478", "003S7VNZPZS0P0DE98V76XSGC8RQ8JTRB9WPT00"),
+ Pair("fC:1275322307696988.17178522", "0028FSGX3ZCNR0863YD6CGR0000000000000000"),
+ Pair("cRai6j:166032749022734.69444771", "0009E0C30V70W113MJHP6MK1D4V6M0000000000"),
+ Pair("KOADwTb3:3932974019564218.48282023", "006ZJ16ZB39BM0Q0Q6KMPKT18HVN8RHK0000000"),
+ Pair("9Fi9wcLgDe:1268366772151214.97268853", "002834N6WRHTW1EC6HTKJHK975VP6K378HJG000"),
+ Pair("SDN:3370670470236379.88943272", "005ZK6V0124DP1AD5AM56H2E000000000000000"),
+ Pair("zGCP5V:4010014441349620.76121145", "0073Y5HYA8GZ8149GGWQMHT3A0TNC0000000000"),
+ Pair("VsW1JjBLn:2037070181191907.99717275", "003KSD2WH18E61FHJ2DNCWTQ6556MGJCDR00000"),
+ Pair("A:1806895799429502.00887758", "0036PQ5P8NMQW00DHF742000000000000000000"),
+ Pair("njA8:4015261148004966.43708687", "00747PYPD116C0MTY47PWTJ1700000000000000"),
+ Pair("Bwq:3562876074139250.28829179", "006AGTNTRWF740DQWQXM4XVH000000000000000"),
+ Pair("8e75v8:3716241006992995.95213823", "006K7SP93WF661DCV3ZKGS9Q6NV3G0000000000"),
+ Pair("XrnbQTTn:3887603772953949.94721267", "006WZGA9X8ANT1D5AKSNGWKEC98N8N3E0000000"),
+ Pair("MIN:0.00000001", "0000000000000000000MTJAE000000000000000"),
+ Pair("MAX:4503599627370496.99999999", "00800000000001FNW3ZMTGAR000000000000000")
+ )
+ for (v in vectors) {
+ val amount = Amount.fromJSONString(v.first)
+ val encodedBytes =
+ Base32Crockford.encode(amount.toByteArray())
+ assertEquals(v.second, encodedBytes)
+ }
+ }
+
+}
diff --git a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/Base32CrockfordTest.kt b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/Base32CrockfordTest.kt
index 565a395..0f16971 100644
--- a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/Base32CrockfordTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/Base32CrockfordTest.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin
+package net.taler.lib.wallet
import kotlin.test.Ignore
import kotlin.test.Test
diff --git a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/DbTest.kt b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/DbTest.kt
index ab4770d..cdd0484 100644
--- a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/DbTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/DbTest.kt
@@ -14,15 +14,16 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin
+package net.taler.lib.wallet
-import net.taler.wallet.kotlin.exchange.Denominations.denomination10
-import net.taler.wallet.kotlin.exchange.Denominations.denomination5
-import net.taler.wallet.kotlin.exchange.DenominationStatus.Unverified
-import net.taler.wallet.kotlin.exchange.DenominationStatus.VerifiedGood
-import net.taler.wallet.kotlin.exchange.ExchangeRecord
-import net.taler.wallet.kotlin.exchange.ExchangeUpdateReason.Initial
-import net.taler.wallet.kotlin.exchange.ExchangeUpdateStatus.FetchKeys
+import net.taler.lib.common.Timestamp
+import net.taler.lib.wallet.exchange.DenominationStatus.Unverified
+import net.taler.lib.wallet.exchange.DenominationStatus.VerifiedGood
+import net.taler.lib.wallet.exchange.Denominations.denomination10
+import net.taler.lib.wallet.exchange.Denominations.denomination5
+import net.taler.lib.wallet.exchange.ExchangeRecord
+import net.taler.lib.wallet.exchange.ExchangeUpdateReason.Initial
+import net.taler.lib.wallet.exchange.ExchangeUpdateStatus.FetchKeys
import kotlin.test.Test
import kotlin.test.assertEquals
diff --git a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/PaytoUriTest.kt b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/PaytoUriTest.kt
index 4f080e3..cf3780a 100644
--- a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/PaytoUriTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/PaytoUriTest.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin
+package net.taler.lib.wallet
import kotlin.test.Test
import kotlin.test.assertEquals
diff --git a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/TestUtils.kt b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/TestUtils.kt
index 0ece68e..14c3076 100644
--- a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/TestUtils.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/TestUtils.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin
+package net.taler.lib.wallet
import io.ktor.client.HttpClient
import io.ktor.client.engine.mock.MockEngine
diff --git a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/TimestampTest.kt b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/TimestampTest.kt
index 1a12549..b0f3b32 100644
--- a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/TimestampTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/TimestampTest.kt
@@ -14,8 +14,9 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin
+package net.taler.lib.wallet
+import net.taler.lib.common.Timestamp
import kotlin.random.Random
import kotlin.test.Test
import kotlin.test.assertEquals
diff --git a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/WalletApiTest.kt b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/WalletApiTest.kt
index 7971be5..511eb79 100644
--- a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/WalletApiTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/WalletApiTest.kt
@@ -14,8 +14,9 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin
+package net.taler.lib.wallet
+import net.taler.lib.common.Amount
import kotlin.test.Ignore
import kotlin.test.Test
import kotlin.test.assertEquals
diff --git a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/crypto/DepositTest.kt b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/DepositTest.kt
index 399b754..e3017a3 100644
--- a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/crypto/DepositTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/DepositTest.kt
@@ -14,12 +14,12 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.crypto
+package net.taler.lib.wallet.crypto
-import net.taler.wallet.kotlin.Amount
-import net.taler.wallet.kotlin.Timestamp
-import net.taler.wallet.kotlin.crypto.Deposit.CoinDepositPermission
-import net.taler.wallet.kotlin.crypto.Deposit.DepositInfo
+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 kotlin.test.Test
import kotlin.test.assertEquals
diff --git a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/crypto/EllipticCurveTest.kt b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/EllipticCurveTest.kt
index 4e83b47..10fbcc1 100644
--- a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/crypto/EllipticCurveTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/EllipticCurveTest.kt
@@ -14,9 +14,9 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.crypto
+package net.taler.lib.wallet.crypto
-import net.taler.wallet.kotlin.Base32Crockford
+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/wallet/kotlin/crypto/KdfTest.kt b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/KdfTest.kt
index 974f9aa..291930d 100644
--- a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/crypto/KdfTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/KdfTest.kt
@@ -14,11 +14,11 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.crypto
+package net.taler.lib.wallet.crypto
-import net.taler.wallet.kotlin.Base32Crockford
-import net.taler.wallet.kotlin.crypto.Kdf.HMAC_SHA256_BLOCK_SIZE
-import net.taler.wallet.kotlin.crypto.Kdf.HMAC_SHA512_BLOCK_SIZE
+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 kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
diff --git a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/crypto/RecoupTest.kt b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/RecoupTest.kt
index ea74e3c..035b7d7 100644
--- a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/crypto/RecoupTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/RecoupTest.kt
@@ -14,14 +14,14 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.crypto
+package net.taler.lib.wallet.crypto
-import net.taler.wallet.kotlin.Amount
-import net.taler.wallet.kotlin.CoinRecord
-import net.taler.wallet.kotlin.CoinSourceType.REFRESH
-import net.taler.wallet.kotlin.CoinSourceType.WITHDRAW
-import net.taler.wallet.kotlin.CoinStatus.FRESH
-import net.taler.wallet.kotlin.crypto.Recoup.Request
+import net.taler.lib.common.Amount
+import net.taler.lib.wallet.CoinRecord
+import net.taler.lib.wallet.CoinSourceType.REFRESH
+import net.taler.lib.wallet.CoinSourceType.WITHDRAW
+import net.taler.lib.wallet.CoinStatus.FRESH
+import net.taler.lib.wallet.crypto.Recoup.Request
import kotlin.test.Test
import kotlin.test.assertEquals
diff --git a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/crypto/RefreshPlanchetTest.kt b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/RefreshPlanchetTest.kt
index 51eb5c6..a56d191 100644
--- a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/crypto/RefreshPlanchetTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/RefreshPlanchetTest.kt
@@ -14,9 +14,9 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.crypto
+package net.taler.lib.wallet.crypto
-import net.taler.wallet.kotlin.Base32Crockford
+import net.taler.lib.wallet.Base32Crockford
import kotlin.test.Test
import kotlin.test.assertEquals
diff --git a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/crypto/Sha256Test.kt b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/Sha256Test.kt
index 3209e05..a71734a 100644
--- a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/crypto/Sha256Test.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/Sha256Test.kt
@@ -14,9 +14,8 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.crypto
+package net.taler.lib.wallet.crypto
-import net.taler.wallet.kotlin.Base32Crockford
import kotlin.test.Test
import kotlin.test.assertEquals
diff --git a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/crypto/Sha512Test.kt b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/Sha512Test.kt
index 24be282..59fd730 100644
--- a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/crypto/Sha512Test.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/Sha512Test.kt
@@ -14,9 +14,9 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.crypto
+package net.taler.lib.wallet.crypto
-import net.taler.wallet.kotlin.Base32Crockford
+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/wallet/kotlin/crypto/SignatureTest.kt b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/SignatureTest.kt
index 1306c14..b3228b9 100644
--- a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/crypto/SignatureTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/crypto/SignatureTest.kt
@@ -14,16 +14,16 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.crypto
+package net.taler.lib.wallet.crypto
-import net.taler.wallet.kotlin.Amount
-import net.taler.wallet.kotlin.Base32Crockford
-import net.taler.wallet.kotlin.Timestamp
-import net.taler.wallet.kotlin.crypto.Signature.PurposeBuilder
-import net.taler.wallet.kotlin.exchange.DenominationRecord
-import net.taler.wallet.kotlin.exchange.DenominationStatus.Unverified
-import net.taler.wallet.kotlin.exchange.DenominationStatus.VerifiedBad
-import net.taler.wallet.kotlin.exchange.WireFee
+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.PurposeBuilder
+import net.taler.lib.wallet.exchange.DenominationRecord
+import net.taler.lib.wallet.exchange.DenominationStatus.Unverified
+import net.taler.lib.wallet.exchange.DenominationStatus.VerifiedBad
+import net.taler.lib.wallet.exchange.WireFee
import kotlin.random.Random
import kotlin.test.Test
import kotlin.test.assertEquals
diff --git a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/exchange/DenominationTest.kt b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/exchange/DenominationTest.kt
index f48c97d..c52638b 100644
--- a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/exchange/DenominationTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/exchange/DenominationTest.kt
@@ -14,17 +14,17 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.exchange
+package net.taler.lib.wallet.exchange
-import net.taler.wallet.kotlin.Amount
-import net.taler.wallet.kotlin.Timestamp
-import net.taler.wallet.kotlin.Timestamp.Companion.NEVER
-import net.taler.wallet.kotlin.exchange.DenominationStatus.VerifiedBad
-import net.taler.wallet.kotlin.exchange.DenominationStatus.VerifiedGood
-import net.taler.wallet.kotlin.exchange.Denominations.denomination1
-import net.taler.wallet.kotlin.exchange.Denominations.denomination10
-import net.taler.wallet.kotlin.exchange.Denominations.denomination2
-import net.taler.wallet.kotlin.exchange.Denominations.denomination5
+import net.taler.lib.common.Amount
+import net.taler.lib.common.Timestamp
+import net.taler.lib.common.Timestamp.Companion.NEVER
+import net.taler.lib.wallet.exchange.DenominationStatus.VerifiedBad
+import net.taler.lib.wallet.exchange.DenominationStatus.VerifiedGood
+import net.taler.lib.wallet.exchange.Denominations.denomination1
+import net.taler.lib.wallet.exchange.Denominations.denomination10
+import net.taler.lib.wallet.exchange.Denominations.denomination2
+import net.taler.lib.wallet.exchange.Denominations.denomination5
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
diff --git a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/exchange/Denominations.kt b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/exchange/Denominations.kt
index 8cfd7fe..10a2772 100644
--- a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/exchange/Denominations.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/exchange/Denominations.kt
@@ -14,12 +14,12 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.exchange
+package net.taler.lib.wallet.exchange
-import net.taler.wallet.kotlin.Amount
-import net.taler.wallet.kotlin.Timestamp
-import net.taler.wallet.kotlin.exchange.DenominationStatus.Unverified
-import net.taler.wallet.kotlin.exchange.DenominationStatus.VerifiedGood
+import net.taler.lib.common.Amount
+import net.taler.lib.common.Timestamp
+import net.taler.lib.wallet.exchange.DenominationStatus.Unverified
+import net.taler.lib.wallet.exchange.DenominationStatus.VerifiedGood
object Denominations {
diff --git a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/exchange/KeysTest.kt b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/exchange/KeysTest.kt
index a6b0c98..a40c7cd 100644
--- a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/exchange/KeysTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/exchange/KeysTest.kt
@@ -14,13 +14,13 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.exchange
+package net.taler.lib.wallet.exchange
-import net.taler.wallet.kotlin.Amount
-import net.taler.wallet.kotlin.Timestamp
-import net.taler.wallet.kotlin.getMockHttpClient
-import net.taler.wallet.kotlin.giveJsonResponse
-import net.taler.wallet.kotlin.runCoroutine
+import net.taler.lib.common.Amount
+import net.taler.lib.common.Timestamp
+import net.taler.lib.wallet.getMockHttpClient
+import net.taler.lib.wallet.giveJsonResponse
+import net.taler.lib.wallet.runCoroutine
import kotlin.test.Test
import kotlin.test.assertEquals
diff --git a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/exchange/UpdateTest.kt b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/exchange/UpdateTest.kt
index 271dc09..15e6d80 100644
--- a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/exchange/UpdateTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/exchange/UpdateTest.kt
@@ -14,9 +14,9 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.exchange
+package net.taler.lib.wallet.exchange
-import net.taler.wallet.kotlin.runCoroutine
+import net.taler.lib.wallet.runCoroutine
import kotlin.test.Ignore
import kotlin.test.Test
import kotlin.test.assertTrue
diff --git a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/exchange/WireTest.kt b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/exchange/WireTest.kt
index d09b44b..16671a9 100644
--- a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/exchange/WireTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/exchange/WireTest.kt
@@ -14,13 +14,13 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.exchange
+package net.taler.lib.wallet.exchange
-import net.taler.wallet.kotlin.Amount
-import net.taler.wallet.kotlin.Timestamp
-import net.taler.wallet.kotlin.getMockHttpClient
-import net.taler.wallet.kotlin.giveJsonResponse
-import net.taler.wallet.kotlin.runCoroutine
+import net.taler.lib.common.Amount
+import net.taler.lib.common.Timestamp
+import net.taler.lib.wallet.getMockHttpClient
+import net.taler.lib.wallet.giveJsonResponse
+import net.taler.lib.wallet.runCoroutine
import kotlin.test.Test
import kotlin.test.assertEquals
diff --git a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/operations/WithdrawTest.kt b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/operations/WithdrawTest.kt
index 541f24f..634a9dd 100644
--- a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/operations/WithdrawTest.kt
+++ b/wallet/src/commonTest/kotlin/net/taler/lib/wallet/operations/WithdrawTest.kt
@@ -14,23 +14,23 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.operations
+package net.taler.lib.wallet.operations
-import net.taler.wallet.kotlin.Amount
-import net.taler.wallet.kotlin.exchange.DenominationSelectionInfo
-import net.taler.wallet.kotlin.exchange.Denominations.denomination0d01
-import net.taler.wallet.kotlin.exchange.Denominations.denomination0d1
-import net.taler.wallet.kotlin.exchange.Denominations.denomination1
-import net.taler.wallet.kotlin.exchange.Denominations.denomination10
-import net.taler.wallet.kotlin.exchange.Denominations.denomination2
-import net.taler.wallet.kotlin.exchange.Denominations.denomination4
-import net.taler.wallet.kotlin.exchange.Denominations.denomination5
-import net.taler.wallet.kotlin.exchange.Denominations.denomination8
-import net.taler.wallet.kotlin.exchange.SelectedDenomination
-import net.taler.wallet.kotlin.getMockHttpClient
-import net.taler.wallet.kotlin.giveJsonResponse
-import net.taler.wallet.kotlin.operations.Withdraw.BankDetails
-import net.taler.wallet.kotlin.runCoroutine
+import net.taler.lib.common.Amount
+import net.taler.lib.wallet.exchange.DenominationSelectionInfo
+import net.taler.lib.wallet.exchange.Denominations.denomination0d01
+import net.taler.lib.wallet.exchange.Denominations.denomination0d1
+import net.taler.lib.wallet.exchange.Denominations.denomination1
+import net.taler.lib.wallet.exchange.Denominations.denomination10
+import net.taler.lib.wallet.exchange.Denominations.denomination2
+import net.taler.lib.wallet.exchange.Denominations.denomination4
+import net.taler.lib.wallet.exchange.Denominations.denomination5
+import net.taler.lib.wallet.exchange.Denominations.denomination8
+import net.taler.lib.wallet.exchange.SelectedDenomination
+import net.taler.lib.wallet.getMockHttpClient
+import net.taler.lib.wallet.giveJsonResponse
+import net.taler.lib.wallet.operations.Withdraw.BankDetails
+import net.taler.lib.wallet.runCoroutine
import kotlin.test.Ignore
import kotlin.test.Test
import kotlin.test.assertEquals
diff --git a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/AmountTest.kt b/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/AmountTest.kt
deleted file mode 100644
index 08ee618..0000000
--- a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/AmountTest.kt
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * 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.wallet.kotlin
-
-import kotlin.random.Random
-import kotlin.test.Test
-import kotlin.test.assertEquals
-import kotlin.test.assertFalse
-import kotlin.test.assertTrue
-import kotlin.test.fail
-
-class AmountTest {
-
- companion object {
- private val charPool: List<Char> = ('a'..'z') + ('A'..'Z') + ('0'..'9')
- fun getRandomString(minLength: Int = 1, maxLength: Int = Random.nextInt(0, 1337)) = (minLength..maxLength)
- .map { Random.nextInt(0, charPool.size) }
- .map(charPool::get)
- .joinToString("")
-
- fun getRandomAmount() = getRandomAmount(getRandomString(1, Random.nextInt(1, 12)))
-
- fun getRandomAmount(currency: String): Amount {
- val value = Random.nextLong(0, Amount.MAX_VALUE)
- val fraction = Random.nextInt(0, Amount.MAX_FRACTION)
- return Amount(currency, value, fraction)
- }
- }
-
- @Test
- fun testFromJSONString() {
- var str = "TESTKUDOS:23.42"
- var amount = Amount.fromJSONString(str)
- assertEquals(str, amount.toJSONString())
- assertEquals("TESTKUDOS", amount.currency)
- assertEquals(23, amount.value)
- assertEquals((0.42 * 1e8).toInt(), amount.fraction)
- assertEquals("23.42 TESTKUDOS", amount.toString())
-
- str = "EUR:500000000.00000001"
- amount = Amount.fromJSONString(str)
- assertEquals(str, amount.toJSONString())
- assertEquals("EUR", amount.currency)
- assertEquals(500000000, amount.value)
- assertEquals(1, amount.fraction)
- assertEquals("500000000.00000001 EUR", amount.toString())
-
- str = "EUR:1500000000.00000003"
- amount = Amount.fromJSONString(str)
- assertEquals(str, amount.toJSONString())
- assertEquals("EUR", amount.currency)
- assertEquals(1500000000, amount.value)
- assertEquals(3, amount.fraction)
- assertEquals("1500000000.00000003 EUR", amount.toString())
- }
-
- @Test
- fun testFromJSONStringAcceptsMaxValuesRejectsAbove() {
- val maxValue = 4503599627370496
- val str = "TESTKUDOS123:$maxValue.99999999"
- val amount = Amount.fromJSONString(str)
- assertEquals(str, amount.toJSONString())
- assertEquals("TESTKUDOS123", amount.currency)
- assertEquals(maxValue, amount.value)
- assertEquals("$maxValue.99999999 TESTKUDOS123", amount.toString())
-
- // longer currency not accepted
- assertThrows<AmountParserException>("longer currency was accepted") {
- Amount.fromJSONString("TESTKUDOS1234:$maxValue.99999999")
- }
-
- // max value + 1 not accepted
- assertThrows<AmountParserException>("max value + 1 was accepted") {
- Amount.fromJSONString("TESTKUDOS123:${maxValue + 1}.99999999")
- }
-
- // max fraction + 1 not accepted
- assertThrows<AmountParserException>("max fraction + 1 was accepted") {
- Amount.fromJSONString("TESTKUDOS123:$maxValue.999999990")
- }
- }
-
- @Test
- fun testFromJSONStringRejections() {
- assertThrows<AmountParserException> {
- Amount.fromJSONString("TESTKUDOS:0,5")
- }
- assertThrows<AmountParserException> {
- Amount.fromJSONString("+TESTKUDOS:0.5")
- }
- assertThrows<AmountParserException> {
- Amount.fromJSONString("0.5")
- }
- assertThrows<AmountParserException> {
- Amount.fromJSONString(":0.5")
- }
- assertThrows<AmountParserException> {
- Amount.fromJSONString("EUR::0.5")
- }
- assertThrows<AmountParserException> {
- Amount.fromJSONString("EUR:.5")
- }
- }
-
- @Test
- fun testAddition() {
- assertEquals(
- Amount.fromJSONString("EUR:2"),
- Amount.fromJSONString("EUR:1") + Amount.fromJSONString("EUR:1")
- )
- assertEquals(
- Amount.fromJSONString("EUR:3"),
- Amount.fromJSONString("EUR:1.5") + Amount.fromJSONString("EUR:1.5")
- )
- assertEquals(
- Amount.fromJSONString("EUR:500000000.00000002"),
- Amount.fromJSONString("EUR:500000000.00000001") + Amount.fromJSONString("EUR:0.00000001")
- )
- assertThrows<AmountOverflowException>("addition didn't overflow") {
- Amount.fromJSONString("EUR:4503599627370496.99999999") + Amount.fromJSONString("EUR:0.00000001")
- }
- assertThrows<AmountOverflowException>("addition didn't overflow") {
- Amount.fromJSONString("EUR:4000000000000000") + Amount.fromJSONString("EUR:4000000000000000")
- }
- }
-
- @Test
- fun testTimes() {
- assertEquals(
- Amount.fromJSONString("EUR:2"),
- Amount.fromJSONString("EUR:2") * 1
- )
- assertEquals(
- Amount.fromJSONString("EUR:2"),
- Amount.fromJSONString("EUR:1") * 2
- )
- assertEquals(
- Amount.fromJSONString("EUR:4.5"),
- Amount.fromJSONString("EUR:1.5") * 3
- )
- assertEquals(Amount.fromJSONString("EUR:0"), Amount.fromJSONString("EUR:1.11") * 0)
- assertEquals(Amount.fromJSONString("EUR:1.11"), Amount.fromJSONString("EUR:1.11") * 1)
- assertEquals(Amount.fromJSONString("EUR:2.22"), Amount.fromJSONString("EUR:1.11") * 2)
- assertEquals(Amount.fromJSONString("EUR:3.33"), Amount.fromJSONString("EUR:1.11") * 3)
- assertEquals(Amount.fromJSONString("EUR:4.44"), Amount.fromJSONString("EUR:1.11") * 4)
- assertEquals(Amount.fromJSONString("EUR:5.55"), Amount.fromJSONString("EUR:1.11") * 5)
- assertEquals(
- Amount.fromJSONString("EUR:1500000000.00000003"),
- Amount.fromJSONString("EUR:500000000.00000001") * 3
- )
- assertThrows<AmountOverflowException>("times didn't overflow") {
- Amount.fromJSONString("EUR:4000000000000000") * 2
- }
- }
-
- @Test
- fun testSubtraction() {
- assertEquals(
- Amount.fromJSONString("EUR:0"),
- Amount.fromJSONString("EUR:1") - Amount.fromJSONString("EUR:1")
- )
- assertEquals(
- Amount.fromJSONString("EUR:1.5"),
- Amount.fromJSONString("EUR:3") - Amount.fromJSONString("EUR:1.5")
- )
- assertEquals(
- Amount.fromJSONString("EUR:500000000.00000001"),
- Amount.fromJSONString("EUR:500000000.00000002") - Amount.fromJSONString("EUR:0.00000001")
- )
- assertThrows<AmountOverflowException>("subtraction didn't underflow") {
- Amount.fromJSONString("EUR:23.42") - Amount.fromJSONString("EUR:42.23")
- }
- assertThrows<AmountOverflowException>("subtraction didn't underflow") {
- Amount.fromJSONString("EUR:0.5") - Amount.fromJSONString("EUR:0.50000001")
- }
- }
-
- @Test
- fun testIsZero() {
- assertTrue(Amount.zero("EUR").isZero())
- assertTrue(Amount.fromJSONString("EUR:0").isZero())
- assertTrue(Amount.fromJSONString("EUR:0.0").isZero())
- assertTrue(Amount.fromJSONString("EUR:0.00000").isZero())
- assertTrue((Amount.fromJSONString("EUR:1.001") - Amount.fromJSONString("EUR:1.001")).isZero())
-
- assertFalse(Amount.fromJSONString("EUR:0.00000001").isZero())
- assertFalse(Amount.fromJSONString("EUR:1.0").isZero())
- assertFalse(Amount.fromJSONString("EUR:0001.0").isZero())
- }
-
- @Test
- fun testComparision() {
- assertTrue(Amount.fromJSONString("EUR:0") <= Amount.fromJSONString("EUR:0"))
- assertTrue(Amount.fromJSONString("EUR:0") <= Amount.fromJSONString("EUR:0.00000001"))
- assertTrue(Amount.fromJSONString("EUR:0") < Amount.fromJSONString("EUR:0.00000001"))
- assertTrue(Amount.fromJSONString("EUR:0") < Amount.fromJSONString("EUR:1"))
- assertEquals(Amount.fromJSONString("EUR:0"), Amount.fromJSONString("EUR:0"))
- assertEquals(Amount.fromJSONString("EUR:42"), Amount.fromJSONString("EUR:42"))
- assertEquals(Amount.fromJSONString("EUR:42.00000001"), Amount.fromJSONString("EUR:42.00000001"))
- assertTrue(Amount.fromJSONString("EUR:42.00000001") >= Amount.fromJSONString("EUR:42.00000001"))
- assertTrue(Amount.fromJSONString("EUR:42.00000002") >= Amount.fromJSONString("EUR:42.00000001"))
- assertTrue(Amount.fromJSONString("EUR:42.00000002") > Amount.fromJSONString("EUR:42.00000001"))
- assertTrue(Amount.fromJSONString("EUR:0.00000002") > Amount.fromJSONString("EUR:0.00000001"))
- assertTrue(Amount.fromJSONString("EUR:0.00000001") > Amount.fromJSONString("EUR:0"))
- assertTrue(Amount.fromJSONString("EUR:2") > Amount.fromJSONString("EUR:1"))
-
- assertThrows<IllegalStateException>("could compare amounts with different currencies") {
- Amount.fromJSONString("EUR:0.5") < Amount.fromJSONString("USD:0.50000001")
- }
- }
-
- @Test
- fun testToByteArray() {
- val vectors = listOf(
- Pair("ceicWVf9GhJ:3902026702525079.40496378", "006XSQV3G899E0K9XKX66SB9CDBNCSHS8XM4M00"),
- Pair("asYDLuK2A:3800267550024600.02072907", "006R0MNXBVHSG00ZM55P2WTS8H67AJSJ8400000"),
- Pair("pV1m:1347558259914570.09786232", "002CK66VCNVMM04NADW70NHHDM0000000000000"),
- Pair("geO82l:553744321840253.41004983", "000ZF855K627T0KHNYVPESAF70S6R0000000000"),
- Pair("B9bWK7WPEO:3663912678613976.12122563", "006G8KS5P9HXG05RZ71M4EB2AX5KENTG8N7G000"),
- Pair("X:1537372109907438.77850768", "002QCETPFYJYW153X285G000000000000000000"),
- Pair("5:4271492725553118.39728399", "007JSSK6J4VXW0JY6M7KA000000000000000000"),
- Pair("OSdV:801656289790342.08256189", "001DJ6H6CA4RC03XZAYMYMV4AR0000000000000"),
- Pair("Y6:2908617536334646.94126271", "0055AQTB19NKC1CW82ZNJDG0000000000000000"),
- Pair("kSHoOZj:2610656582865206.00292046", "004MCR6T828KC004EK76PMT8DX7NMTG00000000"),
- Pair("GkhLXrlGES:4246330707533398.83874252", "007HC0Z9DFF5C17ZT764ETV89HC74V278N9G000"),
- Pair("CNS09:738124490298524.71259462", "0019YMG01DA9R11ZAN346KJK60WG00000000000"),
- Pair("sw0b1tKXZym:2132978464977419.28199478", "003S7VNZPZS0P0DE98V76XSGC8RQ8JTRB9WPT00"),
- Pair("fC:1275322307696988.17178522", "0028FSGX3ZCNR0863YD6CGR0000000000000000"),
- Pair("cRai6j:166032749022734.69444771", "0009E0C30V70W113MJHP6MK1D4V6M0000000000"),
- Pair("KOADwTb3:3932974019564218.48282023", "006ZJ16ZB39BM0Q0Q6KMPKT18HVN8RHK0000000"),
- Pair("9Fi9wcLgDe:1268366772151214.97268853", "002834N6WRHTW1EC6HTKJHK975VP6K378HJG000"),
- Pair("SDN:3370670470236379.88943272", "005ZK6V0124DP1AD5AM56H2E000000000000000"),
- Pair("zGCP5V:4010014441349620.76121145", "0073Y5HYA8GZ8149GGWQMHT3A0TNC0000000000"),
- Pair("VsW1JjBLn:2037070181191907.99717275", "003KSD2WH18E61FHJ2DNCWTQ6556MGJCDR00000"),
- Pair("A:1806895799429502.00887758", "0036PQ5P8NMQW00DHF742000000000000000000"),
- Pair("njA8:4015261148004966.43708687", "00747PYPD116C0MTY47PWTJ1700000000000000"),
- Pair("Bwq:3562876074139250.28829179", "006AGTNTRWF740DQWQXM4XVH000000000000000"),
- Pair("8e75v8:3716241006992995.95213823", "006K7SP93WF661DCV3ZKGS9Q6NV3G0000000000"),
- Pair("XrnbQTTn:3887603772953949.94721267", "006WZGA9X8ANT1D5AKSNGWKEC98N8N3E0000000"),
- Pair("MIN:0.00000001", "0000000000000000000MTJAE000000000000000"),
- Pair("MAX:4503599627370496.99999999", "00800000000001FNW3ZMTGAR000000000000000")
- )
- for (v in vectors) {
- val amount = Amount.fromJSONString(v.first)
- val encodedBytes = Base32Crockford.encode(amount.toByteArray())
- assertEquals(v.second, encodedBytes)
- }
- }
-
- private inline fun <reified T : Throwable> assertThrows(
- msg: String? = null,
- function: () -> Any
- ) {
- try {
- function.invoke()
- fail(msg)
- } catch (e: Exception) {
- assertTrue(e is T)
- }
- }
-
-}
diff --git a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/TalerUriTest.kt b/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/TalerUriTest.kt
deleted file mode 100644
index cfcc8bd..0000000
--- a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/TalerUriTest.kt
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.wallet.kotlin
-
-import net.taler.wallet.kotlin.TalerUri.WithdrawUriResult
-import net.taler.wallet.kotlin.TalerUri.parseWithdrawUri
-import kotlin.test.Test
-import kotlin.test.assertEquals
-import kotlin.test.assertNull
-
-class TalerUriTest {
-
- @Test
- fun testParseWithdrawUri() {
- // correct parsing
- var uri = "taler://withdraw/bank.example.com/12345"
- var expected = WithdrawUriResult("https://bank.example.com/", "12345")
- assertEquals(expected, parseWithdrawUri(uri))
-
- // correct parsing with insecure http
- uri = "taler+http://withdraw/bank.example.org/foo"
- expected = WithdrawUriResult("http://bank.example.org/", "foo")
- assertEquals(expected, parseWithdrawUri(uri))
-
- // correct parsing with long path
- uri = "taler://withdraw/bank.example.com/foo/bar/23/42/1337/1234567890"
- expected = WithdrawUriResult("https://bank.example.com/foo/bar/23/42/1337", "1234567890")
- assertEquals(expected, parseWithdrawUri(uri))
-
- // rejects incorrect scheme
- uri = "talerx://withdraw/bank.example.com/12345"
- assertNull(parseWithdrawUri(uri))
-
- // rejects incorrect authority
- uri = "taler://withdrawx/bank.example.com/12345"
- assertNull(parseWithdrawUri(uri))
-
- // rejects incorrect authority with insecure http
- uri = "taler+http://withdrawx/bank.example.com/12345"
- assertNull(parseWithdrawUri(uri))
-
- // rejects empty withdrawalId
- uri = "taler://withdraw/bank.example.com//"
- assertNull(parseWithdrawUri(uri))
-
- // rejects empty path and withdrawalId
- uri = "taler://withdraw/bank.example.com////"
- assertNull(parseWithdrawUri(uri))
- }
-
-}
diff --git a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/VersionTest.kt b/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/VersionTest.kt
deleted file mode 100644
index d445ebc..0000000
--- a/wallet/src/commonTest/kotlin/net/taler/wallet/kotlin/VersionTest.kt
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.wallet.kotlin
-
-import kotlin.test.Test
-import kotlin.test.assertEquals
-import kotlin.test.assertNull
-
-class VersionTest {
-
- @Test
- fun testComparision() {
- assertNull(compareVersions("0:0:0", ""))
- assertNull(compareVersions("", "0:0:0"))
- assertNull(compareVersions("foo", "0:0:0"))
- assertNull(compareVersions("0:0:0", "foo"))
- assertEquals(
- VersionMatchResult(true, 0),
- compareVersions("0:0:0", "0:0:0")
- )
- assertEquals(
- VersionMatchResult(true, -1),
- compareVersions("0:0:0", "1:0:1")
- )
- assertEquals(
- VersionMatchResult(true, -1),
- compareVersions("0:0:0", "1:5:1")
- )
- assertEquals(
- VersionMatchResult(false, -1),
- compareVersions("0:0:0", "1:5:0")
- )
- assertEquals(
- VersionMatchResult(false, 1),
- compareVersions("1:0:0", "0:5:0")
- )
- assertEquals(
- VersionMatchResult(true, 0),
- compareVersions("1:0:1", "1:5:1")
- )
- }
-
-}
diff --git a/wallet/src/jsMain/kotlin/net/taler/wallet/kotlin/Db.kt b/wallet/src/jsMain/kotlin/net/taler/lib/wallet/Db.kt
index 45cbfc3..39394b8 100644
--- a/wallet/src/jsMain/kotlin/net/taler/wallet/kotlin/Db.kt
+++ b/wallet/src/jsMain/kotlin/net/taler/lib/wallet/Db.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin
+package net.taler.lib.wallet
internal actual class DbFactory {
actual fun openDb(): Db {
diff --git a/wallet/src/jsMain/kotlin/net/taler/wallet/kotlin/crypto/CryptoFactory.kt b/wallet/src/jsMain/kotlin/net/taler/lib/wallet/crypto/CryptoFactory.kt
index e428f6a..e5f9531 100644
--- a/wallet/src/jsMain/kotlin/net/taler/wallet/kotlin/crypto/CryptoFactory.kt
+++ b/wallet/src/jsMain/kotlin/net/taler/lib/wallet/crypto/CryptoFactory.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.crypto
+package net.taler.lib.wallet.crypto
import org.khronos.webgl.Uint8Array
import org.khronos.webgl.get
diff --git a/wallet/src/jsTest/kotlin/net/taler/wallet/kotlin/TestUtils.kt b/wallet/src/jsTest/kotlin/net/taler/lib/wallet/TestUtils.kt
index 49466e0..16da3f7 100644
--- a/wallet/src/jsTest/kotlin/net/taler/wallet/kotlin/TestUtils.kt
+++ b/wallet/src/jsTest/kotlin/net/taler/lib/wallet/TestUtils.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin
+package net.taler.lib.wallet
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.GlobalScope
diff --git a/wallet/src/nativeMain/kotlin/net/taler/wallet/kotlin/Db.kt b/wallet/src/nativeMain/kotlin/net/taler/lib/wallet/Db.kt
index 45cbfc3..39394b8 100644
--- a/wallet/src/nativeMain/kotlin/net/taler/wallet/kotlin/Db.kt
+++ b/wallet/src/nativeMain/kotlin/net/taler/lib/wallet/Db.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin
+package net.taler.lib.wallet
internal actual class DbFactory {
actual fun openDb(): Db {
diff --git a/wallet/src/nativeMain/kotlin/net/taler/wallet/kotlin/crypto/CryptoFactory.kt b/wallet/src/nativeMain/kotlin/net/taler/lib/wallet/crypto/CryptoFactory.kt
index 7860607..61646a0 100644
--- a/wallet/src/nativeMain/kotlin/net/taler/wallet/kotlin/crypto/CryptoFactory.kt
+++ b/wallet/src/nativeMain/kotlin/net/taler/lib/wallet/crypto/CryptoFactory.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin.crypto
+package net.taler.lib.wallet.crypto
import kotlinx.cinterop.CValuesRef
import kotlinx.cinterop.UByteVar
diff --git a/wallet/src/nativeTest/kotlin/net/taler/wallet/kotlin/TestUtils.kt b/wallet/src/nativeTest/kotlin/net/taler/lib/wallet/TestUtils.kt
index c44a846..c38916c 100644
--- a/wallet/src/nativeTest/kotlin/net/taler/wallet/kotlin/TestUtils.kt
+++ b/wallet/src/nativeTest/kotlin/net/taler/lib/wallet/TestUtils.kt
@@ -14,7 +14,7 @@
* GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-package net.taler.wallet.kotlin
+package net.taler.lib.wallet
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.runBlocking