mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
adding protobuf
This commit is contained in:
parent
c962050b30
commit
5ad4addc43
17
parse_proto.php
Executable file
17
parse_proto.php
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Copyright 2015 gRPC authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
PHP_PLUGIN="$(which grpc_php_plugin)"
|
||||||
|
protoc --proto_path=./src/protobuf/gradido --php_out=./src/ --grpc_out=./src/ --plugin=protoc-gen-grpc=$PHP_PLUGIN ./src/protobuf/gradido/*.proto
|
||||||
|
|
||||||
44
src/protobuf/gradido/BasicTypes.proto
Normal file
44
src/protobuf/gradido/BasicTypes.proto
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package model.messages.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
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
15
src/protobuf/gradido/StateCreateGroup.proto
Normal file
15
src/protobuf/gradido/StateCreateGroup.proto
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package model.messages.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;
|
||||||
|
|
||||||
|
}
|
||||||
12
src/protobuf/gradido/StateGroupChangeParent.proto
Normal file
12
src/protobuf/gradido/StateGroupChangeParent.proto
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package model.messages.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;
|
||||||
|
}
|
||||||
19
src/protobuf/gradido/Transaction.proto
Normal file
19
src/protobuf/gradido/Transaction.proto
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package model.messages.gradido;
|
||||||
|
|
||||||
|
import "BasicTypes.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;
|
||||||
|
}
|
||||||
18
src/protobuf/gradido/TransactionBody.proto
Normal file
18
src/protobuf/gradido/TransactionBody.proto
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package model.messages.gradido;
|
||||||
|
|
||||||
|
import "Transfer.proto";
|
||||||
|
import "StateCreateGroup.proto";
|
||||||
|
import "StateGroupChangeParent.proto";
|
||||||
|
import "TransactionCreation.proto";
|
||||||
|
|
||||||
|
message TransactionBody {
|
||||||
|
string memo = 1; // max 150 chars
|
||||||
|
oneof data {
|
||||||
|
StateCreateGroup createGroup = 2;
|
||||||
|
StateGroupChangeParent groupChangeParent = 3;
|
||||||
|
Transfer transfer = 4;
|
||||||
|
TransactionCreation creation = 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
13
src/protobuf/gradido/TransactionCreation.proto
Normal file
13
src/protobuf/gradido/TransactionCreation.proto
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package model.messages.gradido;
|
||||||
|
|
||||||
|
import "BasicTypes.proto";
|
||||||
|
|
||||||
|
// need signature from group admin or
|
||||||
|
// percent of group users another than the receiver
|
||||||
|
message TransactionCreation {
|
||||||
|
ReceiverAmount receiverAmount = 1;
|
||||||
|
sint32 ident_hash = 2;
|
||||||
|
|
||||||
|
}
|
||||||
10
src/protobuf/gradido/Transfer.proto
Normal file
10
src/protobuf/gradido/Transfer.proto
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package model.messages.gradido;
|
||||||
|
|
||||||
|
import "BasicTypes.proto";
|
||||||
|
|
||||||
|
message Transfer {
|
||||||
|
repeated SenderAmount senderAmounts = 1;
|
||||||
|
repeated ReceiverAmount receiverAmounts = 2;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user