Skip to content

Commit d070345

Browse files
committed
wip passkeys
1 parent 6c4dda6 commit d070345

33 files changed

Lines changed: 1950 additions & 341 deletions

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"pestphp/pest-plugin-laravel": "^3.0|^4.0",
4444
"phpunit/phpunit": "^11.0|^12.0",
4545
"spatie/laravel-ray": "^1.26",
46+
"spatie/laravel-passkeys": "^1.0",
4647
"spatie/laravel-typescript-transformer": "^2.3",
4748
"spatie/typescript-transformer": "^2.2"
4849
},

demo/app/Models/User.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
use Illuminate\Database\Eloquent\Relations\MorphOne;
88
use Illuminate\Foundation\Auth\User as Authenticatable;
99
use Illuminate\Notifications\Notifiable;
10+
use Spatie\LaravelPasskeys\Models\Concerns\HasPasskeys;
11+
use Spatie\LaravelPasskeys\Models\Concerns\InteractsWithPasskeys;
1012

11-
class User extends Authenticatable
13+
class User extends Authenticatable implements HasPasskeys
1214
{
1315
use HasFactory;
16+
use InteractsWithPasskeys;
1417
use Notifiable;
1518

1619
protected $guarded = [];

demo/app/Providers/DemoSharpServiceProvider.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ protected function configureSharp(SharpConfigBuilder $config): void
2323
->setSharpMenu(SharpMenu::class)
2424
->setThemeColor('#004c9b')
2525
->setThemeLogo(logoUrl: '/img/sharp/logo.svg', logoHeight: '1rem', faviconUrl: '/img/sharp/favicon-32x32.png')
26-
->enableImpersonation()
26+
// ->enableImpersonation()
2727
->enableForgottenPassword()
2828
->setAuthCustomGuard('web')
29+
->enable2faCustom(Demo2faNotificationHandler::class)
30+
->enableLoginRateLimiting(maxAttempts: 3)
31+
->enablePasskeys()
2932
->setLoginAttributes('email', 'password')
3033
->setUserDisplayAttribute('name')
3134
->setUserAvatarAttribute(fn () => auth()->user()->avatar?->thumbnail(200))
32-
->enable2faCustom(Demo2faNotificationHandler::class)
33-
->enableLoginRateLimiting(maxAttempts: 3)
3435
->suggestRememberMeOnLoginForm()
3536
->appendMessageOnLoginForm(view('sharp._login-page-message'))
3637
->enableGlobalSearch(AppSearchEngine::class, 'Search for posts or authors...')

demo/app/Sharp/Profile/ProfileSingleShow.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
use App\Sharp\Profile\Commands\Activate2faCommand;
66
use App\Sharp\Profile\Commands\ChangePasswordCommand;
77
use App\Sharp\Profile\Commands\Deactivate2faCommand;
8+
use Code16\Sharp\Auth\Passkeys\PasskeyEntity;
9+
use Code16\Sharp\Show\Fields\SharpShowEntityListField;
810
use Code16\Sharp\Show\Fields\SharpShowPictureField;
911
use Code16\Sharp\Show\Fields\SharpShowTextField;
1012
use Code16\Sharp\Show\Layout\ShowLayout;
@@ -25,6 +27,9 @@ protected function buildShowFields(FieldsContainer $showFields): void
2527
)
2628
->addField(
2729
SharpShowPictureField::make('avatar'),
30+
)
31+
->addField(
32+
SharpShowEntityListField::make(PasskeyEntity::class)
2833
);
2934
}
3035

@@ -35,7 +40,8 @@ protected function buildShowLayout(ShowLayout $showLayout): void
3540
$section
3641
->addColumn(6, fn (ShowLayoutColumn $column) => $column->withField('email'))
3742
->addColumn(6, fn (ShowLayoutColumn $column) => $column->withField('avatar'));
38-
});
43+
})
44+
->addEntityListSection(PasskeyEntity::class);
3945
}
4046

4147
public function buildShowConfig(): void

demo/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"masterminds/html5": "^2.9",
1717
"pragmarx/google2fa": "^8.0",
1818
"spatie/image-optimizer": "^1.7",
19+
"spatie/laravel-passkeys": "^1.6",
1920
"spatie/laravel-translatable": "^6.13",
2021
"symfony/html-sanitizer": "^7.3",
2122
"technikermathe/blade-lucide-icons": "dev-l13-compatibility",

0 commit comments

Comments
 (0)