mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
adding gradido protobuf messages
This commit is contained in:
parent
410927e5b2
commit
3d47f0fca3
@ -1 +1 @@
|
||||
Subproject commit a37f26ae9ce3bd3c25cfeb9b51bef3f2a4a6ebeb
|
||||
Subproject commit 92d3e9def837e48f2d8e3da0b2de487e6fa27d7b
|
||||
@ -12,6 +12,13 @@ use App\Controller\AppController;
|
||||
*/
|
||||
class TransactionCreationsController extends AppController
|
||||
{
|
||||
|
||||
public function initialize()
|
||||
{
|
||||
parent::initialize();
|
||||
//$this->Auth->allow(['add', 'edit']);
|
||||
$this->Auth->allow('add');
|
||||
}
|
||||
/**
|
||||
* Index method
|
||||
*
|
||||
@ -42,6 +49,19 @@ class TransactionCreationsController extends AppController
|
||||
|
||||
$this->set('transactionCreation', $transactionCreation);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$startTime = microtime(true);
|
||||
$this->viewBuilder()->setLayout('frontend');
|
||||
$session = $this->getRequest()->getSession();
|
||||
$user = $session->read('StateUser');
|
||||
//var_dump($user);
|
||||
$transactionCreation = $this->TransactionCreations->newEntity();
|
||||
$transactionCreation->state_user_id = $user->id;
|
||||
$timeUsed = microtime(true) - $startTime;
|
||||
$this->set(compact('transactionCreation', 'timeUsed'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add method
|
||||
@ -50,6 +70,7 @@ class TransactionCreationsController extends AppController
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
|
||||
$transactionCreation = $this->TransactionCreations->newEntity();
|
||||
if ($this->request->is('post')) {
|
||||
$transactionCreation = $this->TransactionCreations->patchEntity($transactionCreation, $this->request->getData());
|
||||
|
||||
33
src/Model/Messages/protobuf/gradido/BasicTypes.proto
Normal file
33
src/Model/Messages/protobuf/gradido/BasicTypes.proto
Normal file
@ -0,0 +1,33 @@
|
||||
syntax = "proto3"
|
||||
|
||||
package gradido;
|
||||
|
||||
message Key {
|
||||
oneof key {
|
||||
bytes ed25519 = 2; // ed25519 signature (libsodium default)
|
||||
bytes ed25519_ref10 = 3; // ed25519 ref10 signature
|
||||
}
|
||||
}
|
||||
|
||||
message SignaturePair {
|
||||
bytes pubKey = 1;
|
||||
oneof signature {
|
||||
bytes ed25519 = 2; // ed25519 signature (libsodium default)
|
||||
bytes ed25519_ref10 = 3; // ed25519 ref10 signature
|
||||
}
|
||||
}
|
||||
|
||||
message SignatureMap {
|
||||
repeated SignaturePair sigPair = 1; // Each signature pair corresponds to a unique Key required to sign the transaction.
|
||||
}
|
||||
|
||||
/* An exact date and time. This is the same data structure as the protobuf Timestamp.proto (see the comments in https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto) */
|
||||
message Timestamp {
|
||||
int64 seconds = 1; // Number of complete seconds since the start of the epoch
|
||||
int32 nanos = 2; // Number of nanoseconds since the start of the last second
|
||||
}
|
||||
|
||||
/* An exact date and time, with a resolution of one second (no nanoseconds). */
|
||||
message TimestampSeconds {
|
||||
int64 seconds = 1; // Number of complete seconds since the start of the epoch
|
||||
}
|
||||
15
src/Model/Messages/protobuf/gradido/StateCreateGroup.proto
Normal file
15
src/Model/Messages/protobuf/gradido/StateCreateGroup.proto
Normal file
@ -0,0 +1,15 @@
|
||||
syntax = "proto3"
|
||||
|
||||
package gradido;
|
||||
|
||||
import "BasicTypes.proto";
|
||||
|
||||
// need signature from this group and from parent (if it isn't zero)
|
||||
message StateCreateGroup {
|
||||
string name = 1;
|
||||
Key groupPublicKey = 2;
|
||||
Key parentGroupPublicKey = 3;
|
||||
reserved "hederaConsensusId";
|
||||
reserved 4;
|
||||
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
syntax = "proto3"
|
||||
|
||||
package gradido;
|
||||
|
||||
import "BasicTypes.proto";
|
||||
|
||||
// need signature from this group and from both parents (if it isn't zero)
|
||||
message StateGroupChangeParent {
|
||||
Key groupPublicKey = 1;
|
||||
Key newParentGroupPublicKey = 2;
|
||||
Key oldParentGroupPublicKey = 3;
|
||||
}
|
||||
20
src/Model/Messages/protobuf/gradido/Transaction.proto
Normal file
20
src/Model/Messages/protobuf/gradido/Transaction.proto
Normal file
@ -0,0 +1,20 @@
|
||||
syntax = "proto3"
|
||||
|
||||
package gradido;
|
||||
|
||||
import "BasicTypes.proto";
|
||||
import "TransactionBody.proto";
|
||||
|
||||
/*
|
||||
id will be set by Node server
|
||||
txHash will be also set by Node server,
|
||||
calculated from previous transaction txHash and this id, sigMap and received;
|
||||
*/
|
||||
|
||||
message Transaction {
|
||||
uint64 id = 1;
|
||||
TimestampSeconds received = 2;
|
||||
SignatureMap sigMap = 3;
|
||||
bytes txHash = 4;
|
||||
bytes bodyBytes = 5;
|
||||
}
|
||||
16
src/Model/Messages/protobuf/gradido/TransactionBody.proto
Normal file
16
src/Model/Messages/protobuf/gradido/TransactionBody.proto
Normal file
@ -0,0 +1,16 @@
|
||||
syntax = "proto3"
|
||||
|
||||
package gradido;
|
||||
|
||||
import "Transfer.proto";
|
||||
import "StateCreateGroup.proto";
|
||||
import "StateGroupChangeParent.proto";
|
||||
|
||||
message TransactionBody {
|
||||
string memo = 1; // max 150 chars
|
||||
oneof data {
|
||||
StateCreateGroup createGroup = 2;
|
||||
StateGroupChangeParent groupChangeParent = 3;
|
||||
Transfer transfer = 4;
|
||||
}
|
||||
}
|
||||
19
src/Model/Messages/protobuf/gradido/Transfer.proto
Normal file
19
src/Model/Messages/protobuf/gradido/Transfer.proto
Normal file
@ -0,0 +1,19 @@
|
||||
syntax = "proto3"
|
||||
|
||||
package gradido;
|
||||
|
||||
message SenderAmount {
|
||||
bytes ed25519_sender_pubkey = 1;
|
||||
sint64 amount = 2;
|
||||
sint64 senderFinalBalance = 3; // sender balance after transaction, including perishability
|
||||
}
|
||||
|
||||
message ReceiverAmount {
|
||||
bytes ed25519_receiver_pubkey = 1;
|
||||
sint64 amount = 2;
|
||||
}
|
||||
|
||||
message Transfer {
|
||||
repeated SenderAmount senderAmounts = 1;
|
||||
repeated ReceiverAmount receiverAmounts = 2;
|
||||
}
|
||||
@ -41,10 +41,10 @@ class StateUsersTable extends Table
|
||||
$this->setDisplayField('id');
|
||||
$this->setPrimaryKey('id');
|
||||
|
||||
$this->belongsTo('Indices', [
|
||||
/*$this->belongsTo('Indices', [
|
||||
'foreignKey' => 'index_id',
|
||||
'joinType' => 'INNER'
|
||||
]);
|
||||
]);*/
|
||||
$this->belongsTo('StateGroups', [
|
||||
'foreignKey' => 'state_group_id',
|
||||
'joinType' => 'INNER'
|
||||
@ -91,8 +91,8 @@ class StateUsersTable extends Table
|
||||
*/
|
||||
public function buildRules(RulesChecker $rules)
|
||||
{
|
||||
$rules->add($rules->existsIn(['index_id'], 'Indices'));
|
||||
$rules->add($rules->existsIn(['state_group_id'], 'StateGroups'));
|
||||
// $rules->add($rules->existsIn(['index_id'], 'Indices'));
|
||||
//$rules->add($rules->existsIn(['state_group_id'], 'StateGroups'));
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
@ -64,8 +64,9 @@ class TransactionCreationsTable extends Table
|
||||
->notEmptyString('amount');
|
||||
|
||||
$validator
|
||||
->requirePresence('ident_hash', 'create')
|
||||
->notEmptyString('ident_hash');
|
||||
//->requirePresence('ident_hash', 'create')
|
||||
//->notEmptyString('ident_hash');
|
||||
->allowEmptyString('ident_hash', null, 'create');
|
||||
|
||||
return $validator;
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
* @license https://opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
$cakeDescription = 'CakePHP: the rapid development php framework';
|
||||
$cakeDescription = 'Gradido';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
<script type="text/javascript">
|
||||
csfr = "<?= $this->request->getParam('_csrfToken') ?>";
|
||||
</script>
|
||||
<link rel="stylesheet" type="text/css" href="css/styles.css">
|
||||
<script type="text/javascript" src="js/app.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../css/styles.css">
|
||||
<script type="text/javascript" src="../js/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,276 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
* @link https://cakephp.org CakePHP(tm) Project
|
||||
* @since 0.10.0
|
||||
* @license https://opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
use Cake\Cache\Cache;
|
||||
use Cake\Core\Configure;
|
||||
use Cake\Core\Plugin;
|
||||
use Cake\Datasource\ConnectionManager;
|
||||
use Cake\Error\Debugger;
|
||||
use Cake\Http\Exception\NotFoundException;
|
||||
|
||||
$this->layout = false;
|
||||
|
||||
if (!Configure::read('debug')) :
|
||||
throw new NotFoundException(
|
||||
'Please replace src/Template/Pages/home.ctp with your own version or re-enable debug mode.'
|
||||
);
|
||||
endif;
|
||||
|
||||
$cakeDescription = 'CakePHP: the rapid development PHP framework';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<?= $this->Html->charset() ?>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>
|
||||
<?= $cakeDescription ?>
|
||||
</title>
|
||||
|
||||
<?= $this->Html->meta('icon') ?>
|
||||
<?= $this->Html->css('base.css') ?>
|
||||
<?= $this->Html->css('style.css') ?>
|
||||
<?= $this->Html->css('home.css') ?>
|
||||
<link href="https://fonts.googleapis.com/css?family=Raleway:500i|Roboto:300,400,700|Roboto+Mono" rel="stylesheet">
|
||||
</head>
|
||||
<body class="home">
|
||||
|
||||
<header class="row">
|
||||
<div class="header-image"><?= $this->Html->image('cake.logo.svg') ?></div>
|
||||
<div class="header-title">
|
||||
<h1>Welcome to CakePHP <?= Configure::version() ?> Red Velvet. Build fast. Grow solid.</h1>
|
||||
<?php $this->layout = false;?><html>
|
||||
<head>
|
||||
<title>Web Assembly Test (CakePHP Single Node Version)</title>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<body>
|
||||
<div class="grd_container">
|
||||
<div class="grd_head">
|
||||
<h2>Gradido</h2>
|
||||
<h3>Implementierung wählen</h3>
|
||||
</div>
|
||||
<div class="grd_container_small">
|
||||
<a class="grd_bn grd_large-bn" href="account/login">Einfach</a>
|
||||
<a class="grd_bn grd_large-bn" href="pages/gradido">Mithril JS</a>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="row">
|
||||
<div class="columns large-12">
|
||||
<div class="ctp-warning alert text-center">
|
||||
<p>Please be aware that this page will not be shown if you turn off debug mode unless you replace src/Template/Pages/home.ctp with your own version.</p>
|
||||
</div>
|
||||
<div id="url-rewriting-warning" class="alert url-rewriting">
|
||||
<ul>
|
||||
<li class="bullet problem">
|
||||
URL rewriting is not properly configured on your server.<br />
|
||||
1) <a target="_blank" href="https://book.cakephp.org/3.0/en/installation.html#url-rewriting">Help me configure it</a><br />
|
||||
2) <a target="_blank" href="https://book.cakephp.org/3.0/en/development/configuration.html#general-configuration">I don't / can't use URL rewriting</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php Debugger::checkSecurityKeys(); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="columns large-6">
|
||||
<h4>Environment</h4>
|
||||
<ul>
|
||||
<?php if (version_compare(PHP_VERSION, '5.6.0', '>=')) : ?>
|
||||
<li class="bullet success">Your version of PHP is 5.6.0 or higher (detected <?= PHP_VERSION ?>).</li>
|
||||
<?php else : ?>
|
||||
<li class="bullet problem">Your version of PHP is too low. You need PHP 5.6.0 or higher to use CakePHP (detected <?= PHP_VERSION ?>).</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (extension_loaded('mbstring')) : ?>
|
||||
<li class="bullet success">Your version of PHP has the mbstring extension loaded.</li>
|
||||
<?php else : ?>
|
||||
<li class="bullet problem">Your version of PHP does NOT have the mbstring extension loaded.</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (extension_loaded('openssl')) : ?>
|
||||
<li class="bullet success">Your version of PHP has the openssl extension loaded.</li>
|
||||
<?php elseif (extension_loaded('mcrypt')) : ?>
|
||||
<li class="bullet success">Your version of PHP has the mcrypt extension loaded.</li>
|
||||
<?php else : ?>
|
||||
<li class="bullet problem">Your version of PHP does NOT have the openssl or mcrypt extension loaded.</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (extension_loaded('intl')) : ?>
|
||||
<li class="bullet success">Your version of PHP has the intl extension loaded.</li>
|
||||
<?php else : ?>
|
||||
<li class="bullet problem">Your version of PHP does NOT have the intl extension loaded.</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="columns large-6">
|
||||
<h4>Filesystem</h4>
|
||||
<ul>
|
||||
<?php if (is_writable(TMP)) : ?>
|
||||
<li class="bullet success">Your tmp directory is writable.</li>
|
||||
<?php else : ?>
|
||||
<li class="bullet problem">Your tmp directory is NOT writable.</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (is_writable(LOGS)) : ?>
|
||||
<li class="bullet success">Your logs directory is writable.</li>
|
||||
<?php else : ?>
|
||||
<li class="bullet problem">Your logs directory is NOT writable.</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php $settings = Cache::getConfig('_cake_core_'); ?>
|
||||
<?php if (!empty($settings)) : ?>
|
||||
<li class="bullet success">The <em><?= $settings['className'] ?>Engine</em> is being used for core caching. To change the config edit config/app.php</li>
|
||||
<?php else : ?>
|
||||
<li class="bullet problem">Your cache is NOT working. Please check the settings in config/app.php</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="columns large-6">
|
||||
<h4>Database</h4>
|
||||
<?php
|
||||
try {
|
||||
$connection = ConnectionManager::get('default');
|
||||
$connected = $connection->connect();
|
||||
} catch (Exception $connectionError) {
|
||||
$connected = false;
|
||||
$errorMsg = $connectionError->getMessage();
|
||||
if (method_exists($connectionError, 'getAttributes')) :
|
||||
$attributes = $connectionError->getAttributes();
|
||||
if (isset($errorMsg['message'])) :
|
||||
$errorMsg .= '<br />' . $attributes['message'];
|
||||
endif;
|
||||
endif;
|
||||
}
|
||||
?>
|
||||
<ul>
|
||||
<?php if ($connected) : ?>
|
||||
<li class="bullet success">CakePHP is able to connect to the database.</li>
|
||||
<?php else : ?>
|
||||
<li class="bullet problem">CakePHP is NOT able to connect to the database.<br /><?= $errorMsg ?></li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="columns large-6">
|
||||
<h4>DebugKit</h4>
|
||||
<ul>
|
||||
<?php if (Plugin::isLoaded('DebugKit')) : ?>
|
||||
<li class="bullet success">DebugKit is loaded.</li>
|
||||
<?php else : ?>
|
||||
<li class="bullet problem">DebugKit is NOT loaded. You need to either install pdo_sqlite, or define the "debug_kit" connection name.</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="columns large-6">
|
||||
<h3>Editing this Page</h3>
|
||||
<ul>
|
||||
<li class="bullet cutlery">To change the content of this page, edit: src/Template/Pages/home.ctp.</li>
|
||||
<li class="bullet cutlery">You can also add some CSS styles for your pages at: webroot/css/.</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="columns large-6">
|
||||
<h3>Getting Started</h3>
|
||||
<ul>
|
||||
<li class="bullet book"><a target="_blank" href="https://book.cakephp.org/3.0/en/">CakePHP 3.0 Docs</a></li>
|
||||
<li class="bullet book"><a target="_blank" href="https://book.cakephp.org/3.0/en/tutorials-and-examples/cms/installation.html">The 20 min CMS Tutorial</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="columns large-12 text-center">
|
||||
<h3 class="more">More about Cake</h3>
|
||||
<p>
|
||||
CakePHP is a rapid development framework for PHP which uses commonly known design patterns like Front Controller and MVC.<br />
|
||||
Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility.
|
||||
</p>
|
||||
</div>
|
||||
<hr/>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="columns large-4">
|
||||
<i class="icon support">P</i>
|
||||
<h3>Help and Bug Reports</h3>
|
||||
<ul>
|
||||
<li class="bullet cutlery">
|
||||
<a href="irc://irc.freenode.net/cakephp">irc.freenode.net #cakephp</a>
|
||||
<ul><li>Live chat about CakePHP</li></ul>
|
||||
</li>
|
||||
<li class="bullet cutlery">
|
||||
<a href="http://cakesf.herokuapp.com/">Slack</a>
|
||||
<ul><li>CakePHP Slack support</li></ul>
|
||||
</li>
|
||||
<li class="bullet cutlery">
|
||||
<a href="https://github.com/cakephp/cakephp/issues">CakePHP Issues</a>
|
||||
<ul><li>CakePHP issues and pull requests</li></ul>
|
||||
</li>
|
||||
<li class="bullet cutlery">
|
||||
<a href="http://discourse.cakephp.org/">CakePHP Forum</a>
|
||||
<ul><li>CakePHP official discussion forum</li></ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="columns large-4">
|
||||
<i class="icon docs">r</i>
|
||||
<h3>Docs and Downloads</h3>
|
||||
<ul>
|
||||
<li class="bullet cutlery">
|
||||
<a href="https://api.cakephp.org/3.0/">CakePHP API</a>
|
||||
<ul><li>Quick Reference</li></ul>
|
||||
</li>
|
||||
<li class="bullet cutlery">
|
||||
<a href="https://book.cakephp.org/3.0/en/">CakePHP Documentation</a>
|
||||
<ul><li>Your Rapid Development Cookbook</li></ul>
|
||||
</li>
|
||||
<li class="bullet cutlery">
|
||||
<a href="https://bakery.cakephp.org">The Bakery</a>
|
||||
<ul><li>Everything CakePHP</li></ul>
|
||||
</li>
|
||||
<li class="bullet cutlery">
|
||||
<a href="https://plugins.cakephp.org">CakePHP plugins repo</a>
|
||||
<ul><li>A comprehensive list of all CakePHP plugins created by the community</li></ul>
|
||||
</li>
|
||||
<li class="bullet cutlery">
|
||||
<a href="https://github.com/cakephp/">CakePHP Code</a>
|
||||
<ul><li>For the Development of CakePHP Git repository, Downloads</li></ul>
|
||||
</li>
|
||||
<li class="bullet cutlery">
|
||||
<a href="https://github.com/FriendsOfCake/awesome-cakephp">CakePHP Awesome List</a>
|
||||
<ul><li>A curated list of amazingly awesome CakePHP plugins, resources and shiny things.</li></ul>
|
||||
</li>
|
||||
<li class="bullet cutlery">
|
||||
<a href="https://www.cakephp.org">CakePHP</a>
|
||||
<ul><li>The Rapid Development Framework</li></ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="columns large-4">
|
||||
<i class="icon training">s</i>
|
||||
<h3>Training and Certification</h3>
|
||||
<ul>
|
||||
<li class="bullet cutlery">
|
||||
<a href="https://cakefoundation.org/">Cake Software Foundation</a>
|
||||
<ul><li>Promoting development related to CakePHP</li></ul>
|
||||
</li>
|
||||
<li class="bullet cutlery">
|
||||
<a href="https://training.cakephp.org/">CakePHP Training</a>
|
||||
<ul><li>Learn to use the CakePHP framework</li></ul>
|
||||
</li>
|
||||
<li class="bullet cutlery">
|
||||
<a href="https://certification.cakephp.org/">CakePHP Certification</a>
|
||||
<ul><li>Become a certified CakePHP developer</li></ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<link rel="stylesheet" type="text/css" href="css/styles.css">
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user