quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

commit 8b8e2777ba9e0b0501288db90396125486c7b006
parent 77a896362ff717048bd9f3936b6fa4adc69b14d5
Author: Marc Stibane <marc@taler.net>
Date:   Thu, 12 Jan 2023 16:27:42 +0100

Framework for ObjC/Swift

Diffstat:
MQuickJS-rt.xcodeproj/project.pbxproj | 219+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
ATalerWalletcore-Bridging-Header.h | 1+
ATalerWalletcore.h | 21+++++++++++++++++++++
ATalerWalletcore.m | 38++++++++++++++++++++++++++++++++++++++
4 files changed, 276 insertions(+), 3 deletions(-)

diff --git a/QuickJS-rt.xcodeproj/project.pbxproj b/QuickJS-rt.xcodeproj/project.pbxproj @@ -578,6 +578,25 @@ 4E3290E7296CEFA1006D0E3C /* libsodium.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E329075296CEAD2006D0E3C /* libsodium.a */; }; 4E3290E8296CEFA1006D0E3C /* libunicode.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E328F15296CDF66006D0E3C /* libunicode.a */; }; 4E3290E9296CF154006D0E3C /* cutils.c in Sources */ = {isa = PBXBuildFile; fileRef = 4E328EC7296CCC48006D0E3C /* cutils.c */; }; + 4E579B1829702D9E007B89A4 /* TalerWalletcore.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E579B1529702ACA007B89A4 /* TalerWalletcore.m */; }; + 4E579B1929702DBB007B89A4 /* taler_wallet_core_lib.c in Sources */ = {isa = PBXBuildFile; fileRef = 4EE2123A296DBF17000D7228 /* taler_wallet_core_lib.c */; }; + 4E579B1B29702E53007B89A4 /* libbf.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E328E95296CC59E006D0E3C /* libbf.a */; platformFilter = ios; }; + 4E579B1C29702E53007B89A4 /* libcurl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E328C6C296C9A27006D0E3C /* libcurl.a */; platformFilter = ios; }; + 4E579B1D29702E53007B89A4 /* libcutils.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E328EC0296CCBFE006D0E3C /* libcutils.a */; platformFilter = ios; }; + 4E579B1E29702E53007B89A4 /* libmbedcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E5C3076296C7A5C0031A049 /* libmbedcrypto.a */; platformFilter = ios; }; + 4E579B1F29702E53007B89A4 /* libmbedtls.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E5C311B296C899D0031A049 /* libmbedtls.a */; platformFilter = ios; }; + 4E579B2029702E53007B89A4 /* libmbedx509.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E328C51296C980F006D0E3C /* libmbedx509.a */; platformFilter = ios; }; + 4E579B2129702E54007B89A4 /* libprelude.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4EE211FB296DB6D1000D7228 /* libprelude.a */; platformFilter = ios; }; + 4E579B2229702E54007B89A4 /* libquickjs-libc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E328ECE296CCC9E006D0E3C /* libquickjs-libc.a */; platformFilter = ios; }; + 4E579B2329702E54007B89A4 /* libquickjs.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E328EDC296CCF05006D0E3C /* libquickjs.a */; platformFilter = ios; }; + 4E579B2429702E54007B89A4 /* libregexp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E328EA4296CC6F0006D0E3C /* libregexp.a */; platformFilter = ios; }; + 4E579B2529702E54007B89A4 /* libsodium.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E328DAD296CA3D0006D0E3C /* libsodium.a */; platformFilter = ios; }; + 4E579B2629702E54007B89A4 /* libtart.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E328E7D296CC0BC006D0E3C /* libtart.a */; platformFilter = ios; }; + 4E579B2729702E54007B89A4 /* libunicode.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E328EB2296CCB85006D0E3C /* libunicode.a */; platformFilter = ios; }; + 4E579B2829702E54007B89A4 /* libwallet_core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4EE21223296DBC7D000D7228 /* libwallet_core.a */; platformFilter = ios; }; + 4E579B2929702F58007B89A4 /* TalerWalletcore.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E579B1029702103007B89A4 /* TalerWalletcore.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4E579B2A29702F7C007B89A4 /* taler_wallet_core_lib.h in Headers */ = {isa = PBXBuildFile; fileRef = 4EBF870C296EF4D400241F24 /* taler_wallet_core_lib.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4E579B2C29702FFE007B89A4 /* TalerWalletcore-Bridging-Header.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E579B2B29702FFE007B89A4 /* TalerWalletcore-Bridging-Header.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4E5C307F296C7DAA0031A049 /* aesni.c in Sources */ = {isa = PBXBuildFile; fileRef = 4E5C307D296C7DAA0031A049 /* aesni.c */; }; 4E5C3080296C7DAA0031A049 /* aes.c in Sources */ = {isa = PBXBuildFile; fileRef = 4E5C307E296C7DAA0031A049 /* aes.c */; }; 4E5C308A296C7FEA0031A049 /* base64.c in Sources */ = {isa = PBXBuildFile; fileRef = 4E5C3085296C7FEA0031A049 /* base64.c */; }; @@ -1399,6 +1418,10 @@ 4E328F6B296CE801006D0E3C /* libmbedcrypto.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libmbedcrypto.a; sourceTree = BUILT_PRODUCTS_DIR; }; 4E328FD1296CE95C006D0E3C /* libcurl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libcurl.a; sourceTree = BUILT_PRODUCTS_DIR; }; 4E329075296CEAD2006D0E3C /* libsodium.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libsodium.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 4E579B0E29702103007B89A4 /* TalerWalletcore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TalerWalletcore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 4E579B1029702103007B89A4 /* TalerWalletcore.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TalerWalletcore.h; sourceTree = "<group>"; }; + 4E579B1529702ACA007B89A4 /* TalerWalletcore.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TalerWalletcore.m; sourceTree = "<group>"; }; + 4E579B2B29702FFE007B89A4 /* TalerWalletcore-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "TalerWalletcore-Bridging-Header.h"; sourceTree = "<group>"; }; 4E5C3076296C7A5C0031A049 /* libmbedcrypto.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libmbedcrypto.a; sourceTree = BUILT_PRODUCTS_DIR; }; 4E5C307D296C7DAA0031A049 /* aesni.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = aesni.c; sourceTree = "<group>"; }; 4E5C307E296C7DAA0031A049 /* aes.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = aes.c; sourceTree = "<group>"; }; @@ -1494,6 +1517,7 @@ 4E5C3144296C91A10031A049 /* ssl_tls13_client.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ssl_tls13_client.c; sourceTree = "<group>"; }; 4E5C3145296C91A10031A049 /* ssl_tls13_generic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ssl_tls13_generic.c; sourceTree = "<group>"; }; 4E5C3146296C91A10031A049 /* ssl_tls13_server.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ssl_tls13_server.c; sourceTree = "<group>"; }; + 4EBF870C296EF4D400241F24 /* taler_wallet_core_lib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = taler_wallet_core_lib.h; sourceTree = "<group>"; }; 4EE211FB296DB6D1000D7228 /* libprelude.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libprelude.a; sourceTree = BUILT_PRODUCTS_DIR; }; 4EE21223296DBC7D000D7228 /* libwallet_core.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libwallet_core.a; sourceTree = BUILT_PRODUCTS_DIR; }; 4EE21233296DBEE1000D7228 /* libtalerwalletcore.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libtalerwalletcore.a; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1504,7 +1528,7 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 4E328EE6296CD029006D0E3C /* Frameworks for macOS PBXNativeTarget "qjsc" */ = { + 4E328EE6296CD029006D0E3C /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( @@ -1522,7 +1546,28 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 4EE21230296DBEE1000D7228 /* Frameworks for iOS PBXNativeTarget "talerwalletcore" */ = { + 4E579B0B29702103007B89A4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4E579B1E29702E53007B89A4 /* libmbedcrypto.a in Frameworks */, + 4E579B1F29702E53007B89A4 /* libmbedtls.a in Frameworks */, + 4E579B2029702E53007B89A4 /* libmbedx509.a in Frameworks */, + 4E579B1C29702E53007B89A4 /* libcurl.a in Frameworks */, + 4E579B2529702E54007B89A4 /* libsodium.a in Frameworks */, + 4E579B1B29702E53007B89A4 /* libbf.a in Frameworks */, + 4E579B1D29702E53007B89A4 /* libcutils.a in Frameworks */, + 4E579B2229702E54007B89A4 /* libquickjs-libc.a in Frameworks */, + 4E579B2329702E54007B89A4 /* libquickjs.a in Frameworks */, + 4E579B2429702E54007B89A4 /* libregexp.a in Frameworks */, + 4E579B2629702E54007B89A4 /* libtart.a in Frameworks */, + 4E579B2729702E54007B89A4 /* libunicode.a in Frameworks */, + 4E579B2129702E54007B89A4 /* libprelude.a in Frameworks */, + 4E579B2829702E54007B89A4 /* libwallet_core.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4EE21230296DBEE1000D7228 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( @@ -1577,6 +1622,7 @@ 4EE211FB296DB6D1000D7228 /* libprelude.a */, 4EE21223296DBC7D000D7228 /* libwallet_core.a */, 4EE21233296DBEE1000D7228 /* libtalerwalletcore.a */, + 4E579B0E29702103007B89A4 /* TalerWalletcore.framework */, ); name = Products; sourceTree = "<group>"; @@ -2397,6 +2443,13 @@ name = mbedtls; sourceTree = "<group>"; }; + 4E579B1A29702E53007B89A4 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = "<group>"; + }; 4E5C305F296C77AF0031A049 = { isa = PBXGroup; children = ( @@ -2413,6 +2466,7 @@ 4EED1C44296DECE300915572 /* prelude.c */, 4EED1C46296DED8000915572 /* wallet_core.c */, 4E328C4C296C9691006D0E3C /* Products */, + 4E579B1A29702E53007B89A4 /* Frameworks */, ); sourceTree = "<group>"; }; @@ -2546,7 +2600,11 @@ 4EE2123C296DBF64000D7228 /* talerwalletcore */ = { isa = PBXGroup; children = ( + 4E579B2B29702FFE007B89A4 /* TalerWalletcore-Bridging-Header.h */, + 4E579B1529702ACA007B89A4 /* TalerWalletcore.m */, + 4E579B1029702103007B89A4 /* TalerWalletcore.h */, 4EE2123A296DBF17000D7228 /* taler_wallet_core_lib.c */, + 4EBF870C296EF4D400241F24 /* taler_wallet_core_lib.h */, ); name = talerwalletcore; sourceTree = "<group>"; @@ -2638,6 +2696,16 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 4E579B0929702103007B89A4 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 4E579B2A29702F7C007B89A4 /* taler_wallet_core_lib.h in Headers */, + 4E579B2C29702FFE007B89A4 /* TalerWalletcore-Bridging-Header.h in Headers */, + 4E579B2929702F58007B89A4 /* TalerWalletcore.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ @@ -3037,6 +3105,24 @@ productReference = 4E329075296CEAD2006D0E3C /* libsodium.a */; productType = "com.apple.product-type.library.static"; }; + 4E579B0D29702103007B89A4 /* TalerWalletcore */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4E579B1229702103007B89A4 /* Build configuration list for PBXNativeTarget "TalerWalletcore" */; + buildPhases = ( + 4E579B0929702103007B89A4 /* Headers */, + 4E579B0A29702103007B89A4 /* Sources */, + 4E579B0B29702103007B89A4 /* Frameworks */, + 4E579B0C29702103007B89A4 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = TalerWalletcore; + productName = TalerWalletcore; + productReference = 4E579B0E29702103007B89A4 /* TalerWalletcore.framework */; + productType = "com.apple.product-type.framework"; + }; 4E5C3075296C7A5C0031A049 /* mbedcrypto */ = { isa = PBXNativeTarget; buildConfigurationList = 4E5C307A296C7A5C0031A049 /* Build configuration list for PBXNativeTarget "mbedcrypto" */; @@ -3110,6 +3196,7 @@ buildConfigurationList = 4EE21237296DBEE1000D7228 /* Build configuration list for PBXNativeTarget "talerwalletcore" */; buildPhases = ( 4EE2122F296DBEE1000D7228 /* Sources */, + 4E1F22A3296F6DF9003017F4 /* ShellScript */, 4EE21230296DBEE1000D7228 /* Frameworks */, 4EE21231296DBEE1000D7228 /* CopyFiles */, ); @@ -3215,6 +3302,9 @@ 4E329074296CEAD2006D0E3C = { CreatedOnToolsVersion = 14.2; }; + 4E579B0D29702103007B89A4 = { + CreatedOnToolsVersion = 14.2; + }; 4E5C3075296C7A5C0031A049 = { CreatedOnToolsVersion = 14.2; }; @@ -3273,11 +3363,39 @@ 4EE211FA296DB6D1000D7228 /* prelude */, 4EE21222296DBC7C000D7228 /* wallet_core */, 4EE21232296DBEE1000D7228 /* talerwalletcore */, + 4E579B0D29702103007B89A4 /* TalerWalletcore */, ); }; /* End PBXProject section */ +/* Begin PBXResourcesBuildPhase section */ + 4E579B0C29702103007B89A4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + /* Begin PBXShellScriptBuildPhase section */ + 4E1F22A3296F6DF9003017F4 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo ${DERIVED_FILE_DIR}\n"; + }; 4EE2121C296DB793000D7228 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -3314,7 +3432,8 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "$BUILD_DIR/$CONFIGURATION/qjsc -c -m -M tart -o ${SCRIPT_OUTPUT_FILE_0} ${SCRIPT_INPUT_FILE_0}\n"; + shellScript = "$BUILD_DIR/$CONFIGURATION/qjsc -c -m -M tart -N qjsc_wallet_core -o ${SCRIPT_OUTPUT_FILE_0} ${SCRIPT_INPUT_FILE_0}\n"; + showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -4040,6 +4159,15 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 4E579B0A29702103007B89A4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4E579B1929702DBB007B89A4 /* taler_wallet_core_lib.c in Sources */, + 4E579B1829702D9E007B89A4 /* TalerWalletcore.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 4E5C3072296C7A5C0031A049 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -5480,6 +5608,82 @@ }; name = Release; }; + 4E579B1329702103007B89A4 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + OTHER_CFLAGS = ( + "-D_GNU_SOURCE", + "-DCONFIG_VERSION=\\\"0.0.1\\\"", + "-DCONFIG_BIGNUM", + "-fno-omit-frame-pointer", + ); + PRODUCT_BUNDLE_IDENTIFIER = Fesh.TalerWalletcore; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SWIFT_EMIT_LOC_STRINGS = "$(inherited)"; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 4E579B1429702103007B89A4 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + OTHER_CFLAGS = ( + "-D_GNU_SOURCE", + "-DCONFIG_VERSION=\\\"0.0.1\\\"", + "-DCONFIG_BIGNUM", + "-fno-omit-frame-pointer", + ); + PRODUCT_BUNDLE_IDENTIFIER = Fesh.TalerWalletcore; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SWIFT_EMIT_LOC_STRINGS = "$(inherited)"; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; 4E5C306D296C77AF0031A049 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -5980,6 +6184,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 4E579B1229702103007B89A4 /* Build configuration list for PBXNativeTarget "TalerWalletcore" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4E579B1329702103007B89A4 /* Debug */, + 4E579B1429702103007B89A4 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 4E5C3063296C77AF0031A049 /* Build configuration list for PBXProject "QuickJS-rt" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/TalerWalletcore-Bridging-Header.h b/TalerWalletcore-Bridging-Header.h @@ -0,0 +1 @@ +#import "taler_wallet_core_lib.h" diff --git a/TalerWalletcore.h b/TalerWalletcore.h @@ -0,0 +1,21 @@ +// +// TalerWalletcore.h +// TalerWalletcore +// +// Created by Marc Stibane on 12.01.23. +// + +#import <Foundation/Foundation.h> + +//! Project version number for TalerWalletcore. +FOUNDATION_EXPORT double TalerWalletcoreVersionNumber; + +//! Project version string for TalerWalletcore. +FOUNDATION_EXPORT const unsigned char TalerWalletcoreVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import <TalerWalletcore/PublicHeader.h> + +#import "taler_wallet_core_lib.h" + +struct TALER_WALLET_Instance * +TALER_WALLET_test(int wait); diff --git a/TalerWalletcore.m b/TalerWalletcore.m @@ -0,0 +1,38 @@ +// +// TalerWalletcore.m +// QuickJS-rt +// +// Created by Marc Stibane on 12.01.23. +// + +#import "TalerWalletcore.h" + + +static void TALER_WALLET_test_handler(void *cls, const char *message) +{ + printf("got message: %s\n", message); +} + +struct TALER_WALLET_Instance * +TALER_WALLET_test(int wait) +{ + struct TALER_WALLET_Instance *wh = TALER_WALLET_create(); + + TALER_WALLET_set_message_handler(wh, &TALER_WALLET_test_handler, NULL); + + TALER_WALLET_run(wh); + + TALER_WALLET_send_request(wh, "{\"operation\": \"init\", \"payload\": {\"skipDefaults\": true}}"); + + TALER_WALLET_send_request(wh, "{\"operation\": \"getVersion\"}"); + + //TALER_WALLET_send_request(wh, "{}"); + + if (wait) { + // Wait for wallet thread to finish. + // If we don't call this, main() exits + // and the wallet thread is killed. + TALER_WALLET_join(wh); + } + return wh; +}