public static function getSalt(): string
    {
        $result = '';

        try {
            $result = static::readSaltFromFile();
        } catch (InvalidArgumentException $e) {
            Log::warning("Failed to read salt from file");
        }

        if ($result) {
            return $result;
        }

        try {
            $salt = static::generateSalt();
            static::writeSaltToFile($salt);
            $result = static::readSaltFromFile();
        } catch (InvalidArgumentException $e) {
            throw new InvalidArgumentException("Failed to regenerate and save new salt: " . $e->getMessage(), 0, $e);
        }
        Log::warning("New salt is generated and stored.  Users might need to logout and clean their cookies.");

        return $result;
    }
public static function getSalt(): string
    {
        $result = '';

        try {
            $result = static::readSaltFromFile();
        } catch (InvalidArgumentException $e) {
            Log::warning("Failed to read salt from file");
        }

        if ($result) {
            return $result;
        }

        try {
            $salt = static::generateSalt();
            static::writeSaltToFile($salt);
            $result = static::readSaltFromFile();
        } catch (InvalidArgumentException $e) {
            throw new InvalidArgumentException("Failed to regenerate and save new salt: " . $e->getMessage(), 0, $e);
        }
        Log::warning("New salt is generated and stored.  Users might need to logout and clean their cookies.");

        return $result;
    }
public static function getSalt ( ) : string { $ result = '' ; try { $ result = static :: readSaltFromFile ( ) ; } catch ( InvalidArgumentException $ e ) { Log :: warning ( "Failed to read salt from file" ) ; } if ( $ result ) { return $ result ; } try { $ salt = static :: generateSalt ( ) ; static :: writeSaltToFile ( $ salt ) ; $ result = static :: readSaltFromFile ( ) ; } catch ( InvalidArgumentException $ e ) { throw new InvalidArgumentException ( "Failed to regenerate and save new salt: " . $ e -> getMessage ( ) , 0 , $ e ) ; } Log :: warning ( "New salt is generated and stored.  Users might need to logout and clean their cookies." ) ; return $ result ; }
Get configured salt string

If the salt was not properly configured, a new salt string
will be generated, stored, and returned.

@throws \InvalidArgumentException when cannot read or regenerate salt
@return string Salt string
Get configured salt string