few bugfixes, fido/u2f still WIP

This commit is contained in:
2024-04-07 18:29:33 +02:00
parent 0974ac9260
commit 6c551b08d8
19 changed files with 164 additions and 67 deletions

View File

@@ -2,26 +2,24 @@
namespace Core\Objects\TwoFactor;
use CBOR\MapObject;
use Core\Objects\ApiObject;
class PublicKey extends ApiObject {
use CBORDecoder;
private int $keyType;
private int $usedAlgorithm;
private int $curveType;
private string $xCoordinate;
private string $yCoordinate;
public function __construct(?string $cborData = null) {
if ($cborData) {
$data = $this->decode($cborData)->getNormalizedData();
$this->keyType = $data["1"];
$this->usedAlgorithm = $data["3"];
$this->curveType = $data["-1"];
$this->xCoordinate = $data["-2"];
$this->yCoordinate = $data["-3"];
public function __construct(?MapObject $publicKeyData = null) {
if ($publicKeyData) {
$this->keyType = $publicKeyData["1"]->getValue();
$this->usedAlgorithm = $publicKeyData["3"]->getValue();
$this->curveType = $publicKeyData["-1"]->getValue();
$this->xCoordinate = $publicKeyData["-2"]->getValue();
$this->yCoordinate = $publicKeyData["-3"]->getValue();
}
}
@@ -53,8 +51,8 @@ class PublicKey extends ApiObject {
public function getNormalizedData(): array {
return [
"1" => $this->keyType,
"3" => $this->usedAlgorithm,
"1" => $this->keyType,
"3" => $this->usedAlgorithm,
"-1" => $this->curveType,
"-2" => $this->xCoordinate,
"-3" => $this->yCoordinate,