github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/kbfs/libpages/config/utils_test.go (about)

     1  // Copyright 2018 Keybase Inc. All rights reserved.
     2  // Use of this source code is governed by a BSD
     3  // license that can be found in the LICENSE file.
     4  
     5  package config
     6  
     7  import (
     8  	"testing"
     9  
    10  	"github.com/stretchr/testify/require"
    11  	"golang.org/x/crypto/bcrypt"
    12  )
    13  
    14  func generateBcryptPasswordHashForTestOrBust(t *testing.T, password string) string {
    15  	passwordHash, err := bcrypt.GenerateFromPassword(
    16  		[]byte(password), bcrypt.MinCost)
    17  	require.NoError(t, err)
    18  	return string(passwordHash)
    19  }
    20  
    21  func generateSHA256PasswordHashForTestOrBust(t *testing.T, password string) string {
    22  	passwordHash, err := GenerateSHA256PasswordHash(password)
    23  	require.NoError(t, err)
    24  	return passwordHash
    25  }
    26  
    27  func stringPtr(str string) *string {
    28  	return &str
    29  }