Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cfa5c51

Browse files
Merge branch 'master' into key_file_singleton
# Conflicts: # keychain_linux/passentry_cmd/sec_mod_linux.cpp
2 parents d10753f + 3219bce commit cfa5c51

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1942
-133
lines changed

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css">
99

1010
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
11-
[![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=A%20good,%20solid%20app%20to%20keep%20your%20keys%20safe.&url=https://keychain.array.io/&via=ProjectArray&hashtags=cybersecurity,private,cryptography,blockchain,app) <a class="btn btn-info btn-sm" href="https://avvrik.github.io/KeyChain/" type="button">Documentation</a>
12-
<a class="btn btn-info btn-sm" href="https://github.com/arrayio/array-io-keychain/releases/download/0.11/KeyChain.Installer.v0.11.zip" type="button">Download</a>
13-
<a class="btn btn-info btn-sm" href="https://keychain.array.io/" type="button">Website</a> [![Contributions welcome](https://img.shields.io/badge/contributions-welcome-orange.svg)](https://github.com/arrayio/array-io-keychain#contributing-to-the-project)
11+
[![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=A%20good,%20solid%20app%20to%20keep%20your%20keys%20safe.&url=https://keychain.array.io/&via=ProjectArray&hashtags=cybersecurity,private,cryptography,blockchain,app) [![Contributions welcome](https://img.shields.io/badge/contributions-welcome-orange.svg)](https://github.com/arrayio/array-io-keychain#contributing-to-the-project)
1412
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/arrayio/array-io-keychain/blob/master/LICENSE.md) [![npm version](https://badge.fury.io/js/web3override.svg)](https://badge.fury.io/js/web3override)
1513

14+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
15+
<a class="btn btn-info btn-sm" href="https://avvrik.github.io/KeyChain/" type="button">Documentation</a>
16+
<a class="btn btn-info btn-sm" href="https://github.com/arrayio/array-io-keychain/releases/download/0.11/KeyChain.Installer.v0.11.zip" type="button">Download for macOS</a>
17+
<a class="btn btn-info btn-sm" href="https://github.com/arrayio/array-io-keychain/releases/download/0.13/keychain.msi" type="button">Download for Windows</a> <a class="btn btn-info btn-sm" href="https://keychain.array.io/" type="button">Website</a>
1618

1719

1820
## Overview
@@ -32,7 +34,7 @@
3234

3335
## Installation
3436

35-
Download and install KeyChain for [macOS](https://github.com/arrayio/array-io-keychain/releases/download/0.11/KeyChain.Installer.v0.11.zip). Windows and Linux installers are coming soon.
37+
Download and install KeyChain for [macOS](https://github.com/arrayio/array-io-keychain/releases/download/0.11/KeyChain.Installer.v0.11.zip) and [Windows](https://github.com/arrayio/array-io-keychain/releases/download/0.13/keychain.msi). Linux installer is coming soon.
3638

3739
*Try out KeyChain on the [demo page](https://arrayio.github.io/array-io-keychain/demo/).*
3840

@@ -48,7 +50,7 @@ You can find comprehensive installation guides for [macOS](https://github.com/ar
4850

4951
After you have installed [KeyChain](https://github.com/arrayio/array-io-keychain/releases/download/0.11/KeyChain.Installer.v0.11.zip), you can start using it with web3. Just follow these simple steps.
5052

51-
1. Install `web3override` library https://www.npmjs.com/package/web3override
53+
1. Install `web3override` library from this [source](https://www.npmjs.com/package/web3override).
5254

5355
```
5456
npm i --save web3override
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
//
2+
// UninstallerManager.swift
3+
// KeyChain Installer
4+
//
5+
// Created by Mikhail Lutskiy on 19/12/2018.
6+
// Copyright © 2018 Mikhail Lutskii. All rights reserved.
7+
//
8+
9+
import Foundation
10+
import AHLaunchCtl
11+
12+
enum UninstallerManagerSteps {
13+
case autoRunProcess
14+
case webSocketBinary
15+
case keyChainBinary
16+
case keyChainResources
17+
case keyChainExamples
18+
case keyChainLogs
19+
case keyChainKeys
20+
case keyChainDir
21+
}
22+
23+
protocol UninstallerManagerDelegate {
24+
func endOfStep(_ step: UninstallerManagerSteps)
25+
func successfullyUninstall()
26+
func failOfStep(_ step: UninstallerManagerSteps)
27+
}
28+
29+
extension UninstallerManagerDelegate {
30+
func endOfStep(_ step: UninstallerManagerSteps) {}
31+
func successfullyUninstall() {}
32+
func failOfStep(_ step: UninstallerManagerSteps) {}
33+
}
34+
35+
class UninstallerManager {
36+
37+
static let shared = UninstallerManager()
38+
39+
var delegate: UninstallerManagerDelegate?
40+
41+
let fileManager = FileManager.default
42+
43+
var isDeleteKeys = false
44+
45+
let ahLaunchCtl = AHLaunchCtl()
46+
47+
func launch () {
48+
ahLaunchCtl.authorize()
49+
print(fileManager.currentDirectoryPath)
50+
predictKeychainPath(success: { (path) in
51+
self.deleteForKeyChainPath(path)
52+
}) {
53+
self.deleteForKeyChainPath(self.fileManager.currentDirectoryPath)
54+
}
55+
disableAutoRunProcess()
56+
deleteKeyChainKeys()
57+
delegate?.successfullyUninstall()
58+
}
59+
60+
func deleteForKeyChainPath(_ path: String) {
61+
deleteWebSocketBinary(path: path)
62+
deleteKeyChainBinary(path: path)
63+
deleteKeyChainResources(path: path)
64+
deleteKeyChainExamples(path: path)
65+
deleteKeyChainLogs(path: path)
66+
deleteFile(path, step: .keyChainDir)
67+
}
68+
69+
func predictKeychainPath (success: @escaping(_ path: String) -> Void, fail:@escaping() -> Void) {
70+
AppleScriptManager.runScriptWithBodyWithReturnString("ps -ax -o command | grep websocket | grep -v grep", success: { (result) in
71+
let subcmd = result.components(separatedBy: " ")
72+
let path = subcmd.first?.replacingOccurrences(of: "/websocketd", with: "") ?? ""
73+
if path != "" {
74+
success(path)
75+
} else {
76+
fail()
77+
}
78+
print(path)
79+
}) { (error) in
80+
print(error)
81+
fail()
82+
}
83+
}
84+
85+
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+
}
101+
}
102+
103+
func deleteWebSocketBinary (path: String) {
104+
deleteFile(path + "/websocketd", step: .webSocketBinary)
105+
}
106+
107+
func deleteKeyChainBinary (path: String) {
108+
deleteFile(path + "/keychain", step: .webSocketBinary)
109+
}
110+
111+
func deleteKeyChainResources (path: String) {
112+
deleteFile(path + "/resources", step: .webSocketBinary)
113+
}
114+
115+
func deleteKeyChainExamples (path: String) {
116+
deleteFile(path + "/examples", step: .webSocketBinary)
117+
}
118+
119+
func deleteKeyChainLogs (path: String) {
120+
deleteFile(path + "/log.txt", step: .webSocketBinary)
121+
deleteFile(path + "/out.txt", step: .webSocketBinary)
122+
}
123+
124+
func deleteKeyChainKeys () {
125+
if isDeleteKeys {
126+
AppleScriptManager.runScriptWithBody("rm -rf /var/keychain", isAdminRequired: true)
127+
}
128+
}
129+
130+
func deleteFile (_ file: String, step: UninstallerManagerSteps) {
131+
if fileManager.fileExists(atPath: file) {
132+
do {
133+
try fileManager.removeItem(atPath: file)
134+
delegate?.endOfStep(step)
135+
} catch let error as NSError {
136+
print(error)
137+
delegate?.failOfStep(step)
138+
}
139+
} else {
140+
delegate?.failOfStep(step)
141+
}
142+
}
143+
144+
}

0 commit comments

Comments
 (0)