Skip to content

Commit 4d84cde

Browse files
committed
keymanager, installer with HOME pass
1 parent 9c842f0 commit 4d84cde

File tree

9 files changed

+64
-13
lines changed

9 files changed

+64
-13
lines changed

installer/macOS/Common/UnistallerManager.swift

+15
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,21 @@ class UninstallerManager {
8383
}
8484

8585
func disableAutoRunProcess () {
86+
do {
87+
try ahLaunchCtl.stop(Consts.LABEL_JOB, in: .globalLaunchDaemon)
88+
} catch {
89+
print(error.localizedDescription)
90+
}
91+
do {
92+
try ahLaunchCtl.unload(Consts.LABEL_JOB, in: .globalLaunchDaemon)
93+
} catch {
94+
print(error.localizedDescription)
95+
}
96+
do {
97+
try ahLaunchCtl.remove(Consts.LABEL_JOB, from: .globalLaunchDaemon)
98+
} catch {
99+
print(error.localizedDescription)
100+
}
86101
do {
87102
try ahLaunchCtl.stop(Consts.LABEL_JOB, in: .userLaunchAgent)
88103
} catch {

installer/macOS/KeyChain Installer.xcodeproj/project.pbxproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
/* Begin PBXBuildFile section */
1010
065E4561476CAD7D2A088F20 /* Pods_Keychain_Installer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D45CE400EF06130F590AA706 /* Pods_Keychain_Installer.framework */; };
11+
A74663752225581F00E370A5 /* bin.tar.gz in Resources */ = {isa = PBXBuildFile; fileRef = A74663742225581F00E370A5 /* bin.tar.gz */; };
1112
A776F48D21D0C696006736C9 /* Print.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7E7F75B21A6B4A60021ED5E /* Print.swift */; };
1213
A776F48F21D0C92E006736C9 /* UninstallVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A776F48E21D0C92E006736C9 /* UninstallVC.swift */; };
1314
A776F49021D0D147006736C9 /* Alerts.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7E7F75721A6B4620021ED5E /* Alerts.swift */; };
1415
A793A32921C2672B0061249D /* LicenseVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A793A32821C2672B0061249D /* LicenseVC.swift */; };
15-
A795237E2215CCE400078EE5 /* bin.tar.gz in Resources */ = {isa = PBXBuildFile; fileRef = A795237D2215CCE400078EE5 /* bin.tar.gz */; };
1616
A799115F21C41AD500CB13B7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A799115E21C41AD500CB13B7 /* AppDelegate.swift */; };
1717
A799116321C41AD500CB13B7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A799116221C41AD500CB13B7 /* Assets.xcassets */; };
1818
A799116621C41AD500CB13B7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A799116421C41AD500CB13B7 /* Main.storyboard */; };
@@ -43,9 +43,9 @@
4343
6FF41F077014844269A8A241 /* Pods-Keychain Uninstaller.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Keychain Uninstaller.release.xcconfig"; path = "Pods/Target Support Files/Pods-Keychain Uninstaller/Pods-Keychain Uninstaller.release.xcconfig"; sourceTree = "<group>"; };
4444
A0679F4132141184C33311C6 /* Pods-Keychain Installer.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Keychain Installer.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Keychain Installer/Pods-Keychain Installer.debug.xcconfig"; sourceTree = "<group>"; };
4545
A1FECE3906833024E5D5394D /* Pods_Keychain_Uninstaller.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Keychain_Uninstaller.framework; sourceTree = BUILT_PRODUCTS_DIR; };
46+
A74663742225581F00E370A5 /* bin.tar.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = bin.tar.gz; sourceTree = "<group>"; };
4647
A776F48E21D0C92E006736C9 /* UninstallVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UninstallVC.swift; sourceTree = "<group>"; };
4748
A793A32821C2672B0061249D /* LicenseVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LicenseVC.swift; sourceTree = "<group>"; };
48-
A795237D2215CCE400078EE5 /* bin.tar.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = bin.tar.gz; sourceTree = "<group>"; };
4949
A799115C21C41AD500CB13B7 /* Keychain Uninstaller.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Keychain Uninstaller.app"; sourceTree = BUILT_PRODUCTS_DIR; };
5050
A799115E21C41AD500CB13B7 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
5151
A799116221C41AD500CB13B7 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
@@ -168,7 +168,7 @@
168168
A7E7F74321A6B0D10021ED5E /* Main.storyboard */,
169169
A7E7F74621A6B0D10021ED5E /* Info.plist */,
170170
A7E7F74721A6B0D10021ED5E /* Keychain_Installer.entitlements */,
171-
A795237D2215CCE400078EE5 /* bin.tar.gz */,
171+
A74663742225581F00E370A5 /* bin.tar.gz */,
172172
);
173173
path = "KeyChain Installer";
174174
sourceTree = "<group>";
@@ -265,7 +265,7 @@
265265
isa = PBXResourcesBuildPhase;
266266
buildActionMask = 2147483647;
267267
files = (
268-
A795237E2215CCE400078EE5 /* bin.tar.gz in Resources */,
268+
A74663752225581F00E370A5 /* bin.tar.gz in Resources */,
269269
A7E7F74221A6B0D10021ED5E /* Assets.xcassets in Resources */,
270270
A7E7F74521A6B0D10021ED5E /* Main.storyboard in Resources */,
271271
);

installer/macOS/KeyChain Installer/Base.lproj/Main.storyboard

+2-2
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@
685685
<scene sceneID="R2V-B0-nI4">
686686
<objects>
687687
<windowController id="B8D-0N-5wS" sceneMemberID="viewController">
688-
<window key="window" title="KeyChain Installer v0.18" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA">
688+
<window key="window" title="KeyChain Installer v0.19" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA">
689689
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
690690
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
691691
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
@@ -987,7 +987,7 @@
987987
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
988988
<subviews>
989989
<textView importsGraphics="NO" richText="NO" verticallyResizable="YES" baseWritingDirection="leftToRight" findStyle="bar" smartInsertDelete="YES" id="g3g-3i-3YG">
990-
<rect key="frame" x="0.0" y="-28" width="410" height="425"/>
990+
<rect key="frame" x="0.0" y="-29" width="410" height="425"/>
991991
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
992992
<color key="textColor" red="0.14118" green="0.16078000000000001" blue="0.18038999999999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
993993
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>

installer/macOS/KeyChain Installer/ProgressVC.swift

+16
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class ProgressVC: NSViewController {
4040
job.programArguments = [
4141
dataPath + "/websocketd",
4242
"--port=16384",
43+
"--passenv=HOME",
4344
"--staticdir=" + dataPath + "/examples",
4445
dataPath+"/keychain"
4546
]
@@ -100,6 +101,21 @@ class ProgressVC: NSViewController {
100101

101102
/// Function stop launchd job
102103
func stopJobs() {
104+
do {
105+
try ahLaunchCtl.stop(Consts.LABEL_JOB, in: .globalLaunchDaemon)
106+
} catch {
107+
print(error.localizedDescription)
108+
}
109+
do {
110+
try ahLaunchCtl.unload(Consts.LABEL_JOB, in: .globalLaunchDaemon)
111+
} catch {
112+
print(error.localizedDescription)
113+
}
114+
do {
115+
try ahLaunchCtl.remove(Consts.LABEL_JOB, from: .globalLaunchDaemon)
116+
} catch {
117+
print(error.localizedDescription)
118+
}
103119
do {
104120
try ahLaunchCtl.stop(Consts.LABEL_JOB, in: .userLaunchAgent)
105121
} catch {

keychain_cmd_app/main.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,20 @@
55
#include "cmd_parser.hpp"
66
#include <keychain_lib/keychain_logger.hpp>
77
#include <keychain_lib/version_info.hpp>
8-
8+
#include <iostream>
99

1010
using namespace keychain_app;
1111
namespace attrs = boost::log::attributes;
1212

1313

1414
int main(int argc, char* argv[])
1515
{
16+
// std::cout << "Start keychain" << std::endl;
1617
auto& log = logger_singleton::instance();
18+
// std::cout << "auto keychain" << std::endl;
1719

1820
BOOST_LOG_SEV(log.lg, info) << "KeyChain application started, version = " << keychain_app::version_info::version();
21+
// std::cout << "BOOST_LOG_SEV keychain" << std::endl;
1922

2023
#ifdef LINUX
2124
BOOST_LOG_SEV(log.lg, info) << "OS: Linux";
@@ -24,8 +27,11 @@ int main(int argc, char* argv[])
2427
#else
2528
BOOST_LOG_SEV(log.lg, info) << "OS: unknown";
2629
#endif
30+
// std::cout << "boost keychain" << std::endl;
2731

2832
cmd_parser cmd_parser_;
33+
// std::cout << "cmd_parser_ keychain" << std::endl;
34+
2935
return cmd_parser_.run(argc, argv);
3036
}
3137

keychain_lib/include/keychain_lib/keychain_commands.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,8 @@ struct keychain_command<command_te::sign_hex> : keychain_command_base
409409
});
410410

411411
auto reply = [&keyfiles, &params, &id](auto& message, const dev::bytes& transaction){
412-
keyfiles.add_log_record(params.public_key,
413-
keyfile_format::log_record(transaction, fc_light::time_point::now(), params.blockchain_type, params.chainid ));
412+
// keyfiles.add_log_record(params.public_key,
413+
// keyfile_format::log_record(transaction, fc_light::time_point::now(), params.blockchain_type, params.chainid ));
414414
json_response response(fc_light::variant(message), id);
415415
fc_light::variant res(response);
416416
return fc_light::json::to_string(res);
@@ -658,8 +658,8 @@ struct keychain_command<command_te::sign_hash> : keychain_command_base
658658

659659
dev::bytes hash_vec;
660660
std::copy(params.hash.begin(), params.hash.end(), std::back_inserter(hash_vec));
661-
keyfiles.add_log_record(params.public_key,
662-
keyfile_format::log_record(hash_vec, fc_light::time_point::now(), blockchain_te::rawhash, ""));
661+
// keyfiles.add_log_record(params.public_key,
662+
// keyfile_format::log_record(hash_vec, fc_light::time_point::now(), blockchain_te::rawhash, ""));
663663
json_response response(fc_light::variant(signature), id);
664664
fc_light::variant res(response);
665665
return fc_light::json::to_string(res);

keychain_lib/src/keychain_logger.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,22 @@ namespace bfs = boost::filesystem;
1919
logger_singleton::logger_singleton(std::string postfix)
2020
{
2121
#if defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
22+
// std::cout << "apple" << std::endl;
23+
// std::cin.get();
24+
// auto dir = bfs::path(getenv("HOME"));
2225
auto dir = bfs::path(getenv("HOME"));
26+
// std::cout << "dir" << dir.c_str() << std::endl;
2327
dir += bfs::path("/" LOG_DEFAULT_PATH);
28+
// std::cout << "dir1234" << dir.c_str() << std::endl;
29+
2430
#else
2531
bfs::path dir(LOG_DEFAULT_PATH);
2632
#endif
2733

2834
typedef sinks::synchronous_sink< sinks::text_file_backend > file_sink;
2935
std::string def_log_path = dir.c_str();
36+
// std::cout << "def_log_path" << def_log_path << std::endl;
37+
3038
// Create a text file sink
3139
#ifdef _WIN32
3240
if (getenv("USERPROFILE") != NULL) {
@@ -48,12 +56,15 @@ logger_singleton::logger_singleton(std::string postfix)
4856
}
4957
}
5058
#endif //_WIN32
59+
// std::cout << "d" << std::endl;
5160

5261
boost::shared_ptr< file_sink > sink(new file_sink(
5362
keywords::file_name = def_log_path + "/%Y%m%d_%H%M%S_"+postfix+".log",
5463
keywords::rotation_size = 16384,
5564
keywords::auto_flush = true
5665
));
66+
// std::cout << "shared_ptr" << std::endl;
67+
5768

5869
sink->set_formatter
5970
(
@@ -67,6 +78,7 @@ logger_singleton::logger_singleton(std::string postfix)
6778
logging::add_common_attributes();
6879

6980
logging::core::get()->add_sink(sink);
81+
// std::cout << "core" << std::endl;
7082

7183
}
7284

keymanager_mac/KeyManager/Base.lproj/Main.storyboard

+1-1
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@
10641064
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
10651065
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
10661066
<tableColumns>
1067-
<tableColumn width="116" minWidth="40" maxWidth="1000" id="Hqc-50-Bgk">
1067+
<tableColumn identifier="key1" width="116" minWidth="40" maxWidth="1000" id="Hqc-50-Bgk">
10681068
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
10691069
<font key="font" metaFont="smallSystem"/>
10701070
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>

keymanager_mac/KeyManager/ViewController.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class ViewController: NSViewController, NSTableViewDelegate, NSTableViewDataSour
2626

2727
fileprivate enum CellIdentifiers {
2828
static let LocationCell = "locationId"
29+
static let key1 = "key1"
2930
}
3031

3132
override func viewDidLoad() {
@@ -87,7 +88,8 @@ class ViewController: NSViewController, NSTableViewDelegate, NSTableViewDataSour
8788
} else if tableView == self.transactionTableView {
8889
if selectedPublicKey != "" {
8990
print("self.transactionTableView")
90-
let log = CPlusPlusBridger().getTransactionLog(forPublicKey: selectedPublicKey)
91+
let logs = CPlusPlusBridger().getTransactionLog(forPublicKey: selectedPublicKey)
92+
9193
}
9294
}
9395
return nil

0 commit comments

Comments
 (0)