func clipboard(mmi ui.UserInteraction, out io.Reader, barrier chan error) { buffer := &bytes.Buffer{} n, err := buffer.ReadFrom(out) if err != nil { barrier <- err return } name := string(buffer.Bytes()[:n-1]) err = mmi.XclipPassword(name) if err == nil { err = io.EOF } barrier <- err return }
func readNewMaster(mmi ui.UserInteraction, reason string) (result string, err error) { var pass1, pass2, text string text = fmt.Sprintf("%s,\nplease enter an encryption phrase.", reason) for result == "" { pass1, err = mmi.ReadPassword(text) if err != nil { return } pass2, err = mmi.ReadPassword("Please enter the same encryption phrase again.") if err != nil { return } if pass1 == pass2 { result = pass1 } else { text = fmt.Sprintf("Your phrases did not match.\n%s,\nplease enter an encryption phrase.", reason) } } return }