ЛР7 на 4: HTTPS, mTLS, OpenBao AppRole и ротация leaf.
Skeleton contracts / contracts (pull_request) Blocked by required conditions
Skeleton contracts / contracts (pull_request) Blocked by required conditions
Smoke/security/grade4/persistence/failover пройдены; REPORT и DEFENSE.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package studenttests_test
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"gavrilenko-sxdees/lab7/internal/credentials"
|
||||
)
|
||||
|
||||
func TestArgon2idRoundTrip(t *testing.T) {
|
||||
hash, err := credentials.HashPassword("пароль-ź")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !strings.HasPrefix(hash, "$argon2id$") {
|
||||
t.Fatalf("expected argon2id prefix, got %q", hash[:20])
|
||||
}
|
||||
if err := credentials.VerifyPassword(hash, "пароль-ź"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if credentials.VerifyPassword(hash, "wrong") == nil {
|
||||
t.Fatal("mismatch not detected")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user