keyId = $keyId; } } public function setProviderId(string $providerId): self { $this->providerId = $providerId; return $this; } public function getProviderId(): string { return $this->providerId; } public function setAccount(string $account): self { $this->account = $account; return $this; } public function getAccount(): string { return $this->account; } public function getKeyId(): string { return $this->keyId; } public function getPublicKey(): string { return $this->publicKey; } public function getPrivateKey(): string { return $this->privateKey; } public function setMetadata(array $metadata): self { $this->metadata = $metadata; return $this; } public function getMetadata(): array { return $this->metadata; } public function setMetaValue(string $key, string|int $value): self { $this->metadata[$key] = $value; return $this; } public function setType(SignatoryType $type): self { $this->type = $type; return $this; } public function getType(): SignatoryType { return $this->type; } public function setStatus(SignatoryStatus $status): self { $this->status = $status; return $this; } public function getStatus(): SignatoryStatus { return $this->status; } public function setCreation(int $creation): self { $this->creation = $creation; return $this; } public function getCreation(): int { return $this->creation; } public function setLastUpdated(int $lastUpdated): self { $this->lastUpdated = $lastUpdated; return $this; } public function getLastUpdated(): int { return $this->lastUpdated; } public function importFromDatabase(array $row): self { $this->setProviderId($row['provider_id'] ?? '') ->setAccount($row['account'] ?? '') ->setMetadata(json_decode($row['metadata'], true) ?? []) ->setType(SignatoryType::from($row['type'] ?? 9)) ->setStatus(SignatoryStatus::from($row['status'] ?? 1)) ->setCreation($row['creation'] ?? 0) ->setLastUpdated($row['last_updated'] ?? 0); return $this; } public function jsonSerialize(): array { return [ 'keyId' => $this->getKeyId(), 'publicKeyPem' => $this->getPublicKey() ]; } }