UpdateMaster takes new master passphrase, old master passphrase as string, new version as int, cipertext as string, and new ScryptParams. It returns and updated hash output string and error.
(newMaster, oldMaster string, newVersion int, ciphertext string, masterparams ScryptParams)
| 112 | |
| 113 | // UpdateMaster takes new master passphrase, old master passphrase as string, new version as int, cipertext as string, and new ScryptParams. It returns and updated hash output string and error. |
| 114 | func UpdateMaster(newMaster, oldMaster string, newVersion int, ciphertext string, masterparams ScryptParams) (pwHashOut string, err error) { |
| 115 | parts := strings.Split(ciphertext, "$") |
| 116 | if len(parts) == 10 && parts[0] == "secBoxv1" { |
| 117 | return updateMasterV1(newMaster, oldMaster, newVersion, parts, masterparams) |
| 118 | } |
| 119 | return "", ErrCiphertextFormat |
| 120 | } |
| 121 | func updateMasterV1(newMaster, oldMaster string, newVersion int, parts []string, masterparams ScryptParams) (newHash string, err error) { |
| 122 | sbpVersion := "v1" |
| 123 | // Update Secretbox Masterpass version |