Chrisbjr\ApiGuard\Repositories\ApiKeyRepository::generateKey PHP Метод

generateKey() публичный статический Метод

A sure method to generate a unique API key
public static generateKey ( ) : string
Результат string
    public static function generateKey()
    {
        do {
            $salt = sha1(time() . mt_rand());
            $newKey = substr($salt, 0, 40);
        } while (self::keyExists($newKey));
        return $newKey;
    }