Skip to content

Commit 96e91cd

Browse files
authored
Here we go
Fixed the testing issue and changed menu again.
1 parent 1dbb54f commit 96e91cd

File tree

1 file changed

+32
-16
lines changed

1 file changed

+32
-16
lines changed

main.go

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
var englishTxt embed.FS
2626

2727

28-
2928
func main() {
3029
if !checkKeycardBinaryExists() {
3130
fmt.Println("Keycard binary not found. Downloading...")
@@ -70,7 +69,26 @@ func main() {
7069
case "3":
7170
qr()
7271

72+
7373
case "4":
74+
fmt.Println("Installing Dependencies...")
75+
keycard_link.JavaDependency()
76+
keycard_link.GlobalPlatformDependency()
77+
78+
case "5":
79+
fmt.Println("Installing Keycard...")
80+
err := keycard_link.InstallKeycard()
81+
if err != nil {
82+
fmt.Println("Error installing keycard:", err)
83+
}
84+
85+
case "6":
86+
fmt.Println("Running Connection test to the IPFS Network.")
87+
cid := "bafkreie7ohywtosou76tasm7j63yigtzxe7d5zqus4zu3j6oltvgtibeom" // Welcome to IPFS CID
88+
runIPFSTestWithViu(cid)
89+
90+
91+
case "7":
7492
err := art_link.PrintFileSlowly("apexflexflexsecure.txt")
7593
if err != nil {
7694
fmt.Println("Error displaying ASCII art:", err)
@@ -79,20 +97,13 @@ func main() {
7997
fmt.Println("Exiting...")
8098
os.Exit(0)
8199

82-
83-
case "5":
84-
cid := "bafkreie7ohywtosou76tasm7j63yigtzxe7d5zqus4zu3j6oltvgtibeom" // Replace with actual CID
85-
runIPFSTestWithViu(cid)
86-
87-
88100
default:
89101
fmt.Println("Invalid option, please try again.")
90102
}
91103
}
92104
}
93105

94106

95-
96107
func qr(){
97108

98109
data, err := os.ReadFile("log_CID.log")
@@ -119,19 +130,23 @@ func qr(){
119130

120131

121132
func menu() (string, error) {
133+
122134
err := art_link.PrintFileSlowly("ipfs.txt")
123135
if err != nil {
124136
fmt.Println("Error displaying ASCII art:", err)
125137
}
138+
126139
fmt.Println("---------------------------------------------")
127-
fmt.Println("IPFS-Secure | NFC Interface for IPFS ")
140+
fmt.Println("IPFS-Secure | NFC Interface for IPFS")
128141
fmt.Println("=============================================")
129-
fmt.Println("What would you like to do? Select 1, 2, or 3")
130-
fmt.Println("1. Encrypt / upload sensitive data to IPFS.")
131-
fmt.Println("2. Decrypt / pull file with CID.")
132-
fmt.Println("3. Print CID Log to QR code.")
133-
fmt.Println("4. Exit.")
134-
fmt.Println("5. Run IPFS Connection test.")
142+
fmt.Println(" What would you like to do?")
143+
fmt.Println("1. Encrypt / upload sensitive data to IPFS")
144+
fmt.Println("2. Decrypt / pull file with CID")
145+
fmt.Println("3. Print CID Log to QR code")
146+
fmt.Println("4. Install Dependencies (Java, GPP)")
147+
fmt.Println("5. Install Keycard onto Implant")
148+
fmt.Println("6. Run Connection Test to IPFS")
149+
fmt.Println("7. Exit the Program")
135150
fmt.Println("=============================================")
136151
return generalAskUser("Enter your choice: ")
137152
}
@@ -173,6 +188,7 @@ func checkAndInstallViu() error {
173188
cmd := exec.Command("sudo", "apt-get", "install", "viu", "-y")
174189
cmd.Stdout = os.Stdout
175190
cmd.Stderr = os.Stderr
191+
fmt.Println("\n If this fails, install viu according to your system :) It should be a standard package.. ")
176192
return cmd.Run()
177193
}
178194
return nil
@@ -211,14 +227,14 @@ func performBasicIPFSTests() error {
211227
return nil
212228
}
213229

214-
// executeIPFSCommand executes an IPFS command and returns any errors.
215230
func executeIPFSCommand(args ...string) error {
216231
cmd := exec.Command("ipfs", args...)
217232
cmd.Stdout = os.Stdout
218233
cmd.Stderr = os.Stderr
219234
return cmd.Run()
220235
}
221236

237+
222238
func downloadKeycardBinary() error {
223239
url := "https://github.com/status-im/keycard-cli/releases/download/0.7.0/keycard-linux-amd64"
224240
response, err := http.Get(url)

0 commit comments

Comments
 (0)