uniqueCredentials) { $attestable->json->set('excludeCredentials', $this->credentials($attestable->user)); } return $next($attestable); } /** * Returns a collection of credentials ready to be inserted into the Attestable JSON. * * @param \Laragear\WebAuthn\Contracts\WebAuthnAuthenticatable $user * @return array */ protected function credentials(WebAuthnAuthenticatable $user): array { return $user ->webAuthnCredentials() ->get(['id', 'transports']) // @phpstan-ignore-next-line ->map(static function (WebAuthnCredential $credential): array { return array_filter([ 'id'=> $credential->getKey(), 'type' => 'public-key', 'transports' => $credential->transports ]); }) ->toArray(); } }