diff --git a/mithril_client b/mithril_client index 680e56876..f0b1d113c 160000 --- a/mithril_client +++ b/mithril_client @@ -1 +1 @@ -Subproject commit 680e56876d6e7f2778bff4eb49c880063716b391 +Subproject commit f0b1d113cee2a76e9dbb098b315f4acaf38410d0 diff --git a/src/Model/Transactions/Transaction.php b/src/Model/Transactions/Transaction.php index eb818f38b..3c55f804c 100644 --- a/src/Model/Transactions/Transaction.php +++ b/src/Model/Transactions/Transaction.php @@ -1,66 +1,66 @@ -addError('base64 decode failed'); - $this->addError(['data' => $base64Data, 'bin' => $transactionBin, 'msg' => 'base64 decode error']); - } else { - $this->mProtoTransaction = new \Model\Messages\Gradido\Transaction(); - $this->mProtoTransaction->mergeFromString($transactionBin); - - $this->mProtoTransactionBody = new \Model\Messages\Gradido\TransactionBody(); - $this->mProtoTransactionBody->mergeFromString($this->mProtoTransaction->getBodyBytes()); - - $data = $this->mProtoTransactionBody->getData(); - var_dump($data); - } - } - - public function validate() { - $sigPairs = $this->mProtoTransaction->getSigMap()->getSigPair(); - $bodyBytes = $this->mProtoTransaction->getBodyBytes(); - - // check signature(s) - foreach($sigPairs as $sigPair) { - $pubkey = $sigPair->getPubKey(); - $signature = $sigPair->getEd25519(); - if (!\Sodium\crypto_sign_verify_detached($signature, $bodyBytes, $pubkey)) { - $this->addError('signature for key ' . bin2hex($pubkey) . ' isn\'t valid ' ); - return false; - } - } - - return true; - } - - public function getErrors() { - return $this->errors; - } - - public function hasErrors() { - return count($this->errors) > 0; - } - - - private function addError($message) { - array_push($this->errors, $message); - } +addError('base64 decode failed'); + $this->addError(['data' => $base64Data, 'bin' => $transactionBin, 'msg' => 'base64 decode error']); + } else { + $this->mProtoTransaction = new \Model\Messages\Gradido\Transaction(); + $this->mProtoTransaction->mergeFromString($transactionBin); + + $this->mProtoTransactionBody = new \Model\Messages\Gradido\TransactionBody(); + $this->mProtoTransactionBody->mergeFromString($this->mProtoTransaction->getBodyBytes()); + + $data = $this->mProtoTransactionBody->getData(); + var_dump($data); + } + } + + public function validate() { + $sigPairs = $this->mProtoTransaction->getSigMap()->getSigPair(); + $bodyBytes = $this->mProtoTransaction->getBodyBytes(); + + // check signature(s) + foreach($sigPairs as $sigPair) { + $pubkey = $sigPair->getPubKey(); + $signature = $sigPair->getEd25519(); + if (!\Sodium\crypto_sign_verify_detached($signature, $bodyBytes, $pubkey)) { + $this->addError('signature for key ' . bin2hex($pubkey) . ' isn\'t valid ' ); + return false; + } + } + + return true; + } + + public function getErrors() { + return $this->errors; + } + + public function hasErrors() { + return count($this->errors) > 0; + } + + + private function addError($message) { + array_push($this->errors, $message); + } } \ No newline at end of file diff --git a/src/Model/Transactions/TransactionBase.php b/src/Model/Transactions/TransactionBase.php index c9ba5cdcd..ddf20798c 100644 --- a/src/Model/Transactions/TransactionBase.php +++ b/src/Model/Transactions/TransactionBase.php @@ -1,7 +1,7 @@ -