@@ -11,8 +11,7 @@ discard block |
||
| 11 | 11 | * @class AuthenticatorSelection |
| 12 | 12 | * @package Platine\Webauthn\Entity |
| 13 | 13 | */ |
| 14 | -class AuthenticatorSelection implements JsonSerializable |
|
| 15 | -{ |
|
| 14 | +class AuthenticatorSelection implements JsonSerializable { |
|
| 16 | 15 | /** |
| 17 | 16 | * The authenticator attachment |
| 18 | 17 | * @var string |
@@ -145,8 +144,7 @@ discard block |
||
| 145 | 144 | * {@inheritdoc} |
| 146 | 145 | * @return mixed |
| 147 | 146 | */ |
| 148 | - public function jsonSerialize() |
|
| 149 | - { |
|
| 147 | + public function jsonSerialize() { |
|
| 150 | 148 | return get_object_vars($this); |
| 151 | 149 | } |
| 152 | 150 | } |
@@ -169,9 +169,9 @@ |
||
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
| 172 | - * {@inheritdoc} |
|
| 173 | - * @return mixed |
|
| 174 | - */ |
|
| 172 | + * {@inheritdoc} |
|
| 173 | + * @return mixed |
|
| 174 | + */ |
|
| 175 | 175 | public function jsonSerialize() |
| 176 | 176 | { |
| 177 | 177 | return get_object_vars($this); |
@@ -11,8 +11,7 @@ discard block |
||
| 11 | 11 | * @class AttestedCredentialData |
| 12 | 12 | * @package Platine\Webauthn\Entity |
| 13 | 13 | */ |
| 14 | -class AttestedCredentialData implements JsonSerializable |
|
| 15 | -{ |
|
| 14 | +class AttestedCredentialData implements JsonSerializable { |
|
| 16 | 15 | /** |
| 17 | 16 | * The AAGUID of the authenticator |
| 18 | 17 | * @var string |
@@ -42,8 +41,7 @@ discard block |
||
| 42 | 41 | * Create new instance |
| 43 | 42 | * @param string $binaryData |
| 44 | 43 | */ |
| 45 | - public function __construct(string $binaryData) |
|
| 46 | - { |
|
| 44 | + public function __construct(string $binaryData) { |
|
| 47 | 45 | if (strlen($binaryData) <= 55) { |
| 48 | 46 | throw new WebauthnException('Attested credential data should be present but is missing'); |
| 49 | 47 | } |
@@ -113,8 +111,7 @@ discard block |
||
| 113 | 111 | * {@inheritdoc} |
| 114 | 112 | * @return mixed |
| 115 | 113 | */ |
| 116 | - public function jsonSerialize() |
|
| 117 | - { |
|
| 114 | + public function jsonSerialize() { |
|
| 118 | 115 | return get_object_vars($this); |
| 119 | 116 | } |
| 120 | 117 | } |
@@ -169,9 +169,9 @@ |
||
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
| 172 | - * {@inheritdoc} |
|
| 173 | - * @return mixed |
|
| 174 | - */ |
|
| 172 | + * {@inheritdoc} |
|
| 173 | + * @return mixed |
|
| 174 | + */ |
|
| 175 | 175 | public function jsonSerialize() |
| 176 | 176 | { |
| 177 | 177 | return get_object_vars($this); |
@@ -14,8 +14,7 @@ discard block |
||
| 14 | 14 | * @class CredentialPublicKey |
| 15 | 15 | * @package Platine\Webauthn\Entity |
| 16 | 16 | */ |
| 17 | -class CredentialPublicKey implements JsonSerializable |
|
| 18 | -{ |
|
| 17 | +class CredentialPublicKey implements JsonSerializable { |
|
| 19 | 18 | /* |
| 20 | 19 | * Cose encoded keys |
| 21 | 20 | */ |
@@ -88,8 +87,7 @@ discard block |
||
| 88 | 87 | * @param int $offset |
| 89 | 88 | * @param int $endOffset |
| 90 | 89 | */ |
| 91 | - public function __construct(string $binaryData, int $offset, int &$endOffset) |
|
| 92 | - { |
|
| 90 | + public function __construct(string $binaryData, int $offset, int &$endOffset) { |
|
| 93 | 91 | $enc = CborDecoder::decodeInPlace($binaryData, $offset, $endOffset); |
| 94 | 92 | |
| 95 | 93 | // COSE key-encoded elliptic curve public key in EC2 format |
@@ -173,8 +171,7 @@ discard block |
||
| 173 | 171 | * {@inheritdoc} |
| 174 | 172 | * @return mixed |
| 175 | 173 | */ |
| 176 | - public function jsonSerialize() |
|
| 177 | - { |
|
| 174 | + public function jsonSerialize() { |
|
| 178 | 175 | return get_object_vars($this); |
| 179 | 176 | } |
| 180 | 177 | |
@@ -169,9 +169,9 @@ |
||
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
| 172 | - * {@inheritdoc} |
|
| 173 | - * @return mixed |
|
| 174 | - */ |
|
| 172 | + * {@inheritdoc} |
|
| 173 | + * @return mixed |
|
| 174 | + */ |
|
| 175 | 175 | public function jsonSerialize() |
| 176 | 176 | { |
| 177 | 177 | return get_object_vars($this); |
@@ -90,14 +90,14 @@ |
||
| 90 | 90 | */ |
| 91 | 91 | public function __construct(int $binaryFlag) |
| 92 | 92 | { |
| 93 | - $this->bit0 = !! ($binaryFlag & 1); |
|
| 94 | - $this->bit1 = !! ($binaryFlag & 2); |
|
| 95 | - $this->bit2 = !! ($binaryFlag & 4); |
|
| 96 | - $this->bit3 = !! ($binaryFlag & 8); |
|
| 97 | - $this->bit4 = !! ($binaryFlag & 16); |
|
| 98 | - $this->bit5 = !! ($binaryFlag & 32); |
|
| 99 | - $this->bit6 = !! ($binaryFlag & 64); |
|
| 100 | - $this->bit7 = !! ($binaryFlag & 128); |
|
| 93 | + $this->bit0 = !!($binaryFlag & 1); |
|
| 94 | + $this->bit1 = !!($binaryFlag & 2); |
|
| 95 | + $this->bit2 = !!($binaryFlag & 4); |
|
| 96 | + $this->bit3 = !!($binaryFlag & 8); |
|
| 97 | + $this->bit4 = !!($binaryFlag & 16); |
|
| 98 | + $this->bit5 = !!($binaryFlag & 32); |
|
| 99 | + $this->bit6 = !!($binaryFlag & 64); |
|
| 100 | + $this->bit7 = !!($binaryFlag & 128); |
|
| 101 | 101 | |
| 102 | 102 | $this->userPresent = $this->bit0; |
| 103 | 103 | $this->userVerified = $this->bit2; |
@@ -10,8 +10,7 @@ discard block |
||
| 10 | 10 | * @class Flag |
| 11 | 11 | * @package Platine\Webauthn\Entity |
| 12 | 12 | */ |
| 13 | -class Flag implements JsonSerializable |
|
| 14 | -{ |
|
| 13 | +class Flag implements JsonSerializable { |
|
| 15 | 14 | /** |
| 16 | 15 | * The bit 0 |
| 17 | 16 | * @var bool |
@@ -88,8 +87,7 @@ discard block |
||
| 88 | 87 | * Create new instance |
| 89 | 88 | * @param int $binaryFlag |
| 90 | 89 | */ |
| 91 | - public function __construct(int $binaryFlag) |
|
| 92 | - { |
|
| 90 | + public function __construct(int $binaryFlag) { |
|
| 93 | 91 | $this->bit0 = !! ($binaryFlag & 1); |
| 94 | 92 | $this->bit1 = !! ($binaryFlag & 2); |
| 95 | 93 | $this->bit2 = !! ($binaryFlag & 4); |
@@ -217,8 +215,7 @@ discard block |
||
| 217 | 215 | * {@inheritdoc} |
| 218 | 216 | * @return mixed |
| 219 | 217 | */ |
| 220 | - public function jsonSerialize() |
|
| 221 | - { |
|
| 218 | + public function jsonSerialize() { |
|
| 222 | 219 | return get_object_vars($this); |
| 223 | 220 | } |
| 224 | 221 | } |
@@ -169,9 +169,9 @@ |
||
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
| 172 | - * {@inheritdoc} |
|
| 173 | - * @return mixed |
|
| 174 | - */ |
|
| 172 | + * {@inheritdoc} |
|
| 173 | + * @return mixed |
|
| 174 | + */ |
|
| 175 | 175 | public function jsonSerialize() |
| 176 | 176 | { |
| 177 | 177 | return get_object_vars($this); |
@@ -11,8 +11,7 @@ discard block |
||
| 11 | 11 | * @class UserInfo |
| 12 | 12 | * @package Platine\Webauthn\Entity |
| 13 | 13 | */ |
| 14 | -class UserInfo implements JsonSerializable |
|
| 15 | -{ |
|
| 14 | +class UserInfo implements JsonSerializable { |
|
| 16 | 15 | /** |
| 17 | 16 | * The id |
| 18 | 17 | * @var ByteBuffer |
@@ -37,8 +36,7 @@ discard block |
||
| 37 | 36 | * @param string $name |
| 38 | 37 | * @param string $displayName |
| 39 | 38 | */ |
| 40 | - public function __construct($id, string $name, string $displayName) |
|
| 41 | - { |
|
| 39 | + public function __construct($id, string $name, string $displayName) { |
|
| 42 | 40 | if (is_string($id)) { |
| 43 | 41 | $id = new ByteBuffer($id); |
| 44 | 42 | } |
@@ -116,8 +114,7 @@ discard block |
||
| 116 | 114 | * {@inheritdoc} |
| 117 | 115 | * @return mixed |
| 118 | 116 | */ |
| 119 | - public function jsonSerialize() |
|
| 120 | - { |
|
| 117 | + public function jsonSerialize() { |
|
| 121 | 118 | return get_object_vars($this); |
| 122 | 119 | } |
| 123 | 120 | } |
@@ -169,9 +169,9 @@ |
||
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
| 172 | - * {@inheritdoc} |
|
| 173 | - * @return mixed |
|
| 174 | - */ |
|
| 172 | + * {@inheritdoc} |
|
| 173 | + * @return mixed |
|
| 174 | + */ |
|
| 175 | 175 | public function jsonSerialize() |
| 176 | 176 | { |
| 177 | 177 | return get_object_vars($this); |
@@ -11,8 +11,7 @@ discard block |
||
| 11 | 11 | * @class UserCredential |
| 12 | 12 | * @package Platine\Webauthn\Entity |
| 13 | 13 | */ |
| 14 | -class UserCredential implements JsonSerializable |
|
| 15 | -{ |
|
| 14 | +class UserCredential implements JsonSerializable { |
|
| 16 | 15 | /** |
| 17 | 16 | * The type |
| 18 | 17 | * @var string |
@@ -36,8 +35,7 @@ discard block |
||
| 36 | 35 | * @param ByteBuffer|string $id |
| 37 | 36 | * @param array<string> $transports |
| 38 | 37 | */ |
| 39 | - public function __construct($id, array $transports = []) |
|
| 40 | - { |
|
| 38 | + public function __construct($id, array $transports = []) { |
|
| 41 | 39 | if (is_string($id)) { |
| 42 | 40 | $id = new ByteBuffer($id); |
| 43 | 41 | } |
@@ -105,8 +103,7 @@ discard block |
||
| 105 | 103 | * {@inheritdoc} |
| 106 | 104 | * @return mixed |
| 107 | 105 | */ |
| 108 | - public function jsonSerialize() |
|
| 109 | - { |
|
| 106 | + public function jsonSerialize() { |
|
| 110 | 107 | return get_object_vars($this); |
| 111 | 108 | } |
| 112 | 109 | } |
@@ -169,9 +169,9 @@ |
||
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
| 172 | - * {@inheritdoc} |
|
| 173 | - * @return mixed |
|
| 174 | - */ |
|
| 172 | + * {@inheritdoc} |
|
| 173 | + * @return mixed |
|
| 174 | + */ |
|
| 175 | 175 | public function jsonSerialize() |
| 176 | 176 | { |
| 177 | 177 | return get_object_vars($this); |
@@ -10,8 +10,7 @@ discard block |
||
| 10 | 10 | * @class PublicKeyCredentialParam |
| 11 | 11 | * @package Platine\Webauthn\Entity |
| 12 | 12 | */ |
| 13 | -class PublicKeyCredentialParam implements JsonSerializable |
|
| 14 | -{ |
|
| 13 | +class PublicKeyCredentialParam implements JsonSerializable { |
|
| 15 | 14 | /** |
| 16 | 15 | * The type |
| 17 | 16 | * @var string |
@@ -28,8 +27,7 @@ discard block |
||
| 28 | 27 | * Create new instance |
| 29 | 28 | * @param int $alg |
| 30 | 29 | */ |
| 31 | - public function __construct(int $alg) |
|
| 32 | - { |
|
| 30 | + public function __construct(int $alg) { |
|
| 33 | 31 | $this->alg = $alg; |
| 34 | 32 | } |
| 35 | 33 | |
@@ -66,8 +64,7 @@ discard block |
||
| 66 | 64 | * {@inheritdoc} |
| 67 | 65 | * @return mixed |
| 68 | 66 | */ |
| 69 | - public function jsonSerialize() |
|
| 70 | - { |
|
| 67 | + public function jsonSerialize() { |
|
| 71 | 68 | return get_object_vars($this); |
| 72 | 69 | } |
| 73 | 70 | } |
@@ -169,9 +169,9 @@ |
||
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
| 172 | - * {@inheritdoc} |
|
| 173 | - * @return mixed |
|
| 174 | - */ |
|
| 172 | + * {@inheritdoc} |
|
| 173 | + * @return mixed |
|
| 174 | + */ |
|
| 175 | 175 | public function jsonSerialize() |
| 176 | 176 | { |
| 177 | 177 | return get_object_vars($this); |
@@ -11,8 +11,7 @@ discard block |
||
| 11 | 11 | * @class PublicKeyAuthParam |
| 12 | 12 | * @package Platine\Webauthn\Entity |
| 13 | 13 | */ |
| 14 | -class PublicKeyAuthParam implements JsonSerializable |
|
| 15 | -{ |
|
| 14 | +class PublicKeyAuthParam implements JsonSerializable { |
|
| 16 | 15 | /** |
| 17 | 16 | * The type |
| 18 | 17 | * @var string |
@@ -36,8 +35,7 @@ discard block |
||
| 36 | 35 | * @param ByteBuffer|string $id |
| 37 | 36 | * @param array<string> $transports |
| 38 | 37 | */ |
| 39 | - public function __construct($id, array $transports = []) |
|
| 40 | - { |
|
| 38 | + public function __construct($id, array $transports = []) { |
|
| 41 | 39 | if (is_string($id)) { |
| 42 | 40 | $id = new ByteBuffer($id); |
| 43 | 41 | } |
@@ -105,8 +103,7 @@ discard block |
||
| 105 | 103 | * {@inheritdoc} |
| 106 | 104 | * @return mixed |
| 107 | 105 | */ |
| 108 | - public function jsonSerialize() |
|
| 109 | - { |
|
| 106 | + public function jsonSerialize() { |
|
| 110 | 107 | return get_object_vars($this); |
| 111 | 108 | } |
| 112 | 109 | } |
@@ -169,9 +169,9 @@ |
||
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
| 172 | - * {@inheritdoc} |
|
| 173 | - * @return mixed |
|
| 174 | - */ |
|
| 172 | + * {@inheritdoc} |
|
| 173 | + * @return mixed |
|
| 174 | + */ |
|
| 175 | 175 | public function jsonSerialize() |
| 176 | 176 | { |
| 177 | 177 | return get_object_vars($this); |
@@ -10,8 +10,7 @@ discard block |
||
| 10 | 10 | * @class CborDecoder |
| 11 | 11 | * @package Platine\Webauthn\Helper |
| 12 | 12 | */ |
| 13 | -class CborDecoder |
|
| 14 | -{ |
|
| 13 | +class CborDecoder { |
|
| 15 | 14 | public const CBOR_MAJOR_UNSIGNED_INT = 0; |
| 16 | 15 | public const CBOR_MAJOR_NEGATIVE_INT = 1; |
| 17 | 16 | public const CBOR_MAJOR_BYTE_STRING = 2; |
@@ -26,8 +25,7 @@ discard block |
||
| 26 | 25 | * @param ByteBuffer|string $data |
| 27 | 26 | * @return mixed |
| 28 | 27 | */ |
| 29 | - public static function decode($data) |
|
| 30 | - { |
|
| 28 | + public static function decode($data) { |
|
| 31 | 29 | if (is_string($data)) { |
| 32 | 30 | $data = new ByteBuffer($data); |
| 33 | 31 | } |
@@ -51,8 +49,7 @@ discard block |
||
| 51 | 49 | * @param int|null $endOffset |
| 52 | 50 | * @return mixed |
| 53 | 51 | */ |
| 54 | - public static function decodeInPlace($data, int $startoffset, ?int $endOffset = null) |
|
| 55 | - { |
|
| 52 | + public static function decodeInPlace($data, int $startoffset, ?int $endOffset = null) { |
|
| 56 | 53 | if (is_string($data)) { |
| 57 | 54 | $data = new ByteBuffer($data); |
| 58 | 55 | } |
@@ -70,8 +67,7 @@ discard block |
||
| 70 | 67 | * @param int $offset |
| 71 | 68 | * @return mixed |
| 72 | 69 | */ |
| 73 | - protected static function parseItem(ByteBuffer $buffer, int &$offset) |
|
| 74 | - { |
|
| 70 | + protected static function parseItem(ByteBuffer $buffer, int &$offset) { |
|
| 75 | 71 | $first = $buffer->getByteValue($offset++); |
| 76 | 72 | $type = $first >> 5; |
| 77 | 73 | $value = $first & 0b11111; |
@@ -91,8 +87,7 @@ discard block |
||
| 91 | 87 | * @param int $offset |
| 92 | 88 | * @return mixed |
| 93 | 89 | */ |
| 94 | - protected static function parseSimpleFloat(int $value, ByteBuffer $buffer, int &$offset) |
|
| 95 | - { |
|
| 90 | + protected static function parseSimpleFloat(int $value, ByteBuffer $buffer, int &$offset) { |
|
| 96 | 91 | switch ($value) { |
| 97 | 92 | case 24: |
| 98 | 93 | $value = $buffer->getByteValue($offset); |
@@ -159,8 +154,7 @@ discard block |
||
| 159 | 154 | * @param int $offset |
| 160 | 155 | * @return mixed |
| 161 | 156 | */ |
| 162 | - protected static function parseItemData(int $type, int $value, ByteBuffer $buffer, int &$offset) |
|
| 163 | - { |
|
| 157 | + protected static function parseItemData(int $type, int $value, ByteBuffer $buffer, int &$offset) { |
|
| 164 | 158 | switch ($type) { |
| 165 | 159 | case self::CBOR_MAJOR_UNSIGNED_INT: |
| 166 | 160 | return $value; |