本文整理匯總了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)
}