Skip to content

Commit

Permalink
remove deprecated features
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin committed Jul 21, 2024
1 parent 4435314 commit 4904b74
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 33 deletions.
12 changes: 0 additions & 12 deletions config/webauthn.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,18 +216,6 @@

'attestation_conveyance' => 'none',

/*
|--------------------------------------------------------------------------
| Google Safetynet ApiKey
|--------------------------------------------------------------------------
|
| Api key to use Google Safetynet.
| See https://developer.android.com/training/safetynet/attestation
|
*/

'google_safetynet_api_key' => env('GOOGLE_SAFETYNET_API_KEY'),

/*
|--------------------------------------------------------------------------
| Webauthn Public Key Credential Parameters
Expand Down
4 changes: 2 additions & 2 deletions src/Models/Casts/TrustPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace LaravelWebauthn\Models\Casts;

use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
use Symfony\Component\Serializer\SerializerInterface;
use Webauthn\TrustPath\TrustPath as TrustPathLib;
use Webauthn\TrustPath\TrustPathLoader;

/**
* @implements CastsAttributes<TrustPathLib,string>
Expand All @@ -19,7 +19,7 @@ class TrustPath implements CastsAttributes
*/
public function get($model, string $key, $value, array $attributes): ?TrustPathLib
{
return $value !== null ? TrustPathLoader::loadTrustPath(json_decode($value, true, flags: JSON_THROW_ON_ERROR)) : null;
return $value !== null ? app(SerializerInterface::class)->deserialize($value, TrustPath::class, 'json') : null;
}

/**
Expand Down
21 changes: 2 additions & 19 deletions src/WebauthnServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;
use Symfony\Component\Serializer\SerializerInterface;
use Webauthn\AttestationStatement\AndroidKeyAttestationStatementSupport;
use Webauthn\AttestationStatement\AndroidSafetyNetAttestationStatementSupport;
use Webauthn\AttestationStatement\AppleAttestationStatementSupport;
use Webauthn\AttestationStatement\AttestationObjectLoader;
use Webauthn\AttestationStatement\AttestationStatementSupportManager;
Expand Down Expand Up @@ -130,15 +129,6 @@ protected function bindWebAuthnPackage(): void
$app[CoseAlgorithmManager::class]
)
);
$this->app->bind(
AndroidSafetyNetAttestationStatementSupport::class,
fn ($app) => (new AndroidSafetyNetAttestationStatementSupport())
->enableApiVerification(
$app[ClientInterface::class],
$app['config']->get('webauthn.google_safetynet_api_key'),
$app[RequestFactoryInterface::class]
)
);
$this->app->bind(
AttestationStatementSupportManager::class,
fn ($app) => tap(new AttestationStatementSupportManager(), function ($manager) use ($app) {
Expand All @@ -157,11 +147,6 @@ protected function bindWebAuthnPackage(): void
// https://www.w3.org/TR/webauthn/#sctn-packed-attestation
$manager->add($app[PackedAttestationStatementSupport::class]);

// https://www.w3.org/TR/webauthn/#sctn-android-safetynet-attestation
if ($app['config']->get('webauthn.google_safetynet_api_key') !== null) {
$manager->add($app[AndroidSafetyNetAttestationStatementSupport::class]);
}

// https://www.w3.org/TR/webauthn/#sctn-apple-anonymous-attestation
$manager->add($app[AppleAttestationStatementSupport::class]);
})
Expand All @@ -182,10 +167,8 @@ protected function bindWebAuthnPackage(): void
$this->app->bind(
AuthenticatorAttestationResponseValidator::class,
fn ($app) => tap(new AuthenticatorAttestationResponseValidator(
$app[AttestationStatementSupportManager::class],
null,
null,
$app[ExtensionOutputCheckerHandler::class]
attestationStatementSupportManager: $app[AttestationStatementSupportManager::class],
extensionOutputCheckerHandler: $app[ExtensionOutputCheckerHandler::class]
), fn (AuthenticatorAttestationResponseValidator $responseValidator) => $responseValidator->setLogger($app['webauthn.log'])
)
);
Expand Down

0 comments on commit 4904b74

Please sign in to comment.