func (s *CmdTestPassphrase) Run() (err error) { defer libkb.Trace(s.G().Log, "CmdTestPassphrase.Run", func() error { return err })() protocols := []rpc.Protocol{ NewSecretUIProtocol(s.G()), } if err = RegisterProtocols(protocols); err != nil { return err } cli, err := GetAccountClient(s.G()) if err != nil { return err } arg := keybase1.PassphrasePromptArg{ GuiArg: libkb.DefaultPassphraseArg(), } res, err := cli.PassphrasePrompt(context.TODO(), arg) if err != nil { return err } res.Passphrase = "[passphrase redacted]" s.G().Log.Debug("passphrase prompt result: %+v", res) return nil }
// promptPassphrase asks the user for a passphrase. // Used during signup. func PromptPassphrase(g *libkb.GlobalContext) (keybase1.GetPassphraseRes, error) { arg := libkb.DefaultPassphraseArg(g, g.SecretStoreAll != nil) arg.WindowTitle = "Passphrase" arg.Prompt = "Pick a strong passphrase (12+ characters)" arg.Type = keybase1.PassphraseType_PASS_PHRASE return promptPassphraseWithArg(g, arg, "Please reenter your passphrase for confirmation") }
// promptNewPassphrase asks the user for a new passphrase. // Used when changing passphrases. func PromptNewPassphrase(g *libkb.GlobalContext) (string, error) { arg := libkb.DefaultPassphraseArg() arg.WindowTitle = "Pick a new passphrase" arg.Prompt = "Pick a new strong passphrase (12+ characters)" arg.Features.StoreSecret.Allow = false res, err := promptPassphraseWithArg(g, arg, "Please reenter your new passphrase for confirmation") if err != nil { return "", err } return res.Passphrase, nil }
// PromptPaperPhrase asks the user to enter a paper key phrase. // Used in `rekey paper` command. func PromptPaperPhrase(g *libkb.GlobalContext) (string, error) { arg := libkb.DefaultPassphraseArg(g, false) arg.WindowTitle = "Enter a paper key" arg.Prompt = "Enter a paper key" arg.Type = keybase1.PassphraseType_PAPER_KEY arg.Features.StoreSecret.Allow = false arg.Features.ShowTyping.Allow = true arg.Features.ShowTyping.DefaultValue = true prompter := newClientPrompter(g) res, err := libkb.GetPassphraseUntilCheck(g, arg, prompter, &libkb.PaperChecker{}) if err != nil { return "", err } return res.Passphrase, nil }
// promptPassphrase asks the user for a passphrase. // Used during signup. func PromptPassphrase(g *libkb.GlobalContext) (keybase1.GetPassphraseRes, error) { arg := libkb.DefaultPassphraseArg() arg.WindowTitle = "Passphrase" arg.Prompt = "Pick a strong passphrase (12+ characters)" return promptPassphraseWithArg(g, arg, "Please reenter your passphrase for confirmation") }