本文整理汇总了Golang中github.com/robertknight/1pass/onepass.Vault.SetMasterPassword方法的典型用法代码示例。如果您正苦于以下问题:Golang Vault.SetMasterPassword方法的具体用法?Golang Vault.SetMasterPassword怎么用?Golang Vault.SetMasterPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/robertknight/1pass/onepass.Vault
的用法示例。
在下文中一共展示了Vault.SetMasterPassword方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: setPassword
func setPassword(vault *onepass.Vault, currentPwd string) {
// TODO - Prompt for hint and save that to the .password.hint file
fmt.Printf("New master password: ")
newPwd, err := terminal.ReadPassword(0)
fmt.Printf("\nRe-enter new master password: ")
newPwd2, err := terminal.ReadPassword(0)
fmt.Println()
if !bytes.Equal(newPwd, newPwd2) {
fatalErr(nil, "Passwords do not match")
}
err = vault.SetMasterPassword(currentPwd, string(newPwd))
if err != nil {
fatalErr(err, "Failed to change master password")
}
fmt.Printf("The master password has been updated.\n\n")
fmt.Printf(setPasswordSyncNote)
}