Passed
Push — master ( 83aa3d...907404 )
by Thomas
07:17
created

AppleDeviceMetadata   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 22
ccs 0
cts 8
cp 0
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getDescription() 0 3 1
A supportsAttestationType() 0 3 1
A getTrustAnchors() 0 4 1
A getStatusReports() 0 3 1
1
<?php
2
3
namespace MadWizard\WebAuthn\Metadata\Provider\Apple;
4
5
use MadWizard\WebAuthn\Attestation\AttestationType;
6
use MadWizard\WebAuthn\Attestation\TrustAnchor\CertificateTrustAnchor;
7
use MadWizard\WebAuthn\Attestation\TrustAnchor\MetadataInterface;
8
use MadWizard\WebAuthn\Pki\X509Certificate;
9
use MadWizard\WebAuthn\Util\BundledData;
10
11
final class AppleDeviceMetadata implements MetadataInterface
12
{
13
    public function getTrustAnchors(): array
14
    {
15
        return [
16
            new CertificateTrustAnchor(X509Certificate::fromPem(BundledData::getContents('apple/apple-webauthn-root.crt'))),
17
        ];
18
    }
19
20
    public function supportsAttestationType(string $type): bool
21
    {
22
        return $type === AttestationType::ANON_CA;
23
    }
24
25
    public function getStatusReports(): array
26
    {
27
        return [];
28
    }
29
30
    public function getDescription(): string
31
    {
32
        return 'Apple device (Touch ID / Face ID)';
33
    }
34
}
35