libfic: add functions to wipe {files,hints,keys}

This commit is contained in:
nemunaire 2017-12-09 00:52:43 +01:00 committed by nemunaire
commit 2c25d917b3
3 changed files with 30 additions and 0 deletions

View file

@ -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) {