diff --git a/app/Http/Livewire/Auth/Auth47Component.php b/app/Http/Livewire/Auth/Auth47Component.php new file mode 100644 index 00000000..bc51f8d4 --- /dev/null +++ b/app/Http/Livewire/Auth/Auth47Component.php @@ -0,0 +1,27 @@ +k1 = bin2hex(str()->random(32)); + $this->url = 'auth47://'.$this->k1.'?c=https://einundzwanzig.eu-1.sharedwithexpose.com/auth/auth47-callback&r=https://einundzwanzig.eu-1.sharedwithexpose.com/auth/auth47-callback'; + $this->qrCode = base64_encode(QrCode::format('png') + ->size(600) + ->errorCorrection('L') + ->generate($this->url)); + } + + public function render() + { + return view('livewire.auth.auth47-component')->layout('layouts.guest'); + } +} diff --git a/app/Http/Livewire/Auth/LNUrlAuth.php b/app/Http/Livewire/Auth/LNUrlAuth.php index fbf88ab8..72e8bf62 100644 --- a/app/Http/Livewire/Auth/LNUrlAuth.php +++ b/app/Http/Livewire/Auth/LNUrlAuth.php @@ -29,7 +29,11 @@ class LNUrlAuth extends Component public function mount() { $this->k1 = bin2hex(str()->random(32)); - $this->url = url('/api/lnurl-auth-callback?tag=login&k1='.$this->k1.'&action=login'); + if (app()->environment('local')) { + $this->url = 'https://einundzwanzig.eu-1.sharedwithexpose.com/api/lnurl-auth-callback?tag=login&k1='.$this->k1.'&action=login'; + } else { + $this->url = url('/api/lnurl-auth-callback?tag=login&k1='.$this->k1.'&action=login'); + } $this->lnurl = lnurl\encodeUrl($this->url); $this->qrCode = base64_encode(QrCode::format('png') ->size(300) diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php index 4e5ab298..ca7eda7e 100644 --- a/app/Http/Middleware/VerifyCsrfToken.php +++ b/app/Http/Middleware/VerifyCsrfToken.php @@ -13,5 +13,6 @@ class VerifyCsrfToken extends Middleware */ protected $except = [ 'horizon/*', + 'auth/auth47-callback', ]; } diff --git a/composer.lock b/composer.lock index dd407ec9..e0b1b793 100644 --- a/composer.lock +++ b/composer.lock @@ -760,16 +760,16 @@ }, { "name": "doctrine/dbal", - "version": "3.5.3", + "version": "3.5.4", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "88fa7e5189fd5ec6682477044264dc0ed4e3aa1e" + "reference": "e0021572bcb343e6fa51bbed8280392c863e1750" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/88fa7e5189fd5ec6682477044264dc0ed4e3aa1e", - "reference": "88fa7e5189fd5ec6682477044264dc0ed4e3aa1e", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/e0021572bcb343e6fa51bbed8280392c863e1750", + "reference": "e0021572bcb343e6fa51bbed8280392c863e1750", "shasum": "" }, "require": { @@ -782,11 +782,12 @@ "psr/log": "^1|^2|^3" }, "require-dev": { - "doctrine/coding-standard": "11.0.0", + "doctrine/coding-standard": "11.1.0", + "fig/log-test": "^1", "jetbrains/phpstorm-stubs": "2022.3", - "phpstan/phpstan": "1.9.4", + "phpstan/phpstan": "1.9.14", "phpstan/phpstan-strict-rules": "^1.4", - "phpunit/phpunit": "9.5.27", + "phpunit/phpunit": "9.6.3", "psalm/plugin-phpunit": "0.18.4", "squizlabs/php_codesniffer": "3.7.1", "symfony/cache": "^5.4|^6.0", @@ -851,7 +852,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/3.5.3" + "source": "https://github.com/doctrine/dbal/tree/3.5.4" }, "funding": [ { @@ -867,7 +868,7 @@ "type": "tidelift" } ], - "time": "2023-01-12T10:21:44+00:00" + "time": "2023-02-07T19:48:47+00:00" }, { "name": "doctrine/deprecations", @@ -2014,6 +2015,90 @@ ], "time": "2022-10-26T14:07:24+00:00" }, + { + "name": "guzzlehttp/uri-template", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/uri-template.git", + "reference": "b945d74a55a25a949158444f09ec0d3c120d69e2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/uri-template/zipball/b945d74a55a25a949158444f09ec0d3c120d69e2", + "reference": "b945d74a55a25a949158444f09ec0d3c120d69e2", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "symfony/polyfill-php80": "^1.17" + }, + "require-dev": { + "phpunit/phpunit": "^8.5.19 || ^9.5.8", + "uri-template/tests": "1.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\UriTemplate\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + } + ], + "description": "A polyfill class for uri_template of PHP", + "keywords": [ + "guzzlehttp", + "uri-template" + ], + "support": { + "issues": "https://github.com/guzzle/uri-template/issues", + "source": "https://github.com/guzzle/uri-template/tree/v1.0.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/uri-template", + "type": "tidelift" + } + ], + "time": "2021-10-07T12:57:01+00:00" + }, { "name": "http-interop/http-factory-guzzle", "version": "1.2.0", @@ -2702,16 +2787,16 @@ }, { "name": "laravel/framework", - "version": "v9.50.2", + "version": "v9.51.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "39932773c09658ddea9045958f305e67f9304995" + "reference": "b81123134349a013a738a9f7f715c6ce99d5a414" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/39932773c09658ddea9045958f305e67f9304995", - "reference": "39932773c09658ddea9045958f305e67f9304995", + "url": "https://api.github.com/repos/laravel/framework/zipball/b81123134349a013a738a9f7f715c6ce99d5a414", + "reference": "b81123134349a013a738a9f7f715c6ce99d5a414", "shasum": "" }, "require": { @@ -2719,9 +2804,15 @@ "doctrine/inflector": "^2.0.5", "dragonmantank/cron-expression": "^3.3.2", "egulias/email-validator": "^3.2.1|^4.0", + "ext-ctype": "*", + "ext-filter": "*", + "ext-hash": "*", "ext-mbstring": "*", "ext-openssl": "*", + "ext-session": "*", + "ext-tokenizer": "*", "fruitcake/php-cors": "^1.2", + "guzzlehttp/uri-template": "^1.0", "laravel/serializable-closure": "^1.2.2", "league/commonmark": "^2.2.1", "league/flysystem": "^3.8.0", @@ -2793,6 +2884,7 @@ "ably/ably-php": "^1.0", "aws/aws-sdk-php": "^3.235.5", "doctrine/dbal": "^2.13.3|^3.1.4", + "ext-gmp": "*", "fakerphp/faker": "^1.21", "guzzlehttp/guzzle": "^7.5", "league/flysystem-aws-s3-v3": "^3.0", @@ -2815,10 +2907,13 @@ "aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage, and SES mail driver (^3.235.5).", "brianium/paratest": "Required to run tests in parallel (^6.0).", "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.13.3|^3.1.4).", + "ext-apcu": "Required to use the APC cache driver.", + "ext-fileinfo": "Required to use the Filesystem class.", "ext-ftp": "Required to use the Flysystem FTP driver.", "ext-gd": "Required to use Illuminate\\Http\\Testing\\FileFactory::image().", "ext-memcached": "Required to use the memcache cache driver.", - "ext-pcntl": "Required to use all features of the queue worker.", + "ext-pcntl": "Required to use all features of the queue worker and console signal trapping.", + "ext-pdo": "Required to use all database features.", "ext-posix": "Required to use all features of the queue worker.", "ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).", "fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).", @@ -2886,20 +2981,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-02-02T20:52:46+00:00" + "time": "2023-02-07T15:37:18+00:00" }, { "name": "laravel/horizon", - "version": "v5.14.0", + "version": "v5.14.1", "source": { "type": "git", "url": "https://github.com/laravel/horizon.git", - "reference": "29da5dcf055c084502e61e84c1070252e8a2ceb8" + "reference": "a990617de27700df73841f6ccaff46e09ba9ec3f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/horizon/zipball/29da5dcf055c084502e61e84c1070252e8a2ceb8", - "reference": "29da5dcf055c084502e61e84c1070252e8a2ceb8", + "url": "https://api.github.com/repos/laravel/horizon/zipball/a990617de27700df73841f6ccaff46e09ba9ec3f", + "reference": "a990617de27700df73841f6ccaff46e09ba9ec3f", "shasum": "" }, "require": { @@ -2961,22 +3056,22 @@ ], "support": { "issues": "https://github.com/laravel/horizon/issues", - "source": "https://github.com/laravel/horizon/tree/v5.14.0" + "source": "https://github.com/laravel/horizon/tree/v5.14.1" }, - "time": "2023-01-27T11:08:41+00:00" + "time": "2023-02-07T14:56:05+00:00" }, { "name": "laravel/jetstream", - "version": "v2.16.0", + "version": "v2.16.1", "source": { "type": "git", "url": "https://github.com/laravel/jetstream.git", - "reference": "ab711bf1ddba2d9af257350eeb0412e6e9d46452" + "reference": "16cafeb0965c7332c8cda8d63a965e887ddab334" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/jetstream/zipball/ab711bf1ddba2d9af257350eeb0412e6e9d46452", - "reference": "ab711bf1ddba2d9af257350eeb0412e6e9d46452", + "url": "https://api.github.com/repos/laravel/jetstream/zipball/16cafeb0965c7332c8cda8d63a965e887ddab334", + "reference": "16cafeb0965c7332c8cda8d63a965e887ddab334", "shasum": "" }, "require": { @@ -3033,7 +3128,7 @@ "issues": "https://github.com/laravel/jetstream/issues", "source": "https://github.com/laravel/jetstream" }, - "time": "2023-01-18T23:01:15+00:00" + "time": "2023-02-03T14:19:22+00:00" }, { "name": "laravel/legacy-factories", @@ -14716,23 +14811,24 @@ }, { "name": "laravel/sail", - "version": "v1.19.0", + "version": "v1.20.0", "source": { "type": "git", "url": "https://github.com/laravel/sail.git", - "reference": "4f230634a3163f3442def6a4e6ffdb02b02e14d6" + "reference": "65dc0556d5809f47f7c39267df4e93f3cc59c512" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/sail/zipball/4f230634a3163f3442def6a4e6ffdb02b02e14d6", - "reference": "4f230634a3163f3442def6a4e6ffdb02b02e14d6", + "url": "https://api.github.com/repos/laravel/sail/zipball/65dc0556d5809f47f7c39267df4e93f3cc59c512", + "reference": "65dc0556d5809f47f7c39267df4e93f3cc59c512", "shasum": "" }, "require": { "illuminate/console": "^8.0|^9.0|^10.0", "illuminate/contracts": "^8.0|^9.0|^10.0", "illuminate/support": "^8.0|^9.0|^10.0", - "php": "^7.3|^8.0" + "php": "^7.3|^8.0", + "symfony/yaml": "^6.0" }, "bin": [ "bin/sail" @@ -14772,7 +14868,7 @@ "issues": "https://github.com/laravel/sail/issues", "source": "https://github.com/laravel/sail" }, - "time": "2023-01-31T13:37:57+00:00" + "time": "2023-02-05T15:12:03+00:00" }, { "name": "mockery/mockery", diff --git a/resources/views/livewire/auth/auth47-component.blade.php b/resources/views/livewire/auth/auth47-component.blade.php new file mode 100644 index 00000000..1f188fab --- /dev/null +++ b/resources/views/livewire/auth/auth47-component.blade.php @@ -0,0 +1,14 @@ +
+
+
+
+ + qrcode + +
+ + {{ $this->url }} + +
+
+
diff --git a/routes/web.php b/routes/web.php index 9d83d917..3e408bb9 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,5 +1,6 @@ get('/', \App\Http\Livewire\Frontend\Welcome::class) ->name('welcome'); +Route::get('auth/auth47', \App\Http\Livewire\Auth\Auth47Component::class) + ->name('auth.auth47'); + +Route::post('auth/auth47-callback', function (Request $request) { + $auth47Version = $request->auth47_response; + $challenge = $request->challenge; + $signature = $request->signature; + $nym = $request->nym; +}) + ->name('auth.auth47.callback'); + Route::middleware([]) ->get('/news', \App\Http\Livewire\News\ArticleOverview::class) ->name('article.overview');