This is an automated email from the ASF dual-hosted git repository. cmorris pushed a commit to branch policy in repository https://gitbox.apache.org/repos/asf/incubator-milagro-dta.git
commit 28c3f2b6a62d6c1023aaa24d98b7d2c877da52db Author: Christopher Morris <[email protected]> AuthorDate: Wed Aug 28 14:34:29 2019 +0100 Add policy to protobuffers and order --- cmd/servicetester/e2e_test.sh | 11 +- go.mod | 5 +- go.sum | 15 ++ libs/documents/docs.pb.go | 294 +++++++++++++++++++----------------- libs/documents/docs.proto | 61 ++++---- libs/documents/docs.validator.pb.go | 27 +++- libs/documents/policy_test.go | 5 +- pkg/api/proto.go | 49 +++--- pkg/common/common.go | 15 +- 9 files changed, 274 insertions(+), 208 deletions(-) diff --git a/cmd/servicetester/e2e_test.sh b/cmd/servicetester/e2e_test.sh index d3dbbce..c84c0cc 100755 --- a/cmd/servicetester/e2e_test.sh +++ b/cmd/servicetester/e2e_test.sh @@ -2,7 +2,9 @@ #End to End Test of Services using curl/bash apiVersion="v1" -simplePolicy='{"policy":{ "example":"single fiduciary","walletRef": "CD-2367-227","beneficiarydocid":"","nodeId": "123","coin": 0,"sharingGroups": [{"groupref": "Back Office Team","threshold":1,"ids": [{"id": "alice","idType": "oidc","idRef": "Alice"}]}],"participantCount": 7}}' +simplePolicy='{ "example":"single fiduciary","walletRef": "CD-2367-227","beneficiarydocid":"","nodeId": "123","coin": 0,"sharingGroups": [{"groupref": "Back Office Team","threshold":1,"ids": [{"id": "alice","idType": "oidc","idRef": "Alice"}]}],"participantCount": 7}' + +#simplePolicy='policy:{"example":"single fiduciary"}' status () { #Determine if an extension is running @@ -23,6 +25,9 @@ status () { execute_bitcoin () { #Run 2 Tests against the Bitcoin Extension echo "Bitcoin Plugin Tests [2 Tests]" + +# echo "http://localhost:5556/$apiVersion/order" -H "accept: */*" -H "Content-Type: application/json" -d "{\"policy\":$simplePolicy,\"beneficiaryIDDocumentCID\":\"\",\"extension\":{\"coin\":\"0\"}}" + output1=$(curl -s -X POST "http://localhost:5556/$apiVersion/order" -H "accept: */*" -H "Content-Type: application/json" -d "{\"policy\":$simplePolicy,\"beneficiaryIDDocumentCID\":\"\",\"extension\":{\"coin\":\"0\"}}") echo $output1 op1=$(echo $output1 | jq .orderReference) @@ -109,10 +114,8 @@ execute_safeguardsecret () { execute_milagro () { echo "Milagro Tests [1 Test]" output1=$(curl -s -X POST "http://localhost:5556/$apiVersion/order" -H "accept: */*" -H "Content-Type: application/json" -d "{\"beneficiaryIDDocumentCID\":$identity}") - echo $output1 op1=$(echo $output1 | jq .orderReference) - commitment1=$(echo $output1 | jq .commitment) output2=$(curl -s -X POST "http://localhost:5556/$apiVersion/order/secret" -H "accept: */*" -H "Content-Type: application/json" -d "{\"orderReference\":$op1,\"beneficiaryIDDocumentCID\":$identity}") commitment2=$(echo $output2 | jq .commitment) @@ -154,7 +157,7 @@ execute_orderlist () { #A simple smoke test to ensure some sort of order is returned hasSecret=`echo $outputOrder | grep "Secret"` - if [ -z $hasSecret ]; then + if [ -z "$hasSecret" ]; then echo "Failed Order has error" exit 1 else diff --git a/go.mod b/go.mod index 7adef26..2777869 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,11 @@ module github.com/apache/incubator-milagro-dta require ( - github.com/VividCortex/gohistogram v1.0.0 // indirect + code.qredo.net/libcustody v0.1.17 github.com/btcsuite/btcd v0.0.0-20190427004231-96897255fd17 github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d github.com/coreos/go-oidc v2.0.0+incompatible + github.com/ethereum/go-ethereum v1.8.27 github.com/go-kit/kit v0.8.0 github.com/go-playground/locales v0.12.1 // indirect github.com/go-playground/universal-translator v0.16.0 // indirect @@ -27,12 +28,10 @@ require ( github.com/multiformats/go-multihash v0.0.5 github.com/mwitkow/go-proto-validators v0.0.0-20190709101305-c00cd28f239a github.com/pkg/errors v0.8.1 - github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35 // indirect github.com/prometheus/client_golang v0.9.3 github.com/stretchr/testify v1.3.0 github.com/tyler-smith/go-bip39 v1.0.0 go.etcd.io/bbolt v1.3.3 - google.golang.org/appengine v1.4.0 // indirect gopkg.in/go-playground/assert.v1 v1.2.1 // indirect gopkg.in/go-playground/validator.v9 v9.29.1 gopkg.in/square/go-jose.v2 v2.3.1 // indirect diff --git a/go.sum b/go.sum index 521c6f5..a7623ae 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,9 @@ bazil.org/fuse v0.0.0-20180421153158-65cc252bf669 h1:FNCRpXiquG1aoyqcIWVFmpTSKVcx2bQD38uZZeGtdlw= bazil.org/fuse v0.0.0-20180421153158-65cc252bf669/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +code.qredo.net/libcustody v0.1.17 h1:HobIrYBS/Viv7P43C+ubD6CGdS5Ax1itLV4+fq7fJgU= +code.qredo.net/libcustody v0.1.17/go.mod h1:jfdOca8JV9wFPaXNJ3cOr+1p0qRtoNLtgJ/uOuAi430= github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9 h1:HD8gA2tkByhMAwYaFAX9w2l7vxvBQ5NMoxDrkhqhtn4= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= @@ -29,10 +32,12 @@ github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnweb github.com/bren2010/proquint v0.0.0-20160323162903-38337c27106d h1:QgeLLoPD3kRVmeu/1al9iIpIANMi9O1zXFm8BnYGCJg= github.com/bren2010/proquint v0.0.0-20160323162903-38337c27106d/go.mod h1:Jbj8eKecMNwf0KFI75skSUZqMB4UCRcndUScVBTWyUI= github.com/btcsuite/btcd v0.0.0-20190213025234-306aecffea32/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= +github.com/btcsuite/btcd v0.0.0-20190410025418-9bfb2ca0346b/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= github.com/btcsuite/btcd v0.0.0-20190427004231-96897255fd17 h1:m0N5Vg5nP3zEz8TREZpwX3gt4Biw3/8fbIf4A3hO96g= github.com/btcsuite/btcd v0.0.0-20190427004231-96897255fd17/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= +github.com/btcsuite/btcutil v0.0.0-20190316010144-3ac1210f4b38/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d h1:yJzD/yFppdVCf6ApMkVy8cUxV0XrxdP9rVf6D87/Mng= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= @@ -75,6 +80,8 @@ github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8 github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/elgris/jsondiff v0.0.0-20160530203242-765b5c24c302/go.mod h1:qBlWZqWeVx9BjvqBsnC/8RUlAYpIFmPvgROcw0n1scE= +github.com/ethereum/go-ethereum v1.8.27 h1:d+gkiLaBDk5fn3Pe/xNVaMrB/ozI+AUB2IlVBp29IrY= +github.com/ethereum/go-ethereum v1.8.27/go.mod h1:PwpWDrCLZrV+tfrhqqF6kPknbISMHaJv9Ln3kPCZLwY= github.com/facebookgo/atomicfile v0.0.0-20151019160806-2de1f203e7d5 h1:BBso6MBKW8ncyZLv37o+KNyy0HrrHgfnOaGQC2qvN+A= github.com/facebookgo/atomicfile v0.0.0-20151019160806-2de1f203e7d5/go.mod h1:JpoxHjuQauoxiFMl1ie8Xc/7TfLuMZ5eOCONd1sUBHg= github.com/fatih/color v1.6.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -124,6 +131,7 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= @@ -143,6 +151,7 @@ github.com/golangci/misspell v0.0.0-20180809174111-950f5d19e770/go.mod h1:dEbvlS github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21/go.mod h1:tf5+bzsHdTM0bsB7+8mt0GUMvjCgwLpTapNZHU8AajI= github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0/go.mod h1:qOQCunEYvmd/TLamH+7LlVccLvUH5kZNhbCgTHoBbp4= github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= +github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -150,6 +159,7 @@ github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/mux v1.7.0/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= @@ -588,6 +598,7 @@ github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7z github.com/prometheus/procfs v0.0.0-20190519111021-9935e8e0588d h1:Z5QMcUKnQw7ouB1wDuyZM6TL/rm+brJcNk6Ai8ut3zM= github.com/prometheus/procfs v0.0.0-20190519111021-9935e8e0588d/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rafaeljusto/redigomock v0.0.0-20190202135759-257e089e14a1/go.mod h1:JaY6n2sDr+z2WTsXkOmNRUfDy6FN0L6Nk7x06ndm4tY= github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= @@ -712,6 +723,7 @@ golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20181102091132-c10e9556a7bc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190310074541-c10a0554eabf/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -723,6 +735,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwL golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190319182350-c85d3e98c914 h1:jIOcLT9BZzyJ9ce+IwwZ+aF9yeCqzrR+NrD68a/SHKw= +golang.org/x/oauth2 v0.0.0-20190319182350-c85d3e98c914/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -789,6 +803,7 @@ gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXa gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= gopkg.in/go-playground/validator.v9 v9.29.1 h1:SvGtYmN60a5CVKTOzMSyfzWDeZRxRuGvRQyEAKbw1xc= gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= +gopkg.in/square/go-jose.v2 v2.3.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/square/go-jose.v2 v2.3.1 h1:SK5KegNXmKmqE342YYN2qPHEnUYeoMiXXl1poUlI+o4= gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= diff --git a/libs/documents/docs.pb.go b/libs/documents/docs.pb.go index 51e50dd..a93e74c 100644 --- a/libs/documents/docs.pb.go +++ b/libs/documents/docs.pb.go @@ -7,6 +7,7 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/golang/protobuf/proto" + timestamp "github.com/golang/protobuf/ptypes/timestamp" _ "github.com/mwitkow/go-proto-validators" math "math" ) @@ -709,20 +710,21 @@ func (m *PolicyWrapper) GetPolicy() *Policy { } type Policy struct { - Example string `protobuf:"bytes,2,opt,name=example,proto3" json:"example,omitempty"` - WalletRef string `protobuf:"bytes,3,opt,name=walletRef,proto3" json:"walletRef,omitempty"` - NodeId string `protobuf:"bytes,4,opt,name=nodeId,proto3" json:"nodeId,omitempty"` - Coin int64 `protobuf:"varint,5,opt,name=coin,proto3" json:"coin,omitempty"` - SharingGroups []*SharingGroup `protobuf:"bytes,6,rep,name=sharingGroups,proto3" json:"sharingGroups,omitempty"` - ParticipantCount int64 `protobuf:"varint,7,opt,name=participantCount,proto3" json:"participantCount,omitempty"` - Threshold int64 `protobuf:"varint,8,opt,name=threshold,proto3" json:"threshold,omitempty"` - Signers []int64 `protobuf:"varint,9,rep,packed,name=signers,proto3" json:"signers,omitempty"` - PublicAddress string `protobuf:"bytes,10,opt,name=publicAddress,proto3" json:"publicAddress,omitempty"` - Beneficiarydocid string `protobuf:"bytes,11,opt,name=beneficiarydocid,proto3" json:"beneficiarydocid,omitempty"` - DateTime int64 `protobuf:"varint,12,opt,name=dateTime,proto3" json:"dateTime,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Example string `protobuf:"bytes,2,opt,name=Example,json=example,proto3" json:"Example,omitempty"` + WalletRef string `protobuf:"bytes,3,opt,name=WalletRef,json=walletRef,proto3" json:"WalletRef,omitempty"` + NodeId string `protobuf:"bytes,4,opt,name=NodeId,json=nodeId,proto3" json:"NodeId,omitempty"` + CoinType int64 `protobuf:"varint,5,opt,name=CoinType,json=coin,proto3" json:"CoinType,omitempty"` + SharingGroups []*SharingGroup `protobuf:"bytes,6,rep,name=SharingGroups,json=sharingGroups,proto3" json:"SharingGroups,omitempty"` + ParticipantCount int64 `protobuf:"varint,7,opt,name=ParticipantCount,json=participantCount,proto3" json:"ParticipantCount,omitempty"` + Threshold int64 `protobuf:"varint,8,opt,name=Threshold,json=threshold,proto3" json:"Threshold,omitempty"` + Signers []int64 `protobuf:"varint,9,rep,packed,name=Signers,json=signers,proto3" json:"Signers,omitempty"` + PublicAddress string `protobuf:"bytes,10,opt,name=PublicAddress,json=publicaddress,proto3" json:"PublicAddress,omitempty"` + BeneficiaryDocCID string `protobuf:"bytes,11,opt,name=BeneficiaryDocCID,json=beneficiarydocid,proto3" json:"BeneficiaryDocCID,omitempty"` + UpdatedAt *timestamp.Timestamp `protobuf:"bytes,12,opt,name=UpdatedAt,json=updatedAt,proto3" json:"UpdatedAt,omitempty"` + CreatedAt *timestamp.Timestamp `protobuf:"bytes,13,opt,name=CreatedAt,json=createdAt,proto3" json:"CreatedAt,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Policy) Reset() { *m = Policy{} } @@ -771,9 +773,9 @@ func (m *Policy) GetNodeId() string { return "" } -func (m *Policy) GetCoin() int64 { +func (m *Policy) GetCoinType() int64 { if m != nil { - return m.Coin + return m.CoinType } return 0 } @@ -813,31 +815,38 @@ func (m *Policy) GetPublicAddress() string { return "" } -func (m *Policy) GetBeneficiarydocid() string { +func (m *Policy) GetBeneficiaryDocCID() string { if m != nil { - return m.Beneficiarydocid + return m.BeneficiaryDocCID } return "" } -func (m *Policy) GetDateTime() int64 { +func (m *Policy) GetUpdatedAt() *timestamp.Timestamp { if m != nil { - return m.DateTime + return m.UpdatedAt } - return 0 + return nil +} + +func (m *Policy) GetCreatedAt() *timestamp.Timestamp { + if m != nil { + return m.CreatedAt + } + return nil } type SharingGroup struct { - Groupid int64 `protobuf:"varint,1,opt,name=groupid,proto3" json:"groupid,omitempty"` - Groupref string `protobuf:"bytes,2,opt,name=groupref,proto3" json:"groupref,omitempty"` - Ids []*Identity `protobuf:"bytes,3,rep,name=ids,proto3" json:"ids,omitempty"` - Threshold int64 `protobuf:"varint,4,opt,name=threshold,proto3" json:"threshold,omitempty"` - Signature []byte `protobuf:"bytes,5,opt,name=signature,proto3" json:"signature,omitempty"` - TimeStamp int64 `protobuf:"varint,6,opt,name=timeStamp,proto3" json:"timeStamp,omitempty"` - Status string `protobuf:"bytes,7,opt,name=status,proto3" json:"status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + GroupID int64 `protobuf:"varint,1,opt,name=GroupID,json=groupId,proto3" json:"GroupID,omitempty"` + GroupRef string `protobuf:"bytes,2,opt,name=GroupRef,json=groupref,proto3" json:"GroupRef,omitempty"` + IDs []*Identity `protobuf:"bytes,3,rep,name=IDs,json=ids,proto3" json:"IDs,omitempty"` + Threshold int64 `protobuf:"varint,4,opt,name=Threshold,json=threshold,proto3" json:"Threshold,omitempty"` + Signature []byte `protobuf:"bytes,5,opt,name=Signature,json=signature,proto3" json:"Signature,omitempty"` + TimeStamp *timestamp.Timestamp `protobuf:"bytes,6,opt,name=TimeStamp,json=timeStamp,proto3" json:"TimeStamp,omitempty"` + Status string `protobuf:"bytes,7,opt,name=Status,json=status,proto3" json:"Status,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SharingGroup) Reset() { *m = SharingGroup{} } @@ -865,23 +874,23 @@ func (m *SharingGroup) XXX_DiscardUnknown() { var xxx_messageInfo_SharingGroup proto.InternalMessageInfo -func (m *SharingGroup) GetGroupid() int64 { +func (m *SharingGroup) GetGroupID() int64 { if m != nil { - return m.Groupid + return m.GroupID } return 0 } -func (m *SharingGroup) GetGroupref() string { +func (m *SharingGroup) GetGroupRef() string { if m != nil { - return m.Groupref + return m.GroupRef } return "" } -func (m *SharingGroup) GetIds() []*Identity { +func (m *SharingGroup) GetIDs() []*Identity { if m != nil { - return m.Ids + return m.IDs } return nil } @@ -900,11 +909,11 @@ func (m *SharingGroup) GetSignature() []byte { return nil } -func (m *SharingGroup) GetTimeStamp() int64 { +func (m *SharingGroup) GetTimeStamp() *timestamp.Timestamp { if m != nil { return m.TimeStamp } - return 0 + return nil } func (m *SharingGroup) GetStatus() string { @@ -916,15 +925,15 @@ func (m *SharingGroup) GetStatus() string { // Identity of a sharing group type Identity struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - IdRef string `protobuf:"bytes,2,opt,name=idRef,proto3" json:"idRef,omitempty"` - IdType string `protobuf:"bytes,3,opt,name=idType,proto3" json:"idType,omitempty"` - Share []byte `protobuf:"bytes,4,opt,name=share,proto3" json:"share,omitempty"` - Status string `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"` - TimeStamp int64 `protobuf:"varint,6,opt,name=timeStamp,proto3" json:"timeStamp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ID string `protobuf:"bytes,1,opt,name=ID,json=id,proto3" json:"ID,omitempty"` + IDRef string `protobuf:"bytes,2,opt,name=IDRef,json=idRef,proto3" json:"IDRef,omitempty"` + IDType string `protobuf:"bytes,3,opt,name=IDType,json=idType,proto3" json:"IDType,omitempty"` + Share []byte `protobuf:"bytes,4,opt,name=Share,json=share,proto3" json:"Share,omitempty"` + Status string `protobuf:"bytes,5,opt,name=Status,json=status,proto3" json:"Status,omitempty"` + TimeStamp *timestamp.Timestamp `protobuf:"bytes,6,opt,name=TimeStamp,json=timeStamp,proto3" json:"TimeStamp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Identity) Reset() { *m = Identity{} } @@ -952,23 +961,23 @@ func (m *Identity) XXX_DiscardUnknown() { var xxx_messageInfo_Identity proto.InternalMessageInfo -func (m *Identity) GetId() string { +func (m *Identity) GetID() string { if m != nil { - return m.Id + return m.ID } return "" } -func (m *Identity) GetIdRef() string { +func (m *Identity) GetIDRef() string { if m != nil { - return m.IdRef + return m.IDRef } return "" } -func (m *Identity) GetIdType() string { +func (m *Identity) GetIDType() string { if m != nil { - return m.IdType + return m.IDType } return "" } @@ -987,11 +996,11 @@ func (m *Identity) GetStatus() string { return "" } -func (m *Identity) GetTimeStamp() int64 { +func (m *Identity) GetTimeStamp() *timestamp.Timestamp { if m != nil { return m.TimeStamp } - return 0 + return nil } type PlainTestMessage1 struct { @@ -1122,9 +1131,9 @@ func init() { proto.RegisterType((*OrderPart3)(nil), "documents.OrderPart3") proto.RegisterType((*OrderPart4)(nil), "documents.OrderPart4") proto.RegisterType((*PolicyWrapper)(nil), "documents.PolicyWrapper") - proto.RegisterType((*Policy)(nil), "documents.policy") - proto.RegisterType((*SharingGroup)(nil), "documents.sharingGroup") - proto.RegisterType((*Identity)(nil), "documents.identity") + proto.RegisterType((*Policy)(nil), "documents.Policy") + proto.RegisterType((*SharingGroup)(nil), "documents.SharingGroup") + proto.RegisterType((*Identity)(nil), "documents.Identity") proto.RegisterType((*PlainTestMessage1)(nil), "documents.PlainTestMessage1") proto.RegisterType((*EncryptTestMessage1)(nil), "documents.EncryptTestMessage1") proto.RegisterType((*SimpleString)(nil), "documents.SimpleString") @@ -1133,85 +1142,90 @@ func init() { func init() { proto.RegisterFile("docs.proto", fileDescriptor_2a25dace11219bce) } var fileDescriptor_2a25dace11219bce = []byte{ - // 1267 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0x4b, 0x6f, 0x1c, 0xc5, - 0x13, 0xd7, 0x78, 0xec, 0x8d, 0xa7, 0xbc, 0xf6, 0xdf, 0xe9, 0x38, 0xc9, 0x28, 0xff, 0x08, 0x5b, - 0x23, 0x83, 0x0c, 0xc2, 0x36, 0x59, 0x3b, 0x11, 0x58, 0x20, 0x14, 0xef, 0x86, 0xb0, 0xe2, 0xb5, - 0xf4, 0x5a, 0x06, 0x29, 0x4a, 0xa4, 0xf1, 0x74, 0x79, 0xb7, 0x95, 0xdd, 0xe9, 0xd1, 0x4c, 0x6f, - 0x92, 0x15, 0x70, 0xe6, 0xc0, 0x81, 0x03, 0x5c, 0xb9, 0x20, 0xe5, 0xca,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xa1, 0xae, 0xe2, 0x4c, - 0x2f, 0xc2, 0x14, 0x7c, 0x19, 0xa5, 0xb4, 0x55, 0xa6, 0x30, 0xdb, 0xbe, 0x29, 0x61, 0x3c, 0x3c, - 0x63, 0x3e, 0xfc, 0x6c, 0x77, 0xbd, 0x1b, 0x70, 0xb1, 0x33, 0xf0, 0x79, 0xb8, 0x87, 0x89, 0xcc, - 0x3e, 0xa9, 0x6f, 0x28, 0x93, 0x0f, 0xfd, 0x21, 0x4a, 0x4c, 0xe4, 0x8d, 0xcc, 0xcb, 0x92, 0xe1, - 0x6d, 0xc1, 0xa5, 0x6c, 0xb0, 0x4c, 0x32, 0x6a, 0x9c, 0x34, 0x6a, 0x78, 0x6b, 0x50, 0xef, 0x72, - 0xd5, 0x55, 0x5d, 0xa9, 0x4a, 0xac, 0xaa, 0xdb, 0x14, 0xa1, 0xc4, 0x30, 0x1f, 0x27, 0x39, 0x79, - 0x50, 0xd3, 0xff, 0x32, 0xb6, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0x63, 0xbb, 0xd8, 0x02, 0xe5, - 0x0c, 0x00, 0x00, + // 1352 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xcf, 0x6f, 0x1b, 0xc5, + 0x17, 0x97, 0xb3, 0xb6, 0xe3, 0x7d, 0xb1, 0xf3, 0x75, 0xa7, 0x69, 0xbb, 0xca, 0xb7, 0xfa, 0x26, + 0xb2, 0xf2, 0x45, 0xe1, 0x47, 0x1c, 0xea, 0xa4, 0x55, 0x89, 0x40, 0xa8, 0xb1, 0x43, 0xb1, 0x80, + 0x62, 0xc6, 0x21, 0x45, 0xaa, 0x5a, 0x69, 0xb3, 0xfb, 0x62, 0x8f, 0x6a, 0xef, 0xac, 0x76, 0xc7, + 0x6d, 0x2d, 0xe0, 0xcc, 0x81, 0x23, 0x67, 0x2e, 0x48, 0xbd, 0x22, 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 0x89, 0x0d, 0x00, 0x00, } diff --git a/libs/documents/docs.proto b/libs/documents/docs.proto index 06ae5be..41673e3 100644 --- a/libs/documents/docs.proto +++ b/libs/documents/docs.proto @@ -30,6 +30,8 @@ syntax="proto3"; package documents; import "github.com/mwitkow/go-proto-validators/validator.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; + //The Encrypted Envelope message SignedEnvelope { @@ -85,7 +87,7 @@ message OrderDocument { OrderPart2 OrderPart2 = 7; OrderPart3 OrderPart3 = 8; OrderPart4 OrderPart4 = 9; - policy policy = 10; + Policy policy = 10; } message OrderPart2 { @@ -108,41 +110,42 @@ message OrderPart4 { } message PolicyWrapper{ - policy policy = 1; + Policy policy = 1; } -message policy{ - string example = 2; - string walletRef = 3; - string nodeId = 4; - int64 coin = 5; - repeated sharingGroup sharingGroups = 6; - int64 participantCount = 7; - int64 threshold = 8; - repeated int64 signers = 9; - string publicAddress = 10; - string beneficiarydocid = 11; - int64 dateTime = 12 [(validator.field) = {int_gt:1564050341,int_lt:32521429541}]; +message Policy{ + string Example = 2 [json_name="example"];; + string WalletRef = 3 [json_name="walletRef"];; + string NodeId = 4 [json_name="nodeId"];; + int64 CoinType = 5 [json_name="coin"];; + repeated SharingGroup SharingGroups = 6 [json_name="sharingGroups"];; + int64 ParticipantCount = 7 [json_name="participantCount"];; + int64 Threshold = 8 [json_name="threshold"]; + repeated int64 Signers = 9 [json_name="signers"];; + string PublicAddress = 10 [json_name="publicaddress"];; + string BeneficiaryDocCID = 11 [json_name="beneficiarydocid"]; + google.protobuf.Timestamp UpdatedAt = 12 [json_name="updatedAt"]; + google.protobuf.Timestamp CreatedAt = 13 [json_name="createdAt"]; } -message sharingGroup { - int64 groupid = 1; - string groupref = 2; - repeated identity ids = 3; - int64 threshold = 4; - bytes signature = 5; - int64 timeStamp = 6; - string status = 7; +message SharingGroup { + int64 GroupID = 1 [json_name="groupId"]; + string GroupRef = 2 [json_name="groupref"]; + repeated Identity IDs = 3 [json_name="ids"]; + int64 Threshold = 4 [json_name="threshold"]; + bytes Signature = 5 [json_name="signature"]; + google.protobuf.Timestamp TimeStamp = 6 [json_name="timeStamp"]; + string Status = 7 [json_name="status"]; } // Identity of a sharing group -message identity { - string id = 1; - string idRef = 2; - string idType = 3; - bytes share = 4; - string status = 5; - int64 timeStamp = 6; +message Identity { + string ID = 1 [json_name="id"]; + string IDRef = 2 [json_name="idRef"]; + string IDType = 3 [json_name="idType"]; + bytes Share = 4 [json_name="share"]; + string Status = 5 [json_name="status"]; + google.protobuf.Timestamp TimeStamp = 6 [json_name="timeStamp"]; } message PlainTestMessage1 { diff --git a/libs/documents/docs.validator.pb.go b/libs/documents/docs.validator.pb.go index ea66ec7..63dc63a 100644 --- a/libs/documents/docs.validator.pb.go +++ b/libs/documents/docs.validator.pb.go @@ -9,6 +9,7 @@ import ( proto "github.com/golang/protobuf/proto" _ "github.com/mwitkow/go-proto-validators" _ "github.com/gogo/protobuf/gogoproto" + _ "github.com/golang/protobuf/ptypes/timestamp" regexp "regexp" github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" ) @@ -183,25 +184,39 @@ func (this *Policy) Validate() error { } } } - if !(this.DateTime > 1564050341) { - return github_com_mwitkow_go_proto_validators.FieldError("DateTime", fmt.Errorf(`value '%v' must be greater than '1564050341'`, this.DateTime)) + if this.UpdatedAt != nil { + if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.UpdatedAt); err != nil { + return github_com_mwitkow_go_proto_validators.FieldError("UpdatedAt", err) + } } - if !(this.DateTime < 32521429541) { - return github_com_mwitkow_go_proto_validators.FieldError("DateTime", fmt.Errorf(`value '%v' must be less than '32521429541'`, this.DateTime)) + if this.CreatedAt != nil { + if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.CreatedAt); err != nil { + return github_com_mwitkow_go_proto_validators.FieldError("CreatedAt", err) + } } return nil } func (this *SharingGroup) Validate() error { - for _, item := range this.Ids { + for _, item := range this.IDs { if item != nil { if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { - return github_com_mwitkow_go_proto_validators.FieldError("Ids", err) + return github_com_mwitkow_go_proto_validators.FieldError("IDs", err) } } } + if this.TimeStamp != nil { + if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.TimeStamp); err != nil { + return github_com_mwitkow_go_proto_validators.FieldError("TimeStamp", err) + } + } return nil } func (this *Identity) Validate() error { + if this.TimeStamp != nil { + if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.TimeStamp); err != nil { + return github_com_mwitkow_go_proto_validators.FieldError("TimeStamp", err) + } + } return nil } func (this *PlainTestMessage1) Validate() error { diff --git a/libs/documents/policy_test.go b/libs/documents/policy_test.go index a0dbdff..3c5164d 100644 --- a/libs/documents/policy_test.go +++ b/libs/documents/policy_test.go @@ -9,9 +9,12 @@ import ( "github.com/stretchr/testify/assert" ) +func Test_a(t *testing.T) { + +} + //Test_PolicyReadSamples - read in sample JSON polcies and ensure they are correctly //parsed into JSON and then Protobuffer formats - func Test_PolicyReadSamples(t *testing.T) { var policy *Policy var err error diff --git a/pkg/api/proto.go b/pkg/api/proto.go index 52ed9bf..9c960fe 100644 --- a/pkg/api/proto.go +++ b/pkg/api/proto.go @@ -172,55 +172,56 @@ type StatusResponse struct { //Policy - JSON polciy definition type Policy struct { + Example string `json:"example" protobuf:"name=Example"` // WalletRef is the customer ref ID for the wallet - WalletRef string `json:"walletRef"` + WalletRef string `json:"walletRef" protobuf:"name=WalletRef"` // NodeID as provided by the customer registration - NodeID string `json:"nodeId"` + NodeID string `json:"nodeId" protobuf:"name=NodeID"` // coinType is the coin type // 0 - Bitcoin // 1 - Bitcoin test - CoinType int `json:"coin"` + CoinType int `json:"coin" protobuf:"name=CoinType"` // Sharing groups. Each group defines a list of identities. // The leader and the node are added automatically. - SharingGroups []SharingGroup `json:"sharingGroups"` + SharingGroups []SharingGroup `json:"sharingGroups" protobuf:"name=SharingGroups"` // The number of participants - ParticipantCount uint `json:"participantCount"` + ParticipantCount uint `json:"participantCount" protobuf:"name=ParticipantCount"` // The required number of signatures - Threshold uint `json:"threshold"` + Threshold uint `json:"threshold" protobuf:"name=Threshold"` // Slice that points to signer's keys - Signers []uint `json:"signers"` + Signers []uint `json:"signers" protobuf:"name=Signers"` //Public Address for deposit - PublicAddress string `json:"publicaddress"` + PublicAddress string `json:"publicaddress" protobuf:"name=PublicAddress"` //The beneficiary who is able to spend - BeneficiaryDocID string `json:"beneficiarydocid"` + BeneficiaryDocID string `json:"beneficiarydocid" protobuf:"name=BeneficiaryDocCID"` //TimeStamps - CreatedAt time.Time `json:"createdAt"` - UpdatedAt time.Time `json:"updatedAt"` + CreatedAt time.Time `json:"createdAt" protobuf:"name=CreatedAt"` + UpdatedAt time.Time `json:"updatedAt" protobuf:"name=UpdatedAt"` } // SharingGroup defines a list of identities that will hold // the secret after split type SharingGroup struct { - GroupID int `json:"groupId"` - GroupRef string `json:"groupref"` - IDs []Identity `json:"ids"` - Threshold int `json:"threshold"` + GroupID int `json:"groupId" protobuf:"name=GroupID"` + GroupRef string `json:"groupref" protobuf:"name=GroupRef"` + IDs []Identity `json:"ids" protobuf:"name=IDs"` + Threshold int `json:"threshold" protobuf:"name=Threshold"` //Temporary store of pSig during withdrawal - Signature []byte `json:"signature,omitempty"` - TimeStamp time.Time `json:"timeStamp"` - Status string `json:"status"` + Signature []byte `json:"signature,omitempty" protobuf:"name=Signature"` + TimeStamp time.Time `json:"timeStamp" protobuf:"name=TimeStamp"` + Status string `json:"status" protobuf:"name=Status"` } // Identity of a sharing group type Identity struct { // ID is a verifiable identity of IDType - ID string `json:"id"` + ID string `json:"id" protobuf:"name=ID"` // IDRef is the identity reference - IDRef string `json:"idRef"` + IDRef string `json:"idRef" protobuf:"name=IDRef"` // IDType is the identity type, e.g. "phone" - IDType string `json:"idType"` + IDType string `json:"idType" protobuf:"name=IDType"` //Temporary store of vss shares during withdrawal - Share []byte `json:"share,omitempty"` - Status string `json:"status"` - TimeStamp time.Time `json:"timeStamp"` + Share []byte `json:"share,omitempty" protobuf:"name=Share"` + Status string `json:"status" protobuf:"name=Status"` + TimeStamp time.Time `json:"timeStamp" protobuf:"name=TimeStamp"` } diff --git a/pkg/common/common.go b/pkg/common/common.go index 3105cf8..cd9bb7d 100644 --- a/pkg/common/common.go +++ b/pkg/common/common.go @@ -22,11 +22,14 @@ package common import ( "encoding/hex" + "encoding/json" "fmt" "io" "sync" "time" + "github.com/gogo/protobuf/jsonpb" + "github.com/apache/incubator-milagro-dta/libs/cryptowallet" "github.com/apache/incubator-milagro-dta/libs/datastore" "github.com/apache/incubator-milagro-dta/libs/documents" @@ -47,12 +50,21 @@ type IdentitySecrets struct { } // CreateNewDepositOrder - Generate an empty new Deposit Order with random reference -func CreateNewDepositOrder(BeneficiaryIDDocumentCID string, nodeID string, policy api.Policy) (*documents.OrderDoc, error) { +func CreateNewDepositOrder(BeneficiaryIDDocumentCID string, nodeID string, jsonPolicy api.Policy) (*documents.OrderDoc, error) { //Create a reference for this order reference, err := uuid.NewUUID() if err != nil { return nil, err } + + //Generate ProtoBuffer Version of the Policy from the JSON version + policy := &documents.Policy{} + policyJSONString, err := json.Marshal(jsonPolicy) + err = jsonpb.UnmarshalString(string(policyJSONString), policy) + if err != nil { + return nil, errors.Wrap(err, "Invalid Policy") + } + order := documents.NewOrderDoc() //oder.Type will be used to extend the things that an order can do. order.Type = "Safeguard_Secret" @@ -60,6 +72,7 @@ func CreateNewDepositOrder(BeneficiaryIDDocumentCID string, nodeID string, polic order.Reference = reference.String() order.BeneficiaryCID = BeneficiaryIDDocumentCID order.Timestamp = time.Now().Unix() + order.Policy = policy return &order, nil }
