func (a *Application) HashSecret() error {
	// check length
	if len(a.Secret) == 0 {
		return nil
	}

	// generate hash from password
	hash, err := bcrypt.GenerateFromPassword([]byte(a.Secret), bcrypt.DefaultCost)
	if err != nil {
		return err
	}

	// save hash
	a.SecretHash = hash

	// clear password
	a.Secret = ""

	return nil
}
func (a *Application) HashSecret() error {
	
	if len(a.Secret) == 0 {
		return nil
	}

	
	hash, err := bcrypt.GenerateFromPassword([]byte(a.Secret), bcrypt.DefaultCost)
	if err != nil {
		return err
	}

	
	a.SecretHash = hash

	
	a.Secret = ""

	return nil
}
func ( a * Application ) HashSecret ( ) error { // check length if len ( a . Secret ) == 0 { return nil } // generate hash from password hash , err := bcrypt . GenerateFromPassword ( [ ] byte ( a . Secret ) , bcrypt . DefaultCost ) if err != nil { return err } // save hash a . SecretHash = hash // clear password a . Secret = " " return nil }
// HashSecret will hash Secret and set SecretHash.
HashSecret will hash Secret and set SecretHash .