Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/komodo_defi_framework/app_build/build_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"coins": {
"fetch_at_build_enabled": true,
"update_commit_on_build": true,
"bundled_coins_repo_commit": "de34ec7af46a0512ea4a107a6f9c9f18d2191536",
"bundled_coins_repo_commit": "57c196726f67cabb242bfce9b39ab04b10001ec5",
"coins_repo_api_url": "https://api.github.com/repos/KomodoPlatform/coins",
"coins_repo_content_url": "https://komodoplatform.github.io/coins",
"coins_repo_branch": "master",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,32 @@ class KdfOperationsNativeLibrary implements IKdfOperations {
).whenComplete(() => calloc.free(startParamsPtr));

if (kDebugMode) _log('KDF started in ${timer.elapsedMilliseconds}ms');
await Future<void>.delayed(const Duration(milliseconds: 500));
if (kDebugMode) _log('KDF started with result: $result');
if (kDebugMode) _log('Status after starting KDF: ${_kdfMainStatus()}');

// Wait for RPC to be fully up instead of just a fixed delay
// This is a workaround for the race condition where KDF is started but
// the RPC server is not yet ready to accept requests.
bool isRpcReady = false;
for (int i = 0; i < 20; i++) {
await Future<void>.delayed(const Duration(milliseconds: 500));
if (_kdfMainStatus() == MainStatus.rpcIsUp) {
isRpcReady = true;
if (kDebugMode) {
_log('RPC server ready after ${timer.elapsedMilliseconds}ms');
}
break;
}
}

if (!isRpcReady && kDebugMode) {
_log(
'Warning: RPC server not ready after ${timer.elapsedMilliseconds}ms',
);
}

if (kDebugMode) {
_log('KDF started with result: $result');
_log('Status after starting KDF: ${_kdfMainStatus()}');
}

return KdfStartupResult.fromDefaultInt(result);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,35 +76,17 @@ extension KdfExtensions on KdfAuthService {

// consider moving to kdf api
Future<void> _restartKdf(KdfStartupConfig config) async {
final foundAuthExceptions = <AuthException>[];
late StreamSubscription<String> sub;
await _stopKdf();
final kdfResult = await _kdfFramework.startKdf(config);

sub = _kdfFramework.logStream.listen((log) {
final exceptions = AuthException.findExceptionsInLog(log);
if (exceptions.isNotEmpty) {
foundAuthExceptions.addAll(exceptions);
}
});

try {
await _stopKdf();
final kdfResult = await _kdfFramework.startKdf(config);

if (!kdfResult.isStartingOrAlreadyRunning()) {
throw AuthException(
'Failed to start KDF: ${kdfResult.name}',
type: AuthExceptionType.generalAuthError,
);
}

await _waitUntilKdfRpcIsUp();

if (foundAuthExceptions.isNotEmpty) {
throw foundAuthExceptions.first;
}
} finally {
await sub.cancel();
if (!kdfResult.isStartingOrAlreadyRunning()) {
throw AuthException(
'Failed to start KDF: ${kdfResult.name}',
type: AuthExceptionType.generalAuthError,
);
}

await _waitUntilKdfRpcIsUp();
}

Future<void> _waitUntilKdfRpcIsUp({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,14 @@
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
Expand Down Expand Up @@ -370,10 +374,14 @@
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
Expand Down
12 changes: 6 additions & 6 deletions packages/komodo_defi_sdk/example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsLocalNetworking</key>
<true/>
</dict>
<key>NSDocumentsFolderUsageDescription</key>
<string>This app needs access to documents folder to store database files.</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// NB! This file is not currently used and will possibly be removed in the
// future.
// future. We can consider migrating the KDF JS bootstrapper to Dart and
// compile to JavaScript.

// ignore_for_file: avoid_dynamic_calls

Expand Down
2 changes: 2 additions & 0 deletions packages/komodo_defi_types/lib/src/utils/security_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ extension CensoredJsonMap on JsonMap {
JsonMap censored() {
// Search recursively for the following keys and replace their values
// with "*" characters.
// TODO: consider adding regex or wildcard support for "*password*" or "*key*"
const sensitive = [
'seed',
'userpass',
Expand All @@ -86,6 +87,7 @@ extension CensoredJsonMap on JsonMap {
'privkey',
'userpass',
'rpc_password',
'wallet_password',
];

return censorKeys(sensitive);
Expand Down
Loading