MCPcopy Create free account
hub / github.com/supabase/auth / TestBcrypt

Function TestBcrypt

internal/crypto/password_test.go:156–178  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

154}
155
156func TestBcrypt(t *testing.T) {
157 // all use the `test` password
158
159 examples := []string{
160 "$2y$04$mIJxfrCaEI3GukZe11CiXublhEFanu5.ododkll1WphfSp6pn4zIu",
161 "$2y$10$srNl09aPtc2qr.0Vl.NtjekJRt/NxRxYQm3qd3OvfcKsJgVnr6.Ve",
162 }
163
164 for _, example := range examples {
165 assert.NoError(t, CompareHashAndPassword(context.Background(), example, "test"))
166 }
167
168 for _, example := range examples {
169 assert.Error(t, CompareHashAndPassword(context.Background(), example, "test1"))
170 }
171
172 negativeExamples := []string{
173 "not-a-hash",
174 }
175 for _, example := range negativeExamples {
176 assert.Error(t, CompareHashAndPassword(context.Background(), example, "test"))
177 }
178}

Callers

nothing calls this directly

Calls 2

CompareHashAndPasswordFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected