code: func AskForPrivateKey(ctx context.Context, crypto backend.Crypto, name, prompt string) (string, error) {
  	if !ctxutil.IsInteractive(ctx) {
  		return "", errors.New("can not select private key without terminal")
  	}
  	if crypto == nil {
  		return "", errors.New("can not select private key without valid crypto backend")
  	}
  
  	kl, err := crypto.ListPrivateKeyIDs(gpg.WithAlwaysTrust(ctx, false))
  	if err != nil {
  		return "", err
  	}
  	if len(kl) < 1 {
  		return "", errors.New("no useable private keys found")
  	}
  
  	for i := 0; i < maxTries; i++ {
  		if !ctxutil.IsTerminal(ctx) {
  			return kl[0], nil
  		}
  		// check for context cancelation
  		select {
  		case <-ctx.Done():
  			return "", errors.New("user aborted")
  		default:
  		}
  
  		fmt.Fprintln(Stdout, prompt)
  		for i, k := range kl {
  			fmt.Fprintf(Stdout, "[%d] %s - %s\n", i, crypto.Name(), crypto.FormatKey(ctx, k))
  		}
  		iv, err := termio.AskForInt(ctx, fmt.Sprintf("Please enter the number of a key (0-%d, [q]uit)", len(kl)-1), 0)
  		if err != nil {
  			if err.Error() == "user aborted" {
  				return "", err
  			}
  
  			continue
  		}
  		if iv >= 0 && iv < len(kl) {
  			return kl[iv], nil
  		}
  	}
  	return "", errors.New("no valid user input")
  }
docs: // AskForPrivateKey promts the user to select from a list of private keys