-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Add VerifyDatabasePasswordV2 and deprecate VerifyDatabasePassword
- Loading branch information
Showing
3 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package requests | ||
|
||
import ( | ||
"errors" | ||
) | ||
|
||
// VerifyDatabasePasswordV2 represents a request to verify the database password. | ||
type VerifyDatabasePasswordV2 struct { | ||
// KeyUID identifies the specific key in the database. | ||
KeyUID string `json:"keyUID"` | ||
|
||
// Password is the password to verify against the database entry. | ||
Password string `json:"password"` | ||
} | ||
|
||
// Validate checks the validity of the VerifyDatabasePasswordV2 request. | ||
func (v *VerifyDatabasePasswordV2) Validate() error { | ||
if v.KeyUID == "" { | ||
return errors.New("verify-database-password-v2: KeyUID cannot be empty") | ||
} | ||
if v.Password == "" { | ||
return errors.New("verify-database-password-v2: Password cannot be empty") | ||
} | ||
return nil | ||
} |