readMasterKey reads the password of private key from terminal
(skip bool)
| 152 | |
| 153 | // readMasterKey reads the password of private key from terminal |
| 154 | func readMasterKey(skip bool) string { |
| 155 | if skip { |
| 156 | return "" |
| 157 | } |
| 158 | fmt.Println("Enter master key(press Enter for default: \"\"): ") |
| 159 | bytePwd, err := terminal.ReadPassword(int(syscall.Stdin)) |
| 160 | fmt.Println() |
| 161 | if err != nil { |
| 162 | ConsoleLog.Errorf("read master key failed: %v", err) |
| 163 | SetExitStatus(1) |
| 164 | Exit() |
| 165 | } |
| 166 | return string(bytePwd) |
| 167 | } |
| 168 | |
| 169 | func getPublicFromConfig() *asymmetric.PublicKey { |
| 170 | configFile = utils.HomeDirExpand(configFile) |
no test coverage detected