libfic: add functions to wipe {files,hints,keys}
This commit is contained in:
parent
3713659930
commit
2c25d917b3
3 changed files with 30 additions and 0 deletions
|
|
@ -77,6 +77,16 @@ func (k Key) Delete() (int64, error) {
|
|||
}
|
||||
}
|
||||
|
||||
func (e Exercice) WipeKeys() (int64, error) {
|
||||
if res, err := DBExec("DELETE FROM exercice_keys WHERE id_exercice = ?", e.Id); err != nil {
|
||||
return 0, err
|
||||
} else if nb, err := res.RowsAffected(); err != nil {
|
||||
return 0, err
|
||||
} else {
|
||||
return nb, err
|
||||
}
|
||||
}
|
||||
|
||||
func (k Key) Check(val string) bool {
|
||||
hash := getHashedKey(val)
|
||||
if len(k.Checksum) != len(hash) {
|
||||
|
|
|
|||
Reference in a new issue