1// SPDX-License-Identifier: ISC 2// Copyright (c) 2014-2020 Bitmark Inc. 3// Use of this source code is governed by an ISC 4// license that can be found in the LICENSE file. 5 6package main 7 8import ( 9 "github.com/urfave/cli" 10) 11 12func runChangePassword(c *cli.Context) error { 13 14 m := c.App.Metadata["config"].(*metadata) 15 16 // check existing password 17 name, owner, err := checkOwnerWithPasswordPrompt(c.GlobalString("identity"), m.config, c) 18 if nil != err { 19 return err 20 } 21 22 // prompt new password and confirm 23 newPassword, err := promptNewPassword() 24 if nil != err { 25 return err 26 } 27 28 err = m.config.AddIdentity(name, owner.Description, owner.Seed, newPassword) 29 if nil != err { 30 return err 31 } 32 33 m.save = true 34 return nil 35} 36