mirror of
https://github.com/passbolt/go-passbolt-cli.git
synced 2025-07-13 05:09:09 +00:00
add the Verify command
This commit is contained in:
parent
07c02c6dba
commit
97ef59ff2c
2 changed files with 91 additions and 2 deletions
|
@ -31,11 +31,11 @@ func GetClient(ctx context.Context) (*api.Client, error) {
|
|||
fmt.Print("Enter Password:")
|
||||
bytepw, err := term.ReadPassword(int(syscall.Stdin))
|
||||
if err != nil {
|
||||
fmt.Println("\n")
|
||||
fmt.Println()
|
||||
return nil, fmt.Errorf("Reading Password: %w", err)
|
||||
}
|
||||
userPassword = string(bytepw)
|
||||
fmt.Println("\n")
|
||||
fmt.Println()
|
||||
}
|
||||
|
||||
client, err := api.NewClient(nil, "", serverAddress, userPrivateKey, userPassword)
|
||||
|
@ -45,6 +45,16 @@ func GetClient(ctx context.Context) (*api.Client, error) {
|
|||
|
||||
client.Debug = viper.GetBool("debug")
|
||||
|
||||
token := viper.GetString("serverVerifyToken")
|
||||
encToken := viper.GetString("serverVerifyEncToken")
|
||||
|
||||
if token != "" {
|
||||
err = client.VerifyServer(ctx, token, encToken)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Verifing Server: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
switch viper.GetString("mfaMode") {
|
||||
case "interactive-totp":
|
||||
client.MFACallback = func(ctx context.Context, c *api.Client, res *api.APIResponse) (http.Cookie, error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue