CoreFiles by mySites.guru
PublicKeyCredential.php65 lines, 1,384 bytes, from Joomla_4.2.7-Stable-Full_Package.zip
Raw History Compare with 4.2.6
md5
07c43792bfdd0b194b70a699566e2c26
sha1
c0afe15a65af79b63abd3b81487e718b48e6da69
sha256
f3531b7246bfda7c0fa5a60dca8dc3dd9dd0cdeb655ab6aac4206dbc2c25b719
<?php

declare(strict_types=1);

/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2014-2019 Spomky-Labs
 *
 * This software may be modified and distributed under the terms
 * of the MIT license.  See the LICENSE file for details.
 */

namespace Webauthn;

use Assert\Assertion;

/**
 * @see https://www.w3.org/TR/webauthn/#iface-pkcredential
 */
class PublicKeyCredential extends Credential
{
    /**
     * @var string
     */
    protected $rawId;

    /**
     * @var AuthenticatorResponse
     */
    protected $response;

    public function __construct(string $id, string $type, string $rawId, AuthenticatorResponse $response)
    {
        parent::__construct($id, $type);
        $this->rawId = $rawId;
        $this->response = $response;
    }

    public function getRawId(): string
    {
        return $this->rawId;
    }

    public function getResponse(): AuthenticatorResponse
    {
        return $this->response;
    }

    /**
     * @param string[] $transport
     */
    public function getPublicKeyCredentialDescriptor(array $transport = []): PublicKeyCredentialDescriptor
    {
        return new PublicKeyCredentialDescriptor($this->getType(), $this->getRawId(), $transport);
    }

    public function __toString()
    {
        $encoded = json_encode($this);
        Assertion::string($encoded, 'Unable to encode the data');

        return $encoded;
    }
}

The same content is in 131 releases, Joomla 4.0.0-beta to 4.4.14. See them all, or every version of this file.