From 9cf0b9ad4818d28097649d989941fc39b06f3de3 Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Tue, 4 Jun 2019 15:22:24 +0200 Subject: [PATCH] ios: Fix setSshKeys Forgot to write the private key to disk --- ios/Runner/AppDelegate.m | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ios/Runner/AppDelegate.m b/ios/Runner/AppDelegate.m index 0dadb66d..d6bc9ef5 100644 --- a/ios/Runner/AppDelegate.m +++ b/ios/Runner/AppDelegate.m @@ -45,6 +45,9 @@ static FlutterMethodChannel* gitChannel = 0; NSArray *sshPublicComponents = [NSArray arrayWithObjects:filesDir, @"ssh", @"id_rsa.pub", nil]; NSString *sshPublicKeyString = [NSString pathWithComponents:sshPublicComponents]; + NSArray *sshPrivateComponents = [NSArray arrayWithObjects:filesDir, @"ssh", @"id_rsa", nil]; + NSString *sshPrivateKeyString = [NSString pathWithComponents:sshPrivateComponents]; + if ([@"getBaseDirectory" isEqualToString:method]) { result(filesDir); } @@ -247,6 +250,14 @@ static FlutterMethodChannel* gitChannel = 0; return; } + [privateKey writeToFile:sshPrivateKeyString atomically:YES encoding:NSUTF8StringEncoding error:&error]; + + if (error != nil) { + result([FlutterError errorWithCode:@"FAILED" + message:[error localizedDescription] details:nil]); + return; + } + result(@YES); } else if ([@"dumpAppLogs" isEqualToString:method]) {