|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* The MIT License (MIT) |
|
7
|
|
|
* |
|
8
|
|
|
* Copyright (c) 2018 Spomky-Labs |
|
9
|
|
|
* |
|
10
|
|
|
* This software may be modified and distributed under the terms |
|
11
|
|
|
* of the MIT license. See the LICENSE file for details. |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
namespace U2FAuthentication\Fido2; |
|
15
|
|
|
|
|
16
|
|
|
class PublicKeyCredentialRequestOptions |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* @var string |
|
20
|
|
|
*/ |
|
21
|
|
|
private $challenge; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @var null|int |
|
25
|
|
|
*/ |
|
26
|
|
|
private $timeout; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* @var string |
|
30
|
|
|
*/ |
|
31
|
|
|
private $rpId; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @var PublicKeyCredentialDescriptor[] |
|
35
|
|
|
*/ |
|
36
|
|
|
private $allowCredentials; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @var string |
|
40
|
|
|
*/ |
|
41
|
|
|
private $userVerification; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @var AuthenticationExtensionsClientInputs |
|
45
|
|
|
*/ |
|
46
|
|
|
private $extensions; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* PublicKeyCredentialRequestOptions constructor. |
|
50
|
|
|
* |
|
51
|
|
|
* @param string $challenge |
|
52
|
|
|
* @param int|null $timeout |
|
53
|
|
|
* @param string $rpId |
|
54
|
|
|
* @param PublicKeyCredentialDescriptor[] $allowCredentials |
|
55
|
|
|
* @param string $userVerification |
|
56
|
|
|
* @param AuthenticationExtensionsClientInputs $extensions |
|
57
|
|
|
*/ |
|
58
|
|
|
public function __construct(string $challenge, ?int $timeout, string $rpId, array $allowCredentials, string $userVerification, AuthenticationExtensionsClientInputs $extensions) |
|
59
|
|
|
{ |
|
60
|
|
|
$this->challenge = $challenge; |
|
61
|
|
|
$this->timeout = $timeout; |
|
62
|
|
|
$this->rpId = $rpId; |
|
63
|
|
|
$this->allowCredentials = $allowCredentials; |
|
64
|
|
|
$this->userVerification = $userVerification; |
|
65
|
|
|
$this->extensions = $extensions; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* @return string |
|
70
|
|
|
*/ |
|
71
|
|
|
public function getChallenge(): string |
|
72
|
|
|
{ |
|
73
|
|
|
return $this->challenge; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* @return int|null |
|
78
|
|
|
*/ |
|
79
|
|
|
public function getTimeout(): ?int |
|
80
|
|
|
{ |
|
81
|
|
|
return $this->timeout; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* @return string |
|
86
|
|
|
*/ |
|
87
|
|
|
public function getRpId(): string |
|
88
|
|
|
{ |
|
89
|
|
|
return $this->rpId; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* @return PublicKeyCredentialDescriptor[] |
|
94
|
|
|
*/ |
|
95
|
|
|
public function getAllowCredentials(): array |
|
96
|
|
|
{ |
|
97
|
|
|
return $this->allowCredentials; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* @return string |
|
102
|
|
|
*/ |
|
103
|
|
|
public function getUserVerification(): string |
|
104
|
|
|
{ |
|
105
|
|
|
return $this->userVerification; |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* @return AuthenticationExtensionsClientInputs |
|
110
|
|
|
*/ |
|
111
|
|
|
public function getExtensions(): AuthenticationExtensionsClientInputs |
|
112
|
|
|
{ |
|
113
|
|
|
return $this->extensions; |
|
114
|
|
|
} |
|
115
|
|
|
} |
|
116
|
|
|
|