PHP code example of hamzi / vaultic
1. Go to this page and download the library: Download hamzi/vaultic library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hamzi / vaultic example snippets
// config/vaultic.php
'cache' => [
'store' => config('cache.default', 'file'), // Uses your app's default cache store
'prefix' => 'vaultic:challenge:',
'ttl' => 300,
],
'auth' => [
'default_guard' => 'web',
'guards' => [
'web' => [
'guard' => 'web',
'provider_model' => App\Models\User::class,
'identifier_column' => 'email',
],
'api' => [
'guard' => 'sanctum',
'provider_model' => App\Models\User::class,
'identifier_column' => 'email',
'token_issuer' => Hamzi\Vaultic\Services\SanctumApiTokenIssuer::class,
],
],
],
'rate_limit' => [
'attempts' => 10,
'decay_seconds' => 60,
],
'resident_key' => '
$this->app->bind(
Hamzi\Vaultic\Contracts\WebAuthnVerifier::class,
App\Security\MyWebAuthnVerifier::class
);
$this->app->bind(
Hamzi\Vaultic\Contracts\ApiTokenIssuer::class,
App\Auth\IssueVaulticToken::class
);
'auth' => [
'guards' => [
'api' => [
'guard' => 'sanctum',
'provider_model' => App\Models\User::class,
'identifier_column' => 'email',
'stateful' => false,
'token_issuer' => Hamzi\Vaultic\Services\SanctumApiTokenIssuer::class,
],
],
],
Route::middleware(['auth', 'passkey., function () {
return 'ok';
});
});
bash
php artisan vendor:publish --provider="Hamzi\\Vaultic\\VaulticServiceProvider" --tag=vaultic-config
php artisan vendor:publish --provider="Hamzi\\Vaultic\\VaulticServiceProvider" --tag=vaultic-migrations
php artisan vendor:publish --provider="Hamzi\\Vaultic\\VaulticServiceProvider" --tag=vaultic-views
php artisan migrate