v0.0.598 prevent json marshalling of PassHash
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 2m35s

This commit is contained in:
2025-09-11 11:17:34 +02:00
parent 38467cb4e7
commit b832d77d3e
6 changed files with 53 additions and 16 deletions

View File

@@ -6,13 +6,15 @@ import (
"crypto/sha512"
"encoding/base64"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"strconv"
"strings"
"git.blackforestbytes.com/BlackForestBytes/goext/langext"
"git.blackforestbytes.com/BlackForestBytes/goext/totpext"
"golang.org/x/crypto/bcrypt"
"strconv"
"strings"
)
const LatestPassHashVersion = 5
@@ -317,6 +319,13 @@ func (ph PassHash) String() string {
return string(ph)
}
func (ph PassHash) MarshalJSON() ([]byte, error) {
if ph == "" {
return json.Marshal("")
}
return json.Marshal("*****")
}
func HashPassword(plainpass string, totpSecret []byte) (PassHash, error) {
return HashPasswordV5(plainpass, totpSecret)
}