diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..29c3364 --- /dev/null +++ b/go.mod @@ -0,0 +1,12 @@ +module github.com/trisacrypto/trisa + +go 1.16 + +require ( + github.com/golang/protobuf v1.5.2 + github.com/google/uuid v1.2.0 + github.com/stretchr/testify v1.7.0 + google.golang.org/grpc v1.37.0 + google.golang.org/protobuf v1.26.0 + software.sslmate.com/src/go-pkcs12 v0.0.0-20210415151418-c5206de65a78 +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..6c44890 --- /dev/null +++ b/go.sum @@ -0,0 +1,105 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= +github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 h1:/ZScEX8SfEmUGRHs0gxpqteO5nfNW6axyZbBdw9A12g= +golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/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-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +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-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.37.0 h1:uSZWeQJX5j11bIQ4AJoj+McDBo29cY1MCoC1wO3ts+c= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +software.sslmate.com/src/go-pkcs12 v0.0.0-20210415151418-c5206de65a78 h1:SqYE5+A2qvRhErbsXFfUEUmpWEKxxRSMgGLkvRAFOV4= +software.sslmate.com/src/go-pkcs12 v0.0.0-20210415151418-c5206de65a78/go.mod h1:B7Wf0Ya4DHF9Yw+qfZuJijQYkWicqDa+79Ytmmq3Kjg= diff --git a/lib/README.md b/lib/README.md new file mode 100644 index 0000000..c80d7b3 --- /dev/null +++ b/lib/README.md @@ -0,0 +1 @@ +# TRISA Libraries \ No newline at end of file diff --git a/lib/java/.gitkeep b/lib/java/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/lib/node/.gitkeep b/lib/node/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/lib/python/.gitkeep b/lib/python/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/pkg/iso3166/alpha.go b/pkg/iso3166/alpha.go new file mode 100644 index 0000000..fb0aea6 --- /dev/null +++ b/pkg/iso3166/alpha.go @@ -0,0 +1,350 @@ +package iso3166 + +import ( + "fmt" + "strings" +) + +func init() { + // Build the mappings for the lookup functions to work. + countries = make(map[string]*AlphaCode) + alpha3 = make(map[string]*AlphaCode) + alpha2 = make(map[string]*AlphaCode) + numeric = make(map[string]*AlphaCode) + + for _, code := range data { + countries[code.Country] = code + alpha2[code.Alpha2] = code + alpha3[code.Alpha3] = code + numeric[code.Numeric] = code + } +} + +var data = []*AlphaCode{ + {"Afghanistan", "AF", "AFG", "004"}, + {"Albania", "AL", "ALB", "008"}, + {"Algeria", "DZ", "DZA", "012"}, + {"American Samoa", "AS", "ASM", "016"}, + {"Andorra", "AD", "AND", "020"}, + {"Angola", "AO", "AGO", "024"}, + {"Anguilla", "AI", "AIA", "660"}, + {"Antarctica", "AQ", "ATA", "010"}, + {"Antigua and Barbuda", "AG", "ATG", "028"}, + {"Argentina", "AR", "ARG", "032"}, + {"Armenia", "AM", "ARM", "051"}, + {"Aruba", "AW", "ABW", "533"}, + {"Australia", "AU", "AUS", "036"}, + {"Austria", "AT", "AUT", "040"}, + {"Azerbaijan", "AZ", "AZE", "031"}, + {"Bahamas", "BS", "BHS", "044"}, + {"Bahrain", "BH", "BHR", "048"}, + {"Bangladesh", "BD", "BGD", "050"}, + {"Barbados", "BB", "BRB", "052"}, + {"Belarus", "BY", "BLR", "112"}, + {"Belgium", "BE", "BEL", "056"}, + {"Belize", "BZ", "BLZ", "084"}, + {"Benin", "BJ", "BEN", "204"}, + {"Bermuda", "BM", "BMU", "060"}, + {"Bhutan", "BT", "BTN", "064"}, + {"Bolivia", "BO", "BOL", "068"}, + {"Bonaire, Sint Eustatius and Saba", "BQ", "BES", "535"}, + {"Bosnia and Herzegovina", "BA", "BIH", "070"}, + {"Botswana", "BW", "BWA", "072"}, + {"Bouvet Island", "BV", "BVT", "074"}, + {"Brazil", "BR", "BRA", "076"}, + {"British Indian Ocean Territory", "IO", "IOT", "086"}, + {"Brunei Darussalam", "BN", "BRN", "096"}, + {"Bulgaria", "BG", "BGR", "100"}, + {"Burkina Faso", "BF", "BFA", "854"}, + {"Burundi", "BI", "BDI", "108"}, + {"Cabo Verde", "CV", "CPV", "132"}, + {"Cambodia", "KH", "KHM", "116"}, + {"Cameroon", "CM", "CMR", "120"}, + {"Canada", "CA", "CAN", "124"}, + {"Cayman Islands", "KY", "CYM", "136"}, + {"Central African Republic", "CF", "CAF", "140"}, + {"Chad", "TD", "TCD", "148"}, + {"Chile", "CL", "CHL", "152"}, + {"China", "CN", "CHN", "156"}, + {"Christmas Island", "CX", "CXR", "162"}, + {"Cocos Islands", "CC", "CCK", "166"}, + {"Colombia", "CO", "COL", "170"}, + {"Comoros", "KM", "COM", "174"}, + {"Democratic Republic of the Congo", "CD", "COD", "180"}, + {"Congo", "CG", "COG", "178"}, + {"Cook Islands", "CK", "COK", "184"}, + {"Costa Rica", "CR", "CRI", "188"}, + {"Croatia", "HR", "HRV", "191"}, + {"Cuba", "CU", "CUB", "192"}, + {"Curaçao", "CW", "CUW", "531"}, + {"Cyprus", "CY", "CYP", "196"}, + {"Czechia", "CZ", "CZE", "203"}, + {"Côte d'Ivoire", "CI", "CIV", "384"}, + {"Denmark", "DK", "DNK", "208"}, + {"Djibouti", "DJ", "DJI", "262"}, + {"Dominica", "DM", "DMA", "212"}, + {"Dominican Republic", "DO", "DOM", "214"}, + {"Ecuador", "EC", "ECU", "218"}, + {"Egypt", "EG", "EGY", "818"}, + {"El Salvador", "SV", "SLV", "222"}, + {"Equatorial Guinea", "GQ", "GNQ", "226"}, + {"Eritrea", "ER", "ERI", "232"}, + {"Estonia", "EE", "EST", "233"}, + {"Eswatini", "SZ", "SWZ", "748"}, + {"Ethiopia", "ET", "ETH", "231"}, + {"Falkland Islands", "FK", "FLK", "238"}, + {"Faroe Islands", "FO", "FRO", "234"}, + {"Fiji", "FJ", "FJI", "242"}, + {"Finland", "FI", "FIN", "246"}, + {"France", "FR", "FRA", "250"}, + {"French Guiana", "GF", "GUF", "254"}, + {"French Polynesia", "PF", "PYF", "258"}, + {"French Southern Territories", "TF", "ATF", "260"}, + {"Gabon", "GA", "GAB", "266"}, + {"Gambia", "GM", "GMB", "270"}, + {"Georgia", "GE", "GEO", "268"}, + {"Germany", "DE", "DEU", "276"}, + {"Ghana", "GH", "GHA", "288"}, + {"Gibraltar", "GI", "GIB", "292"}, + {"Greece", "GR", "GRC", "300"}, + {"Greenland", "GL", "GRL", "304"}, + {"Grenada", "GD", "GRD", "308"}, + {"Guadeloupe", "GP", "GLP", "312"}, + {"Guam", "GU", "GUM", "316"}, + {"Guatemala", "GT", "GTM", "320"}, + {"Guernsey", "GG", "GGY", "831"}, + {"Guinea", "GN", "GIN", "324"}, + {"Guinea-Bissau", "GW", "GNB", "624"}, + {"Guyana", "GY", "GUY", "328"}, + {"Haiti", "HT", "HTI", "332"}, + {"Heard Island and McDonald Islands", "HM", "HMD", "334"}, + {"Holy See", "VA", "VAT", "336"}, + {"Honduras", "HN", "HND", "340"}, + {"Hong Kong", "HK", "HKG", "344"}, + {"Hungary", "HU", "HUN", "348"}, + {"Iceland", "IS", "ISL", "352"}, + {"India", "IN", "IND", "356"}, + {"Indonesia", "ID", "IDN", "360"}, + {"Iran", "IR", "IRN", "364"}, + {"Iraq", "IQ", "IRQ", "368"}, + {"Ireland", "IE", "IRL", "372"}, + {"Isle of Man", "IM", "IMN", "833"}, + {"Israel", "IL", "ISR", "376"}, + {"Italy", "IT", "ITA", "380"}, + {"Jamaica", "JM", "JAM", "388"}, + {"Japan", "JP", "JPN", "392"}, + {"Jersey", "JE", "JEY", "832"}, + {"Jordan", "JO", "JOR", "400"}, + {"Kazakhstan", "KZ", "KAZ", "398"}, + {"Kenya", "KE", "KEN", "404"}, + {"Kiribati", "KI", "KIR", "296"}, + {"Democratic People's Republic of Korea", "KP", "PRK", "408"}, + {"Republic of Korea", "KR", "KOR", "410"}, + {"Kuwait", "KW", "KWT", "414"}, + {"Kyrgyzstan", "KG", "KGZ", "417"}, + {"Lao People's Democratic Republic", "LA", "LAO", "418"}, + {"Latvia", "LV", "LVA", "428"}, + {"Lebanon", "LB", "LBN", "422"}, + {"Lesotho", "LS", "LSO", "426"}, + {"Liberia", "LR", "LBR", "430"}, + {"Libya", "LY", "LBY", "434"}, + {"Liechtenstein", "LI", "LIE", "438"}, + {"Lithuania", "LT", "LTU", "440"}, + {"Luxembourg", "LU", "LUX", "442"}, + {"Macao", "MO", "MAC", "446"}, + {"Madagascar", "MG", "MDG", "450"}, + {"Malawi", "MW", "MWI", "454"}, + {"Malaysia", "MY", "MYS", "458"}, + {"Maldives", "MV", "MDV", "462"}, + {"Mali", "ML", "MLI", "466"}, + {"Malta", "MT", "MLT", "470"}, + {"Marshall Islands", "MH", "MHL", "584"}, + {"Martinique", "MQ", "MTQ", "474"}, + {"Mauritania", "MR", "MRT", "478"}, + {"Mauritius", "MU", "MUS", "480"}, + {"Mayotte", "YT", "MYT", "175"}, + {"Mexico", "MX", "MEX", "484"}, + {"Micronesia", "FM", "FSM", "583"}, + {"Moldova", "MD", "MDA", "498"}, + {"Monaco", "MC", "MCO", "492"}, + {"Mongolia", "MN", "MNG", "496"}, + {"Montenegro", "ME", "MNE", "499"}, + {"Montserrat", "MS", "MSR", "500"}, + {"Morocco", "MA", "MAR", "504"}, + {"Mozambique", "MZ", "MOZ", "508"}, + {"Myanmar", "MM", "MMR", "104"}, + {"Namibia", "NA", "NAM", "516"}, + {"Nauru", "NR", "NRU", "520"}, + {"Nepal", "NP", "NPL", "524"}, + {"Netherlands", "NL", "NLD", "528"}, + {"New Caledonia", "NC", "NCL", "540"}, + {"New Zealand", "NZ", "NZL", "554"}, + {"Nicaragua", "NI", "NIC", "558"}, + {"Niger", "NE", "NER", "562"}, + {"Nigeria", "NG", "NGA", "566"}, + {"Niue", "NU", "NIU", "570"}, + {"Norfolk Island", "NF", "NFK", "574"}, + {"Northern Mariana Islands", "MP", "MNP", "580"}, + {"Norway", "NO", "NOR", "578"}, + {"Oman", "OM", "OMN", "512"}, + {"Pakistan", "PK", "PAK", "586"}, + {"Palau", "PW", "PLW", "585"}, + {"Palestine", "PS", "PSE", "275"}, + {"Panama", "PA", "PAN", "591"}, + {"Papua New Guinea", "PG", "PNG", "598"}, + {"Paraguay", "PY", "PRY", "600"}, + {"Peru", "PE", "PER", "604"}, + {"Philippines", "PH", "PHL", "608"}, + {"Pitcairn", "PN", "PCN", "612"}, + {"Poland", "PL", "POL", "616"}, + {"Portugal", "PT", "PRT", "620"}, + {"Puerto Rico", "PR", "PRI", "630"}, + {"Qatar", "QA", "QAT", "634"}, + {"Republic of North Macedonia", "MK", "MKD", "807"}, + {"Romania", "RO", "ROU", "642"}, + {"Russia", "RU", "RUS", "643"}, + {"Rwanda", "RW", "RWA", "646"}, + {"Réunion", "RE", "REU", "638"}, + {"Saint Barthélemy", "BL", "BLM", "652"}, + {"Saint Helena, Ascension and Tristan da Cunha", "SH", "SHN", "654"}, + {"Saint Kitts and Nevis", "KN", "KNA", "659"}, + {"Saint Lucia", "LC", "LCA", "662"}, + {"Saint Martin", "MF", "MAF", "663"}, + {"Saint Pierre and Miquelon", "PM", "SPM", "666"}, + {"Saint Vincent and the Grenadines", "VC", "VCT", "670"}, + {"Samoa", "WS", "WSM", "882"}, + {"San Marino", "SM", "SMR", "674"}, + {"Sao Tome and Principe", "ST", "STP", "678"}, + {"Saudi Arabia", "SA", "SAU", "682"}, + {"Senegal", "SN", "SEN", "686"}, + {"Serbia", "RS", "SRB", "688"}, + {"Seychelles", "SC", "SYC", "690"}, + {"Sierra Leone", "SL", "SLE", "694"}, + {"Singapore", "SG", "SGP", "702"}, + {"Sint Maarten", "SX", "SXM", "534"}, + {"Slovakia", "SK", "SVK", "703"}, + {"Slovenia", "SI", "SVN", "705"}, + {"Solomon Islands", "SB", "SLB", "090"}, + {"Somalia", "SO", "SOM", "706"}, + {"South Africa", "ZA", "ZAF", "710"}, + {"South Georgia and the South Sandwich Islands", "GS", "SGS", "239"}, + {"South Sudan", "SS", "SSD", "728"}, + {"Spain", "ES", "ESP", "724"}, + {"Sri Lanka", "LK", "LKA", "144"}, + {"Sudan", "SD", "SDN", "729"}, + {"Suriname", "SR", "SUR", "740"}, + {"Svalbard and Jan Mayen", "SJ", "SJM", "744"}, + {"Sweden", "SE", "SWE", "752"}, + {"Switzerland", "CH", "CHE", "756"}, + {"Syrian Arab Republic", "SY", "SYR", "760"}, + {"Taiwan", "TW", "TWN", "158"}, + {"Tajikistan", "TJ", "TJK", "762"}, + {"Tanzania", "TZ", "TZA", "834"}, + {"Thailand", "TH", "THA", "764"}, + {"Timor-Leste", "TL", "TLS", "626"}, + {"Togo", "TG", "TGO", "768"}, + {"Tokelau", "TK", "TKL", "772"}, + {"Tonga", "TO", "TON", "776"}, + {"Trinidad and Tobago", "TT", "TTO", "780"}, + {"Tunisia", "TN", "TUN", "788"}, + {"Turkey", "TR", "TUR", "792"}, + {"Turkmenistan", "TM", "TKM", "795"}, + {"Turks and Caicos Islands", "TC", "TCA", "796"}, + {"Tuvalu", "TV", "TUV", "798"}, + {"Uganda", "UG", "UGA", "800"}, + {"Ukraine", "UA", "UKR", "804"}, + {"United Arab Emirates", "AE", "ARE", "784"}, + {"United Kingdom", "GB", "GBR", "826"}, + {"United States of America", "US", "USA", "840"}, + {"Uruguay", "UY", "URY", "858"}, + {"Uzbekistan", "UZ", "UZB", "860"}, + {"Vanuatu", "VU", "VUT", "548"}, + {"Venezuela", "VE", "VEN", "862"}, + {"Viet Nam", "VN", "VNM", "704"}, + {"British Virgin Islands", "VG", "VGB", "092"}, + {"U.S. Minor Outlying Islands", "UM", "UMI", "581"}, + {"U.S. Virgin Islands", "VI", "VIR", "850"}, + {"Wallis and Futuna", "WF", "WLF", "876"}, + {"Western Sahara", "EH", "ESH", "732"}, + {"Yemen", "YE", "YEM", "887"}, + {"Zambia", "ZM", "ZMB", "894"}, + {"Zimbabwe", "ZW", "ZWE", "716"}, + {"Åland Islands", "AX", "ALA", "248"}, +} + +// Lookup mappings +var ( + countries map[string]*AlphaCode + alpha2 map[string]*AlphaCode + alpha3 map[string]*AlphaCode + numeric map[string]*AlphaCode +) + +// AlphaCode maps country to alpha-2 and alpha-3 ISO 3166-1 codes and their numeric code. +type AlphaCode struct { + Country string + Alpha2 string + Alpha3 string + Numeric string +} + +// Find a country alpha code by the country name, 2 or 3 digit alpha code, or +// numeric code. An error is returned if the country can't be found. +func Find(s string) (_ AlphaCode, err error) { + var ok bool + var code *AlphaCode + + if len(s) == 2 { + if code, ok = alpha2[strings.ToUpper(s)]; ok { + return *code, nil + } + } + + if len(s) == 3 { + if code, ok = alpha3[strings.ToUpper(s)]; ok { + return *code, nil + } + + if code, ok = numeric[s]; ok { + return *code, nil + } + } + + // Attempt a fast case-sensitive lookup for exact names to improve performance + if code, ok = countries[s]; ok { + return *code, nil + } + + // Perform a slow case-insensitive and startswith search of the records + s = strings.ToUpper(s) + if strings.HasPrefix(s, "THE") { + s = strings.Replace(s, "THE", "", 1) + } + + results := make([]*AlphaCode, 0, 1) + for country, code := range countries { + country = strings.ToUpper(country) + if strings.HasPrefix(country, s) { + results = append(results, code) + } + } + + if len(results) == 1 { + return *results[0], nil + } + + if len(results) > 1 { + return AlphaCode{}, fmt.Errorf("%q is ambiguous, multiple countries matched", s) + } + + return AlphaCode{}, fmt.Errorf("could not find alpha code for %q", s) +} + +// List all country codes that are stored in the module +func List() (codes []*AlphaCode) { + codes = make([]*AlphaCode, 0, len(countries)) + for _, code := range countries { + codes = append(codes, code) + } + return codes +} diff --git a/pkg/iso3166/alpha_test.go b/pkg/iso3166/alpha_test.go new file mode 100644 index 0000000..d1f14e7 --- /dev/null +++ b/pkg/iso3166/alpha_test.go @@ -0,0 +1,60 @@ +package iso3166_test + +import ( + "strings" + "testing" + + "github.com/stretchr/testify/require" + "github.com/trisacrypto/trisa/pkg/iso3166" +) + +func TestFind(t *testing.T) { + code, err := iso3166.Find("United States") + require.NoError(t, err) + require.Equal(t, "USA", code.Alpha3) + + code, err = iso3166.Find("GB") + require.NoError(t, err) + require.Equal(t, "United Kingdom", code.Country) + + code, err = iso3166.Find("gb") + require.NoError(t, err) + require.Equal(t, "United Kingdom", code.Country) + + code, err = iso3166.Find("BRA") + require.NoError(t, err) + require.Equal(t, "Brazil", code.Country) + + code, err = iso3166.Find("bra") + require.NoError(t, err) + require.Equal(t, "Brazil", code.Country) + + code, err = iso3166.Find("376") + require.NoError(t, err) + require.Equal(t, "Israel", code.Country) + + code, err = iso3166.Find("turks and caicos") + require.NoError(t, err) + require.Equal(t, "TC", code.Alpha2) + + _, err = iso3166.Find("Foo") + require.Error(t, err) +} + +func TestNormalizedSearch(t *testing.T) { + for _, code := range iso3166.List() { + // Unnormalized result should always return + found, err := iso3166.Find(code.Country) + require.NoError(t, err) + require.Equal(t, code.Alpha3, found.Alpha3) + + // Normalized results might return an error + found, err = iso3166.Find(strings.ToLower(code.Country)) + if err != nil { + t.Logf("%q has an ambiguous, case-insensitive lookup", code.Country) + require.Contains(t, err.Error(), "ambiguous, multiple countries matched") + } else { + require.Equal(t, code.Alpha3, found.Alpha3) + } + } +} diff --git a/pkg/ivms101/enum.go b/pkg/ivms101/enum.go new file mode 100644 index 0000000..f9d663a --- /dev/null +++ b/pkg/ivms101/enum.go @@ -0,0 +1,38 @@ +package ivms101 + +// Short form natural person name type codes. +const ( + NaturalPersonAlias = NaturalPersonNameTypeCode_NATURAL_PERSON_NAME_TYPE_CODE_ALIA + NaturalPersonBirth = NaturalPersonNameTypeCode_NATURAL_PERSON_NAME_TYPE_CODE_BIRT + NaturalPersonMaiden = NaturalPersonNameTypeCode_NATURAL_PERSON_NAME_TYPE_CODE_MAID + NaturalPersonLegal = NaturalPersonNameTypeCode_NATURAL_PERSON_NAME_TYPE_CODE_LEGL + NaturalPersonMisc = NaturalPersonNameTypeCode_NATURAL_PERSON_NAME_TYPE_CODE_MISC +) + +// Short form legal person name type codes. +const ( + LegalPersonLegal = LegalPersonNameTypeCode_LEGAL_PERSON_NAME_TYPE_CODE_LEGL + LegalPersonShort = LegalPersonNameTypeCode_LEGAL_PERSON_NAME_TYPE_CODE_SHRT + LegalPersonTrading = LegalPersonNameTypeCode_LEGAL_PERSON_NAME_TYPE_CODE_TRAD +) + +// Short form address type codes. +const ( + AddressTypeHome = AddressTypeCode_ADDRESS_TYPE_CODE_HOME + AddressTypeBusiness = AddressTypeCode_ADDRESS_TYPE_CODE_BIZZ + AddressTypeGeographic = AddressTypeCode_ADDRESS_TYPE_CODE_GEOG +) + +// Short form national identifier type codes. +const ( + NationalIdentifierARNU = NationalIdentifierTypeCode_NATIONAL_IDENTIFIER_TYPE_CODE_ARNU + NationalIdentifierCCPT = NationalIdentifierTypeCode_NATIONAL_IDENTIFIER_TYPE_CODE_CCPT + NationalIdentifierRAID = NationalIdentifierTypeCode_NATIONAL_IDENTIFIER_TYPE_CODE_RAID + NationalIdentifierDRLC = NationalIdentifierTypeCode_NATIONAL_IDENTIFIER_TYPE_CODE_DRLC + NationalIdentifierFIIN = NationalIdentifierTypeCode_NATIONAL_IDENTIFIER_TYPE_CODE_FIIN + NationalIdentifierTXID = NationalIdentifierTypeCode_NATIONAL_IDENTIFIER_TYPE_CODE_TXID + NationalIdentifierSOCS = NationalIdentifierTypeCode_NATIONAL_IDENTIFIER_TYPE_CODE_SOCS + NationalIdentifierIDCD = NationalIdentifierTypeCode_NATIONAL_IDENTIFIER_TYPE_CODE_IDCD + NationalIdentifierLEIX = NationalIdentifierTypeCode_NATIONAL_IDENTIFIER_TYPE_CODE_LEIX + NationalIdentifierMISC = NationalIdentifierTypeCode_NATIONAL_IDENTIFIER_TYPE_CODE_MISC +) diff --git a/pkg/ivms101/enum.pb.go b/pkg/ivms101/enum.pb.go new file mode 100644 index 0000000..def1492 --- /dev/null +++ b/pkg/ivms101/enum.pb.go @@ -0,0 +1,596 @@ +// Specification Copyright (c) 2020 Joint Working Group on interVASP Messaging Standards +// https://intervasp.org/ +// https://intervasp.org/wp-content/uploads/2020/05/IVMS101-interVASP-data-model-standard-issue-1-FINAL.pdf + +// Protocol Buffer Specification Copyright (c) 2020 CipherTrace, Inc. https://ciphertrace.com + +// Licensed under MIT License + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// NOTE ON THE SPECIFICATION MAPPING +// This protocol buffers specification has applied the Protocol Buffers style guide +// https://developers.google.com/protocol-buffers/docs/style to the ISVM101 +// specification to be consistent with other Protocol Buffers specifications and to +// avoid common pitfalls when generating language specific classes. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.14.0 +// source: ivms101/enum.proto + +package ivms101 + +import ( + proto "github.com/golang/protobuf/proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +// Definition: A single value corresponding to the nature of name being adopted. +type NaturalPersonNameTypeCode int32 + +const ( + // Alias name + // A name other than the legal name by which a natural person is also known. + NaturalPersonNameTypeCode_NATURAL_PERSON_NAME_TYPE_CODE_ALIA NaturalPersonNameTypeCode = 0 + // Name at birth + // The name given to a natural person at birth. + NaturalPersonNameTypeCode_NATURAL_PERSON_NAME_TYPE_CODE_BIRT NaturalPersonNameTypeCode = 1 + // Maiden name + // The original name of a natural person who has changed their name after marriage. + NaturalPersonNameTypeCode_NATURAL_PERSON_NAME_TYPE_CODE_MAID NaturalPersonNameTypeCode = 2 + // Legal name + // Identifies a natural person for legal, official or administrative purposes. + NaturalPersonNameTypeCode_NATURAL_PERSON_NAME_TYPE_CODE_LEGL NaturalPersonNameTypeCode = 3 + // Unspecified + // A name by which a natural person may be known but which cannot otherwise be + // categorized or the category of which the sender is unable to determine. + NaturalPersonNameTypeCode_NATURAL_PERSON_NAME_TYPE_CODE_MISC NaturalPersonNameTypeCode = 4 +) + +// Enum value maps for NaturalPersonNameTypeCode. +var ( + NaturalPersonNameTypeCode_name = map[int32]string{ + 0: "NATURAL_PERSON_NAME_TYPE_CODE_ALIA", + 1: "NATURAL_PERSON_NAME_TYPE_CODE_BIRT", + 2: "NATURAL_PERSON_NAME_TYPE_CODE_MAID", + 3: "NATURAL_PERSON_NAME_TYPE_CODE_LEGL", + 4: "NATURAL_PERSON_NAME_TYPE_CODE_MISC", + } + NaturalPersonNameTypeCode_value = map[string]int32{ + "NATURAL_PERSON_NAME_TYPE_CODE_ALIA": 0, + "NATURAL_PERSON_NAME_TYPE_CODE_BIRT": 1, + "NATURAL_PERSON_NAME_TYPE_CODE_MAID": 2, + "NATURAL_PERSON_NAME_TYPE_CODE_LEGL": 3, + "NATURAL_PERSON_NAME_TYPE_CODE_MISC": 4, + } +) + +func (x NaturalPersonNameTypeCode) Enum() *NaturalPersonNameTypeCode { + p := new(NaturalPersonNameTypeCode) + *p = x + return p +} + +func (x NaturalPersonNameTypeCode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (NaturalPersonNameTypeCode) Descriptor() protoreflect.EnumDescriptor { + return file_ivms101_enum_proto_enumTypes[0].Descriptor() +} + +func (NaturalPersonNameTypeCode) Type() protoreflect.EnumType { + return &file_ivms101_enum_proto_enumTypes[0] +} + +func (x NaturalPersonNameTypeCode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use NaturalPersonNameTypeCode.Descriptor instead. +func (NaturalPersonNameTypeCode) EnumDescriptor() ([]byte, []int) { + return file_ivms101_enum_proto_rawDescGZIP(), []int{0} +} + +// Definition: A single value corresponding to the nature of name being specified +// for the legal person. +type LegalPersonNameTypeCode int32 + +const ( + // Legal name + // Official name under which an organisation is registered. + LegalPersonNameTypeCode_LEGAL_PERSON_NAME_TYPE_CODE_LEGL LegalPersonNameTypeCode = 0 + // Short name + // Specifies the short name of the organisation. + LegalPersonNameTypeCode_LEGAL_PERSON_NAME_TYPE_CODE_SHRT LegalPersonNameTypeCode = 1 + // Trading name + // Name used by a business for commercial purposes, although its registered legal + // name, used for contracts and other formal situations, may be another. + LegalPersonNameTypeCode_LEGAL_PERSON_NAME_TYPE_CODE_TRAD LegalPersonNameTypeCode = 2 +) + +// Enum value maps for LegalPersonNameTypeCode. +var ( + LegalPersonNameTypeCode_name = map[int32]string{ + 0: "LEGAL_PERSON_NAME_TYPE_CODE_LEGL", + 1: "LEGAL_PERSON_NAME_TYPE_CODE_SHRT", + 2: "LEGAL_PERSON_NAME_TYPE_CODE_TRAD", + } + LegalPersonNameTypeCode_value = map[string]int32{ + "LEGAL_PERSON_NAME_TYPE_CODE_LEGL": 0, + "LEGAL_PERSON_NAME_TYPE_CODE_SHRT": 1, + "LEGAL_PERSON_NAME_TYPE_CODE_TRAD": 2, + } +) + +func (x LegalPersonNameTypeCode) Enum() *LegalPersonNameTypeCode { + p := new(LegalPersonNameTypeCode) + *p = x + return p +} + +func (x LegalPersonNameTypeCode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (LegalPersonNameTypeCode) Descriptor() protoreflect.EnumDescriptor { + return file_ivms101_enum_proto_enumTypes[1].Descriptor() +} + +func (LegalPersonNameTypeCode) Type() protoreflect.EnumType { + return &file_ivms101_enum_proto_enumTypes[1] +} + +func (x LegalPersonNameTypeCode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use LegalPersonNameTypeCode.Descriptor instead. +func (LegalPersonNameTypeCode) EnumDescriptor() ([]byte, []int) { + return file_ivms101_enum_proto_rawDescGZIP(), []int{1} +} + +// Definition: Identifies the nature of the address. +type AddressTypeCode int32 + +const ( + // Residential + // Address is the home address. + AddressTypeCode_ADDRESS_TYPE_CODE_HOME AddressTypeCode = 0 + // Business + // Address is the business address. + AddressTypeCode_ADDRESS_TYPE_CODE_BIZZ AddressTypeCode = 1 + // Geographic + // Address is the unspecified physical (geographical) address suitable for + // identification of the natural or legal person. + AddressTypeCode_ADDRESS_TYPE_CODE_GEOG AddressTypeCode = 2 +) + +// Enum value maps for AddressTypeCode. +var ( + AddressTypeCode_name = map[int32]string{ + 0: "ADDRESS_TYPE_CODE_HOME", + 1: "ADDRESS_TYPE_CODE_BIZZ", + 2: "ADDRESS_TYPE_CODE_GEOG", + } + AddressTypeCode_value = map[string]int32{ + "ADDRESS_TYPE_CODE_HOME": 0, + "ADDRESS_TYPE_CODE_BIZZ": 1, + "ADDRESS_TYPE_CODE_GEOG": 2, + } +) + +func (x AddressTypeCode) Enum() *AddressTypeCode { + p := new(AddressTypeCode) + *p = x + return p +} + +func (x AddressTypeCode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (AddressTypeCode) Descriptor() protoreflect.EnumDescriptor { + return file_ivms101_enum_proto_enumTypes[2].Descriptor() +} + +func (AddressTypeCode) Type() protoreflect.EnumType { + return &file_ivms101_enum_proto_enumTypes[2] +} + +func (x AddressTypeCode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use AddressTypeCode.Descriptor instead. +func (AddressTypeCode) EnumDescriptor() ([]byte, []int) { + return file_ivms101_enum_proto_rawDescGZIP(), []int{2} +} + +// Definition: Identifies the national identification type. +// NationalIdentifierTypeCode applies a restriction over the codes present in ISO20022 +// datatype ‘TypeOfIdentification4Code’. +type NationalIdentifierTypeCode int32 + +const ( + // Alien registration number + // Number assigned by a government agency to identify foreign nationals. + NationalIdentifierTypeCode_NATIONAL_IDENTIFIER_TYPE_CODE_ARNU NationalIdentifierTypeCode = 0 + // Passport number + // Number assigned by a passport authority. + NationalIdentifierTypeCode_NATIONAL_IDENTIFIER_TYPE_CODE_CCPT NationalIdentifierTypeCode = 1 + // Registration authority identifier + // Identifier of a legal entity as maintained by a registration authority. + NationalIdentifierTypeCode_NATIONAL_IDENTIFIER_TYPE_CODE_RAID NationalIdentifierTypeCode = 2 + // Driver license number + // Number assigned to a driver's license. + NationalIdentifierTypeCode_NATIONAL_IDENTIFIER_TYPE_CODE_DRLC NationalIdentifierTypeCode = 3 + // Foreign investment identity number + // Number assigned to a foreign investor (other than the alien number). + NationalIdentifierTypeCode_NATIONAL_IDENTIFIER_TYPE_CODE_FIIN NationalIdentifierTypeCode = 4 + // Tax identification number + // Number assigned by a tax authority to an entity. + NationalIdentifierTypeCode_NATIONAL_IDENTIFIER_TYPE_CODE_TXID NationalIdentifierTypeCode = 5 + // Social security number + // Number assigned by a social security agency. + NationalIdentifierTypeCode_NATIONAL_IDENTIFIER_TYPE_CODE_SOCS NationalIdentifierTypeCode = 6 + // Identity card number + // Number assigned by a national authority to an identity card. + NationalIdentifierTypeCode_NATIONAL_IDENTIFIER_TYPE_CODE_IDCD NationalIdentifierTypeCode = 7 + // Legal Entity Identifier + // Legal Entity Identifier (LEI) assigned in accordance with ISO 17442. + // The LEI is a 20-character, alpha-numeric code that enables clear and unique + // identification of legal entities participating in financial transactions. + NationalIdentifierTypeCode_NATIONAL_IDENTIFIER_TYPE_CODE_LEIX NationalIdentifierTypeCode = 8 + // Unspecified + // A national identifier which may be known but which cannot otherwise be + // categorized or the category of which the sender is unable to determine. + NationalIdentifierTypeCode_NATIONAL_IDENTIFIER_TYPE_CODE_MISC NationalIdentifierTypeCode = 9 +) + +// Enum value maps for NationalIdentifierTypeCode. +var ( + NationalIdentifierTypeCode_name = map[int32]string{ + 0: "NATIONAL_IDENTIFIER_TYPE_CODE_ARNU", + 1: "NATIONAL_IDENTIFIER_TYPE_CODE_CCPT", + 2: "NATIONAL_IDENTIFIER_TYPE_CODE_RAID", + 3: "NATIONAL_IDENTIFIER_TYPE_CODE_DRLC", + 4: "NATIONAL_IDENTIFIER_TYPE_CODE_FIIN", + 5: "NATIONAL_IDENTIFIER_TYPE_CODE_TXID", + 6: "NATIONAL_IDENTIFIER_TYPE_CODE_SOCS", + 7: "NATIONAL_IDENTIFIER_TYPE_CODE_IDCD", + 8: "NATIONAL_IDENTIFIER_TYPE_CODE_LEIX", + 9: "NATIONAL_IDENTIFIER_TYPE_CODE_MISC", + } + NationalIdentifierTypeCode_value = map[string]int32{ + "NATIONAL_IDENTIFIER_TYPE_CODE_ARNU": 0, + "NATIONAL_IDENTIFIER_TYPE_CODE_CCPT": 1, + "NATIONAL_IDENTIFIER_TYPE_CODE_RAID": 2, + "NATIONAL_IDENTIFIER_TYPE_CODE_DRLC": 3, + "NATIONAL_IDENTIFIER_TYPE_CODE_FIIN": 4, + "NATIONAL_IDENTIFIER_TYPE_CODE_TXID": 5, + "NATIONAL_IDENTIFIER_TYPE_CODE_SOCS": 6, + "NATIONAL_IDENTIFIER_TYPE_CODE_IDCD": 7, + "NATIONAL_IDENTIFIER_TYPE_CODE_LEIX": 8, + "NATIONAL_IDENTIFIER_TYPE_CODE_MISC": 9, + } +) + +func (x NationalIdentifierTypeCode) Enum() *NationalIdentifierTypeCode { + p := new(NationalIdentifierTypeCode) + *p = x + return p +} + +func (x NationalIdentifierTypeCode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (NationalIdentifierTypeCode) Descriptor() protoreflect.EnumDescriptor { + return file_ivms101_enum_proto_enumTypes[3].Descriptor() +} + +func (NationalIdentifierTypeCode) Type() protoreflect.EnumType { + return &file_ivms101_enum_proto_enumTypes[3] +} + +func (x NationalIdentifierTypeCode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use NationalIdentifierTypeCode.Descriptor instead. +func (NationalIdentifierTypeCode) EnumDescriptor() ([]byte, []int) { + return file_ivms101_enum_proto_rawDescGZIP(), []int{3} +} + +// Definition: Identifies the national script from which transliteration to Latin +// script is applied. +type TransliterationMethodCode int32 + +const ( + // Arabic (Arabic language) + // ISO 233-2:1993 + TransliterationMethodCode_TRANSLITERATION_METHOD_CODE_ARAB TransliterationMethodCode = 0 + // Arabic (Persian language) + // ISO 233-3:1999 + TransliterationMethodCode_TRANSLITERATION_METHOD_CODE_ARAN TransliterationMethodCode = 1 + // Armenian + // ISO 9985:1996 + TransliterationMethodCode_TRANSLITERATION_METHOD_CODE_ARMN TransliterationMethodCode = 2 + // Cyrillic + // ISO 9:1995 + TransliterationMethodCode_TRANSLITERATION_METHOD_CODE_CYRL TransliterationMethodCode = 3 + // Devanagari & related Indic + // ISO 15919:2001 + TransliterationMethodCode_TRANSLITERATION_METHOD_CODE_DEVA TransliterationMethodCode = 4 + // Georgian + // ISO 9984:1996 + TransliterationMethodCode_TRANSLITERATION_METHOD_CODE_GEOR TransliterationMethodCode = 5 + // Greek + // ISO 843:1997 + TransliterationMethodCode_TRANSLITERATION_METHOD_CODE_GREK TransliterationMethodCode = 6 + // Han (Hanzi, Kanji, Hanja) + // ISO 7098:2015 + TransliterationMethodCode_TRANSLITERATION_METHOD_CODE_HANI TransliterationMethodCode = 7 + // Hebrew + // ISO 259-2:1994 + TransliterationMethodCode_TRANSLITERATION_METHOD_CODE_HEBR TransliterationMethodCode = 8 + // Kana + // ISO 3602:1989 + TransliterationMethodCode_TRANSLITERATION_METHOD_CODE_KANA TransliterationMethodCode = 10 + // Korean + // Revised Romanization of Korean + TransliterationMethodCode_TRANSLITERATION_METHOD_CODE_KORE TransliterationMethodCode = 11 + // Thai + // ISO 11940-2:2007 + TransliterationMethodCode_TRANSLITERATION_METHOD_CODE_THAI TransliterationMethodCode = 12 + // Script other than those listed above + // Unspecified Standard + TransliterationMethodCode_TRANSLITERATION_METHOD_CODE_OTHR TransliterationMethodCode = 13 +) + +// Enum value maps for TransliterationMethodCode. +var ( + TransliterationMethodCode_name = map[int32]string{ + 0: "TRANSLITERATION_METHOD_CODE_ARAB", + 1: "TRANSLITERATION_METHOD_CODE_ARAN", + 2: "TRANSLITERATION_METHOD_CODE_ARMN", + 3: "TRANSLITERATION_METHOD_CODE_CYRL", + 4: "TRANSLITERATION_METHOD_CODE_DEVA", + 5: "TRANSLITERATION_METHOD_CODE_GEOR", + 6: "TRANSLITERATION_METHOD_CODE_GREK", + 7: "TRANSLITERATION_METHOD_CODE_HANI", + 8: "TRANSLITERATION_METHOD_CODE_HEBR", + 10: "TRANSLITERATION_METHOD_CODE_KANA", + 11: "TRANSLITERATION_METHOD_CODE_KORE", + 12: "TRANSLITERATION_METHOD_CODE_THAI", + 13: "TRANSLITERATION_METHOD_CODE_OTHR", + } + TransliterationMethodCode_value = map[string]int32{ + "TRANSLITERATION_METHOD_CODE_ARAB": 0, + "TRANSLITERATION_METHOD_CODE_ARAN": 1, + "TRANSLITERATION_METHOD_CODE_ARMN": 2, + "TRANSLITERATION_METHOD_CODE_CYRL": 3, + "TRANSLITERATION_METHOD_CODE_DEVA": 4, + "TRANSLITERATION_METHOD_CODE_GEOR": 5, + "TRANSLITERATION_METHOD_CODE_GREK": 6, + "TRANSLITERATION_METHOD_CODE_HANI": 7, + "TRANSLITERATION_METHOD_CODE_HEBR": 8, + "TRANSLITERATION_METHOD_CODE_KANA": 10, + "TRANSLITERATION_METHOD_CODE_KORE": 11, + "TRANSLITERATION_METHOD_CODE_THAI": 12, + "TRANSLITERATION_METHOD_CODE_OTHR": 13, + } +) + +func (x TransliterationMethodCode) Enum() *TransliterationMethodCode { + p := new(TransliterationMethodCode) + *p = x + return p +} + +func (x TransliterationMethodCode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TransliterationMethodCode) Descriptor() protoreflect.EnumDescriptor { + return file_ivms101_enum_proto_enumTypes[4].Descriptor() +} + +func (TransliterationMethodCode) Type() protoreflect.EnumType { + return &file_ivms101_enum_proto_enumTypes[4] +} + +func (x TransliterationMethodCode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use TransliterationMethodCode.Descriptor instead. +func (TransliterationMethodCode) EnumDescriptor() ([]byte, []int) { + return file_ivms101_enum_proto_rawDescGZIP(), []int{4} +} + +var File_ivms101_enum_proto protoreflect.FileDescriptor + +var file_ivms101_enum_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2f, 0x65, 0x6e, 0x75, 0x6d, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2a, 0xe3, 0x01, + 0x0a, 0x19, 0x4e, 0x61, 0x74, 0x75, 0x72, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4e, + 0x61, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x26, 0x0a, 0x22, 0x4e, + 0x41, 0x54, 0x55, 0x52, 0x41, 0x4c, 0x5f, 0x50, 0x45, 0x52, 0x53, 0x4f, 0x4e, 0x5f, 0x4e, 0x41, + 0x4d, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x41, 0x4c, 0x49, + 0x41, 0x10, 0x00, 0x12, 0x26, 0x0a, 0x22, 0x4e, 0x41, 0x54, 0x55, 0x52, 0x41, 0x4c, 0x5f, 0x50, + 0x45, 0x52, 0x53, 0x4f, 0x4e, 0x5f, 0x4e, 0x41, 0x4d, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x42, 0x49, 0x52, 0x54, 0x10, 0x01, 0x12, 0x26, 0x0a, 0x22, 0x4e, + 0x41, 0x54, 0x55, 0x52, 0x41, 0x4c, 0x5f, 0x50, 0x45, 0x52, 0x53, 0x4f, 0x4e, 0x5f, 0x4e, 0x41, + 0x4d, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x4d, 0x41, 0x49, + 0x44, 0x10, 0x02, 0x12, 0x26, 0x0a, 0x22, 0x4e, 0x41, 0x54, 0x55, 0x52, 0x41, 0x4c, 0x5f, 0x50, + 0x45, 0x52, 0x53, 0x4f, 0x4e, 0x5f, 0x4e, 0x41, 0x4d, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x45, 0x47, 0x4c, 0x10, 0x03, 0x12, 0x26, 0x0a, 0x22, 0x4e, + 0x41, 0x54, 0x55, 0x52, 0x41, 0x4c, 0x5f, 0x50, 0x45, 0x52, 0x53, 0x4f, 0x4e, 0x5f, 0x4e, 0x41, + 0x4d, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x4d, 0x49, 0x53, + 0x43, 0x10, 0x04, 0x2a, 0x8b, 0x01, 0x0a, 0x17, 0x4c, 0x65, 0x67, 0x61, 0x6c, 0x50, 0x65, 0x72, + 0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x24, 0x0a, 0x20, 0x4c, 0x45, 0x47, 0x41, 0x4c, 0x5f, 0x50, 0x45, 0x52, 0x53, 0x4f, 0x4e, 0x5f, + 0x4e, 0x41, 0x4d, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x4c, + 0x45, 0x47, 0x4c, 0x10, 0x00, 0x12, 0x24, 0x0a, 0x20, 0x4c, 0x45, 0x47, 0x41, 0x4c, 0x5f, 0x50, + 0x45, 0x52, 0x53, 0x4f, 0x4e, 0x5f, 0x4e, 0x41, 0x4d, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x48, 0x52, 0x54, 0x10, 0x01, 0x12, 0x24, 0x0a, 0x20, 0x4c, + 0x45, 0x47, 0x41, 0x4c, 0x5f, 0x50, 0x45, 0x52, 0x53, 0x4f, 0x4e, 0x5f, 0x4e, 0x41, 0x4d, 0x45, + 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x54, 0x52, 0x41, 0x44, 0x10, + 0x02, 0x2a, 0x65, 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x54, 0x79, 0x70, 0x65, + 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x41, 0x44, 0x44, 0x52, 0x45, 0x53, 0x53, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x48, 0x4f, 0x4d, 0x45, 0x10, 0x00, + 0x12, 0x1a, 0x0a, 0x16, 0x41, 0x44, 0x44, 0x52, 0x45, 0x53, 0x53, 0x5f, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x42, 0x49, 0x5a, 0x5a, 0x10, 0x01, 0x12, 0x1a, 0x0a, 0x16, + 0x41, 0x44, 0x44, 0x52, 0x45, 0x53, 0x53, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x44, + 0x45, 0x5f, 0x47, 0x45, 0x4f, 0x47, 0x10, 0x02, 0x2a, 0xac, 0x03, 0x0a, 0x1a, 0x4e, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x54, + 0x79, 0x70, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x26, 0x0a, 0x22, 0x4e, 0x41, 0x54, 0x49, 0x4f, + 0x4e, 0x41, 0x4c, 0x5f, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x49, 0x46, 0x49, 0x45, 0x52, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x41, 0x52, 0x4e, 0x55, 0x10, 0x00, 0x12, + 0x26, 0x0a, 0x22, 0x4e, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x41, 0x4c, 0x5f, 0x49, 0x44, 0x45, 0x4e, + 0x54, 0x49, 0x46, 0x49, 0x45, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x44, 0x45, + 0x5f, 0x43, 0x43, 0x50, 0x54, 0x10, 0x01, 0x12, 0x26, 0x0a, 0x22, 0x4e, 0x41, 0x54, 0x49, 0x4f, + 0x4e, 0x41, 0x4c, 0x5f, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x49, 0x46, 0x49, 0x45, 0x52, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x52, 0x41, 0x49, 0x44, 0x10, 0x02, 0x12, + 0x26, 0x0a, 0x22, 0x4e, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x41, 0x4c, 0x5f, 0x49, 0x44, 0x45, 0x4e, + 0x54, 0x49, 0x46, 0x49, 0x45, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x44, 0x45, + 0x5f, 0x44, 0x52, 0x4c, 0x43, 0x10, 0x03, 0x12, 0x26, 0x0a, 0x22, 0x4e, 0x41, 0x54, 0x49, 0x4f, + 0x4e, 0x41, 0x4c, 0x5f, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x49, 0x46, 0x49, 0x45, 0x52, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x46, 0x49, 0x49, 0x4e, 0x10, 0x04, 0x12, + 0x26, 0x0a, 0x22, 0x4e, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x41, 0x4c, 0x5f, 0x49, 0x44, 0x45, 0x4e, + 0x54, 0x49, 0x46, 0x49, 0x45, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x44, 0x45, + 0x5f, 0x54, 0x58, 0x49, 0x44, 0x10, 0x05, 0x12, 0x26, 0x0a, 0x22, 0x4e, 0x41, 0x54, 0x49, 0x4f, + 0x4e, 0x41, 0x4c, 0x5f, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x49, 0x46, 0x49, 0x45, 0x52, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x53, 0x4f, 0x43, 0x53, 0x10, 0x06, 0x12, + 0x26, 0x0a, 0x22, 0x4e, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x41, 0x4c, 0x5f, 0x49, 0x44, 0x45, 0x4e, + 0x54, 0x49, 0x46, 0x49, 0x45, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x44, 0x45, + 0x5f, 0x49, 0x44, 0x43, 0x44, 0x10, 0x07, 0x12, 0x26, 0x0a, 0x22, 0x4e, 0x41, 0x54, 0x49, 0x4f, + 0x4e, 0x41, 0x4c, 0x5f, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x49, 0x46, 0x49, 0x45, 0x52, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x4c, 0x45, 0x49, 0x58, 0x10, 0x08, 0x12, + 0x26, 0x0a, 0x22, 0x4e, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x41, 0x4c, 0x5f, 0x49, 0x44, 0x45, 0x4e, + 0x54, 0x49, 0x46, 0x49, 0x45, 0x52, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x44, 0x45, + 0x5f, 0x4d, 0x49, 0x53, 0x43, 0x10, 0x09, 0x2a, 0x89, 0x04, 0x0a, 0x19, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x6c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, + 0x64, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x24, 0x0a, 0x20, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x4c, 0x49, + 0x54, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, 0x44, 0x5f, + 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x41, 0x52, 0x41, 0x42, 0x10, 0x00, 0x12, 0x24, 0x0a, 0x20, 0x54, + 0x52, 0x41, 0x4e, 0x53, 0x4c, 0x49, 0x54, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, + 0x45, 0x54, 0x48, 0x4f, 0x44, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x41, 0x52, 0x41, 0x4e, 0x10, + 0x01, 0x12, 0x24, 0x0a, 0x20, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x4c, 0x49, 0x54, 0x45, 0x52, 0x41, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, 0x44, 0x5f, 0x43, 0x4f, 0x44, 0x45, + 0x5f, 0x41, 0x52, 0x4d, 0x4e, 0x10, 0x02, 0x12, 0x24, 0x0a, 0x20, 0x54, 0x52, 0x41, 0x4e, 0x53, + 0x4c, 0x49, 0x54, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, + 0x44, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x43, 0x59, 0x52, 0x4c, 0x10, 0x03, 0x12, 0x24, 0x0a, + 0x20, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x4c, 0x49, 0x54, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, + 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, 0x44, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x44, 0x45, 0x56, + 0x41, 0x10, 0x04, 0x12, 0x24, 0x0a, 0x20, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x4c, 0x49, 0x54, 0x45, + 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, 0x44, 0x5f, 0x43, 0x4f, + 0x44, 0x45, 0x5f, 0x47, 0x45, 0x4f, 0x52, 0x10, 0x05, 0x12, 0x24, 0x0a, 0x20, 0x54, 0x52, 0x41, + 0x4e, 0x53, 0x4c, 0x49, 0x54, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x45, 0x54, + 0x48, 0x4f, 0x44, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x47, 0x52, 0x45, 0x4b, 0x10, 0x06, 0x12, + 0x24, 0x0a, 0x20, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x4c, 0x49, 0x54, 0x45, 0x52, 0x41, 0x54, 0x49, + 0x4f, 0x4e, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, 0x44, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x48, + 0x41, 0x4e, 0x49, 0x10, 0x07, 0x12, 0x24, 0x0a, 0x20, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x4c, 0x49, + 0x54, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, 0x44, 0x5f, + 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x48, 0x45, 0x42, 0x52, 0x10, 0x08, 0x12, 0x24, 0x0a, 0x20, 0x54, + 0x52, 0x41, 0x4e, 0x53, 0x4c, 0x49, 0x54, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, + 0x45, 0x54, 0x48, 0x4f, 0x44, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x4b, 0x41, 0x4e, 0x41, 0x10, + 0x0a, 0x12, 0x24, 0x0a, 0x20, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x4c, 0x49, 0x54, 0x45, 0x52, 0x41, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, 0x44, 0x5f, 0x43, 0x4f, 0x44, 0x45, + 0x5f, 0x4b, 0x4f, 0x52, 0x45, 0x10, 0x0b, 0x12, 0x24, 0x0a, 0x20, 0x54, 0x52, 0x41, 0x4e, 0x53, + 0x4c, 0x49, 0x54, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, + 0x44, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x54, 0x48, 0x41, 0x49, 0x10, 0x0c, 0x12, 0x24, 0x0a, + 0x20, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x4c, 0x49, 0x54, 0x45, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, + 0x5f, 0x4d, 0x45, 0x54, 0x48, 0x4f, 0x44, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x4f, 0x54, 0x48, + 0x52, 0x10, 0x0d, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x74, 0x72, 0x69, 0x73, 0x61, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2f, 0x74, 0x72, + 0x69, 0x73, 0x61, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ivms101_enum_proto_rawDescOnce sync.Once + file_ivms101_enum_proto_rawDescData = file_ivms101_enum_proto_rawDesc +) + +func file_ivms101_enum_proto_rawDescGZIP() []byte { + file_ivms101_enum_proto_rawDescOnce.Do(func() { + file_ivms101_enum_proto_rawDescData = protoimpl.X.CompressGZIP(file_ivms101_enum_proto_rawDescData) + }) + return file_ivms101_enum_proto_rawDescData +} + +var file_ivms101_enum_proto_enumTypes = make([]protoimpl.EnumInfo, 5) +var file_ivms101_enum_proto_goTypes = []interface{}{ + (NaturalPersonNameTypeCode)(0), // 0: ivms101.NaturalPersonNameTypeCode + (LegalPersonNameTypeCode)(0), // 1: ivms101.LegalPersonNameTypeCode + (AddressTypeCode)(0), // 2: ivms101.AddressTypeCode + (NationalIdentifierTypeCode)(0), // 3: ivms101.NationalIdentifierTypeCode + (TransliterationMethodCode)(0), // 4: ivms101.TransliterationMethodCode +} +var file_ivms101_enum_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_ivms101_enum_proto_init() } +func file_ivms101_enum_proto_init() { + if File_ivms101_enum_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ivms101_enum_proto_rawDesc, + NumEnums: 5, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ivms101_enum_proto_goTypes, + DependencyIndexes: file_ivms101_enum_proto_depIdxs, + EnumInfos: file_ivms101_enum_proto_enumTypes, + }.Build() + File_ivms101_enum_proto = out.File + file_ivms101_enum_proto_rawDesc = nil + file_ivms101_enum_proto_goTypes = nil + file_ivms101_enum_proto_depIdxs = nil +} diff --git a/pkg/ivms101/errors.go b/pkg/ivms101/errors.go new file mode 100644 index 0000000..98abb3d --- /dev/null +++ b/pkg/ivms101/errors.go @@ -0,0 +1,27 @@ +package ivms101 + +import "errors" + +// Standard error values for error type checking +var ( + ErrNoNaturalPersonNameIdentifiers = errors.New("one or more natural person name identifiers is required") + ErrInvalidNaturalPersonName = errors.New("natural person name required with max length 100 chars") + ErrInvalidNaturalPersonNameTypeCode = errors.New("invalid natural person name type code") + ErrNoLegalPersonNameIdentifiers = errors.New("one or more legal person name identifiers is required") + ErrInvalidLegalPersonName = errors.New("legal person name required with max length 100 chars") + ErrInvalidLegalPersonNameTypeCode = errors.New("invalid legal person name type code") + ErrLegalNamesPresent = errors.New("at least one name identifier must have a LEGL name identifier type") + ErrInvalidCustomerNumber = errors.New("customer number can be at most 50 chars") + ErrInvalidCustomerIdentification = errors.New("customer identification can be at most 50 chars") + ErrInvalidCountryCode = errors.New("invalid ISO-3166-1 alpha-2 country code") + ErrValidNationalIdentifierLegalPerson = errors.New("a legal person must have a national identifier of type RAID, MISC, LEIX, or TXID") + ErrInvalidLEI = errors.New("national identifier required with max length 35") + ErrInvalidNationalIdentifierTypeCode = errors.New("invalid national identifier type code") + ErrCompleteNationalIdentifierLegalPerson = errors.New("a legal person must not have a value for country and must have value for registration authority if identifier type is not LEIX") + ErrInvalidDateOfBirth = errors.New("date of birth must be a valid date in YYYY-MM-DD format") + ErrInvalidPlaceOfBirth = errors.New("place of birth required with at most 70 characters") + ErrDateInPast = errors.New("date of birth must be a historic date, prior to current date") + ErrValidAddress = errors.New("address must have at least one address line or street name + building name or number") + ErrInvalidAddressTypeCode = errors.New("invalid address type code") + ErrInvalidAddressLines = errors.New("an address can contain at most 7 address lines") +) diff --git a/pkg/ivms101/generate.go b/pkg/ivms101/generate.go new file mode 100644 index 0000000..9258633 --- /dev/null +++ b/pkg/ivms101/generate.go @@ -0,0 +1,3 @@ +package ivms101 + +//go:generate protoc -I=../../proto --go_out=. --go_opt=module=github.com/trisacrypto/trisa/pkg/ivms101 ivms101/enum.proto ivms101/ivms101.proto ivms101/identity.proto diff --git a/pkg/ivms101/identity.pb.go b/pkg/ivms101/identity.pb.go new file mode 100644 index 0000000..9dba2f4 --- /dev/null +++ b/pkg/ivms101/identity.pb.go @@ -0,0 +1,788 @@ +// Specification Copyright (c) 2020 Joint Working Group on interVASP Messaging Standards +// https://intervasp.org/ +// https://intervasp.org/wp-content/uploads/2020/05/IVMS101-interVASP-data-model-standard-issue-1-FINAL.pdf + +// Protocol Buffer Specification Copyright (c) 2020 CipherTrace, Inc. https://ciphertrace.com + +// Licensed under MIT License + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// NOTE ON THE SPECIFICATION MAPPING +// This protocol buffers specification has applied the Protocol Buffers style guide +// https://developers.google.com/protocol-buffers/docs/style to the ISVM101 +// specification to be consistent with other Protocol Buffers specifications and to +// avoid common pitfalls when generating language specific classes. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.14.0 +// source: ivms101/identity.proto + +package ivms101 + +import ( + proto "github.com/golang/protobuf/proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type IdentityPayload struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Originator *Originator `protobuf:"bytes,1,opt,name=originator,proto3" json:"originator,omitempty"` + Beneficiary *Beneficiary `protobuf:"bytes,2,opt,name=beneficiary,proto3" json:"beneficiary,omitempty"` + OriginatingVasp *OriginatingVasp `protobuf:"bytes,3,opt,name=originating_vasp,json=originatingVasp,proto3" json:"originating_vasp,omitempty"` + BeneficiaryVasp *BeneficiaryVasp `protobuf:"bytes,4,opt,name=beneficiary_vasp,json=beneficiaryVasp,proto3" json:"beneficiary_vasp,omitempty"` + TransferPath *TransferPath `protobuf:"bytes,5,opt,name=transfer_path,json=transferPath,proto3" json:"transfer_path,omitempty"` + PayloadMetadata *PayloadMetadata `protobuf:"bytes,6,opt,name=payload_metadata,json=payloadMetadata,proto3" json:"payload_metadata,omitempty"` +} + +func (x *IdentityPayload) Reset() { + *x = IdentityPayload{} + if protoimpl.UnsafeEnabled { + mi := &file_ivms101_identity_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IdentityPayload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IdentityPayload) ProtoMessage() {} + +func (x *IdentityPayload) ProtoReflect() protoreflect.Message { + mi := &file_ivms101_identity_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IdentityPayload.ProtoReflect.Descriptor instead. +func (*IdentityPayload) Descriptor() ([]byte, []int) { + return file_ivms101_identity_proto_rawDescGZIP(), []int{0} +} + +func (x *IdentityPayload) GetOriginator() *Originator { + if x != nil { + return x.Originator + } + return nil +} + +func (x *IdentityPayload) GetBeneficiary() *Beneficiary { + if x != nil { + return x.Beneficiary + } + return nil +} + +func (x *IdentityPayload) GetOriginatingVasp() *OriginatingVasp { + if x != nil { + return x.OriginatingVasp + } + return nil +} + +func (x *IdentityPayload) GetBeneficiaryVasp() *BeneficiaryVasp { + if x != nil { + return x.BeneficiaryVasp + } + return nil +} + +func (x *IdentityPayload) GetTransferPath() *TransferPath { + if x != nil { + return x.TransferPath + } + return nil +} + +func (x *IdentityPayload) GetPayloadMetadata() *PayloadMetadata { + if x != nil { + return x.PayloadMetadata + } + return nil +} + +type Originator struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Definition: the account holder who allows the VA transfer from that account or, + // where there is no account, the natural or legal person that places the order with + // the originating VASP to perform the VA transfer. + // One or More + OriginatorPersons []*Person `protobuf:"bytes,1,rep,name=originator_persons,json=originatorPersons,proto3" json:"originator_persons,omitempty"` + // Definition: Identifier of an account that is used to process the transaction. + // The value for this element is case-sensitive. + // Datatype: “Max100Text” + // Zero or More + AccountNumbers []string `protobuf:"bytes,2,rep,name=account_numbers,json=accountNumbers,proto3" json:"account_numbers,omitempty"` +} + +func (x *Originator) Reset() { + *x = Originator{} + if protoimpl.UnsafeEnabled { + mi := &file_ivms101_identity_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Originator) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Originator) ProtoMessage() {} + +func (x *Originator) ProtoReflect() protoreflect.Message { + mi := &file_ivms101_identity_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Originator.ProtoReflect.Descriptor instead. +func (*Originator) Descriptor() ([]byte, []int) { + return file_ivms101_identity_proto_rawDescGZIP(), []int{1} +} + +func (x *Originator) GetOriginatorPersons() []*Person { + if x != nil { + return x.OriginatorPersons + } + return nil +} + +func (x *Originator) GetAccountNumbers() []string { + if x != nil { + return x.AccountNumbers + } + return nil +} + +type Beneficiary struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Definition: the natural or legal person or legal arrangement who is identified + // by the originator as the receiver of the requested VA transfer. + // One or More + BeneficiaryPersons []*Person `protobuf:"bytes,1,rep,name=beneficiary_persons,json=beneficiaryPersons,proto3" json:"beneficiary_persons,omitempty"` + // Definition: Identifier of an account that is used to process the transaction. + // The value for this element is case-sensitive. + // Datatype: “Max100Text” + // Zero or More + AccountNumbers []string `protobuf:"bytes,2,rep,name=account_numbers,json=accountNumbers,proto3" json:"account_numbers,omitempty"` +} + +func (x *Beneficiary) Reset() { + *x = Beneficiary{} + if protoimpl.UnsafeEnabled { + mi := &file_ivms101_identity_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Beneficiary) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Beneficiary) ProtoMessage() {} + +func (x *Beneficiary) ProtoReflect() protoreflect.Message { + mi := &file_ivms101_identity_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Beneficiary.ProtoReflect.Descriptor instead. +func (*Beneficiary) Descriptor() ([]byte, []int) { + return file_ivms101_identity_proto_rawDescGZIP(), []int{2} +} + +func (x *Beneficiary) GetBeneficiaryPersons() []*Person { + if x != nil { + return x.BeneficiaryPersons + } + return nil +} + +func (x *Beneficiary) GetAccountNumbers() []string { + if x != nil { + return x.AccountNumbers + } + return nil +} + +type OriginatingVasp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Definition: refers to the VASP which initiates the VA transfer, and transfers + // the VA upon receiving the request for a VA transfer on behalf of the originator. + // Optional + OriginatingVasp *Person `protobuf:"bytes,1,opt,name=originating_vasp,json=originatingVasp,proto3" json:"originating_vasp,omitempty"` +} + +func (x *OriginatingVasp) Reset() { + *x = OriginatingVasp{} + if protoimpl.UnsafeEnabled { + mi := &file_ivms101_identity_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OriginatingVasp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OriginatingVasp) ProtoMessage() {} + +func (x *OriginatingVasp) ProtoReflect() protoreflect.Message { + mi := &file_ivms101_identity_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OriginatingVasp.ProtoReflect.Descriptor instead. +func (*OriginatingVasp) Descriptor() ([]byte, []int) { + return file_ivms101_identity_proto_rawDescGZIP(), []int{3} +} + +func (x *OriginatingVasp) GetOriginatingVasp() *Person { + if x != nil { + return x.OriginatingVasp + } + return nil +} + +type BeneficiaryVasp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Definition: the VASP which receives the transfer of a virtual asset from the + // originating VASP directly or through an intermediary VASP and makes the funds + // available to the beneficiary. + // Optional + BeneficiaryVasp *Person `protobuf:"bytes,1,opt,name=beneficiary_vasp,json=beneficiaryVasp,proto3" json:"beneficiary_vasp,omitempty"` +} + +func (x *BeneficiaryVasp) Reset() { + *x = BeneficiaryVasp{} + if protoimpl.UnsafeEnabled { + mi := &file_ivms101_identity_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BeneficiaryVasp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BeneficiaryVasp) ProtoMessage() {} + +func (x *BeneficiaryVasp) ProtoReflect() protoreflect.Message { + mi := &file_ivms101_identity_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BeneficiaryVasp.ProtoReflect.Descriptor instead. +func (*BeneficiaryVasp) Descriptor() ([]byte, []int) { + return file_ivms101_identity_proto_rawDescGZIP(), []int{4} +} + +func (x *BeneficiaryVasp) GetBeneficiaryVasp() *Person { + if x != nil { + return x.BeneficiaryVasp + } + return nil +} + +type IntermediaryVasp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Definition: the VASP in a serial chain that receives and retransmits a VA + // transfer on behalf of the originating VASP and the beneficiary VASP, or another + // intermediary VASP. + // Required + IntermediaryVasp *Person `protobuf:"bytes,1,opt,name=intermediary_vasp,json=intermediaryVasp,proto3" json:"intermediary_vasp,omitempty"` + // Definition: the sequence in a serial chain at which the corresponding + // intermediary VASP participates in the transfer. + // Constraints: totalDigits: 18; fractionDigits: 0 + // Required + Sequence uint64 `protobuf:"varint,2,opt,name=sequence,proto3" json:"sequence,omitempty"` +} + +func (x *IntermediaryVasp) Reset() { + *x = IntermediaryVasp{} + if protoimpl.UnsafeEnabled { + mi := &file_ivms101_identity_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IntermediaryVasp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IntermediaryVasp) ProtoMessage() {} + +func (x *IntermediaryVasp) ProtoReflect() protoreflect.Message { + mi := &file_ivms101_identity_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IntermediaryVasp.ProtoReflect.Descriptor instead. +func (*IntermediaryVasp) Descriptor() ([]byte, []int) { + return file_ivms101_identity_proto_rawDescGZIP(), []int{5} +} + +func (x *IntermediaryVasp) GetIntermediaryVasp() *Person { + if x != nil { + return x.IntermediaryVasp + } + return nil +} + +func (x *IntermediaryVasp) GetSequence() uint64 { + if x != nil { + return x.Sequence + } + return 0 +} + +type TransferPath struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Definition: the intermediary VASP(s) participating in a serial chain that + // receive and retransmit a VA transfer on behalf of the originating VASP and the + // beneficiary VASP, or another intermediary VASP, together with their + // corresponding sequence number. + // Zero or More + TransferPath []*IntermediaryVasp `protobuf:"bytes,1,rep,name=transfer_path,json=transferPath,proto3" json:"transfer_path,omitempty"` +} + +func (x *TransferPath) Reset() { + *x = TransferPath{} + if protoimpl.UnsafeEnabled { + mi := &file_ivms101_identity_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TransferPath) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TransferPath) ProtoMessage() {} + +func (x *TransferPath) ProtoReflect() protoreflect.Message { + mi := &file_ivms101_identity_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TransferPath.ProtoReflect.Descriptor instead. +func (*TransferPath) Descriptor() ([]byte, []int) { + return file_ivms101_identity_proto_rawDescGZIP(), []int{6} +} + +func (x *TransferPath) GetTransferPath() []*IntermediaryVasp { + if x != nil { + return x.TransferPath + } + return nil +} + +type PayloadMetadata struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Definition: the method used to map from a national system of writing to Latin script. + // Zero or More + TransliterationMethod []TransliterationMethodCode `protobuf:"varint,1,rep,packed,name=transliteration_method,json=transliterationMethod,proto3,enum=ivms101.TransliterationMethodCode" json:"transliteration_method,omitempty"` +} + +func (x *PayloadMetadata) Reset() { + *x = PayloadMetadata{} + if protoimpl.UnsafeEnabled { + mi := &file_ivms101_identity_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayloadMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayloadMetadata) ProtoMessage() {} + +func (x *PayloadMetadata) ProtoReflect() protoreflect.Message { + mi := &file_ivms101_identity_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayloadMetadata.ProtoReflect.Descriptor instead. +func (*PayloadMetadata) Descriptor() ([]byte, []int) { + return file_ivms101_identity_proto_rawDescGZIP(), []int{7} +} + +func (x *PayloadMetadata) GetTransliterationMethod() []TransliterationMethodCode { + if x != nil { + return x.TransliterationMethod + } + return nil +} + +var File_ivms101_identity_proto protoreflect.FileDescriptor + +var file_ivms101_identity_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, + 0x31, 0x1a, 0x15, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2f, 0x69, 0x76, 0x6d, 0x73, 0x31, + 0x30, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x12, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, + 0x31, 0x2f, 0x65, 0x6e, 0x75, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x89, 0x03, 0x0a, + 0x0f, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x12, 0x33, 0x0a, 0x0a, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, 0x4f, + 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x0a, 0x6f, 0x72, 0x69, 0x67, 0x69, + 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x36, 0x0a, 0x0b, 0x62, 0x65, 0x6e, 0x65, 0x66, 0x69, 0x63, + 0x69, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x69, 0x76, 0x6d, + 0x73, 0x31, 0x30, 0x31, 0x2e, 0x42, 0x65, 0x6e, 0x65, 0x66, 0x69, 0x63, 0x69, 0x61, 0x72, 0x79, + 0x52, 0x0b, 0x62, 0x65, 0x6e, 0x65, 0x66, 0x69, 0x63, 0x69, 0x61, 0x72, 0x79, 0x12, 0x43, 0x0a, + 0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x73, + 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, + 0x31, 0x2e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x73, + 0x70, 0x52, 0x0f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x56, 0x61, + 0x73, 0x70, 0x12, 0x43, 0x0a, 0x10, 0x62, 0x65, 0x6e, 0x65, 0x66, 0x69, 0x63, 0x69, 0x61, 0x72, + 0x79, 0x5f, 0x76, 0x61, 0x73, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x69, + 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, 0x42, 0x65, 0x6e, 0x65, 0x66, 0x69, 0x63, 0x69, 0x61, + 0x72, 0x79, 0x56, 0x61, 0x73, 0x70, 0x52, 0x0f, 0x62, 0x65, 0x6e, 0x65, 0x66, 0x69, 0x63, 0x69, + 0x61, 0x72, 0x79, 0x56, 0x61, 0x73, 0x70, 0x12, 0x3a, 0x0a, 0x0d, 0x74, 0x72, 0x61, 0x6e, 0x73, + 0x66, 0x65, 0x72, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, + 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, + 0x72, 0x50, 0x61, 0x74, 0x68, 0x52, 0x0c, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x50, + 0x61, 0x74, 0x68, 0x12, 0x43, 0x0a, 0x10, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x6d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x0f, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x75, 0x0a, 0x0a, 0x4f, 0x72, 0x69, 0x67, + 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x3e, 0x0a, 0x12, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, + 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, 0x50, 0x65, 0x72, + 0x73, 0x6f, 0x6e, 0x52, 0x11, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x6f, 0x72, 0x50, + 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x0e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x22, + 0x78, 0x0a, 0x0b, 0x42, 0x65, 0x6e, 0x65, 0x66, 0x69, 0x63, 0x69, 0x61, 0x72, 0x79, 0x12, 0x40, + 0x0a, 0x13, 0x62, 0x65, 0x6e, 0x65, 0x66, 0x69, 0x63, 0x69, 0x61, 0x72, 0x79, 0x5f, 0x70, 0x65, + 0x72, 0x73, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x69, 0x76, + 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x52, 0x12, 0x62, 0x65, + 0x6e, 0x65, 0x66, 0x69, 0x63, 0x69, 0x61, 0x72, 0x79, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x73, + 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x63, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x22, 0x4d, 0x0a, 0x0f, 0x4f, 0x72, 0x69, + 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x73, 0x70, 0x12, 0x3a, 0x0a, 0x10, + 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x73, 0x70, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, + 0x2e, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x52, 0x0f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, + 0x74, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x73, 0x70, 0x22, 0x4d, 0x0a, 0x0f, 0x42, 0x65, 0x6e, 0x65, + 0x66, 0x69, 0x63, 0x69, 0x61, 0x72, 0x79, 0x56, 0x61, 0x73, 0x70, 0x12, 0x3a, 0x0a, 0x10, 0x62, + 0x65, 0x6e, 0x65, 0x66, 0x69, 0x63, 0x69, 0x61, 0x72, 0x79, 0x5f, 0x76, 0x61, 0x73, 0x70, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, + 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x52, 0x0f, 0x62, 0x65, 0x6e, 0x65, 0x66, 0x69, 0x63, 0x69, + 0x61, 0x72, 0x79, 0x56, 0x61, 0x73, 0x70, 0x22, 0x6c, 0x0a, 0x10, 0x49, 0x6e, 0x74, 0x65, 0x72, + 0x6d, 0x65, 0x64, 0x69, 0x61, 0x72, 0x79, 0x56, 0x61, 0x73, 0x70, 0x12, 0x3c, 0x0a, 0x11, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x72, 0x79, 0x5f, 0x76, 0x61, 0x73, 0x70, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, + 0x2e, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x52, 0x10, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, + 0x64, 0x69, 0x61, 0x72, 0x79, 0x56, 0x61, 0x73, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, + 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x65, 0x71, + 0x75, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x4e, 0x0a, 0x0c, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, + 0x72, 0x50, 0x61, 0x74, 0x68, 0x12, 0x3e, 0x0a, 0x0d, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, + 0x72, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x69, + 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6d, 0x65, 0x64, 0x69, + 0x61, 0x72, 0x79, 0x56, 0x61, 0x73, 0x70, 0x52, 0x0c, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, + 0x72, 0x50, 0x61, 0x74, 0x68, 0x22, 0x6c, 0x0a, 0x0f, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x59, 0x0a, 0x16, 0x74, 0x72, 0x61, 0x6e, + 0x73, 0x6c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x22, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, + 0x30, 0x31, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x15, 0x74, 0x72, + 0x61, 0x6e, 0x73, 0x6c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, + 0x68, 0x6f, 0x64, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x74, 0x72, 0x69, 0x73, 0x61, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2f, 0x74, 0x72, + 0x69, 0x73, 0x61, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ivms101_identity_proto_rawDescOnce sync.Once + file_ivms101_identity_proto_rawDescData = file_ivms101_identity_proto_rawDesc +) + +func file_ivms101_identity_proto_rawDescGZIP() []byte { + file_ivms101_identity_proto_rawDescOnce.Do(func() { + file_ivms101_identity_proto_rawDescData = protoimpl.X.CompressGZIP(file_ivms101_identity_proto_rawDescData) + }) + return file_ivms101_identity_proto_rawDescData +} + +var file_ivms101_identity_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_ivms101_identity_proto_goTypes = []interface{}{ + (*IdentityPayload)(nil), // 0: ivms101.IdentityPayload + (*Originator)(nil), // 1: ivms101.Originator + (*Beneficiary)(nil), // 2: ivms101.Beneficiary + (*OriginatingVasp)(nil), // 3: ivms101.OriginatingVasp + (*BeneficiaryVasp)(nil), // 4: ivms101.BeneficiaryVasp + (*IntermediaryVasp)(nil), // 5: ivms101.IntermediaryVasp + (*TransferPath)(nil), // 6: ivms101.TransferPath + (*PayloadMetadata)(nil), // 7: ivms101.PayloadMetadata + (*Person)(nil), // 8: ivms101.Person + (TransliterationMethodCode)(0), // 9: ivms101.TransliterationMethodCode +} +var file_ivms101_identity_proto_depIdxs = []int32{ + 1, // 0: ivms101.IdentityPayload.originator:type_name -> ivms101.Originator + 2, // 1: ivms101.IdentityPayload.beneficiary:type_name -> ivms101.Beneficiary + 3, // 2: ivms101.IdentityPayload.originating_vasp:type_name -> ivms101.OriginatingVasp + 4, // 3: ivms101.IdentityPayload.beneficiary_vasp:type_name -> ivms101.BeneficiaryVasp + 6, // 4: ivms101.IdentityPayload.transfer_path:type_name -> ivms101.TransferPath + 7, // 5: ivms101.IdentityPayload.payload_metadata:type_name -> ivms101.PayloadMetadata + 8, // 6: ivms101.Originator.originator_persons:type_name -> ivms101.Person + 8, // 7: ivms101.Beneficiary.beneficiary_persons:type_name -> ivms101.Person + 8, // 8: ivms101.OriginatingVasp.originating_vasp:type_name -> ivms101.Person + 8, // 9: ivms101.BeneficiaryVasp.beneficiary_vasp:type_name -> ivms101.Person + 8, // 10: ivms101.IntermediaryVasp.intermediary_vasp:type_name -> ivms101.Person + 5, // 11: ivms101.TransferPath.transfer_path:type_name -> ivms101.IntermediaryVasp + 9, // 12: ivms101.PayloadMetadata.transliteration_method:type_name -> ivms101.TransliterationMethodCode + 13, // [13:13] is the sub-list for method output_type + 13, // [13:13] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name +} + +func init() { file_ivms101_identity_proto_init() } +func file_ivms101_identity_proto_init() { + if File_ivms101_identity_proto != nil { + return + } + file_ivms101_ivms101_proto_init() + file_ivms101_enum_proto_init() + if !protoimpl.UnsafeEnabled { + file_ivms101_identity_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IdentityPayload); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ivms101_identity_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Originator); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ivms101_identity_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Beneficiary); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ivms101_identity_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OriginatingVasp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ivms101_identity_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BeneficiaryVasp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ivms101_identity_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IntermediaryVasp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ivms101_identity_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TransferPath); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ivms101_identity_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayloadMetadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ivms101_identity_proto_rawDesc, + NumEnums: 0, + NumMessages: 8, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ivms101_identity_proto_goTypes, + DependencyIndexes: file_ivms101_identity_proto_depIdxs, + MessageInfos: file_ivms101_identity_proto_msgTypes, + }.Build() + File_ivms101_identity_proto = out.File + file_ivms101_identity_proto_rawDesc = nil + file_ivms101_identity_proto_goTypes = nil + file_ivms101_identity_proto_depIdxs = nil +} diff --git a/pkg/ivms101/ivms101.go b/pkg/ivms101/ivms101.go new file mode 100644 index 0000000..0da82b8 --- /dev/null +++ b/pkg/ivms101/ivms101.go @@ -0,0 +1,366 @@ +/* +Package ivms101 extends the Go protocol buffers generated by the ivms101 protobuf +package with JSON loading utilities, validation helpers, short constants, etc. +*/ +package ivms101 + +import ( + "strings" + "time" +) + +// Person converts a NaturalPerson into a Person protobuf message type. +func (p *NaturalPerson) Person() *Person { + return &Person{ + Person: &Person_NaturalPerson{ + NaturalPerson: p, + }, + } +} + +// Person converts a LegalPerson into a Person protobuf message type. +func (p *LegalPerson) Person() *Person { + return &Person{ + Person: &Person_LegalPerson{ + LegalPerson: p, + }, + } +} + +// Validate the IVMS101 constraints for a natural person data definition. ON the first +// invalid constraint found an error is returned. No error is returned for valid data. +func (p *NaturalPerson) Validate() (err error) { + // Constraint: required ValidNaturalPersonName + if p.Name == nil { + return ErrNoNaturalPersonNameIdentifiers + } + if err = p.Name.Validate(); err != nil { + return err + } + + // Constraint: ValidAddresses + for _, addr := range p.GeographicAddresses { + if err = addr.Validate(); err != nil { + return err + } + } + + // Constraint: Optional ValidNationalIdentification + if p.NationalIdentification != nil { + if err = p.NationalIdentification.Validate(); err != nil { + return err + } + } + + // Constraint: optioanl Max50Text + if len(p.CustomerIdentification) > 50 { + return ErrInvalidCustomerIdentification + } + + // Contstraint: Optional Valid DateAndPlaceOfBirth + if p.DateAndPlaceOfBirth != nil { + if err = p.DateAndPlaceOfBirth.Validate(); err != nil { + return err + } + } + + // Constraint: Optional ISO-3166-1 alpha-2 codes or XX + if p.CountryOfResidence != "" { + // TODO: ensure the code is valid; for now just checking length + if len(p.CountryOfResidence) != 2 { + return ErrInvalidCountryCode + } + + // Ensure that country code is all upper case + p.CountryOfResidence = strings.ToUpper(p.CountryOfResidence) + } + + return nil +} + +// Validate the IVMS101 constraints for a legal person data definition. On the first +// invalid constraint found an error is returned. No error is returned for valid data. +func (p *LegalPerson) Validate() (err error) { + // Constraint: ValidLegalPersonName + // Constraint: LegalNamePresentLegalPerson + if p.Name == nil { + return ErrNoLegalPersonNameIdentifiers + } + if err = p.Name.Validate(); err != nil { + return err + } + + // Constraint: ValidAddresses + for _, addr := range p.GeographicAddresses { + if err = addr.Validate(); err != nil { + return err + } + } + + // Constraint: Optional Max50Text Datatype + if p.CustomerNumber != "" && len(p.CustomerNumber) > 50 { + return ErrInvalidCustomerNumber + } + + // Constraint: Optional ValidNationalIdentification + if p.NationalIdentification != nil { + if err = p.NationalIdentification.Validate(); err != nil { + return err + } + + // Constraint: ValidNationalIdentifierLegalPerson + if !(p.NationalIdentification.NationalIdentifierType == NationalIdentifierRAID || + p.NationalIdentification.NationalIdentifierType == NationalIdentifierMISC || + p.NationalIdentification.NationalIdentifierType == NationalIdentifierLEIX || + p.NationalIdentification.NationalIdentifierType == NationalIdentifierTXID) { + return ErrValidNationalIdentifierLegalPerson + } + + // Constraint: CompleteNationalIdentifierLegalPerson + if p.NationalIdentification.NationalIdentifierType != NationalIdentifierLEIX { + if p.NationalIdentification.CountryOfIssue != "" || p.NationalIdentification.RegistrationAuthority == "" { + return ErrCompleteNationalIdentifierLegalPerson + } + } + + } + + // Constraint: Optional ISO-3166-1 alpha-2 codes or XX + if p.CountryOfRegistration != "" { + // TODO: ensure the code is valid; for now just checking length + if len(p.CountryOfRegistration) != 2 { + return ErrInvalidCountryCode + } + + // Ensure that country code is all upper case + p.CountryOfRegistration = strings.ToUpper(p.CountryOfRegistration) + } + + return nil +} + +// Validate the IVMS101 constraints for natural person name +func (n *NaturalPersonName) Validate() (err error) { + // Constraint one or more + if len(n.NameIdentifiers) < 1 { + return ErrNoNaturalPersonNameIdentifiers + } + + // Constraint: valid name identifiers + var legalNames int + for _, name := range n.NameIdentifiers { + if err = name.Validate(); err != nil { + return err + } + + if name.NameIdentifierType == NaturalPersonLegal { + legalNames++ + } + } + + // Constraint: LegalNamePresent + if legalNames == 0 { + return ErrLegalNamesPresent + } + + // Constraint: valid local name identifiers + for _, name := range n.LocalNameIdentifiers { + if err = name.Validate(); err != nil { + return err + } + } + + // Constraint: valid phonetic name identifiers + for _, name := range n.PhoneticNameIdentifiers { + if err = name.Validate(); err != nil { + return err + } + } + + return nil +} + +// Validate the IVMS101 constraints for natural person name identifiers +func (n *NaturalPersonNameId) Validate() (err error) { + if n.PrimaryIdentifier == "" || len(n.PrimaryIdentifier) > 100 { + return ErrInvalidNaturalPersonName + } + + if len(n.SecondaryIdentifier) > 100 { + return ErrInvalidNaturalPersonName + } + + typeCode := int32(n.NameIdentifierType) + if _, ok := NaturalPersonNameTypeCode_name[typeCode]; !ok { + return ErrInvalidNaturalPersonNameTypeCode + } + + return nil +} + +// Validate the IVMS101 constraints for local natural person anme identifiers +func (n *LocalNaturalPersonNameId) Validate() (err error) { + if n.PrimaryIdentifier == "" || len(n.PrimaryIdentifier) > 100 { + return ErrInvalidNaturalPersonName + } + + if len(n.SecondaryIdentifier) > 100 { + return ErrInvalidNaturalPersonName + } + + typeCode := int32(n.NameIdentifierType) + if _, ok := NaturalPersonNameTypeCode_name[typeCode]; !ok { + return ErrInvalidNaturalPersonNameTypeCode + } + + return nil +} + +// Validate the IVMS101 constraints for legal person name. +func (n *LegalPersonName) Validate() (err error) { + // Constraint: one or more + if len(n.NameIdentifiers) < 1 { + return ErrNoLegalPersonNameIdentifiers + } + + // Constraint: valid name identifiers + var legalNames int + for _, name := range n.NameIdentifiers { + if err = name.Validate(); err != nil { + return err + } + + if name.LegalPersonNameIdentifierType == LegalPersonLegal { + legalNames++ + } + } + + // Constraint: LegalNamePresent + if legalNames == 0 { + return ErrLegalNamesPresent + } + + // Constraint: valid local name identifiers + for _, name := range n.LocalNameIdentifiers { + if err = name.Validate(); err != nil { + return err + } + } + + // Constraint: valid phonetic name identifiers + for _, name := range n.PhoneticNameIdentifiers { + if err = name.Validate(); err != nil { + return err + } + } + + return nil +} + +// Validate the IVMS101 constraints for legal person name identifier +func (n *LegalPersonNameId) Validate() (err error) { + if n.LegalPersonName == "" || len(n.LegalPersonName) > 100 { + return ErrInvalidLegalPersonName + } + + typeCode := int32(n.LegalPersonNameIdentifierType) + if _, ok := LegalPersonNameTypeCode_name[typeCode]; !ok { + return ErrInvalidLegalPersonNameTypeCode + } + + return nil +} + +// Validate the IVMS101 constraints for local legal person name identifier +func (n *LocalLegalPersonNameId) Validate() (err error) { + if n.LegalPersonName == "" || len(n.LegalPersonName) > 100 { + return ErrInvalidLegalPersonName + } + + typeCode := int32(n.LegalPersonNameIdentifierType) + if _, ok := LegalPersonNameTypeCode_name[typeCode]; !ok { + return ErrInvalidLegalPersonNameTypeCode + } + + return nil +} + +// Validate the IVMS101 constraints for a geograpic address +func (a *Address) Validate() (err error) { + // Constraint: valid required address type code + typeCode := int32(a.AddressType) + if _, ok := AddressTypeCode_name[typeCode]; !ok { + return ErrInvalidAddressTypeCode + } + + // TODO: validate optional max length constraints + // Constraint: at most 7 address lines + if len(a.AddressLine) > 7 { + return ErrInvalidAddressLines + } + + // Constraint: ValidAddress + if len(a.AddressLine) == 0 && (a.StreetName == "" && (a.BuildingName == "" || a.BuildingNumber == "")) { + return ErrValidAddress + } + + // Constraint: required valid country code + // TODO: validate ISO-3166-1 alpha-2 country code + if a.Country == "" || len(a.Country) != 2 { + return ErrInvalidCountryCode + } + a.Country = strings.ToUpper(a.Country) + + return nil +} + +// Validate the IVMS101 constraints for a national identification +func (id *NationalIdentification) Validate() (err error) { + // TODO: Constraint ValidLEI + // Constraint: required Max35Text datatype + if id.NationalIdentifier == "" || len(id.NationalIdentifier) > 35 { + return ErrInvalidLEI + } + + // Constraint: required valid national identifier type code + typeCode := int32(id.NationalIdentifierType) + if _, ok := NationalIdentifierTypeCode_name[typeCode]; !ok { + return ErrInvalidNationalIdentifierTypeCode + } + + // Constraint: valid country code + if id.CountryOfIssue != "" { + // TODO: validate ISO-3166-1 alpha-2 country code + if len(id.CountryOfIssue) != 2 { + return ErrInvalidCountryCode + } + id.CountryOfIssue = strings.ToUpper(id.CountryOfIssue) + } + + // TODO: Contraint authority in GLEIF Registration authorities list + return nil +} + +// Validate the IVMS101 constraints for date and place of birth +func (d *DateAndPlaceOfBirth) Validate() (err error) { + // Constraint: require valid date + if d.DateOfBirth == "" { + return ErrInvalidDateOfBirth + } + + var date time.Time + if date, err = time.Parse("2006-01-02", d.DateOfBirth); err != nil { + return ErrInvalidDateOfBirth + } + + if d.PlaceOfBirth == "" || len(d.PlaceOfBirth) > 70 { + return ErrInvalidPlaceOfBirth + } + + // Constraint: DateInPast + if date.After(time.Now()) { + return ErrDateInPast + } + + return nil +} diff --git a/pkg/ivms101/ivms101.pb.go b/pkg/ivms101/ivms101.pb.go new file mode 100644 index 0000000..6bb2e98 --- /dev/null +++ b/pkg/ivms101/ivms101.pb.go @@ -0,0 +1,1604 @@ +// Specification Copyright (c) 2020 Joint Working Group on interVASP Messaging Standards +// https://intervasp.org/ +// https://intervasp.org/wp-content/uploads/2020/05/IVMS101-interVASP-data-model-standard-issue-1-FINAL.pdf + +// Protocol Buffer Specification Copyright (c) 2020 CipherTrace, Inc. https://ciphertrace.com + +// Licensed under MIT License + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// NOTE ON THE SPECIFICATION MAPPING +// This protocol buffers specification has applied the Protocol Buffers style guide +// https://developers.google.com/protocol-buffers/docs/style to the ISVM101 +// specification to be consistent with other Protocol Buffers specifications and to +// avoid common pitfalls when generating language specific classes. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.14.0 +// source: ivms101/ivms101.proto + +package ivms101 + +import ( + proto "github.com/golang/protobuf/proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type Person struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Person: + // *Person_NaturalPerson + // *Person_LegalPerson + Person isPerson_Person `protobuf_oneof:"person"` +} + +func (x *Person) Reset() { + *x = Person{} + if protoimpl.UnsafeEnabled { + mi := &file_ivms101_ivms101_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Person) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Person) ProtoMessage() {} + +func (x *Person) ProtoReflect() protoreflect.Message { + mi := &file_ivms101_ivms101_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Person.ProtoReflect.Descriptor instead. +func (*Person) Descriptor() ([]byte, []int) { + return file_ivms101_ivms101_proto_rawDescGZIP(), []int{0} +} + +func (m *Person) GetPerson() isPerson_Person { + if m != nil { + return m.Person + } + return nil +} + +func (x *Person) GetNaturalPerson() *NaturalPerson { + if x, ok := x.GetPerson().(*Person_NaturalPerson); ok { + return x.NaturalPerson + } + return nil +} + +func (x *Person) GetLegalPerson() *LegalPerson { + if x, ok := x.GetPerson().(*Person_LegalPerson); ok { + return x.LegalPerson + } + return nil +} + +type isPerson_Person interface { + isPerson_Person() +} + +type Person_NaturalPerson struct { + // Definition: a uniquely distinguishable individual; one single person. + NaturalPerson *NaturalPerson `protobuf:"bytes,1,opt,name=natural_person,json=naturalPerson,proto3,oneof"` +} + +type Person_LegalPerson struct { + // Definition: any entity other than a natural person that can establish a + // permanent customer relationship with an affected entity or otherwise own + // property. This can include companies, bodies corporate, foundations, anstalt, + // partnerships, or associations and other relevantly similar entities. + LegalPerson *LegalPerson `protobuf:"bytes,2,opt,name=legal_person,json=legalPerson,proto3,oneof"` +} + +func (*Person_NaturalPerson) isPerson_Person() {} + +func (*Person_LegalPerson) isPerson_Person() {} + +// Definition: refers to a uniquely distinguishable individual; one single person +type NaturalPerson struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Definition: the distinct words used as identification for an individual. + // Required + Name *NaturalPersonName `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Definition: the particulars of a location at which a person may be communicated with. + // Zero or More + GeographicAddresses []*Address `protobuf:"bytes,2,rep,name=geographic_addresses,json=geographicAddresses,proto3" json:"geographic_addresses,omitempty"` + // Definition: a distinct identifier used by governments of countries to uniquely + // identify a natural or legal person. + // Optional + NationalIdentification *NationalIdentification `protobuf:"bytes,3,opt,name=national_identification,json=nationalIdentification,proto3" json:"national_identification,omitempty"` + // Definition: a distinct identifier that uniquely identifies the person to the + // institution in context. + // Datatype: “Max50Text” + // Optional + CustomerIdentification string `protobuf:"bytes,4,opt,name=customer_identification,json=customerIdentification,proto3" json:"customer_identification,omitempty"` + // Definition: date and place of birth of a person. + // Optional + DateAndPlaceOfBirth *DateAndPlaceOfBirth `protobuf:"bytes,5,opt,name=date_and_place_of_birth,json=dateAndPlaceOfBirth,proto3" json:"date_and_place_of_birth,omitempty"` + // Definition: country in which a person resides (the place of a person's home). + // The value used for the field country must be present on the ISO-3166-1 alpha-2 + // codes or the value XX. + // Datatype: “CountryCode” + // Optional + CountryOfResidence string `protobuf:"bytes,6,opt,name=country_of_residence,json=countryOfResidence,proto3" json:"country_of_residence,omitempty"` +} + +func (x *NaturalPerson) Reset() { + *x = NaturalPerson{} + if protoimpl.UnsafeEnabled { + mi := &file_ivms101_ivms101_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NaturalPerson) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NaturalPerson) ProtoMessage() {} + +func (x *NaturalPerson) ProtoReflect() protoreflect.Message { + mi := &file_ivms101_ivms101_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NaturalPerson.ProtoReflect.Descriptor instead. +func (*NaturalPerson) Descriptor() ([]byte, []int) { + return file_ivms101_ivms101_proto_rawDescGZIP(), []int{1} +} + +func (x *NaturalPerson) GetName() *NaturalPersonName { + if x != nil { + return x.Name + } + return nil +} + +func (x *NaturalPerson) GetGeographicAddresses() []*Address { + if x != nil { + return x.GeographicAddresses + } + return nil +} + +func (x *NaturalPerson) GetNationalIdentification() *NationalIdentification { + if x != nil { + return x.NationalIdentification + } + return nil +} + +func (x *NaturalPerson) GetCustomerIdentification() string { + if x != nil { + return x.CustomerIdentification + } + return "" +} + +func (x *NaturalPerson) GetDateAndPlaceOfBirth() *DateAndPlaceOfBirth { + if x != nil { + return x.DateAndPlaceOfBirth + } + return nil +} + +func (x *NaturalPerson) GetCountryOfResidence() string { + if x != nil { + return x.CountryOfResidence + } + return "" +} + +type NaturalPersonName struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // At least one occurrence of naturalPersonNameID must have the value ‘LEGL’ + // specified in the element naturalPersonNameIdentifierType. + // Definition: full name separated into primary and secondary identifier. + // One or more + NameIdentifiers []*NaturalPersonNameId `protobuf:"bytes,1,rep,name=name_identifiers,json=nameIdentifiers,proto3" json:"name_identifiers,omitempty"` + // Definition: full name separated into primary and secondary identifier using + // local characters. + // Zero or more + LocalNameIdentifiers []*LocalNaturalPersonNameId `protobuf:"bytes,2,rep,name=local_name_identifiers,json=localNameIdentifiers,proto3" json:"local_name_identifiers,omitempty"` + // Definition: Alternate representation of a name that corresponds to the manner + // the name is pronounced. + // Zero or more + PhoneticNameIdentifiers []*LocalNaturalPersonNameId `protobuf:"bytes,3,rep,name=phonetic_name_identifiers,json=phoneticNameIdentifiers,proto3" json:"phonetic_name_identifiers,omitempty"` +} + +func (x *NaturalPersonName) Reset() { + *x = NaturalPersonName{} + if protoimpl.UnsafeEnabled { + mi := &file_ivms101_ivms101_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NaturalPersonName) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NaturalPersonName) ProtoMessage() {} + +func (x *NaturalPersonName) ProtoReflect() protoreflect.Message { + mi := &file_ivms101_ivms101_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NaturalPersonName.ProtoReflect.Descriptor instead. +func (*NaturalPersonName) Descriptor() ([]byte, []int) { + return file_ivms101_ivms101_proto_rawDescGZIP(), []int{2} +} + +func (x *NaturalPersonName) GetNameIdentifiers() []*NaturalPersonNameId { + if x != nil { + return x.NameIdentifiers + } + return nil +} + +func (x *NaturalPersonName) GetLocalNameIdentifiers() []*LocalNaturalPersonNameId { + if x != nil { + return x.LocalNameIdentifiers + } + return nil +} + +func (x *NaturalPersonName) GetPhoneticNameIdentifiers() []*LocalNaturalPersonNameId { + if x != nil { + return x.PhoneticNameIdentifiers + } + return nil +} + +type NaturalPersonNameId struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Definition: This may be the family name, the maiden name or the married name, + // the main name, the surname, and in some cases, the entire name where the natural + // person’s name cannot be divided into two parts, or where the sender is unable to + // divide the natural person’s name into two parts. + // Datatype: “Max100Text” + // Required + PrimaryIdentifier string `protobuf:"bytes,1,opt,name=primary_identifier,json=primaryIdentifier,proto3" json:"primary_identifier,omitempty"` + // Definition: These may be the forenames, familiar names, given names, initials, + // prefixes, suffixes or Roman numerals (where considered to be legally part of the + // name) or any other secondary names. + // Datatype: “Max100Text” + // Optional + SecondaryIdentifier string `protobuf:"bytes,2,opt,name=secondary_identifier,json=secondaryIdentifier,proto3" json:"secondary_identifier,omitempty"` + // Definition: The nature of the name specified. + // Required + NameIdentifierType NaturalPersonNameTypeCode `protobuf:"varint,3,opt,name=name_identifier_type,json=nameIdentifierType,proto3,enum=ivms101.NaturalPersonNameTypeCode" json:"name_identifier_type,omitempty"` +} + +func (x *NaturalPersonNameId) Reset() { + *x = NaturalPersonNameId{} + if protoimpl.UnsafeEnabled { + mi := &file_ivms101_ivms101_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NaturalPersonNameId) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NaturalPersonNameId) ProtoMessage() {} + +func (x *NaturalPersonNameId) ProtoReflect() protoreflect.Message { + mi := &file_ivms101_ivms101_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NaturalPersonNameId.ProtoReflect.Descriptor instead. +func (*NaturalPersonNameId) Descriptor() ([]byte, []int) { + return file_ivms101_ivms101_proto_rawDescGZIP(), []int{3} +} + +func (x *NaturalPersonNameId) GetPrimaryIdentifier() string { + if x != nil { + return x.PrimaryIdentifier + } + return "" +} + +func (x *NaturalPersonNameId) GetSecondaryIdentifier() string { + if x != nil { + return x.SecondaryIdentifier + } + return "" +} + +func (x *NaturalPersonNameId) GetNameIdentifierType() NaturalPersonNameTypeCode { + if x != nil { + return x.NameIdentifierType + } + return NaturalPersonNameTypeCode_NATURAL_PERSON_NAME_TYPE_CODE_ALIA +} + +type LocalNaturalPersonNameId struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Definition: This may be the family name, the maiden name or the married name, + // the main name, the surname, and in some cases, the entire name where the natural + // person’s name cannot be divided into two parts, or where the sender is unable to + // divide the natural person’s name into two parts. + // Datatype: “LocalMax100Text” + // Required + PrimaryIdentifier string `protobuf:"bytes,1,opt,name=primary_identifier,json=primaryIdentifier,proto3" json:"primary_identifier,omitempty"` + // Definition: These may be the forenames, familiar names, given names, initials, + // prefixes, suffixes or Roman numerals (where considered to be legally part of + // the name) or any other secondary names. + // Datatype: “LocalMax100Text” + // Optional + SecondaryIdentifier string `protobuf:"bytes,2,opt,name=secondary_identifier,json=secondaryIdentifier,proto3" json:"secondary_identifier,omitempty"` + // Definition: The nature of the name specified. + // Required + NameIdentifierType NaturalPersonNameTypeCode `protobuf:"varint,3,opt,name=name_identifier_type,json=nameIdentifierType,proto3,enum=ivms101.NaturalPersonNameTypeCode" json:"name_identifier_type,omitempty"` +} + +func (x *LocalNaturalPersonNameId) Reset() { + *x = LocalNaturalPersonNameId{} + if protoimpl.UnsafeEnabled { + mi := &file_ivms101_ivms101_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LocalNaturalPersonNameId) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LocalNaturalPersonNameId) ProtoMessage() {} + +func (x *LocalNaturalPersonNameId) ProtoReflect() protoreflect.Message { + mi := &file_ivms101_ivms101_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LocalNaturalPersonNameId.ProtoReflect.Descriptor instead. +func (*LocalNaturalPersonNameId) Descriptor() ([]byte, []int) { + return file_ivms101_ivms101_proto_rawDescGZIP(), []int{4} +} + +func (x *LocalNaturalPersonNameId) GetPrimaryIdentifier() string { + if x != nil { + return x.PrimaryIdentifier + } + return "" +} + +func (x *LocalNaturalPersonNameId) GetSecondaryIdentifier() string { + if x != nil { + return x.SecondaryIdentifier + } + return "" +} + +func (x *LocalNaturalPersonNameId) GetNameIdentifierType() NaturalPersonNameTypeCode { + if x != nil { + return x.NameIdentifierType + } + return NaturalPersonNameTypeCode_NATURAL_PERSON_NAME_TYPE_CODE_ALIA +} + +// Constraint: ValidAddress +// There must be at least one occurrence of the element addressLine or (streetName and +// buildingName and/or buildingNumber). +type Address struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Definition: Identifies the nature of the address. + // Required + AddressType AddressTypeCode `protobuf:"varint,1,opt,name=address_type,json=addressType,proto3,enum=ivms101.AddressTypeCode" json:"address_type,omitempty"` + // Definition: Identification of a division of a large organisation or building. + // Datatype: “Max50Text” + // Optional + Department string `protobuf:"bytes,2,opt,name=department,proto3" json:"department,omitempty"` + // Definition: Identification of a sub-division of a large organisation or building. + // Datatype: “Max70Text” + // Optional + SubDepartment string `protobuf:"bytes,3,opt,name=sub_department,json=subDepartment,proto3" json:"sub_department,omitempty"` + // Definition: Name of a street or thoroughfare. + // Datatype: “Max70Text” + // Optional + StreetName string `protobuf:"bytes,4,opt,name=street_name,json=streetName,proto3" json:"street_name,omitempty"` + // Definition: Number that identifies the position of a building on a street. + // Datatype: “Max16Text” + // Optional + BuildingNumber string `protobuf:"bytes,5,opt,name=building_number,json=buildingNumber,proto3" json:"building_number,omitempty"` + // Definition: Name of the building or house. + // Datatype: “Max35Text” + // Optional + BuildingName string `protobuf:"bytes,6,opt,name=building_name,json=buildingName,proto3" json:"building_name,omitempty"` + // Definition: Floor or storey within a building. + // Datatype: “Max70Text” + // Optional + Floor string `protobuf:"bytes,7,opt,name=floor,proto3" json:"floor,omitempty"` + // Definition: Numbered box in a post office, assigned to a person or organisation, + // where letters are kept until called for. + // Datatype: “Max16Text” + // Optional + PostBox string `protobuf:"bytes,8,opt,name=post_box,json=postBox,proto3" json:"post_box,omitempty"` + // Definition: Building room number. + // Datatype: “Max70Text” + // Optional + Room string `protobuf:"bytes,9,opt,name=room,proto3" json:"room,omitempty"` + // Definition: Identifier consisting of a group of letters and/or numbers that is + // added to a postal address to assist the sorting of mail. + // Datatype: “Max16Text” + // Optional + PostCode string `protobuf:"bytes,10,opt,name=post_code,json=postCode,proto3" json:"post_code,omitempty"` + // Definition: Name of a built-up area, with defined boundaries and a local government. + // Datatype: “Max35Text” + // Optional + TownName string `protobuf:"bytes,11,opt,name=town_name,json=townName,proto3" json:"town_name,omitempty"` + // Definition: Specific location name within the town. + // Datatype: “Max35Text” + // Optional + TownLocationName string `protobuf:"bytes,12,opt,name=town_location_name,json=townLocationName,proto3" json:"town_location_name,omitempty"` + // Definition: Identifies a subdivision within a country subdivision. + // Datatype: “Max35Text” + // Optional + DistrictName string `protobuf:"bytes,13,opt,name=district_name,json=districtName,proto3" json:"district_name,omitempty"` + // Definition: Identifies a subdivision of a country for example, state, region, + // province, départment or county. + // Datatype: “Max35Text” + // Optional + CountrySubDivision string `protobuf:"bytes,14,opt,name=country_sub_division,json=countrySubDivision,proto3" json:"country_sub_division,omitempty"` + // Definition: Information that locates and identifies a specific address, as + // defined by postal services, presented in free format text. + // Datatype: “Max70Text” + // Zero to Seven + AddressLine []string `protobuf:"bytes,15,rep,name=address_line,json=addressLine,proto3" json:"address_line,omitempty"` + // Constraint: The value used for the field country must be present on the + // ISO-3166-1 alpha-2 codes or the value XX. + // Datatype: “CountryCode” + // Required + Country string `protobuf:"bytes,16,opt,name=country,proto3" json:"country,omitempty"` +} + +func (x *Address) Reset() { + *x = Address{} + if protoimpl.UnsafeEnabled { + mi := &file_ivms101_ivms101_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Address) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Address) ProtoMessage() {} + +func (x *Address) ProtoReflect() protoreflect.Message { + mi := &file_ivms101_ivms101_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Address.ProtoReflect.Descriptor instead. +func (*Address) Descriptor() ([]byte, []int) { + return file_ivms101_ivms101_proto_rawDescGZIP(), []int{5} +} + +func (x *Address) GetAddressType() AddressTypeCode { + if x != nil { + return x.AddressType + } + return AddressTypeCode_ADDRESS_TYPE_CODE_HOME +} + +func (x *Address) GetDepartment() string { + if x != nil { + return x.Department + } + return "" +} + +func (x *Address) GetSubDepartment() string { + if x != nil { + return x.SubDepartment + } + return "" +} + +func (x *Address) GetStreetName() string { + if x != nil { + return x.StreetName + } + return "" +} + +func (x *Address) GetBuildingNumber() string { + if x != nil { + return x.BuildingNumber + } + return "" +} + +func (x *Address) GetBuildingName() string { + if x != nil { + return x.BuildingName + } + return "" +} + +func (x *Address) GetFloor() string { + if x != nil { + return x.Floor + } + return "" +} + +func (x *Address) GetPostBox() string { + if x != nil { + return x.PostBox + } + return "" +} + +func (x *Address) GetRoom() string { + if x != nil { + return x.Room + } + return "" +} + +func (x *Address) GetPostCode() string { + if x != nil { + return x.PostCode + } + return "" +} + +func (x *Address) GetTownName() string { + if x != nil { + return x.TownName + } + return "" +} + +func (x *Address) GetTownLocationName() string { + if x != nil { + return x.TownLocationName + } + return "" +} + +func (x *Address) GetDistrictName() string { + if x != nil { + return x.DistrictName + } + return "" +} + +func (x *Address) GetCountrySubDivision() string { + if x != nil { + return x.CountrySubDivision + } + return "" +} + +func (x *Address) GetAddressLine() []string { + if x != nil { + return x.AddressLine + } + return nil +} + +func (x *Address) GetCountry() string { + if x != nil { + return x.Country + } + return "" +} + +// Constraint: DateInPast +// If dateOfBirth is specified, the date specified must be a historic date (i.e. a date +// prior to the current date) +type DateAndPlaceOfBirth struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Definition: Date on which a person is born. + // Definition: A point in time, represented as a day within the calendar year. + // Compliant with ISO 8601. + // Type: Text + // Format: YYYY-MM-DD + // Regex: ^([0-9]{4})-([0-9]{2})-([0-9]{2})$ + // Required + DateOfBirth string `protobuf:"bytes,1,opt,name=date_of_birth,json=dateOfBirth,proto3" json:"date_of_birth,omitempty"` + // Definition: The town and/or the city and/or the suburb and/or the country + // subdivision and/or the country where the person was born. + // Datatype: “Max70Text” + // Required + PlaceOfBirth string `protobuf:"bytes,2,opt,name=place_of_birth,json=placeOfBirth,proto3" json:"place_of_birth,omitempty"` +} + +func (x *DateAndPlaceOfBirth) Reset() { + *x = DateAndPlaceOfBirth{} + if protoimpl.UnsafeEnabled { + mi := &file_ivms101_ivms101_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DateAndPlaceOfBirth) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DateAndPlaceOfBirth) ProtoMessage() {} + +func (x *DateAndPlaceOfBirth) ProtoReflect() protoreflect.Message { + mi := &file_ivms101_ivms101_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DateAndPlaceOfBirth.ProtoReflect.Descriptor instead. +func (*DateAndPlaceOfBirth) Descriptor() ([]byte, []int) { + return file_ivms101_ivms101_proto_rawDescGZIP(), []int{6} +} + +func (x *DateAndPlaceOfBirth) GetDateOfBirth() string { + if x != nil { + return x.DateOfBirth + } + return "" +} + +func (x *DateAndPlaceOfBirth) GetPlaceOfBirth() string { + if x != nil { + return x.PlaceOfBirth + } + return "" +} + +// Constraint: ValidNationalIdentifierLegalPerson +// A legal person must have a value for nationalIdentifierType of either ‘RAID’ or +// ‘MISC’ or ‘LEIX’ or ‘TXID’. +// Constraint: CompleteNationalIdentifierLegalPerson +// A LegalPerson must not have a value for countryOfIssue and must have a value for the +// element RegistrationAuthority if the value for nationalIdentifierType is not ‘LEIX’ +// Constraint: ValidLEI +// A LegalPerson with a nationalIdentifierType of ‘LEIX’ must have a value for the +// element nationalIdentifier that adheres to the convention as stated in datatype +// ‘LEIText’. +type NationalIdentification struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Definition: An identifier issued by an appropriate issuing authority. + // Constraint: ValidLEI + // Datatype: “Max35Text” + // Required + NationalIdentifier string `protobuf:"bytes,1,opt,name=national_identifier,json=nationalIdentifier,proto3" json:"national_identifier,omitempty"` + // Definition: Specifies the type of identifier specified. + // Required + NationalIdentifierType NationalIdentifierTypeCode `protobuf:"varint,2,opt,name=national_identifier_type,json=nationalIdentifierType,proto3,enum=ivms101.NationalIdentifierTypeCode" json:"national_identifier_type,omitempty"` + // Definition: Country of the issuing authority. + // Datatype: “CountryCode” + // Optional + CountryOfIssue string `protobuf:"bytes,3,opt,name=country_of_issue,json=countryOfIssue,proto3" json:"country_of_issue,omitempty"` + // Definition: A code specifying the registration authority. + // Constraint: The value used for the applicable element must be present on the + // GLEIF Registration Authorities List. + // Datatype: “RegistrationAuthority” + // Optional + RegistrationAuthority string `protobuf:"bytes,4,opt,name=registration_authority,json=registrationAuthority,proto3" json:"registration_authority,omitempty"` +} + +func (x *NationalIdentification) Reset() { + *x = NationalIdentification{} + if protoimpl.UnsafeEnabled { + mi := &file_ivms101_ivms101_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NationalIdentification) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NationalIdentification) ProtoMessage() {} + +func (x *NationalIdentification) ProtoReflect() protoreflect.Message { + mi := &file_ivms101_ivms101_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NationalIdentification.ProtoReflect.Descriptor instead. +func (*NationalIdentification) Descriptor() ([]byte, []int) { + return file_ivms101_ivms101_proto_rawDescGZIP(), []int{7} +} + +func (x *NationalIdentification) GetNationalIdentifier() string { + if x != nil { + return x.NationalIdentifier + } + return "" +} + +func (x *NationalIdentification) GetNationalIdentifierType() NationalIdentifierTypeCode { + if x != nil { + return x.NationalIdentifierType + } + return NationalIdentifierTypeCode_NATIONAL_IDENTIFIER_TYPE_CODE_ARNU +} + +func (x *NationalIdentification) GetCountryOfIssue() string { + if x != nil { + return x.CountryOfIssue + } + return "" +} + +func (x *NationalIdentification) GetRegistrationAuthority() string { + if x != nil { + return x.RegistrationAuthority + } + return "" +} + +// Definition: refers to any entity other than a natural person that can establish a +// permanent customer relationship with an affected entity or otherwise own property. +// This can include companies, bodies corporate, foundations, anstalt, partnerships, or +// associations and other relevantly similar entities. +// Constraint: OriginatorInformationLegalPerson +// If the originator is a LegalPerson either geographicAddress (with an addressType +// value of ‘GEOG’) and/or nationalIdentification and/or customerNumber is required. +type LegalPerson struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Definition: The name of the legal person. + // Constraint: LegalNamePresentLegalPerson + // At least one occurrence of legalPersonNameIdentifier must have the value ‘LEGL’ + // specified in the element legalPersonNameIdentifierType. + Name *LegalPersonName `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Definition: The address of the legal person. + // Zero or more + GeographicAddresses []*Address `protobuf:"bytes,2,rep,name=geographic_addresses,json=geographicAddresses,proto3" json:"geographic_addresses,omitempty"` + // Definition: The unique identification number applied by the VASP to customer. + // NOTE The specification has a descrepency in that 5.2.9.3.3 specifies an element + // name as "customerNumber", while the table in 5.2.9.1 calls that element + // "customerIdentification" + // Datatype: “Max50Text” + // Optional + CustomerNumber string `protobuf:"bytes,3,opt,name=customer_number,json=customerNumber,proto3" json:"customer_number,omitempty"` + // Definition: A distinct identifier used by governments of countries to uniquely + // identify a natural or legal person. + // Optional + NationalIdentification *NationalIdentification `protobuf:"bytes,4,opt,name=national_identification,json=nationalIdentification,proto3" json:"national_identification,omitempty"` + // Definition: The country in which the legal person is registered. + // Constraint: The value used for the field country must be present on the + // ISO-3166-1 alpha-2 codes or the value XX. + // Datatype: “CountryCode” + // Optional + CountryOfRegistration string `protobuf:"bytes,5,opt,name=country_of_registration,json=countryOfRegistration,proto3" json:"country_of_registration,omitempty"` +} + +func (x *LegalPerson) Reset() { + *x = LegalPerson{} + if protoimpl.UnsafeEnabled { + mi := &file_ivms101_ivms101_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LegalPerson) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LegalPerson) ProtoMessage() {} + +func (x *LegalPerson) ProtoReflect() protoreflect.Message { + mi := &file_ivms101_ivms101_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LegalPerson.ProtoReflect.Descriptor instead. +func (*LegalPerson) Descriptor() ([]byte, []int) { + return file_ivms101_ivms101_proto_rawDescGZIP(), []int{8} +} + +func (x *LegalPerson) GetName() *LegalPersonName { + if x != nil { + return x.Name + } + return nil +} + +func (x *LegalPerson) GetGeographicAddresses() []*Address { + if x != nil { + return x.GeographicAddresses + } + return nil +} + +func (x *LegalPerson) GetCustomerNumber() string { + if x != nil { + return x.CustomerNumber + } + return "" +} + +func (x *LegalPerson) GetNationalIdentification() *NationalIdentification { + if x != nil { + return x.NationalIdentification + } + return nil +} + +func (x *LegalPerson) GetCountryOfRegistration() string { + if x != nil { + return x.CountryOfRegistration + } + return "" +} + +type LegalPersonName struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Definition: The name and type of name by which the legal person is known. + // Constraint: LegalNamePresent + // At least one occurrence of legalPersonNameIdentifier must have the value + // ‘LEGL’ specified in the element legalPersonNameIdentifierType. + // One or more + NameIdentifiers []*LegalPersonNameId `protobuf:"bytes,1,rep,name=name_identifiers,json=nameIdentifiers,proto3" json:"name_identifiers,omitempty"` + // Definition: The name and type of name by which the legal person is known using + // local characters. + // Zero or more + LocalNameIdentifiers []*LocalLegalPersonNameId `protobuf:"bytes,2,rep,name=local_name_identifiers,json=localNameIdentifiers,proto3" json:"local_name_identifiers,omitempty"` + // Definition: The name and type of name by which the legal person is known using + // local characters. + // Zero or more + PhoneticNameIdentifiers []*LocalLegalPersonNameId `protobuf:"bytes,3,rep,name=phonetic_name_identifiers,json=phoneticNameIdentifiers,proto3" json:"phonetic_name_identifiers,omitempty"` +} + +func (x *LegalPersonName) Reset() { + *x = LegalPersonName{} + if protoimpl.UnsafeEnabled { + mi := &file_ivms101_ivms101_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LegalPersonName) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LegalPersonName) ProtoMessage() {} + +func (x *LegalPersonName) ProtoReflect() protoreflect.Message { + mi := &file_ivms101_ivms101_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LegalPersonName.ProtoReflect.Descriptor instead. +func (*LegalPersonName) Descriptor() ([]byte, []int) { + return file_ivms101_ivms101_proto_rawDescGZIP(), []int{9} +} + +func (x *LegalPersonName) GetNameIdentifiers() []*LegalPersonNameId { + if x != nil { + return x.NameIdentifiers + } + return nil +} + +func (x *LegalPersonName) GetLocalNameIdentifiers() []*LocalLegalPersonNameId { + if x != nil { + return x.LocalNameIdentifiers + } + return nil +} + +func (x *LegalPersonName) GetPhoneticNameIdentifiers() []*LocalLegalPersonNameId { + if x != nil { + return x.PhoneticNameIdentifiers + } + return nil +} + +type LegalPersonNameId struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Definition: Name by which the legal person is known. + // Datatype: “Max100Text” + // Required + LegalPersonName string `protobuf:"bytes,1,opt,name=legal_person_name,json=legalPersonName,proto3" json:"legal_person_name,omitempty"` + // Definition: The nature of the name specified. + // Required + LegalPersonNameIdentifierType LegalPersonNameTypeCode `protobuf:"varint,2,opt,name=legal_person_name_identifier_type,json=legalPersonNameIdentifierType,proto3,enum=ivms101.LegalPersonNameTypeCode" json:"legal_person_name_identifier_type,omitempty"` +} + +func (x *LegalPersonNameId) Reset() { + *x = LegalPersonNameId{} + if protoimpl.UnsafeEnabled { + mi := &file_ivms101_ivms101_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LegalPersonNameId) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LegalPersonNameId) ProtoMessage() {} + +func (x *LegalPersonNameId) ProtoReflect() protoreflect.Message { + mi := &file_ivms101_ivms101_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LegalPersonNameId.ProtoReflect.Descriptor instead. +func (*LegalPersonNameId) Descriptor() ([]byte, []int) { + return file_ivms101_ivms101_proto_rawDescGZIP(), []int{10} +} + +func (x *LegalPersonNameId) GetLegalPersonName() string { + if x != nil { + return x.LegalPersonName + } + return "" +} + +func (x *LegalPersonNameId) GetLegalPersonNameIdentifierType() LegalPersonNameTypeCode { + if x != nil { + return x.LegalPersonNameIdentifierType + } + return LegalPersonNameTypeCode_LEGAL_PERSON_NAME_TYPE_CODE_LEGL +} + +type LocalLegalPersonNameId struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Definition: Name by which the legal person is known. + // Datatype: "LocalMax100Text" + // Required + LegalPersonName string `protobuf:"bytes,1,opt,name=legal_person_name,json=legalPersonName,proto3" json:"legal_person_name,omitempty"` + // Definition: The nature of the name specified. + // Required + LegalPersonNameIdentifierType LegalPersonNameTypeCode `protobuf:"varint,2,opt,name=legal_person_name_identifier_type,json=legalPersonNameIdentifierType,proto3,enum=ivms101.LegalPersonNameTypeCode" json:"legal_person_name_identifier_type,omitempty"` +} + +func (x *LocalLegalPersonNameId) Reset() { + *x = LocalLegalPersonNameId{} + if protoimpl.UnsafeEnabled { + mi := &file_ivms101_ivms101_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LocalLegalPersonNameId) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LocalLegalPersonNameId) ProtoMessage() {} + +func (x *LocalLegalPersonNameId) ProtoReflect() protoreflect.Message { + mi := &file_ivms101_ivms101_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LocalLegalPersonNameId.ProtoReflect.Descriptor instead. +func (*LocalLegalPersonNameId) Descriptor() ([]byte, []int) { + return file_ivms101_ivms101_proto_rawDescGZIP(), []int{11} +} + +func (x *LocalLegalPersonNameId) GetLegalPersonName() string { + if x != nil { + return x.LegalPersonName + } + return "" +} + +func (x *LocalLegalPersonNameId) GetLegalPersonNameIdentifierType() LegalPersonNameTypeCode { + if x != nil { + return x.LegalPersonNameIdentifierType + } + return LegalPersonNameTypeCode_LEGAL_PERSON_NAME_TYPE_CODE_LEGL +} + +var File_ivms101_ivms101_proto protoreflect.FileDescriptor + +var file_ivms101_ivms101_proto_rawDesc = []byte{ + 0x0a, 0x15, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2f, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, + 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, + 0x1a, 0x12, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2f, 0x65, 0x6e, 0x75, 0x6d, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8e, 0x01, 0x0a, 0x06, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x12, + 0x3f, 0x0a, 0x0e, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x61, 0x6c, 0x5f, 0x70, 0x65, 0x72, 0x73, 0x6f, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, + 0x31, 0x2e, 0x4e, 0x61, 0x74, 0x75, 0x72, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x48, + 0x00, 0x52, 0x0d, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, + 0x12, 0x39, 0x0a, 0x0c, 0x6c, 0x65, 0x67, 0x61, 0x6c, 0x5f, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, + 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0b, + 0x6c, 0x65, 0x67, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x42, 0x08, 0x0a, 0x06, 0x70, + 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x22, 0x9d, 0x03, 0x0a, 0x0d, 0x4e, 0x61, 0x74, 0x75, 0x72, 0x61, + 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, + 0x4e, 0x61, 0x74, 0x75, 0x72, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, + 0x65, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x43, 0x0a, 0x14, 0x67, 0x65, 0x6f, 0x67, 0x72, + 0x61, 0x70, 0x68, 0x69, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x13, 0x67, 0x65, 0x6f, 0x67, 0x72, 0x61, 0x70, + 0x68, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x17, + 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, + 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, 0x4e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x16, + 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x37, 0x0a, 0x17, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, + 0x65, 0x72, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, + 0x72, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x52, 0x0a, 0x17, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x70, 0x6c, 0x61, 0x63, + 0x65, 0x5f, 0x6f, 0x66, 0x5f, 0x62, 0x69, 0x72, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1c, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, 0x44, 0x61, 0x74, 0x65, 0x41, + 0x6e, 0x64, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x4f, 0x66, 0x42, 0x69, 0x72, 0x74, 0x68, 0x52, 0x13, + 0x64, 0x61, 0x74, 0x65, 0x41, 0x6e, 0x64, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x4f, 0x66, 0x42, 0x69, + 0x72, 0x74, 0x68, 0x12, 0x30, 0x0a, 0x14, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x5f, 0x6f, + 0x66, 0x5f, 0x72, 0x65, 0x73, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x12, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x4f, 0x66, 0x52, 0x65, 0x73, 0x69, + 0x64, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x94, 0x02, 0x0a, 0x11, 0x4e, 0x61, 0x74, 0x75, 0x72, 0x61, + 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x47, 0x0a, 0x10, 0x6e, + 0x61, 0x6d, 0x65, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, + 0x4e, 0x61, 0x74, 0x75, 0x72, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, + 0x65, 0x49, 0x64, 0x52, 0x0f, 0x6e, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, + 0x69, 0x65, 0x72, 0x73, 0x12, 0x57, 0x0a, 0x16, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, 0x4c, + 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x61, 0x74, 0x75, 0x72, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, + 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x52, 0x14, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x61, + 0x6d, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, 0x12, 0x5d, 0x0a, + 0x19, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x74, 0x69, 0x63, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x69, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x21, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, + 0x4e, 0x61, 0x74, 0x75, 0x72, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, + 0x65, 0x49, 0x64, 0x52, 0x17, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x74, 0x69, 0x63, 0x4e, 0x61, 0x6d, + 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, 0x22, 0xcd, 0x01, 0x0a, + 0x13, 0x4e, 0x61, 0x74, 0x75, 0x72, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4e, 0x61, + 0x6d, 0x65, 0x49, 0x64, 0x12, 0x2d, 0x0a, 0x12, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x5f, + 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x11, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, + 0x69, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x14, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, + 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x13, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x49, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x54, 0x0a, 0x14, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x69, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x22, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, 0x4e, + 0x61, 0x74, 0x75, 0x72, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, + 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x12, 0x6e, 0x61, 0x6d, 0x65, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x22, 0xd2, 0x01, 0x0a, + 0x18, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, 0x61, 0x74, 0x75, 0x72, 0x61, 0x6c, 0x50, 0x65, 0x72, + 0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x12, 0x2d, 0x0a, 0x12, 0x70, 0x72, 0x69, + 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x14, 0x73, 0x65, 0x63, 0x6f, + 0x6e, 0x64, 0x61, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, + 0x79, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x54, 0x0a, 0x14, 0x6e, + 0x61, 0x6d, 0x65, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x22, 0x2e, 0x69, 0x76, 0x6d, 0x73, + 0x31, 0x30, 0x31, 0x2e, 0x4e, 0x61, 0x74, 0x75, 0x72, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, + 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x12, 0x6e, + 0x61, 0x6d, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x54, 0x79, 0x70, + 0x65, 0x22, 0xbd, 0x04, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x3b, 0x0a, + 0x0c, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x0b, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, + 0x70, 0x61, 0x72, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x75, + 0x62, 0x5f, 0x64, 0x65, 0x70, 0x61, 0x72, 0x74, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0d, 0x73, 0x75, 0x62, 0x44, 0x65, 0x70, 0x61, 0x72, 0x74, 0x6d, 0x65, 0x6e, + 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x72, 0x65, 0x65, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x74, 0x72, 0x65, 0x65, 0x74, 0x4e, 0x61, + 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x6e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x62, 0x75, 0x69, + 0x6c, 0x64, 0x69, 0x6e, 0x67, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x62, + 0x75, 0x69, 0x6c, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0c, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x69, 0x6e, 0x67, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x14, 0x0a, 0x05, 0x66, 0x6c, 0x6f, 0x6f, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x66, 0x6c, 0x6f, 0x6f, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x74, 0x5f, 0x62, + 0x6f, 0x78, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x6f, 0x73, 0x74, 0x42, 0x6f, + 0x78, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x6f, 0x73, 0x74, 0x5f, 0x63, 0x6f, + 0x64, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x74, 0x43, 0x6f, + 0x64, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x6f, 0x77, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x6f, 0x77, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x2c, 0x0a, 0x12, 0x74, 0x6f, 0x77, 0x6e, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x74, 0x6f, 0x77, + 0x6e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, + 0x0d, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0d, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x4e, 0x61, + 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x5f, 0x73, 0x75, + 0x62, 0x5f, 0x64, 0x69, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x12, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x53, 0x75, 0x62, 0x44, 0x69, 0x76, 0x69, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, + 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x4c, 0x69, 0x6e, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x72, 0x79, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, + 0x79, 0x22, 0x5f, 0x0a, 0x13, 0x44, 0x61, 0x74, 0x65, 0x41, 0x6e, 0x64, 0x50, 0x6c, 0x61, 0x63, + 0x65, 0x4f, 0x66, 0x42, 0x69, 0x72, 0x74, 0x68, 0x12, 0x22, 0x0a, 0x0d, 0x64, 0x61, 0x74, 0x65, + 0x5f, 0x6f, 0x66, 0x5f, 0x62, 0x69, 0x72, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x66, 0x42, 0x69, 0x72, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x0e, + 0x70, 0x6c, 0x61, 0x63, 0x65, 0x5f, 0x6f, 0x66, 0x5f, 0x62, 0x69, 0x72, 0x74, 0x68, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x4f, 0x66, 0x42, 0x69, 0x72, + 0x74, 0x68, 0x22, 0x89, 0x02, 0x0a, 0x16, 0x4e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x49, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2f, 0x0a, + 0x13, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x6e, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x61, 0x6c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x5d, + 0x0a, 0x18, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x23, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, 0x4e, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x61, 0x6c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x54, 0x79, 0x70, + 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x16, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x49, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x28, 0x0a, + 0x10, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x5f, 0x6f, 0x66, 0x5f, 0x69, 0x73, 0x73, 0x75, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, + 0x4f, 0x66, 0x49, 0x73, 0x73, 0x75, 0x65, 0x12, 0x35, 0x0a, 0x16, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, + 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0xbb, + 0x02, 0x0a, 0x0b, 0x4c, 0x65, 0x67, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x12, 0x2c, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x69, + 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, + 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x43, 0x0a, 0x14, + 0x67, 0x65, 0x6f, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x69, 0x76, 0x6d, + 0x73, 0x31, 0x30, 0x31, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x13, 0x67, 0x65, + 0x6f, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, + 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x5f, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x75, 0x73, 0x74, + 0x6f, 0x6d, 0x65, 0x72, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x58, 0x0a, 0x17, 0x6e, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x69, 0x76, + 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, 0x4e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x16, 0x6e, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x36, 0x0a, 0x17, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x5f, + 0x6f, 0x66, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x4f, 0x66, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x8c, 0x02, 0x0a, + 0x0f, 0x4c, 0x65, 0x67, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x45, 0x0a, 0x10, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, + 0x69, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x69, 0x76, 0x6d, + 0x73, 0x31, 0x30, 0x31, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, + 0x4e, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x52, 0x0f, 0x6e, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, 0x12, 0x55, 0x0a, 0x16, 0x6c, 0x6f, 0x63, 0x61, 0x6c, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, + 0x31, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4c, 0x65, 0x67, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, + 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x52, 0x14, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x4e, + 0x61, 0x6d, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, 0x12, 0x5b, + 0x0a, 0x19, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x74, 0x69, 0x63, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x5f, + 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1f, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, 0x4c, 0x6f, 0x63, 0x61, + 0x6c, 0x4c, 0x65, 0x67, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, + 0x49, 0x64, 0x52, 0x17, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x74, 0x69, 0x63, 0x4e, 0x61, 0x6d, 0x65, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, 0x22, 0xab, 0x01, 0x0a, 0x11, + 0x4c, 0x65, 0x67, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x49, + 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x6c, 0x65, 0x67, 0x61, 0x6c, 0x5f, 0x70, 0x65, 0x72, 0x73, 0x6f, + 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x65, + 0x67, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x6a, 0x0a, + 0x21, 0x6c, 0x65, 0x67, 0x61, 0x6c, 0x5f, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x5f, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, + 0x30, 0x31, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4e, 0x61, + 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x1d, 0x6c, 0x65, 0x67, 0x61, + 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x66, 0x69, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x22, 0xb0, 0x01, 0x0a, 0x16, 0x4c, 0x6f, + 0x63, 0x61, 0x6c, 0x4c, 0x65, 0x67, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4e, 0x61, + 0x6d, 0x65, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x6c, 0x65, 0x67, 0x61, 0x6c, 0x5f, 0x70, 0x65, + 0x72, 0x73, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0f, 0x6c, 0x65, 0x67, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x6a, 0x0a, 0x21, 0x6c, 0x65, 0x67, 0x61, 0x6c, 0x5f, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x69, 0x76, + 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, + 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x1d, 0x6c, + 0x65, 0x67, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x42, 0x2a, 0x5a, 0x28, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x72, 0x69, 0x73, 0x61, + 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2f, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2f, 0x70, 0x6b, 0x67, + 0x2f, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_ivms101_ivms101_proto_rawDescOnce sync.Once + file_ivms101_ivms101_proto_rawDescData = file_ivms101_ivms101_proto_rawDesc +) + +func file_ivms101_ivms101_proto_rawDescGZIP() []byte { + file_ivms101_ivms101_proto_rawDescOnce.Do(func() { + file_ivms101_ivms101_proto_rawDescData = protoimpl.X.CompressGZIP(file_ivms101_ivms101_proto_rawDescData) + }) + return file_ivms101_ivms101_proto_rawDescData +} + +var file_ivms101_ivms101_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_ivms101_ivms101_proto_goTypes = []interface{}{ + (*Person)(nil), // 0: ivms101.Person + (*NaturalPerson)(nil), // 1: ivms101.NaturalPerson + (*NaturalPersonName)(nil), // 2: ivms101.NaturalPersonName + (*NaturalPersonNameId)(nil), // 3: ivms101.NaturalPersonNameId + (*LocalNaturalPersonNameId)(nil), // 4: ivms101.LocalNaturalPersonNameId + (*Address)(nil), // 5: ivms101.Address + (*DateAndPlaceOfBirth)(nil), // 6: ivms101.DateAndPlaceOfBirth + (*NationalIdentification)(nil), // 7: ivms101.NationalIdentification + (*LegalPerson)(nil), // 8: ivms101.LegalPerson + (*LegalPersonName)(nil), // 9: ivms101.LegalPersonName + (*LegalPersonNameId)(nil), // 10: ivms101.LegalPersonNameId + (*LocalLegalPersonNameId)(nil), // 11: ivms101.LocalLegalPersonNameId + (NaturalPersonNameTypeCode)(0), // 12: ivms101.NaturalPersonNameTypeCode + (AddressTypeCode)(0), // 13: ivms101.AddressTypeCode + (NationalIdentifierTypeCode)(0), // 14: ivms101.NationalIdentifierTypeCode + (LegalPersonNameTypeCode)(0), // 15: ivms101.LegalPersonNameTypeCode +} +var file_ivms101_ivms101_proto_depIdxs = []int32{ + 1, // 0: ivms101.Person.natural_person:type_name -> ivms101.NaturalPerson + 8, // 1: ivms101.Person.legal_person:type_name -> ivms101.LegalPerson + 2, // 2: ivms101.NaturalPerson.name:type_name -> ivms101.NaturalPersonName + 5, // 3: ivms101.NaturalPerson.geographic_addresses:type_name -> ivms101.Address + 7, // 4: ivms101.NaturalPerson.national_identification:type_name -> ivms101.NationalIdentification + 6, // 5: ivms101.NaturalPerson.date_and_place_of_birth:type_name -> ivms101.DateAndPlaceOfBirth + 3, // 6: ivms101.NaturalPersonName.name_identifiers:type_name -> ivms101.NaturalPersonNameId + 4, // 7: ivms101.NaturalPersonName.local_name_identifiers:type_name -> ivms101.LocalNaturalPersonNameId + 4, // 8: ivms101.NaturalPersonName.phonetic_name_identifiers:type_name -> ivms101.LocalNaturalPersonNameId + 12, // 9: ivms101.NaturalPersonNameId.name_identifier_type:type_name -> ivms101.NaturalPersonNameTypeCode + 12, // 10: ivms101.LocalNaturalPersonNameId.name_identifier_type:type_name -> ivms101.NaturalPersonNameTypeCode + 13, // 11: ivms101.Address.address_type:type_name -> ivms101.AddressTypeCode + 14, // 12: ivms101.NationalIdentification.national_identifier_type:type_name -> ivms101.NationalIdentifierTypeCode + 9, // 13: ivms101.LegalPerson.name:type_name -> ivms101.LegalPersonName + 5, // 14: ivms101.LegalPerson.geographic_addresses:type_name -> ivms101.Address + 7, // 15: ivms101.LegalPerson.national_identification:type_name -> ivms101.NationalIdentification + 10, // 16: ivms101.LegalPersonName.name_identifiers:type_name -> ivms101.LegalPersonNameId + 11, // 17: ivms101.LegalPersonName.local_name_identifiers:type_name -> ivms101.LocalLegalPersonNameId + 11, // 18: ivms101.LegalPersonName.phonetic_name_identifiers:type_name -> ivms101.LocalLegalPersonNameId + 15, // 19: ivms101.LegalPersonNameId.legal_person_name_identifier_type:type_name -> ivms101.LegalPersonNameTypeCode + 15, // 20: ivms101.LocalLegalPersonNameId.legal_person_name_identifier_type:type_name -> ivms101.LegalPersonNameTypeCode + 21, // [21:21] is the sub-list for method output_type + 21, // [21:21] is the sub-list for method input_type + 21, // [21:21] is the sub-list for extension type_name + 21, // [21:21] is the sub-list for extension extendee + 0, // [0:21] is the sub-list for field type_name +} + +func init() { file_ivms101_ivms101_proto_init() } +func file_ivms101_ivms101_proto_init() { + if File_ivms101_ivms101_proto != nil { + return + } + file_ivms101_enum_proto_init() + if !protoimpl.UnsafeEnabled { + file_ivms101_ivms101_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Person); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ivms101_ivms101_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NaturalPerson); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ivms101_ivms101_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NaturalPersonName); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ivms101_ivms101_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NaturalPersonNameId); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ivms101_ivms101_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LocalNaturalPersonNameId); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ivms101_ivms101_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Address); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ivms101_ivms101_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DateAndPlaceOfBirth); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ivms101_ivms101_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NationalIdentification); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ivms101_ivms101_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LegalPerson); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ivms101_ivms101_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LegalPersonName); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ivms101_ivms101_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LegalPersonNameId); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ivms101_ivms101_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LocalLegalPersonNameId); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_ivms101_ivms101_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*Person_NaturalPerson)(nil), + (*Person_LegalPerson)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_ivms101_ivms101_proto_rawDesc, + NumEnums: 0, + NumMessages: 12, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_ivms101_ivms101_proto_goTypes, + DependencyIndexes: file_ivms101_ivms101_proto_depIdxs, + MessageInfos: file_ivms101_ivms101_proto_msgTypes, + }.Build() + File_ivms101_ivms101_proto = out.File + file_ivms101_ivms101_proto_rawDesc = nil + file_ivms101_ivms101_proto_goTypes = nil + file_ivms101_ivms101_proto_depIdxs = nil +} diff --git a/pkg/ivms101/ivms101_test.go b/pkg/ivms101/ivms101_test.go new file mode 100644 index 0000000..8536e5e --- /dev/null +++ b/pkg/ivms101/ivms101_test.go @@ -0,0 +1,40 @@ +package ivms101_test + +import ( + "encoding/json" + "io/ioutil" + "testing" + + "github.com/stretchr/testify/require" + "github.com/trisacrypto/trisa/pkg/ivms101" +) + +func TestLegalPerson(t *testing.T) { + data, err := ioutil.ReadFile("testdata/legalperson.json") + require.NoError(t, err) + + // Should be able to load a valid legal person from JSON data + var person *ivms101.LegalPerson + require.NoError(t, json.Unmarshal(data, &person)) + require.NoError(t, person.Validate()) + + // Should be able to convert a legal person into a generic Persion + gp := person.Person() + require.Nil(t, gp.GetNaturalPerson()) + require.Equal(t, person, gp.GetLegalPerson()) +} + +func TestNaturalPerson(t *testing.T) { + data, err := ioutil.ReadFile("testdata/naturalperson.json") + require.NoError(t, err) + + // Should be able to load a valid legal person from JSON data + var person *ivms101.NaturalPerson + require.NoError(t, json.Unmarshal(data, &person)) + require.NoError(t, person.Validate()) + + // Should be able to convert a legal person into a generic Persion + gp := person.Person() + require.Nil(t, gp.GetLegalPerson()) + require.Equal(t, person, gp.GetNaturalPerson()) +} diff --git a/pkg/ivms101/names.go b/pkg/ivms101/names.go new file mode 100644 index 0000000..ccbeb21 --- /dev/null +++ b/pkg/ivms101/names.go @@ -0,0 +1,60 @@ +package ivms101 + +import "strings" + +// Names returns a list of strings that collects all of the names from the NaturalPerson +// including name identifiers, local name identifiers, and phonetic name identifiers, +// in that order. The secondary and primary names are joined with a space such that the +// secondary name is first. No identifier codes or sorting are returned. +func (p *NaturalPerson) Names() []string { + if p.Name == nil { + return nil + } + + // Create the name array + nameCount := len(p.Name.NameIdentifiers) + len(p.Name.LocalNameIdentifiers) + len(p.Name.PhoneticNameIdentifiers) + names := make([]string, 0, nameCount) + + for _, nameID := range p.Name.NameIdentifiers { + name := strings.TrimSpace(nameID.SecondaryIdentifier + " " + nameID.PrimaryIdentifier) + names = append(names, name) + } + + for _, nameID := range p.Name.LocalNameIdentifiers { + name := strings.TrimSpace(nameID.SecondaryIdentifier + " " + nameID.PrimaryIdentifier) + names = append(names, name) + } + + for _, nameID := range p.Name.PhoneticNameIdentifiers { + name := strings.TrimSpace(nameID.SecondaryIdentifier + " " + nameID.PrimaryIdentifier) + names = append(names, name) + } + + return names +} + +// Names returns a list of strings that collects all of the names from the LegalPerson +// including name identifiers, local name identifiers, and phonetic name identifiers, +// in that order. No identifier codes or sorting are returned. +func (p *LegalPerson) Names() []string { + if p.Name == nil { + return nil + } + + nameCount := len(p.Name.NameIdentifiers) + len(p.Name.LocalNameIdentifiers) + len(p.Name.PhoneticNameIdentifiers) + names := make([]string, 0, nameCount) + + for _, nameID := range p.Name.NameIdentifiers { + names = append(names, nameID.LegalPersonName) + } + + for _, nameID := range p.Name.LocalNameIdentifiers { + names = append(names, nameID.LegalPersonName) + } + + for _, nameID := range p.Name.PhoneticNameIdentifiers { + names = append(names, nameID.LegalPersonName) + } + + return names +} diff --git a/pkg/ivms101/testdata/legalperson.json b/pkg/ivms101/testdata/legalperson.json new file mode 100644 index 0000000..ddb502c --- /dev/null +++ b/pkg/ivms101/testdata/legalperson.json @@ -0,0 +1,32 @@ +{ + "name": { + "name_identifiers": [ + { + "legal_person_name": "Bob's Discount VASP, PLC", + "legal_person_name_identifier_type": 0 + }, + { + "legal_person_name": "Bob VASP", + "legal_person_name_identifier_type": 1 + } + ] + }, + "geographic_addresses": [ + { + "address_type": 1, + "building_number": "762", + "street_name": "Grimsby Road", + "town_name": "Oxford", + "post_code": "OX8 U89", + "country": "GB" + } + ], + "customer_number": "", + "national_identification": { + "national_identifier": "213800AQUAUP6I215N33", + "national_identifier_type": 8, + "country_of_issue": "GB", + "registration_authority": "RA000589" + }, + "country_of_registration": "GB" +} \ No newline at end of file diff --git a/pkg/ivms101/testdata/naturalperson.json b/pkg/ivms101/testdata/naturalperson.json new file mode 100644 index 0000000..5fe76a6 --- /dev/null +++ b/pkg/ivms101/testdata/naturalperson.json @@ -0,0 +1,34 @@ +{ + "name": { + "name_identifiers": [ + { + "primary_identifier": "Sanders", + "secondary_identifier": "Alice", + "name_identifier_type": 3 + } + ] + }, + "geographic_addresses": [ + { + "address_type": 0, + "street_name": "Thorne Road", + "building_number": "78", + "post_code": "11801", + "town": "Hicksville", + "country_sub_division": "NY", + "country": "US" + } + ], + "national_identification": { + "national_identifier": "864 118 996", + "national_identifier_type": 3, + "country_of_issue": "US", + "registration_authority": "RA000628" + }, + "customer_identification": "", + "date_and_place_of_birth": { + "date_of_birth": "1975-02-18", + "place_of_birth": "Defiance, OH" + }, + "country_of_residence": "US" +} \ No newline at end of file diff --git a/pkg/trisa/api/v1beta1/api.pb.go b/pkg/trisa/api/v1beta1/api.pb.go new file mode 100644 index 0000000..50db5d1 --- /dev/null +++ b/pkg/trisa/api/v1beta1/api.pb.go @@ -0,0 +1,855 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.14.0 +// source: trisa/api/v1beta1/api.proto + +package api + +import ( + proto "github.com/golang/protobuf/proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type ServiceState_Status int32 + +const ( + ServiceState_UNKNOWN ServiceState_Status = 0 + ServiceState_HEALTHY ServiceState_Status = 1 + ServiceState_UNHEALTHY ServiceState_Status = 2 + ServiceState_DANGER ServiceState_Status = 3 + ServiceState_OFFLINE ServiceState_Status = 4 + ServiceState_MAINTENANCE ServiceState_Status = 5 +) + +// Enum value maps for ServiceState_Status. +var ( + ServiceState_Status_name = map[int32]string{ + 0: "UNKNOWN", + 1: "HEALTHY", + 2: "UNHEALTHY", + 3: "DANGER", + 4: "OFFLINE", + 5: "MAINTENANCE", + } + ServiceState_Status_value = map[string]int32{ + "UNKNOWN": 0, + "HEALTHY": 1, + "UNHEALTHY": 2, + "DANGER": 3, + "OFFLINE": 4, + "MAINTENANCE": 5, + } +) + +func (x ServiceState_Status) Enum() *ServiceState_Status { + p := new(ServiceState_Status) + *p = x + return p +} + +func (x ServiceState_Status) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ServiceState_Status) Descriptor() protoreflect.EnumDescriptor { + return file_trisa_api_v1beta1_api_proto_enumTypes[0].Descriptor() +} + +func (ServiceState_Status) Type() protoreflect.EnumType { + return &file_trisa_api_v1beta1_api_proto_enumTypes[0] +} + +func (x ServiceState_Status) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ServiceState_Status.Descriptor instead. +func (ServiceState_Status) EnumDescriptor() ([]byte, []int) { + return file_trisa_api_v1beta1_api_proto_rawDescGZIP(), []int{6, 0} +} + +// Encrypted transaction envelope that is the outer layer of the TRISA information +// exchange protocol and facilitates the secure storage of KYC data in a transaction. +// The envelope specifies a unique id to reference the transaction out-of-band (e.g in +// the blockchain layer) and provides the necessary information so that only the +// originator and the beneficiary can decrypt the trnasaction data. +type SecureEnvelope struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The transaction identifier generated by the sender. Any response + // to a transaction request needs to carry the same identifier. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Encrypted Payload + Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` + // Encryption key used to encrypt the transaction blob. This key itself + // is encrypted using the public key of the receiver. + EncryptionKey []byte `protobuf:"bytes,3,opt,name=encryption_key,json=encryptionKey,proto3" json:"encryption_key,omitempty"` + // The encryption algorithm used to encrypt the transaction blob. + EncryptionAlgorithm string `protobuf:"bytes,4,opt,name=encryption_algorithm,json=encryptionAlgorithm,proto3" json:"encryption_algorithm,omitempty"` + // HMAC signature calculated from encrypted transaction blob. + Hmac []byte `protobuf:"bytes,5,opt,name=hmac,proto3" json:"hmac,omitempty"` + // The HMAC secret used to calculate the HMAC signature. This secret + // itself is encrypted using the public key of the receiver. + HmacSecret []byte `protobuf:"bytes,6,opt,name=hmac_secret,json=hmacSecret,proto3" json:"hmac_secret,omitempty"` + // The algorithm used to calculate the HMAC signature. + HmacAlgorithm string `protobuf:"bytes,7,opt,name=hmac_algorithm,json=hmacAlgorithm,proto3" json:"hmac_algorithm,omitempty"` + // Rejection errors are used inside of a streaming context so that the stream is + // not closed when an exchange-related rejection occurs. In the unary case, errors + // are directly returned rather than as part of the secure envelope. + Error *Error `protobuf:"bytes,9,opt,name=error,proto3" json:"error,omitempty"` +} + +func (x *SecureEnvelope) Reset() { + *x = SecureEnvelope{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_api_v1beta1_api_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SecureEnvelope) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SecureEnvelope) ProtoMessage() {} + +func (x *SecureEnvelope) ProtoReflect() protoreflect.Message { + mi := &file_trisa_api_v1beta1_api_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SecureEnvelope.ProtoReflect.Descriptor instead. +func (*SecureEnvelope) Descriptor() ([]byte, []int) { + return file_trisa_api_v1beta1_api_proto_rawDescGZIP(), []int{0} +} + +func (x *SecureEnvelope) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *SecureEnvelope) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +func (x *SecureEnvelope) GetEncryptionKey() []byte { + if x != nil { + return x.EncryptionKey + } + return nil +} + +func (x *SecureEnvelope) GetEncryptionAlgorithm() string { + if x != nil { + return x.EncryptionAlgorithm + } + return "" +} + +func (x *SecureEnvelope) GetHmac() []byte { + if x != nil { + return x.Hmac + } + return nil +} + +func (x *SecureEnvelope) GetHmacSecret() []byte { + if x != nil { + return x.HmacSecret + } + return nil +} + +func (x *SecureEnvelope) GetHmacAlgorithm() string { + if x != nil { + return x.HmacAlgorithm + } + return "" +} + +func (x *SecureEnvelope) GetError() *Error { + if x != nil { + return x.Error + } + return nil +} + +// Payload is the expected message structure that will be parsed from the encrypted +// secure envelope. The Payload should contain the identity and transaction information +// for the information exchange. The internal message types are purposefully generic to +// allow flexibility with the data needs for different exchanges. +type Payload struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Identity contains any valid identity structure. The recommended format is the + // IVMS101 IdentityPayload which contains the originator and beneficiary identities, + // the originator and beneficiary VASP identities, as well as the transfer path of + // any intermediate VASPs. The identity payload can be bidirectional (containing + // both originator and beneficiary identities) or unidirectional - containing only + // the identity of the sender. In the bidirectional case, the identity may be + // purposefully partial to allow the recipient to fill in the details. In the + // unidirectional case, the identities must be collated after. + Identity *anypb.Any `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` + // Transaction contains network specific information about the exchange or transfer. + Transaction *anypb.Any `protobuf:"bytes,2,opt,name=transaction,proto3" json:"transaction,omitempty"` +} + +func (x *Payload) Reset() { + *x = Payload{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_api_v1beta1_api_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Payload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Payload) ProtoMessage() {} + +func (x *Payload) ProtoReflect() protoreflect.Message { + mi := &file_trisa_api_v1beta1_api_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Payload.ProtoReflect.Descriptor instead. +func (*Payload) Descriptor() ([]byte, []int) { + return file_trisa_api_v1beta1_api_proto_rawDescGZIP(), []int{1} +} + +func (x *Payload) GetIdentity() *anypb.Any { + if x != nil { + return x.Identity + } + return nil +} + +func (x *Payload) GetTransaction() *anypb.Any { + if x != nil { + return x.Transaction + } + return nil +} + +// TODO: specify the address confirmation protocol. +type Address struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *Address) Reset() { + *x = Address{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_api_v1beta1_api_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Address) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Address) ProtoMessage() {} + +func (x *Address) ProtoReflect() protoreflect.Message { + mi := &file_trisa_api_v1beta1_api_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Address.ProtoReflect.Descriptor instead. +func (*Address) Descriptor() ([]byte, []int) { + return file_trisa_api_v1beta1_api_proto_rawDescGZIP(), []int{2} +} + +type AddressConfirmation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *AddressConfirmation) Reset() { + *x = AddressConfirmation{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_api_v1beta1_api_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddressConfirmation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddressConfirmation) ProtoMessage() {} + +func (x *AddressConfirmation) ProtoReflect() protoreflect.Message { + mi := &file_trisa_api_v1beta1_api_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddressConfirmation.ProtoReflect.Descriptor instead. +func (*AddressConfirmation) Descriptor() ([]byte, []int) { + return file_trisa_api_v1beta1_api_proto_rawDescGZIP(), []int{3} +} + +// SigningKey provides metadata for decoding a PEM encoded PKIX public key for RSA +// encryption and transaction signing. The SigningKey is a lightweight version of the +// Certificate information stored in the Directory Service. +type SigningKey struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // x.509 metadata information for ease of reference without parsing the key. + Version int64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + SignatureAlgorithm string `protobuf:"bytes,3,opt,name=signature_algorithm,json=signatureAlgorithm,proto3" json:"signature_algorithm,omitempty"` + PublicKeyAlgorithm string `protobuf:"bytes,4,opt,name=public_key_algorithm,json=publicKeyAlgorithm,proto3" json:"public_key_algorithm,omitempty"` + // Validity information + NotBefore string `protobuf:"bytes,8,opt,name=not_before,json=notBefore,proto3" json:"not_before,omitempty"` + NotAfter string `protobuf:"bytes,9,opt,name=not_after,json=notAfter,proto3" json:"not_after,omitempty"` + Revoked bool `protobuf:"varint,10,opt,name=revoked,proto3" json:"revoked,omitempty"` + // The PEM encoded public key to PKIX, ASN.1 DER form without the trust chain. + Data []byte `protobuf:"bytes,11,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *SigningKey) Reset() { + *x = SigningKey{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_api_v1beta1_api_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SigningKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SigningKey) ProtoMessage() {} + +func (x *SigningKey) ProtoReflect() protoreflect.Message { + mi := &file_trisa_api_v1beta1_api_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SigningKey.ProtoReflect.Descriptor instead. +func (*SigningKey) Descriptor() ([]byte, []int) { + return file_trisa_api_v1beta1_api_proto_rawDescGZIP(), []int{4} +} + +func (x *SigningKey) GetVersion() int64 { + if x != nil { + return x.Version + } + return 0 +} + +func (x *SigningKey) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +func (x *SigningKey) GetSignatureAlgorithm() string { + if x != nil { + return x.SignatureAlgorithm + } + return "" +} + +func (x *SigningKey) GetPublicKeyAlgorithm() string { + if x != nil { + return x.PublicKeyAlgorithm + } + return "" +} + +func (x *SigningKey) GetNotBefore() string { + if x != nil { + return x.NotBefore + } + return "" +} + +func (x *SigningKey) GetNotAfter() string { + if x != nil { + return x.NotAfter + } + return "" +} + +func (x *SigningKey) GetRevoked() bool { + if x != nil { + return x.Revoked + } + return false +} + +func (x *SigningKey) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +type HealthCheck struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The number of failed health checks that proceeded the current check. + Attempts uint32 `protobuf:"varint,1,opt,name=attempts,proto3" json:"attempts,omitempty"` + // The timestamp of the last health check, successful or otherwise. + LastCheckedAt string `protobuf:"bytes,2,opt,name=last_checked_at,json=lastCheckedAt,proto3" json:"last_checked_at,omitempty"` +} + +func (x *HealthCheck) Reset() { + *x = HealthCheck{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_api_v1beta1_api_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HealthCheck) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HealthCheck) ProtoMessage() {} + +func (x *HealthCheck) ProtoReflect() protoreflect.Message { + mi := &file_trisa_api_v1beta1_api_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HealthCheck.ProtoReflect.Descriptor instead. +func (*HealthCheck) Descriptor() ([]byte, []int) { + return file_trisa_api_v1beta1_api_proto_rawDescGZIP(), []int{5} +} + +func (x *HealthCheck) GetAttempts() uint32 { + if x != nil { + return x.Attempts + } + return 0 +} + +func (x *HealthCheck) GetLastCheckedAt() string { + if x != nil { + return x.LastCheckedAt + } + return "" +} + +type ServiceState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Current service status as defined by the recieving system. The system is obliged + // to respond with the closest matching status in a best-effort fashion. Alerts will + // be triggered on service status changes if the system does not respond and the + // previous system state was not unknown. + Status ServiceState_Status `protobuf:"varint,1,opt,name=status,proto3,enum=trisa.api.v1beta1.ServiceState_Status" json:"status,omitempty"` + // Suggest to the directory service when to check the health status again. + NotBefore string `protobuf:"bytes,2,opt,name=not_before,json=notBefore,proto3" json:"not_before,omitempty"` + NotAfter string `protobuf:"bytes,3,opt,name=not_after,json=notAfter,proto3" json:"not_after,omitempty"` +} + +func (x *ServiceState) Reset() { + *x = ServiceState{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_api_v1beta1_api_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ServiceState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServiceState) ProtoMessage() {} + +func (x *ServiceState) ProtoReflect() protoreflect.Message { + mi := &file_trisa_api_v1beta1_api_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServiceState.ProtoReflect.Descriptor instead. +func (*ServiceState) Descriptor() ([]byte, []int) { + return file_trisa_api_v1beta1_api_proto_rawDescGZIP(), []int{6} +} + +func (x *ServiceState) GetStatus() ServiceState_Status { + if x != nil { + return x.Status + } + return ServiceState_UNKNOWN +} + +func (x *ServiceState) GetNotBefore() string { + if x != nil { + return x.NotBefore + } + return "" +} + +func (x *ServiceState) GetNotAfter() string { + if x != nil { + return x.NotAfter + } + return "" +} + +var File_trisa_api_v1beta1_api_proto protoreflect.FileDescriptor + +var file_trisa_api_v1beta1_api_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x11, 0x74, + 0x72, 0x69, 0x73, 0x61, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x74, 0x72, 0x69, + 0x73, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa0, 0x02, 0x0a, 0x0e, + 0x53, 0x65, 0x63, 0x75, 0x72, 0x65, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, + 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x6e, 0x63, 0x72, + 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x0d, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, + 0x31, 0x0a, 0x14, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x6c, + 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x65, + 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, + 0x68, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6d, 0x61, 0x63, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x04, 0x68, 0x6d, 0x61, 0x63, 0x12, 0x1f, 0x0a, 0x0b, 0x68, 0x6d, 0x61, 0x63, 0x5f, 0x73, + 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x68, 0x6d, 0x61, + 0x63, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x68, 0x6d, 0x61, 0x63, 0x5f, + 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0d, 0x68, 0x6d, 0x61, 0x63, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x2e, + 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x73, + 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x30, 0x0a, 0x08, 0x69, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, + 0x79, 0x52, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x36, 0x0a, 0x0b, 0x74, + 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x0b, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x22, 0x09, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x15, + 0x0a, 0x13, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x91, 0x02, 0x0a, 0x0a, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, + 0x67, 0x4b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1c, + 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x2f, 0x0a, 0x13, + 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, + 0x74, 0x68, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x30, 0x0a, + 0x14, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x61, 0x6c, 0x67, 0x6f, + 0x72, 0x69, 0x74, 0x68, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x70, 0x75, 0x62, + 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, + 0x1d, 0x0a, 0x0a, 0x6e, 0x6f, 0x74, 0x5f, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x6f, 0x74, 0x42, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x12, 0x1b, + 0x0a, 0x09, 0x6e, 0x6f, 0x74, 0x5f, 0x61, 0x66, 0x74, 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x6e, 0x6f, 0x74, 0x41, 0x66, 0x74, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x72, + 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, + 0x76, 0x6f, 0x6b, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x0b, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x51, 0x0a, 0x0b, 0x48, 0x65, 0x61, + 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x74, 0x74, 0x65, + 0x6d, 0x70, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x61, 0x74, 0x74, 0x65, + 0x6d, 0x70, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x63, 0x68, 0x65, + 0x63, 0x6b, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6c, + 0x61, 0x73, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x64, 0x41, 0x74, 0x22, 0xe7, 0x01, 0x0a, + 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3e, 0x0a, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, + 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1d, 0x0a, + 0x0a, 0x6e, 0x6f, 0x74, 0x5f, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x6e, 0x6f, 0x74, 0x42, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x12, 0x1b, 0x0a, 0x09, + 0x6e, 0x6f, 0x74, 0x5f, 0x61, 0x66, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x6e, 0x6f, 0x74, 0x41, 0x66, 0x74, 0x65, 0x72, 0x22, 0x5b, 0x0a, 0x06, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, + 0x12, 0x0b, 0x0a, 0x07, 0x48, 0x45, 0x41, 0x4c, 0x54, 0x48, 0x59, 0x10, 0x01, 0x12, 0x0d, 0x0a, + 0x09, 0x55, 0x4e, 0x48, 0x45, 0x41, 0x4c, 0x54, 0x48, 0x59, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, + 0x44, 0x41, 0x4e, 0x47, 0x45, 0x52, 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x4f, 0x46, 0x46, 0x4c, + 0x49, 0x4e, 0x45, 0x10, 0x04, 0x12, 0x0f, 0x0a, 0x0b, 0x4d, 0x41, 0x49, 0x4e, 0x54, 0x45, 0x4e, + 0x41, 0x4e, 0x43, 0x45, 0x10, 0x05, 0x32, 0xe7, 0x02, 0x0a, 0x0c, 0x54, 0x52, 0x49, 0x53, 0x41, + 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x52, 0x0a, 0x08, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x66, 0x65, 0x72, 0x12, 0x21, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x65, 0x45, 0x6e, + 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x1a, 0x21, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, + 0x65, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x22, 0x00, 0x12, 0x5c, 0x0a, 0x0e, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x21, 0x2e, + 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x65, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, + 0x1a, 0x21, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x65, 0x45, 0x6e, 0x76, 0x65, 0x6c, + 0x6f, 0x70, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x56, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x72, 0x6d, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x2e, 0x74, 0x72, + 0x69, 0x73, 0x61, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x1a, 0x26, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, + 0x00, 0x12, 0x4d, 0x0a, 0x0b, 0x4b, 0x65, 0x79, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, + 0x12, 0x1d, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x1a, + 0x1d, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x22, 0x00, + 0x32, 0x5a, 0x0a, 0x0b, 0x54, 0x52, 0x49, 0x53, 0x41, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x12, + 0x4b, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1e, 0x2e, 0x74, 0x72, 0x69, 0x73, + 0x61, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x48, 0x65, + 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x1a, 0x1f, 0x2e, 0x74, 0x72, 0x69, 0x73, + 0x61, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x00, 0x42, 0x38, 0x5a, 0x36, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x72, 0x69, 0x73, 0x61, + 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2f, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2f, 0x70, 0x6b, 0x67, + 0x2f, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_trisa_api_v1beta1_api_proto_rawDescOnce sync.Once + file_trisa_api_v1beta1_api_proto_rawDescData = file_trisa_api_v1beta1_api_proto_rawDesc +) + +func file_trisa_api_v1beta1_api_proto_rawDescGZIP() []byte { + file_trisa_api_v1beta1_api_proto_rawDescOnce.Do(func() { + file_trisa_api_v1beta1_api_proto_rawDescData = protoimpl.X.CompressGZIP(file_trisa_api_v1beta1_api_proto_rawDescData) + }) + return file_trisa_api_v1beta1_api_proto_rawDescData +} + +var file_trisa_api_v1beta1_api_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_trisa_api_v1beta1_api_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_trisa_api_v1beta1_api_proto_goTypes = []interface{}{ + (ServiceState_Status)(0), // 0: trisa.api.v1beta1.ServiceState.Status + (*SecureEnvelope)(nil), // 1: trisa.api.v1beta1.SecureEnvelope + (*Payload)(nil), // 2: trisa.api.v1beta1.Payload + (*Address)(nil), // 3: trisa.api.v1beta1.Address + (*AddressConfirmation)(nil), // 4: trisa.api.v1beta1.AddressConfirmation + (*SigningKey)(nil), // 5: trisa.api.v1beta1.SigningKey + (*HealthCheck)(nil), // 6: trisa.api.v1beta1.HealthCheck + (*ServiceState)(nil), // 7: trisa.api.v1beta1.ServiceState + (*Error)(nil), // 8: trisa.api.v1beta1.Error + (*anypb.Any)(nil), // 9: google.protobuf.Any +} +var file_trisa_api_v1beta1_api_proto_depIdxs = []int32{ + 8, // 0: trisa.api.v1beta1.SecureEnvelope.error:type_name -> trisa.api.v1beta1.Error + 9, // 1: trisa.api.v1beta1.Payload.identity:type_name -> google.protobuf.Any + 9, // 2: trisa.api.v1beta1.Payload.transaction:type_name -> google.protobuf.Any + 0, // 3: trisa.api.v1beta1.ServiceState.status:type_name -> trisa.api.v1beta1.ServiceState.Status + 1, // 4: trisa.api.v1beta1.TRISANetwork.Transfer:input_type -> trisa.api.v1beta1.SecureEnvelope + 1, // 5: trisa.api.v1beta1.TRISANetwork.TransferStream:input_type -> trisa.api.v1beta1.SecureEnvelope + 3, // 6: trisa.api.v1beta1.TRISANetwork.ConfirmAddress:input_type -> trisa.api.v1beta1.Address + 5, // 7: trisa.api.v1beta1.TRISANetwork.KeyExchange:input_type -> trisa.api.v1beta1.SigningKey + 6, // 8: trisa.api.v1beta1.TRISAHealth.Status:input_type -> trisa.api.v1beta1.HealthCheck + 1, // 9: trisa.api.v1beta1.TRISANetwork.Transfer:output_type -> trisa.api.v1beta1.SecureEnvelope + 1, // 10: trisa.api.v1beta1.TRISANetwork.TransferStream:output_type -> trisa.api.v1beta1.SecureEnvelope + 4, // 11: trisa.api.v1beta1.TRISANetwork.ConfirmAddress:output_type -> trisa.api.v1beta1.AddressConfirmation + 5, // 12: trisa.api.v1beta1.TRISANetwork.KeyExchange:output_type -> trisa.api.v1beta1.SigningKey + 7, // 13: trisa.api.v1beta1.TRISAHealth.Status:output_type -> trisa.api.v1beta1.ServiceState + 9, // [9:14] is the sub-list for method output_type + 4, // [4:9] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_trisa_api_v1beta1_api_proto_init() } +func file_trisa_api_v1beta1_api_proto_init() { + if File_trisa_api_v1beta1_api_proto != nil { + return + } + file_trisa_api_v1beta1_errors_proto_init() + if !protoimpl.UnsafeEnabled { + file_trisa_api_v1beta1_api_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SecureEnvelope); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trisa_api_v1beta1_api_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Payload); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trisa_api_v1beta1_api_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Address); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trisa_api_v1beta1_api_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddressConfirmation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trisa_api_v1beta1_api_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SigningKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trisa_api_v1beta1_api_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HealthCheck); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trisa_api_v1beta1_api_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ServiceState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_trisa_api_v1beta1_api_proto_rawDesc, + NumEnums: 1, + NumMessages: 7, + NumExtensions: 0, + NumServices: 2, + }, + GoTypes: file_trisa_api_v1beta1_api_proto_goTypes, + DependencyIndexes: file_trisa_api_v1beta1_api_proto_depIdxs, + EnumInfos: file_trisa_api_v1beta1_api_proto_enumTypes, + MessageInfos: file_trisa_api_v1beta1_api_proto_msgTypes, + }.Build() + File_trisa_api_v1beta1_api_proto = out.File + file_trisa_api_v1beta1_api_proto_rawDesc = nil + file_trisa_api_v1beta1_api_proto_goTypes = nil + file_trisa_api_v1beta1_api_proto_depIdxs = nil +} diff --git a/pkg/trisa/api/v1beta1/api_grpc.pb.go b/pkg/trisa/api/v1beta1/api_grpc.pb.go new file mode 100644 index 0000000..72dd346 --- /dev/null +++ b/pkg/trisa/api/v1beta1/api_grpc.pb.go @@ -0,0 +1,351 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package api + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion7 + +// TRISANetworkClient is the client API for TRISANetwork service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type TRISANetworkClient interface { + // To conduct an information exchange prior to a virtual asset transaction, an + // originating VASP will send an encrypted transaction envelope to the beneficiary + // VASP containing a unique ID for the transaction, the encrypted transaction bundle, + // and metadata associated with the transaction cipher. In response, the beneficiary + // will validate the transaction request, then return the beneficiary's transaction + // information using the same unique transaction ID. The TRISANetwork provides both + // a unary RPC for simple, single transactions and a transaction stream for high + // throughput transaction workloads. + Transfer(ctx context.Context, in *SecureEnvelope, opts ...grpc.CallOption) (*SecureEnvelope, error) + TransferStream(ctx context.Context, opts ...grpc.CallOption) (TRISANetwork_TransferStreamClient, error) + // Address confirmation allows an originator VASP to establish that a beneficiary + // VASP has control of a crypto wallet address, prior to sending transaction + // information with sensitive PII data. + ConfirmAddress(ctx context.Context, in *Address, opts ...grpc.CallOption) (*AddressConfirmation, error) + // The encrypted transaction envelope uses asymmetric (public/private) encryption to + // exchange a symmetric key and signature for the transaction blob. To facilitate + // transaction signatures, VASPs must be able to exchange public signing keys if + // they have not already obtained them from the directory service. + KeyExchange(ctx context.Context, in *SigningKey, opts ...grpc.CallOption) (*SigningKey, error) +} + +type tRISANetworkClient struct { + cc grpc.ClientConnInterface +} + +func NewTRISANetworkClient(cc grpc.ClientConnInterface) TRISANetworkClient { + return &tRISANetworkClient{cc} +} + +func (c *tRISANetworkClient) Transfer(ctx context.Context, in *SecureEnvelope, opts ...grpc.CallOption) (*SecureEnvelope, error) { + out := new(SecureEnvelope) + err := c.cc.Invoke(ctx, "/trisa.api.v1beta1.TRISANetwork/Transfer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tRISANetworkClient) TransferStream(ctx context.Context, opts ...grpc.CallOption) (TRISANetwork_TransferStreamClient, error) { + stream, err := c.cc.NewStream(ctx, &_TRISANetwork_serviceDesc.Streams[0], "/trisa.api.v1beta1.TRISANetwork/TransferStream", opts...) + if err != nil { + return nil, err + } + x := &tRISANetworkTransferStreamClient{stream} + return x, nil +} + +type TRISANetwork_TransferStreamClient interface { + Send(*SecureEnvelope) error + Recv() (*SecureEnvelope, error) + grpc.ClientStream +} + +type tRISANetworkTransferStreamClient struct { + grpc.ClientStream +} + +func (x *tRISANetworkTransferStreamClient) Send(m *SecureEnvelope) error { + return x.ClientStream.SendMsg(m) +} + +func (x *tRISANetworkTransferStreamClient) Recv() (*SecureEnvelope, error) { + m := new(SecureEnvelope) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *tRISANetworkClient) ConfirmAddress(ctx context.Context, in *Address, opts ...grpc.CallOption) (*AddressConfirmation, error) { + out := new(AddressConfirmation) + err := c.cc.Invoke(ctx, "/trisa.api.v1beta1.TRISANetwork/ConfirmAddress", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tRISANetworkClient) KeyExchange(ctx context.Context, in *SigningKey, opts ...grpc.CallOption) (*SigningKey, error) { + out := new(SigningKey) + err := c.cc.Invoke(ctx, "/trisa.api.v1beta1.TRISANetwork/KeyExchange", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// TRISANetworkServer is the server API for TRISANetwork service. +// All implementations must embed UnimplementedTRISANetworkServer +// for forward compatibility +type TRISANetworkServer interface { + // To conduct an information exchange prior to a virtual asset transaction, an + // originating VASP will send an encrypted transaction envelope to the beneficiary + // VASP containing a unique ID for the transaction, the encrypted transaction bundle, + // and metadata associated with the transaction cipher. In response, the beneficiary + // will validate the transaction request, then return the beneficiary's transaction + // information using the same unique transaction ID. The TRISANetwork provides both + // a unary RPC for simple, single transactions and a transaction stream for high + // throughput transaction workloads. + Transfer(context.Context, *SecureEnvelope) (*SecureEnvelope, error) + TransferStream(TRISANetwork_TransferStreamServer) error + // Address confirmation allows an originator VASP to establish that a beneficiary + // VASP has control of a crypto wallet address, prior to sending transaction + // information with sensitive PII data. + ConfirmAddress(context.Context, *Address) (*AddressConfirmation, error) + // The encrypted transaction envelope uses asymmetric (public/private) encryption to + // exchange a symmetric key and signature for the transaction blob. To facilitate + // transaction signatures, VASPs must be able to exchange public signing keys if + // they have not already obtained them from the directory service. + KeyExchange(context.Context, *SigningKey) (*SigningKey, error) + mustEmbedUnimplementedTRISANetworkServer() +} + +// UnimplementedTRISANetworkServer must be embedded to have forward compatible implementations. +type UnimplementedTRISANetworkServer struct { +} + +func (UnimplementedTRISANetworkServer) Transfer(context.Context, *SecureEnvelope) (*SecureEnvelope, error) { + return nil, status.Errorf(codes.Unimplemented, "method Transfer not implemented") +} +func (UnimplementedTRISANetworkServer) TransferStream(TRISANetwork_TransferStreamServer) error { + return status.Errorf(codes.Unimplemented, "method TransferStream not implemented") +} +func (UnimplementedTRISANetworkServer) ConfirmAddress(context.Context, *Address) (*AddressConfirmation, error) { + return nil, status.Errorf(codes.Unimplemented, "method ConfirmAddress not implemented") +} +func (UnimplementedTRISANetworkServer) KeyExchange(context.Context, *SigningKey) (*SigningKey, error) { + return nil, status.Errorf(codes.Unimplemented, "method KeyExchange not implemented") +} +func (UnimplementedTRISANetworkServer) mustEmbedUnimplementedTRISANetworkServer() {} + +// UnsafeTRISANetworkServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to TRISANetworkServer will +// result in compilation errors. +type UnsafeTRISANetworkServer interface { + mustEmbedUnimplementedTRISANetworkServer() +} + +func RegisterTRISANetworkServer(s grpc.ServiceRegistrar, srv TRISANetworkServer) { + s.RegisterService(&_TRISANetwork_serviceDesc, srv) +} + +func _TRISANetwork_Transfer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SecureEnvelope) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TRISANetworkServer).Transfer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/trisa.api.v1beta1.TRISANetwork/Transfer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TRISANetworkServer).Transfer(ctx, req.(*SecureEnvelope)) + } + return interceptor(ctx, in, info, handler) +} + +func _TRISANetwork_TransferStream_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(TRISANetworkServer).TransferStream(&tRISANetworkTransferStreamServer{stream}) +} + +type TRISANetwork_TransferStreamServer interface { + Send(*SecureEnvelope) error + Recv() (*SecureEnvelope, error) + grpc.ServerStream +} + +type tRISANetworkTransferStreamServer struct { + grpc.ServerStream +} + +func (x *tRISANetworkTransferStreamServer) Send(m *SecureEnvelope) error { + return x.ServerStream.SendMsg(m) +} + +func (x *tRISANetworkTransferStreamServer) Recv() (*SecureEnvelope, error) { + m := new(SecureEnvelope) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _TRISANetwork_ConfirmAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Address) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TRISANetworkServer).ConfirmAddress(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/trisa.api.v1beta1.TRISANetwork/ConfirmAddress", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TRISANetworkServer).ConfirmAddress(ctx, req.(*Address)) + } + return interceptor(ctx, in, info, handler) +} + +func _TRISANetwork_KeyExchange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SigningKey) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TRISANetworkServer).KeyExchange(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/trisa.api.v1beta1.TRISANetwork/KeyExchange", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TRISANetworkServer).KeyExchange(ctx, req.(*SigningKey)) + } + return interceptor(ctx, in, info, handler) +} + +var _TRISANetwork_serviceDesc = grpc.ServiceDesc{ + ServiceName: "trisa.api.v1beta1.TRISANetwork", + HandlerType: (*TRISANetworkServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Transfer", + Handler: _TRISANetwork_Transfer_Handler, + }, + { + MethodName: "ConfirmAddress", + Handler: _TRISANetwork_ConfirmAddress_Handler, + }, + { + MethodName: "KeyExchange", + Handler: _TRISANetwork_KeyExchange_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "TransferStream", + Handler: _TRISANetwork_TransferStream_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "trisa/api/v1beta1/api.proto", +} + +// TRISAHealthClient is the client API for TRISAHealth service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type TRISAHealthClient interface { + Status(ctx context.Context, in *HealthCheck, opts ...grpc.CallOption) (*ServiceState, error) +} + +type tRISAHealthClient struct { + cc grpc.ClientConnInterface +} + +func NewTRISAHealthClient(cc grpc.ClientConnInterface) TRISAHealthClient { + return &tRISAHealthClient{cc} +} + +func (c *tRISAHealthClient) Status(ctx context.Context, in *HealthCheck, opts ...grpc.CallOption) (*ServiceState, error) { + out := new(ServiceState) + err := c.cc.Invoke(ctx, "/trisa.api.v1beta1.TRISAHealth/Status", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// TRISAHealthServer is the server API for TRISAHealth service. +// All implementations must embed UnimplementedTRISAHealthServer +// for forward compatibility +type TRISAHealthServer interface { + Status(context.Context, *HealthCheck) (*ServiceState, error) + mustEmbedUnimplementedTRISAHealthServer() +} + +// UnimplementedTRISAHealthServer must be embedded to have forward compatible implementations. +type UnimplementedTRISAHealthServer struct { +} + +func (UnimplementedTRISAHealthServer) Status(context.Context, *HealthCheck) (*ServiceState, error) { + return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") +} +func (UnimplementedTRISAHealthServer) mustEmbedUnimplementedTRISAHealthServer() {} + +// UnsafeTRISAHealthServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to TRISAHealthServer will +// result in compilation errors. +type UnsafeTRISAHealthServer interface { + mustEmbedUnimplementedTRISAHealthServer() +} + +func RegisterTRISAHealthServer(s grpc.ServiceRegistrar, srv TRISAHealthServer) { + s.RegisterService(&_TRISAHealth_serviceDesc, srv) +} + +func _TRISAHealth_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HealthCheck) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TRISAHealthServer).Status(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/trisa.api.v1beta1.TRISAHealth/Status", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TRISAHealthServer).Status(ctx, req.(*HealthCheck)) + } + return interceptor(ctx, in, info, handler) +} + +var _TRISAHealth_serviceDesc = grpc.ServiceDesc{ + ServiceName: "trisa.api.v1beta1.TRISAHealth", + HandlerType: (*TRISAHealthServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Status", + Handler: _TRISAHealth_Status_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "trisa/api/v1beta1/api.proto", +} diff --git a/pkg/trisa/api/v1beta1/errors.go b/pkg/trisa/api/v1beta1/errors.go new file mode 100644 index 0000000..20aec1f --- /dev/null +++ b/pkg/trisa/api/v1beta1/errors.go @@ -0,0 +1,155 @@ +package api + +import ( + "fmt" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + anypb "google.golang.org/protobuf/types/known/anypb" +) + +// TRISA error code constants. See protocol buffers documentation for more details. +const ( + Unhandled = Error_UNHANDLED + Unavailable = Error_UNAVAILABLE + ServiceDownTime = Error_SERVICE_DOWN_TIME + Maintenance = Error_MAINTENANCE + Unimplemented = Error_UNIMPLEMENTED + InternalError = Error_INTERNAL_ERROR + Rejected = Error_REJECTED + UnkownWalletAddress = Error_UNKNOWN_WALLET_ADDRESS + UnknownIdentity = Error_UNKOWN_IDENTITY + UnkownOriginator = Error_UNKNOWN_ORIGINATOR + UnkownBeneficiary = Error_UNKOWN_BENEFICIARY + BeneficiaryNameUnmatched = Error_BENEFICIARY_NAME_UNMATCHED + UnsupportedCurrency = Error_UNSUPPORTED_CURRENCY + ExceededTradingVolume = Error_EXCEEDED_TRADING_VOLUME + ComplianceCheckFail = Error_COMPLIANCE_CHECK_FAIL + NoCompliance = Error_NO_COMPLIANCE + HighRisk = Error_HIGH_RISK + OutOfNetwork = Error_OUT_OF_NETWORK + Forbidden = Error_FORBIDDEN + NoSigningKey = Error_NO_SIGNING_KEY + CertificateRevoked = Error_CERTIFICATE_REVOKED + Unverified = Error_UNVERIFIED + Untrusted = Error_UNTRUSTED + InvalidSignature = Error_INVALID_SIGNATURE + InvalidKey = Error_INVALID_KEY + EnvelopeDecodeFail = Error_ENVELOPE_DECODE_FAIL + PrivateInfoDecodeFail = Error_PRIVATE_INFO_DECODE_FAIL + UnhandledAlgorithm = Error_UNHANDLED_ALGORITHM + BadRequest = Error_BAD_REQUEST + UnparseableIdentity = Error_UNPARSEABLE_IDENTITY + PrivateInfoWrongFormat = Error_PRIVATE_INFO_WRONG_FORMAT + UnparseableTransaction = Error_UNPARSEABLE_TRANSACTION + MissingFields = Error_MISSING_FIELDS + IncompleteIdentity = Error_INCOMPLETE_IDENTITY + ValidationError = Error_VALIDATION_ERROR +) + +// Sygna BVRC rejected error codes +const ( + BVRC001 = Error_BVRC001 + BVRC002 = Error_BVRC002 + BVRC003 = Error_BVRC003 + BVRC004 = Error_BVRC004 + BVRC005 = Error_BVRC005 + BVRC006 = Error_BVRC006 + BVRC007 = Error_BVRC007 + BVRC999 = Error_BVRC999 +) + +// Errorp parses an error from a status error (e.g. the error is embedded in the details) +// or if the error is already the correct type return that directly. If the error cannot +// be parsed, an *Error is returned with the Unhandled error code and the message of the +// original error; in this case, ok will be false. +func Errorp(err error) (e *Error, ok bool) { + if err == nil { + return nil, true + } + + if e, ok = err.(*Error); ok { + return e, ok + } + + // TODO: DANGER! This doesn't work for some reason, the tests just hang? + // var s *status.Status + // if s, ok = status.FromError(err); ok { + // es := s.Details() + // if len(es) == 1 { + // if e, ok = es[0].(*Error); ok { + // return e, ok + // } + // } + // } + + return &Error{Code: Unhandled, Message: err.Error()}, false +} + +// Errorf creates a new Error message formated with the specified arguments. If the +// error code indicates the error should be retried it sets retry to true. +func Errorf(code Error_Code, format string, a ...interface{}) *Error { + if len(a) == 0 { + return &Error{Code: code, Message: format} + } + + return &Error{ + Code: code, + Message: fmt.Sprintf(format, a...), + Retry: code >= 150, + } +} + +// WithRetry returns a new error with the retry flag set to true. +func (e *Error) WithRetry() *Error { + return &Error{ + Code: e.Code, + Message: e.Message, + Retry: true, + } +} + +// WithDetails returns the new error with the details as a pb.Any struct. +func (e *Error) WithDetails(details proto.Message) (_ *Error, err error) { + var any *anypb.Any + if any, err = ptypes.MarshalAny(details); err != nil { + return nil, err + } + return &Error{ + Code: e.Code, + Message: e.Message, + Retry: e.Retry, + Details: any, + }, nil +} + +// Error implements the error interface for printing and logging. +func (e *Error) Error() string { + return fmt.Sprintf("trisa error [%s]: %s", e.Code, e.Message) +} + +// Err returns a gRPC status error with appropriate gRPC status codes for returning +// out of a gRPC server function. This should be returned where possible. +func (e *Error) Err() (err error) { + var code codes.Code + switch { + case e.Code < 49: + code = codes.Unavailable + case e.Code == 49: + code = codes.Internal + case e.Code > 49 && e.Code < 100: + code = codes.Aborted + case e.Code >= 100 && e.Code < 105: + code = codes.FailedPrecondition + case e.Code > 105: + code = codes.InvalidArgument + } + + st := status.New(code, fmt.Sprintf("[%s] %s", e.Code, e.Message)) + if st, err = st.WithDetails(e); err != nil { + panic(fmt.Sprintf("error attaching status metadata: %v", err)) + } + return st.Err() +} diff --git a/pkg/trisa/api/v1beta1/errors.pb.go b/pkg/trisa/api/v1beta1/errors.pb.go new file mode 100644 index 0000000..a8b0918 --- /dev/null +++ b/pkg/trisa/api/v1beta1/errors.pb.go @@ -0,0 +1,463 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.14.0 +// source: trisa/api/v1beta1/errors.proto + +package api + +import ( + proto "github.com/golang/protobuf/proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type Error_Code int32 + +const ( + // Errors 0-49 are reserved for service-specific errors + // Default error - something very bad happened. + Error_UNHANDLED Error_Code = 0 + // Generic error - could not handle request, retry later. + Error_UNAVAILABLE Error_Code = 1 + Error_SERVICE_DOWN_TIME Error_Code = 1 // Alias: Sygna BVRC Rejected Type + Error_BVRC002 Error_Code = 1 // Alias: Sygna BVRC Rejected Code + // The service is currently in maintenance mode and cannot respond. + Error_MAINTENANCE Error_Code = 2 + // The RPC is not currently implemented by the TRISA node. + Error_UNIMPLEMENTED Error_Code = 3 + // Request could not be processed by recipient. + Error_INTERNAL_ERROR Error_Code = 49 + Error_BVRC999 Error_Code = 49 // Alias: Sygna BVRC Rejected Code + // Errors 50-99 are reserved for transaction rejections. + // Default rejection - no specified reason for rejecting the transaction. + Error_REJECTED Error_Code = 50 + // VASP does not control the specified wallet address. + Error_UNKNOWN_WALLET_ADDRESS Error_Code = 51 + // VASP does not have KYC information for the specified wallet address. + Error_UNKOWN_IDENTITY Error_Code = 52 + // Specifically, the Originator account cannot be identified. + Error_UNKNOWN_ORIGINATOR Error_Code = 53 + // Specifically, the Beneficiary account cannot be identified. + Error_UNKOWN_BENEFICIARY Error_Code = 54 + Error_BENEFICIARY_NAME_UNMATCHED Error_Code = 54 // Alias: Sygna BVRC Rejected Type + Error_BVRC007 Error_Code = 54 // Alias: Sygna BVRC Rejected Code + // VASP cannot support the fiat currency or coin described in the transaction. + Error_UNSUPPORTED_CURRENCY Error_Code = 60 + Error_BVRC001 Error_Code = 60 // Alias: Sygna BVRC Rejected Code + // No longer able to receive more transaction inflows + Error_EXCEEDED_TRADING_VOLUME Error_Code = 61 + Error_BVRC003 Error_Code = 61 // Alias: Sygna BVRC Rejected Code + // An internal compliance check has failed or black listing has occurred + Error_COMPLIANCE_CHECK_FAIL Error_Code = 90 + Error_BVRC004 Error_Code = 90 // Alias: Sygna BVRC Rejected Code + // VASP not able to implement travel rule compliance. + Error_NO_COMPLIANCE Error_Code = 91 + // VASP unwilling to conduct the transaction because of a risk assessment. + Error_HIGH_RISK Error_Code = 92 + // Wallet address or transaction is not available on this network. + Error_OUT_OF_NETWORK Error_Code = 99 + // Errors 100-149 are reserved for authentication or cryptography failures. + // Default access denied - no specified reason for forbidding the transaction. + Error_FORBIDDEN Error_Code = 100 + // Could not sign transaction because no signing key is available. + Error_NO_SIGNING_KEY Error_Code = 101 + // Could not sign transaction because keys have been revoked. + Error_CERTIFICATE_REVOKED Error_Code = 102 + // Could not verify certificates with any certificate authority. + Error_UNVERIFIED Error_Code = 103 + // A trusted connection could not be established. + Error_UNTRUSTED Error_Code = 104 + // An HMAC signature could not be verified + Error_INVALID_SIGNATURE Error_Code = 105 + // The transaction bundle cannot be decrypted with the specified key + Error_INVALID_KEY Error_Code = 106 + // Could not decode or decrypt private transaction data + Error_ENVELOPE_DECODE_FAIL Error_Code = 107 + Error_PRIVATE_INFO_DECODE_FAIL Error_Code = 107 // Alias: Sygna BVRC Rejected Type + Error_BVRC005 Error_Code = 107 // Alias: Sygna BVRC Rejected Code + // The algorithm specified by the encryption or signature is not implemented + Error_UNHANDLED_ALGORITHM Error_Code = 108 + // Errors 150-199 are reserved for repairing exchange information. + // Generic bad request - usually implies retry when reuqest is fixed. + Error_BAD_REQUEST Error_Code = 150 + // Could not parse the identity record; specify the type in extra + Error_UNPARSEABLE_IDENTITY Error_Code = 151 + Error_PRIVATE_INFO_WRONG_FORMAT Error_Code = 151 // Alias: Sygna BVRC Rejected Type + Error_BVRC006 Error_Code = 151 // Alias: Sygna BVRC Rejected Code + // Could not parse the transaction data record; specify the type in extra + Error_UNPARSEABLE_TRANSACTION Error_Code = 152 + // There are missing required fields in the transaction data, a list of these + // fields is specified in extra. + Error_MISSING_FIELDS Error_Code = 153 + // The identity record is not complete enough for compliance purposes of the + // receiving VASPs. Required fields or format specified in extra. + Error_INCOMPLETE_IDENTITY Error_Code = 154 + // There was an error validating a field in the transaction data (specified in extra) + Error_VALIDATION_ERROR Error_Code = 155 +) + +// Enum value maps for Error_Code. +var ( + Error_Code_name = map[int32]string{ + 0: "UNHANDLED", + 1: "UNAVAILABLE", + // Duplicate value: 1: "SERVICE_DOWN_TIME", + // Duplicate value: 1: "BVRC002", + 2: "MAINTENANCE", + 3: "UNIMPLEMENTED", + 49: "INTERNAL_ERROR", + // Duplicate value: 49: "BVRC999", + 50: "REJECTED", + 51: "UNKNOWN_WALLET_ADDRESS", + 52: "UNKOWN_IDENTITY", + 53: "UNKNOWN_ORIGINATOR", + 54: "UNKOWN_BENEFICIARY", + // Duplicate value: 54: "BENEFICIARY_NAME_UNMATCHED", + // Duplicate value: 54: "BVRC007", + 60: "UNSUPPORTED_CURRENCY", + // Duplicate value: 60: "BVRC001", + 61: "EXCEEDED_TRADING_VOLUME", + // Duplicate value: 61: "BVRC003", + 90: "COMPLIANCE_CHECK_FAIL", + // Duplicate value: 90: "BVRC004", + 91: "NO_COMPLIANCE", + 92: "HIGH_RISK", + 99: "OUT_OF_NETWORK", + 100: "FORBIDDEN", + 101: "NO_SIGNING_KEY", + 102: "CERTIFICATE_REVOKED", + 103: "UNVERIFIED", + 104: "UNTRUSTED", + 105: "INVALID_SIGNATURE", + 106: "INVALID_KEY", + 107: "ENVELOPE_DECODE_FAIL", + // Duplicate value: 107: "PRIVATE_INFO_DECODE_FAIL", + // Duplicate value: 107: "BVRC005", + 108: "UNHANDLED_ALGORITHM", + 150: "BAD_REQUEST", + 151: "UNPARSEABLE_IDENTITY", + // Duplicate value: 151: "PRIVATE_INFO_WRONG_FORMAT", + // Duplicate value: 151: "BVRC006", + 152: "UNPARSEABLE_TRANSACTION", + 153: "MISSING_FIELDS", + 154: "INCOMPLETE_IDENTITY", + 155: "VALIDATION_ERROR", + } + Error_Code_value = map[string]int32{ + "UNHANDLED": 0, + "UNAVAILABLE": 1, + "SERVICE_DOWN_TIME": 1, + "BVRC002": 1, + "MAINTENANCE": 2, + "UNIMPLEMENTED": 3, + "INTERNAL_ERROR": 49, + "BVRC999": 49, + "REJECTED": 50, + "UNKNOWN_WALLET_ADDRESS": 51, + "UNKOWN_IDENTITY": 52, + "UNKNOWN_ORIGINATOR": 53, + "UNKOWN_BENEFICIARY": 54, + "BENEFICIARY_NAME_UNMATCHED": 54, + "BVRC007": 54, + "UNSUPPORTED_CURRENCY": 60, + "BVRC001": 60, + "EXCEEDED_TRADING_VOLUME": 61, + "BVRC003": 61, + "COMPLIANCE_CHECK_FAIL": 90, + "BVRC004": 90, + "NO_COMPLIANCE": 91, + "HIGH_RISK": 92, + "OUT_OF_NETWORK": 99, + "FORBIDDEN": 100, + "NO_SIGNING_KEY": 101, + "CERTIFICATE_REVOKED": 102, + "UNVERIFIED": 103, + "UNTRUSTED": 104, + "INVALID_SIGNATURE": 105, + "INVALID_KEY": 106, + "ENVELOPE_DECODE_FAIL": 107, + "PRIVATE_INFO_DECODE_FAIL": 107, + "BVRC005": 107, + "UNHANDLED_ALGORITHM": 108, + "BAD_REQUEST": 150, + "UNPARSEABLE_IDENTITY": 151, + "PRIVATE_INFO_WRONG_FORMAT": 151, + "BVRC006": 151, + "UNPARSEABLE_TRANSACTION": 152, + "MISSING_FIELDS": 153, + "INCOMPLETE_IDENTITY": 154, + "VALIDATION_ERROR": 155, + } +) + +func (x Error_Code) Enum() *Error_Code { + p := new(Error_Code) + *p = x + return p +} + +func (x Error_Code) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Error_Code) Descriptor() protoreflect.EnumDescriptor { + return file_trisa_api_v1beta1_errors_proto_enumTypes[0].Descriptor() +} + +func (Error_Code) Type() protoreflect.EnumType { + return &file_trisa_api_v1beta1_errors_proto_enumTypes[0] +} + +func (x Error_Code) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Error_Code.Descriptor instead. +func (Error_Code) EnumDescriptor() ([]byte, []int) { + return file_trisa_api_v1beta1_errors_proto_rawDescGZIP(), []int{0, 0} +} + +type Error struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Error codes are standardized in the TRISA network to prevent confusion and to + // allow easy identification of rejections or other problems so that the repair of + // the connection or information exchange can be expedited. + Code Error_Code `protobuf:"varint,1,opt,name=code,proto3,enum=trisa.api.v1beta1.Error_Code" json:"code,omitempty"` + // Human readable message stating the reason for the error, should be loggable and + // actionable. Both standardized and unique/detail messages are acceptable. + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + // If the message that caused the error should be retried with a fix; otherwise the + // rejection is permenant and the request should not be retried. + Retry bool `protobuf:"varint,3,opt,name=retry,proto3" json:"retry,omitempty"` + // Any additional data or reasons for the rejection, e.g. a parent error, a diff, + // a location for redirect, etc. The payload of the additional data should be + // described by the error code. + Details *anypb.Any `protobuf:"bytes,4,opt,name=details,proto3" json:"details,omitempty"` +} + +func (x *Error) Reset() { + *x = Error{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_api_v1beta1_errors_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Error) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Error) ProtoMessage() {} + +func (x *Error) ProtoReflect() protoreflect.Message { + mi := &file_trisa_api_v1beta1_errors_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Error.ProtoReflect.Descriptor instead. +func (*Error) Descriptor() ([]byte, []int) { + return file_trisa_api_v1beta1_errors_proto_rawDescGZIP(), []int{0} +} + +func (x *Error) GetCode() Error_Code { + if x != nil { + return x.Code + } + return Error_UNHANDLED +} + +func (x *Error) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *Error) GetRetry() bool { + if x != nil { + return x.Retry + } + return false +} + +func (x *Error) GetDetails() *anypb.Any { + if x != nil { + return x.Details + } + return nil +} + +var File_trisa_api_v1beta1_errors_proto protoreflect.FileDescriptor + +var file_trisa_api_v1beta1_errors_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x11, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9b, + 0x08, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x31, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, + 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x65, 0x74, 0x72, 0x79, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x72, 0x65, 0x74, 0x72, 0x79, 0x12, 0x2e, 0x0a, 0x07, 0x64, + 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, + 0x6e, 0x79, 0x52, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x22, 0xfe, 0x06, 0x0a, 0x04, + 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x48, 0x41, 0x4e, 0x44, 0x4c, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x41, 0x56, 0x41, 0x49, 0x4c, 0x41, 0x42, + 0x4c, 0x45, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x5f, + 0x44, 0x4f, 0x57, 0x4e, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x42, + 0x56, 0x52, 0x43, 0x30, 0x30, 0x32, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x4d, 0x41, 0x49, 0x4e, + 0x54, 0x45, 0x4e, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x55, 0x4e, 0x49, + 0x4d, 0x50, 0x4c, 0x45, 0x4d, 0x45, 0x4e, 0x54, 0x45, 0x44, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, + 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x31, + 0x12, 0x0b, 0x0a, 0x07, 0x42, 0x56, 0x52, 0x43, 0x39, 0x39, 0x39, 0x10, 0x31, 0x12, 0x0c, 0x0a, + 0x08, 0x52, 0x45, 0x4a, 0x45, 0x43, 0x54, 0x45, 0x44, 0x10, 0x32, 0x12, 0x1a, 0x0a, 0x16, 0x55, + 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x57, 0x41, 0x4c, 0x4c, 0x45, 0x54, 0x5f, 0x41, 0x44, + 0x44, 0x52, 0x45, 0x53, 0x53, 0x10, 0x33, 0x12, 0x13, 0x0a, 0x0f, 0x55, 0x4e, 0x4b, 0x4f, 0x57, + 0x4e, 0x5f, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x49, 0x54, 0x59, 0x10, 0x34, 0x12, 0x16, 0x0a, 0x12, + 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x4f, 0x52, 0x49, 0x47, 0x49, 0x4e, 0x41, 0x54, + 0x4f, 0x52, 0x10, 0x35, 0x12, 0x16, 0x0a, 0x12, 0x55, 0x4e, 0x4b, 0x4f, 0x57, 0x4e, 0x5f, 0x42, + 0x45, 0x4e, 0x45, 0x46, 0x49, 0x43, 0x49, 0x41, 0x52, 0x59, 0x10, 0x36, 0x12, 0x1e, 0x0a, 0x1a, + 0x42, 0x45, 0x4e, 0x45, 0x46, 0x49, 0x43, 0x49, 0x41, 0x52, 0x59, 0x5f, 0x4e, 0x41, 0x4d, 0x45, + 0x5f, 0x55, 0x4e, 0x4d, 0x41, 0x54, 0x43, 0x48, 0x45, 0x44, 0x10, 0x36, 0x12, 0x0b, 0x0a, 0x07, + 0x42, 0x56, 0x52, 0x43, 0x30, 0x30, 0x37, 0x10, 0x36, 0x12, 0x18, 0x0a, 0x14, 0x55, 0x4e, 0x53, + 0x55, 0x50, 0x50, 0x4f, 0x52, 0x54, 0x45, 0x44, 0x5f, 0x43, 0x55, 0x52, 0x52, 0x45, 0x4e, 0x43, + 0x59, 0x10, 0x3c, 0x12, 0x0b, 0x0a, 0x07, 0x42, 0x56, 0x52, 0x43, 0x30, 0x30, 0x31, 0x10, 0x3c, + 0x12, 0x1b, 0x0a, 0x17, 0x45, 0x58, 0x43, 0x45, 0x45, 0x44, 0x45, 0x44, 0x5f, 0x54, 0x52, 0x41, + 0x44, 0x49, 0x4e, 0x47, 0x5f, 0x56, 0x4f, 0x4c, 0x55, 0x4d, 0x45, 0x10, 0x3d, 0x12, 0x0b, 0x0a, + 0x07, 0x42, 0x56, 0x52, 0x43, 0x30, 0x30, 0x33, 0x10, 0x3d, 0x12, 0x19, 0x0a, 0x15, 0x43, 0x4f, + 0x4d, 0x50, 0x4c, 0x49, 0x41, 0x4e, 0x43, 0x45, 0x5f, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x5f, 0x46, + 0x41, 0x49, 0x4c, 0x10, 0x5a, 0x12, 0x0b, 0x0a, 0x07, 0x42, 0x56, 0x52, 0x43, 0x30, 0x30, 0x34, + 0x10, 0x5a, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x4f, 0x5f, 0x43, 0x4f, 0x4d, 0x50, 0x4c, 0x49, 0x41, + 0x4e, 0x43, 0x45, 0x10, 0x5b, 0x12, 0x0d, 0x0a, 0x09, 0x48, 0x49, 0x47, 0x48, 0x5f, 0x52, 0x49, + 0x53, 0x4b, 0x10, 0x5c, 0x12, 0x12, 0x0a, 0x0e, 0x4f, 0x55, 0x54, 0x5f, 0x4f, 0x46, 0x5f, 0x4e, + 0x45, 0x54, 0x57, 0x4f, 0x52, 0x4b, 0x10, 0x63, 0x12, 0x0d, 0x0a, 0x09, 0x46, 0x4f, 0x52, 0x42, + 0x49, 0x44, 0x44, 0x45, 0x4e, 0x10, 0x64, 0x12, 0x12, 0x0a, 0x0e, 0x4e, 0x4f, 0x5f, 0x53, 0x49, + 0x47, 0x4e, 0x49, 0x4e, 0x47, 0x5f, 0x4b, 0x45, 0x59, 0x10, 0x65, 0x12, 0x17, 0x0a, 0x13, 0x43, + 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x5f, 0x52, 0x45, 0x56, 0x4f, 0x4b, + 0x45, 0x44, 0x10, 0x66, 0x12, 0x0e, 0x0a, 0x0a, 0x55, 0x4e, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x67, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x54, 0x52, 0x55, 0x53, 0x54, 0x45, + 0x44, 0x10, 0x68, 0x12, 0x15, 0x0a, 0x11, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x53, + 0x49, 0x47, 0x4e, 0x41, 0x54, 0x55, 0x52, 0x45, 0x10, 0x69, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x4e, + 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x4b, 0x45, 0x59, 0x10, 0x6a, 0x12, 0x18, 0x0a, 0x14, 0x45, + 0x4e, 0x56, 0x45, 0x4c, 0x4f, 0x50, 0x45, 0x5f, 0x44, 0x45, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x46, + 0x41, 0x49, 0x4c, 0x10, 0x6b, 0x12, 0x1c, 0x0a, 0x18, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, + 0x5f, 0x49, 0x4e, 0x46, 0x4f, 0x5f, 0x44, 0x45, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x46, 0x41, 0x49, + 0x4c, 0x10, 0x6b, 0x12, 0x0b, 0x0a, 0x07, 0x42, 0x56, 0x52, 0x43, 0x30, 0x30, 0x35, 0x10, 0x6b, + 0x12, 0x17, 0x0a, 0x13, 0x55, 0x4e, 0x48, 0x41, 0x4e, 0x44, 0x4c, 0x45, 0x44, 0x5f, 0x41, 0x4c, + 0x47, 0x4f, 0x52, 0x49, 0x54, 0x48, 0x4d, 0x10, 0x6c, 0x12, 0x10, 0x0a, 0x0b, 0x42, 0x41, 0x44, + 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x96, 0x01, 0x12, 0x19, 0x0a, 0x14, 0x55, + 0x4e, 0x50, 0x41, 0x52, 0x53, 0x45, 0x41, 0x42, 0x4c, 0x45, 0x5f, 0x49, 0x44, 0x45, 0x4e, 0x54, + 0x49, 0x54, 0x59, 0x10, 0x97, 0x01, 0x12, 0x1e, 0x0a, 0x19, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, + 0x45, 0x5f, 0x49, 0x4e, 0x46, 0x4f, 0x5f, 0x57, 0x52, 0x4f, 0x4e, 0x47, 0x5f, 0x46, 0x4f, 0x52, + 0x4d, 0x41, 0x54, 0x10, 0x97, 0x01, 0x12, 0x0c, 0x0a, 0x07, 0x42, 0x56, 0x52, 0x43, 0x30, 0x30, + 0x36, 0x10, 0x97, 0x01, 0x12, 0x1c, 0x0a, 0x17, 0x55, 0x4e, 0x50, 0x41, 0x52, 0x53, 0x45, 0x41, + 0x42, 0x4c, 0x45, 0x5f, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10, + 0x98, 0x01, 0x12, 0x13, 0x0a, 0x0e, 0x4d, 0x49, 0x53, 0x53, 0x49, 0x4e, 0x47, 0x5f, 0x46, 0x49, + 0x45, 0x4c, 0x44, 0x53, 0x10, 0x99, 0x01, 0x12, 0x18, 0x0a, 0x13, 0x49, 0x4e, 0x43, 0x4f, 0x4d, + 0x50, 0x4c, 0x45, 0x54, 0x45, 0x5f, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x49, 0x54, 0x59, 0x10, 0x9a, + 0x01, 0x12, 0x15, 0x0a, 0x10, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, + 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x9b, 0x01, 0x1a, 0x02, 0x10, 0x01, 0x42, 0x38, 0x5a, 0x36, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x72, 0x69, 0x73, 0x61, + 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2f, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2f, 0x70, 0x6b, 0x67, + 0x2f, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_trisa_api_v1beta1_errors_proto_rawDescOnce sync.Once + file_trisa_api_v1beta1_errors_proto_rawDescData = file_trisa_api_v1beta1_errors_proto_rawDesc +) + +func file_trisa_api_v1beta1_errors_proto_rawDescGZIP() []byte { + file_trisa_api_v1beta1_errors_proto_rawDescOnce.Do(func() { + file_trisa_api_v1beta1_errors_proto_rawDescData = protoimpl.X.CompressGZIP(file_trisa_api_v1beta1_errors_proto_rawDescData) + }) + return file_trisa_api_v1beta1_errors_proto_rawDescData +} + +var file_trisa_api_v1beta1_errors_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_trisa_api_v1beta1_errors_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_trisa_api_v1beta1_errors_proto_goTypes = []interface{}{ + (Error_Code)(0), // 0: trisa.api.v1beta1.Error.Code + (*Error)(nil), // 1: trisa.api.v1beta1.Error + (*anypb.Any)(nil), // 2: google.protobuf.Any +} +var file_trisa_api_v1beta1_errors_proto_depIdxs = []int32{ + 0, // 0: trisa.api.v1beta1.Error.code:type_name -> trisa.api.v1beta1.Error.Code + 2, // 1: trisa.api.v1beta1.Error.details:type_name -> google.protobuf.Any + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_trisa_api_v1beta1_errors_proto_init() } +func file_trisa_api_v1beta1_errors_proto_init() { + if File_trisa_api_v1beta1_errors_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_trisa_api_v1beta1_errors_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Error); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_trisa_api_v1beta1_errors_proto_rawDesc, + NumEnums: 1, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_trisa_api_v1beta1_errors_proto_goTypes, + DependencyIndexes: file_trisa_api_v1beta1_errors_proto_depIdxs, + EnumInfos: file_trisa_api_v1beta1_errors_proto_enumTypes, + MessageInfos: file_trisa_api_v1beta1_errors_proto_msgTypes, + }.Build() + File_trisa_api_v1beta1_errors_proto = out.File + file_trisa_api_v1beta1_errors_proto_rawDesc = nil + file_trisa_api_v1beta1_errors_proto_goTypes = nil + file_trisa_api_v1beta1_errors_proto_depIdxs = nil +} diff --git a/pkg/trisa/api/v1beta1/errors_test.go b/pkg/trisa/api/v1beta1/errors_test.go new file mode 100644 index 0000000..94d863d --- /dev/null +++ b/pkg/trisa/api/v1beta1/errors_test.go @@ -0,0 +1,31 @@ +package api_test + +import ( + "errors" + "testing" + + "github.com/stretchr/testify/require" + protocol "github.com/trisacrypto/trisa/pkg/trisa/api/v1beta1" +) + +func TestErrors(t *testing.T) { + err := protocol.Errorf(protocol.UnknownIdentity, "could not parse %q", "foo") + require.Error(t, err) + require.Equal(t, err.Error(), `trisa error [UNKOWN_IDENTITY]: could not parse "foo"`) + + oerr, ok := protocol.Errorp(err) + require.True(t, ok) + require.Equal(t, err, oerr) + + oerr, ok = protocol.Errorp(errors.New("unhandled error")) + require.False(t, ok) + require.Equal(t, oerr.Error(), "trisa error [UNHANDLED]: unhandled error") + + // TODO: This doesn't work for some reason - the tests just hang? + // sterr := err.Err() + // require.Equal(t, sterr.Error(), `rpc error: code = Aborted desc = [UNKOWN_IDENTITY] could not parse "foo"`) + + // oerr, ok = protocol.Errorp(sterr) + // require.True(t, ok) + // require.Equal(t, err, oerr) +} diff --git a/pkg/trisa/api/v1beta1/generate.go b/pkg/trisa/api/v1beta1/generate.go new file mode 100644 index 0000000..675c853 --- /dev/null +++ b/pkg/trisa/api/v1beta1/generate.go @@ -0,0 +1,3 @@ +package api + +//go:generate protoc -I=../../../../proto --go_out=. --go_opt=module=github.com/trisacrypto/trisa/pkg/trisa/api/v1beta1 --go-grpc_out=. --go-grpc_opt=module=github.com/trisacrypto/trisa/pkg/trisa/api/v1beta1 trisa/api/v1beta1/api.proto trisa/api/v1beta1/errors.proto diff --git a/pkg/trisa/crypto/aesgcm/aesgcm.go b/pkg/trisa/crypto/aesgcm/aesgcm.go new file mode 100644 index 0000000..d0c5672 --- /dev/null +++ b/pkg/trisa/crypto/aesgcm/aesgcm.go @@ -0,0 +1,142 @@ +package aesgcm + +import ( + "bytes" + "crypto/aes" + "crypto/cipher" + "crypto/hmac" + "crypto/sha256" + "errors" + "fmt" + + "github.com/trisacrypto/trisa/pkg/trisa/crypto" +) + +// AESGCM implements the crypto.Crypto interface using the AES-GCM algorithm for +// symmetric-key encryption. This algorithm is widely adopted for it's performance and +// throughput rates for state-of-the-art high-speed communication on inexpensive +// hardware (Wikipedia). This implementation generates a 32 byte random encryption key +// when initialized, if one not specified by default. Users should create a new AESGCM +// to encrypt and sign different messages with different keys. +type AESGCM struct { + key []byte // the symmetric encryption key + secret []byte // the HMAC secret used to calculate the signature +} + +// New creates an AESGCM Crypto handler, generating an encryption key if it is nil or +// zero length. If hmac_secret isn't specified, the encryption key is used. The key and +// secret should be 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256. +func New(encryptionKey, hmacSecret []byte) (_ *AESGCM, err error) { + if len(encryptionKey) == 0 { + if encryptionKey, err = crypto.Random(32); err != nil { + return nil, fmt.Errorf("could not generate encryption key: %s", err) + } + } + + if len(hmacSecret) == 0 { + hmacSecret = encryptionKey + } + + return &AESGCM{key: encryptionKey, secret: hmacSecret}, nil +} + +// Encrypt a message using the struct key, appending a 12 byte random nonce to the end +// of the ciphertext message. +func (c *AESGCM) Encrypt(plaintext []byte) (ciphertext []byte, err error) { + block, err := aes.NewCipher(c.key) + if err != nil { + return nil, err + } + + aesgcm, err := cipher.NewGCM(block) + if err != nil { + return nil, err + } + + nonce, err := crypto.Random(12) + if err != nil { + return nil, err + } + + ciphertext = aesgcm.Seal(nil, nonce, plaintext, nil) + ciphertext = append(ciphertext, nonce...) + return ciphertext, nil +} + +// Decrypt a message using the struct key, extracting the nonce from the end. +func (c *AESGCM) Decrypt(ciphertext []byte) (plaintext []byte, err error) { + if len(ciphertext) < 12 { + return nil, errors.New("empty cipher text") + } + + data := ciphertext[:len(ciphertext)-12] + nonce := ciphertext[len(ciphertext)-12:] + + block, err := aes.NewCipher(c.key) + if err != nil { + return nil, err + } + + aesgcm, err := cipher.NewGCM(block) + if err != nil { + return nil, err + } + + plaintext, err = aesgcm.Open(nil, nonce, data, nil) + if err != nil { + return nil, fmt.Errorf("could not decrypt ciphertext: %s", err) + } + return plaintext, nil +} + +// EncryptionAlgorithm returns the name of the algorithm for adding to the Transaction. +func (c *AESGCM) EncryptionAlgorithm() string { + switch len(c.key) { + case 32: + return "AES256-GCM" + case 24: + return "AES192-GCM" + case 16: + return "AES128-GCM" + default: + return "AES-GCM" + } +} + +// Sign the specified data (ususally the ciphertext) using the struct secret. +func (c *AESGCM) Sign(data []byte) (signature []byte, err error) { + if len(data) == 0 { + return nil, errors.New("cannot sign empty data") + } + + hm := hmac.New(sha256.New, c.secret) + hm.Write(data) + return hm.Sum(nil), nil +} + +// Verify the signature on the specified data using the struct secret. +func (c *AESGCM) Verify(data, signature []byte) (err error) { + hm := hmac.New(sha256.New, c.secret) + hm.Write(data) + + if !bytes.Equal(signature, hm.Sum(nil)) { + return errors.New("hmac signature mismatch") + } + + return nil +} + +// SignatureAlgorithm returns the name of the hmac_algorithm for adding to the Transaction. +func (c *AESGCM) SignatureAlgorithm() string { + return "HMAC-SHA256" +} + +// EncryptionKey is a read-only getter. +func (c *AESGCM) EncryptionKey() []byte { + return c.key +} + +// HMACSecret is a read-only getter. +func (c *AESGCM) HMACSecret() []byte { + return c.secret +} diff --git a/pkg/trisa/crypto/aesgcm/aesgcm_test.go b/pkg/trisa/crypto/aesgcm/aesgcm_test.go new file mode 100644 index 0000000..310931a --- /dev/null +++ b/pkg/trisa/crypto/aesgcm/aesgcm_test.go @@ -0,0 +1,37 @@ +package aesgcm_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + "github.com/trisacrypto/trisa/pkg/trisa/crypto" + "github.com/trisacrypto/trisa/pkg/trisa/crypto/aesgcm" +) + +func TestAESGCM(t *testing.T) { + plaintext := []byte("theeaglefliesatmidnight") + + // Generate a key + cipher, err := aesgcm.New(nil, nil) + require.NoError(t, err) + require.NotEmpty(t, cipher.EncryptionKey()) + require.NotEmpty(t, cipher.HMACSecret()) + + ciphertext, err := cipher.Encrypt(plaintext) + require.NoError(t, err) + + signature, err := cipher.Sign(ciphertext) + require.NoError(t, err) + + // Decode using a new cipher + var decoder crypto.Crypto + decoder, err = aesgcm.New(cipher.EncryptionKey(), cipher.HMACSecret()) + require.NoError(t, err) + + err = decoder.Verify(ciphertext, signature) + require.NoError(t, err) + + decoded, err := decoder.Decrypt(ciphertext) + require.NoError(t, err) + require.Equal(t, plaintext, decoded) +} diff --git a/pkg/trisa/crypto/crypto.go b/pkg/trisa/crypto/crypto.go new file mode 100644 index 0000000..d6f7154 --- /dev/null +++ b/pkg/trisa/crypto/crypto.go @@ -0,0 +1,43 @@ +/* +Package crypto describes interfaces for the various encryption and hmac algorithms that +might be used to encrypt and sign transaction envelopes being passed securely in the +TRISA network. Subpackages implement specific algorithms such as aesgcm for symmetric +encryption or rsa for asymmetric encryption. Note that not all encryption mechanisms are +legal in different countries, these interfaces allow the use of different algorithms and +methodologies in the protocol without specifying what must be used. +*/ +package crypto + +import "crypto/rand" + +// Crypto handler for TRISA transaction envelopes must be both a Cipher and a Signer. +type Crypto interface { + Cipher + Signer +} + +// Cipher is a device that can perform encryption and decryption, This interface wraps +// different encryption algorithms that must be identified in the TRISA protocol. +type Cipher interface { + Encrypt(plaintext []byte) (ciphertext []byte, err error) + Decrypt(ciphertext []byte) (plaintext []byte, err error) + EncryptionAlgorithm() string +} + +// Signer creates or verifies HMAC signatures. This interface wraps multiple hmac +// algorithms that must be identified in the TRISA protocol. +type Signer interface { + Sign(data []byte) (signature []byte, err error) + Verify(data, signature []byte) (err error) + SignatureAlgorithm() string +} + +// Random generates a secure random sequence of bytes, this helper function is used to +// easily create keys, salts, and secrets in the crypto subpackages. +func Random(n int) (b []byte, err error) { + b = make([]byte, n) + if _, err = rand.Read(b); err != nil { + return nil, err + } + return b, nil +} diff --git a/pkg/trisa/crypto/rsaoeap/rsaoeap.go b/pkg/trisa/crypto/rsaoeap/rsaoeap.go new file mode 100644 index 0000000..1a14509 --- /dev/null +++ b/pkg/trisa/crypto/rsaoeap/rsaoeap.go @@ -0,0 +1,62 @@ +package rsaoeap + +import ( + "crypto/rand" + "crypto/rsa" + "crypto/sha512" + "errors" + "fmt" +) + +// RSA implements the crypto.Cipher interface using RSA public/private key algorithm +// as specified in PKCS #1. Messages are encrypted with the public key and can only be +// decrypted using the private key. RSA objects must have a public key but the private +// key is only required for decryption. +type RSA struct { + pub *rsa.PublicKey + priv *rsa.PrivateKey +} + +// New creates an RSA Crypto handler with the specified key pair. If the cipher is only +// being used for encryption, simply pass the public key: New(pub *rsa.PublicKey); If +// the cipher is being used for decryption, then pass the private key: +// New(key *rsa.PrivateKey). +func New(key interface{}) (_ *RSA, err error) { + switch t := key.(type) { + case *rsa.PublicKey: + return &RSA{pub: t, priv: nil}, nil + case *rsa.PrivateKey: + return &RSA{pub: &t.PublicKey, priv: t}, nil + default: + return nil, fmt.Errorf("could not create RSA cipher from %T", t) + } +} + +// Encrypt the message using the public key. +func (c *RSA) Encrypt(plaintext []byte) (ciphertext []byte, err error) { + hash := sha512.New() + ciphertext, err = rsa.EncryptOAEP(hash, rand.Reader, c.pub, plaintext, nil) + if err != nil { + return nil, err + } + return ciphertext, nil +} + +// Decrypt the message using the private key. +func (c *RSA) Decrypt(ciphertext []byte) (plaintext []byte, err error) { + if c.priv == nil { + return nil, errors.New("private key required for decryption") + } + + hash := sha512.New() + plaintext, err = rsa.DecryptOAEP(hash, rand.Reader, c.priv, ciphertext, nil) + if err != nil { + return nil, err + } + return plaintext, nil +} + +// EncryptionAlgorithm returns the name of the algorithm for adding to the Transaction. +func (c *RSA) EncryptionAlgorithm() string { + return "RSA-OAEP-SHA512" +} diff --git a/pkg/trisa/crypto/rsaoeap/rsaoeap_test.go b/pkg/trisa/crypto/rsaoeap/rsaoeap_test.go new file mode 100644 index 0000000..19a6a47 --- /dev/null +++ b/pkg/trisa/crypto/rsaoeap/rsaoeap_test.go @@ -0,0 +1,38 @@ +package rsaoeap_test + +import ( + "crypto/rand" + "crypto/rsa" + "testing" + + "github.com/stretchr/testify/require" + "github.com/trisacrypto/trisa/pkg/trisa/crypto" + "github.com/trisacrypto/trisa/pkg/trisa/crypto/rsaoeap" +) + +func TestRSA(t *testing.T) { + priv, err := rsa.GenerateKey(rand.Reader, 4096) + require.NoError(t, err) + + plaintext := []byte("for your eyes only -- classified") + + // Cipher only takes RSA keys + _, err = rsaoeap.New("foo") + require.Error(t, err) + + // Encrypt using a new cipher with just the public key + var cipher crypto.Cipher + cipher, err = rsaoeap.New(&priv.PublicKey) + + ciphertext, err := cipher.Encrypt(plaintext) + require.NoError(t, err) + + // Decrypt using a new cipher with both public and private key + var decoder crypto.Cipher + decoder, err = rsaoeap.New(priv) + require.NoError(t, err) + + decoded, err := decoder.Decrypt(ciphertext) + require.NoError(t, err) + require.Equal(t, plaintext, decoded) +} diff --git a/pkg/trisa/gds/api/v1beta1/api.pb.go b/pkg/trisa/gds/api/v1beta1/api.pb.go new file mode 100644 index 0000000..b6fa0e0 --- /dev/null +++ b/pkg/trisa/gds/api/v1beta1/api.pb.go @@ -0,0 +1,1465 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.14.0 +// source: trisa/gds/api/v1beta1/api.proto + +package api + +import ( + proto "github.com/golang/protobuf/proto" + ivms101 "github.com/trisacrypto/trisa/pkg/ivms101" + v1beta1 "github.com/trisacrypto/trisa/pkg/trisa/gds/models/v1beta1" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type Error struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *Error) Reset() { + *x = Error{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Error) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Error) ProtoMessage() {} + +func (x *Error) ProtoReflect() protoreflect.Message { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Error.ProtoReflect.Descriptor instead. +func (*Error) Descriptor() ([]byte, []int) { + return file_trisa_gds_api_v1beta1_api_proto_rawDescGZIP(), []int{0} +} + +func (x *Error) GetCode() int32 { + if x != nil { + return x.Code + } + return 0 +} + +func (x *Error) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +// Registration requests are validated that they contain correct information and then +// are sent through the verification process, creating or updating a VASP as needed. +type RegisterRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The legal entity IVMS 101 data for VASP KYC information exchange. This is the + // IVMS 101 data that should be exchanged in the TRISA P2P protocol as the + // Originator, Intermediate, or Beneficiary VASP fields. A complete and valid + // identity record with country of registration is required. + Entity *ivms101.LegalPerson `protobuf:"bytes,1,opt,name=entity,proto3" json:"entity,omitempty"` + // Technical, legal, billing, and administrative contacts for the VASP. + Contacts *v1beta1.Contacts `protobuf:"bytes,2,opt,name=contacts,proto3" json:"contacts,omitempty"` + // Travel Rule Implementation Endpoint - where other TRISA peers should connect. + // This should be an addr:port combination, e.g. trisa.vaspbot.net:443 + TrisaEndpoint string `protobuf:"bytes,3,opt,name=trisa_endpoint,json=trisaEndpoint,proto3" json:"trisa_endpoint,omitempty"` + // Common name should be the VASP domain name to issue certificates for, which + // should match the domain in the trisa_endpoint. If this field is omitted, the + // common name is inferred from the trisa_endpoint. + CommonName string `protobuf:"bytes,4,opt,name=common_name,json=commonName,proto3" json:"common_name,omitempty"` + // Business Information + Website string `protobuf:"bytes,5,opt,name=website,proto3" json:"website,omitempty"` + BusinessCategory v1beta1.BusinessCategory `protobuf:"varint,6,opt,name=business_category,json=businessCategory,proto3,enum=trisa.gds.models.v1beta1.BusinessCategory" json:"business_category,omitempty"` + VaspCategory v1beta1.VASPCategory `protobuf:"varint,7,opt,name=vasp_category,json=vaspCategory,proto3,enum=trisa.gds.models.v1beta1.VASPCategory" json:"vasp_category,omitempty"` + EstablishedOn string `protobuf:"bytes,8,opt,name=established_on,json=establishedOn,proto3" json:"established_on,omitempty"` // Should be a date in YYYY-MM-DD format + // TRIXO Questionnaire + Trixo *v1beta1.TRIXOQuestionnaire `protobuf:"bytes,9,opt,name=trixo,proto3" json:"trixo,omitempty"` +} + +func (x *RegisterRequest) Reset() { + *x = RegisterRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RegisterRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegisterRequest) ProtoMessage() {} + +func (x *RegisterRequest) ProtoReflect() protoreflect.Message { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RegisterRequest.ProtoReflect.Descriptor instead. +func (*RegisterRequest) Descriptor() ([]byte, []int) { + return file_trisa_gds_api_v1beta1_api_proto_rawDescGZIP(), []int{1} +} + +func (x *RegisterRequest) GetEntity() *ivms101.LegalPerson { + if x != nil { + return x.Entity + } + return nil +} + +func (x *RegisterRequest) GetContacts() *v1beta1.Contacts { + if x != nil { + return x.Contacts + } + return nil +} + +func (x *RegisterRequest) GetTrisaEndpoint() string { + if x != nil { + return x.TrisaEndpoint + } + return "" +} + +func (x *RegisterRequest) GetCommonName() string { + if x != nil { + return x.CommonName + } + return "" +} + +func (x *RegisterRequest) GetWebsite() string { + if x != nil { + return x.Website + } + return "" +} + +func (x *RegisterRequest) GetBusinessCategory() v1beta1.BusinessCategory { + if x != nil { + return x.BusinessCategory + } + return v1beta1.BusinessCategory_UNKNOWN_ENTITY +} + +func (x *RegisterRequest) GetVaspCategory() v1beta1.VASPCategory { + if x != nil { + return x.VaspCategory + } + return v1beta1.VASPCategory_UNKNOWN_VASP +} + +func (x *RegisterRequest) GetEstablishedOn() string { + if x != nil { + return x.EstablishedOn + } + return "" +} + +func (x *RegisterRequest) GetTrixo() *v1beta1.TRIXOQuestionnaire { + if x != nil { + return x.Trixo + } + return nil +} + +type RegisterReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // If the registration was successful, no error will be returned + Error *Error `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` + // Unique identifiers for the VASP created by the registration. + // Use these identifiers for status lookup requests and any follow-on interactions. + Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` + RegisteredDirectory string `protobuf:"bytes,3,opt,name=registered_directory,json=registeredDirectory,proto3" json:"registered_directory,omitempty"` + CommonName string `protobuf:"bytes,4,opt,name=common_name,json=commonName,proto3" json:"common_name,omitempty"` + // The verification status of the VASP entity. + Status v1beta1.VerificationState `protobuf:"varint,5,opt,name=status,proto3,enum=trisa.gds.models.v1beta1.VerificationState" json:"status,omitempty"` + Message string `protobuf:"bytes,6,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *RegisterReply) Reset() { + *x = RegisterReply{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RegisterReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegisterReply) ProtoMessage() {} + +func (x *RegisterReply) ProtoReflect() protoreflect.Message { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RegisterReply.ProtoReflect.Descriptor instead. +func (*RegisterReply) Descriptor() ([]byte, []int) { + return file_trisa_gds_api_v1beta1_api_proto_rawDescGZIP(), []int{2} +} + +func (x *RegisterReply) GetError() *Error { + if x != nil { + return x.Error + } + return nil +} + +func (x *RegisterReply) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *RegisterReply) GetRegisteredDirectory() string { + if x != nil { + return x.RegisteredDirectory + } + return "" +} + +func (x *RegisterReply) GetCommonName() string { + if x != nil { + return x.CommonName + } + return "" +} + +func (x *RegisterReply) GetStatus() v1beta1.VerificationState { + if x != nil { + return x.Status + } + return v1beta1.VerificationState_NO_VERIFICATION +} + +func (x *RegisterReply) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +// Lookup VASP certification information either by their unique ID or by the domain of +// the TRISA implementation endpoint, which should be the common name of the certificate. +// Note that if both id and common name are supplied, ID is prioritized. +type LookupRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Unique identifier generated by the directory service, most common lookup field. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // The URL of the directory that registered the VASP. If ommitted, it is assumed + // that the directory being queried is the registering VASP. + RegisteredDirectory string `protobuf:"bytes,2,opt,name=registered_directory,json=registeredDirectory,proto3" json:"registered_directory,omitempty"` + // The common name of the certificate, e.g. the domain name of the TRISA endpoint. + // To use other name fields such as the legal business name, you must use search. + CommonName string `protobuf:"bytes,3,opt,name=common_name,json=commonName,proto3" json:"common_name,omitempty"` +} + +func (x *LookupRequest) Reset() { + *x = LookupRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LookupRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LookupRequest) ProtoMessage() {} + +func (x *LookupRequest) ProtoReflect() protoreflect.Message { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LookupRequest.ProtoReflect.Descriptor instead. +func (*LookupRequest) Descriptor() ([]byte, []int) { + return file_trisa_gds_api_v1beta1_api_proto_rawDescGZIP(), []int{3} +} + +func (x *LookupRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *LookupRequest) GetRegisteredDirectory() string { + if x != nil { + return x.RegisteredDirectory + } + return "" +} + +func (x *LookupRequest) GetCommonName() string { + if x != nil { + return x.CommonName + } + return "" +} + +// Summary information is given in return for VASP lookups as lookups are primarily +// intended to facilitate P2P verification and public key exchange. +// NOTE: only verified VASPs are returned using the lookup RPC. +type LookupReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // If no error is specified, the lookup was successful + Error *Error `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` + // The uniquely identifying components of the VASP in the directory service + Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` + RegisteredDirectory string `protobuf:"bytes,3,opt,name=registered_directory,json=registeredDirectory,proto3" json:"registered_directory,omitempty"` + CommonName string `protobuf:"bytes,4,opt,name=common_name,json=commonName,proto3" json:"common_name,omitempty"` + // The endpoint to connect to for the TRISA P2P protocol (addr:port) + Endpoint string `protobuf:"bytes,5,opt,name=endpoint,proto3" json:"endpoint,omitempty"` + // Certificate information if the VASP is available and verified. The identity + // certificate is used to establish mTLS connections, the signing certificate is + // used on a per-transaction basis. + IdentityCertificate *v1beta1.Certificate `protobuf:"bytes,6,opt,name=identity_certificate,json=identityCertificate,proto3" json:"identity_certificate,omitempty"` + SigningCertificate *v1beta1.Certificate `protobuf:"bytes,7,opt,name=signing_certificate,json=signingCertificate,proto3" json:"signing_certificate,omitempty"` + // Other VASP information that faciliates P2P exchanges + Name string `protobuf:"bytes,8,opt,name=name,proto3" json:"name,omitempty"` + Country string `protobuf:"bytes,9,opt,name=country,proto3" json:"country,omitempty"` + VerifiedOn string `protobuf:"bytes,10,opt,name=verified_on,json=verifiedOn,proto3" json:"verified_on,omitempty"` +} + +func (x *LookupReply) Reset() { + *x = LookupReply{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LookupReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LookupReply) ProtoMessage() {} + +func (x *LookupReply) ProtoReflect() protoreflect.Message { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LookupReply.ProtoReflect.Descriptor instead. +func (*LookupReply) Descriptor() ([]byte, []int) { + return file_trisa_gds_api_v1beta1_api_proto_rawDescGZIP(), []int{4} +} + +func (x *LookupReply) GetError() *Error { + if x != nil { + return x.Error + } + return nil +} + +func (x *LookupReply) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *LookupReply) GetRegisteredDirectory() string { + if x != nil { + return x.RegisteredDirectory + } + return "" +} + +func (x *LookupReply) GetCommonName() string { + if x != nil { + return x.CommonName + } + return "" +} + +func (x *LookupReply) GetEndpoint() string { + if x != nil { + return x.Endpoint + } + return "" +} + +func (x *LookupReply) GetIdentityCertificate() *v1beta1.Certificate { + if x != nil { + return x.IdentityCertificate + } + return nil +} + +func (x *LookupReply) GetSigningCertificate() *v1beta1.Certificate { + if x != nil { + return x.SigningCertificate + } + return nil +} + +func (x *LookupReply) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *LookupReply) GetCountry() string { + if x != nil { + return x.Country + } + return "" +} + +func (x *LookupReply) GetVerifiedOn() string { + if x != nil { + return x.VerifiedOn + } + return "" +} + +// Search requests allow a more flexibly field serach to identify a VASP, these requests +// are primarily used to locate a beneficiary VASP in order to begin the TRISA P2P protocol. +// NOTE: only verified VASPs are returned using the search RPC. +type SearchRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Case insensitive search fields that use OR to perform the lookup. The name field + // can be the legal, short, or DBA name of the VASP or the common name of + // certificate issued to that VASP (though in this case, it is better to use the + // Lookup RPC). The website must be a parseable URL to lookup the VASP with. + Name []string `protobuf:"bytes,1,rep,name=name,proto3" json:"name,omitempty"` + Website []string `protobuf:"bytes,2,rep,name=website,proto3" json:"website,omitempty"` + // Search filters to condition the search on. Only VASPs that are in the + // country(ies) or category(ies) specified are returned. + Country []string `protobuf:"bytes,7,rep,name=country,proto3" json:"country,omitempty"` + BusinessCategory []v1beta1.BusinessCategory `protobuf:"varint,8,rep,packed,name=business_category,json=businessCategory,proto3,enum=trisa.gds.models.v1beta1.BusinessCategory" json:"business_category,omitempty"` + VaspCategory []v1beta1.VASPCategory `protobuf:"varint,9,rep,packed,name=vasp_category,json=vaspCategory,proto3,enum=trisa.gds.models.v1beta1.VASPCategory" json:"vasp_category,omitempty"` +} + +func (x *SearchRequest) Reset() { + *x = SearchRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchRequest) ProtoMessage() {} + +func (x *SearchRequest) ProtoReflect() protoreflect.Message { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchRequest.ProtoReflect.Descriptor instead. +func (*SearchRequest) Descriptor() ([]byte, []int) { + return file_trisa_gds_api_v1beta1_api_proto_rawDescGZIP(), []int{5} +} + +func (x *SearchRequest) GetName() []string { + if x != nil { + return x.Name + } + return nil +} + +func (x *SearchRequest) GetWebsite() []string { + if x != nil { + return x.Website + } + return nil +} + +func (x *SearchRequest) GetCountry() []string { + if x != nil { + return x.Country + } + return nil +} + +func (x *SearchRequest) GetBusinessCategory() []v1beta1.BusinessCategory { + if x != nil { + return x.BusinessCategory + } + return nil +} + +func (x *SearchRequest) GetVaspCategory() []v1beta1.VASPCategory { + if x != nil { + return x.VaspCategory + } + return nil +} + +type SearchReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // If no error is specified, the search was successful, even if no results returned. + Error *Error `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` + Results []*SearchReply_Result `protobuf:"bytes,2,rep,name=results,proto3" json:"results,omitempty"` +} + +func (x *SearchReply) Reset() { + *x = SearchReply{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchReply) ProtoMessage() {} + +func (x *SearchReply) ProtoReflect() protoreflect.Message { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchReply.ProtoReflect.Descriptor instead. +func (*SearchReply) Descriptor() ([]byte, []int) { + return file_trisa_gds_api_v1beta1_api_proto_rawDescGZIP(), []int{6} +} + +func (x *SearchReply) GetError() *Error { + if x != nil { + return x.Error + } + return nil +} + +func (x *SearchReply) GetResults() []*SearchReply_Result { + if x != nil { + return x.Results + } + return nil +} + +// Check on the status of a VASP including its verification status and the service +// status if the TRISA directory service performs health check monitoring. The same +// parameters as the Lookup RPC are sent, but note that a TRISA directory service may +// refuse to return all or part of the status request. +type StatusRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Unique identifier generated by the directory service, most common lookup field. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // The URL of the directory that registered the VASP. If ommitted, it is assumed + // that the directory being queried is the registering VASP. + RegisteredDirectory string `protobuf:"bytes,2,opt,name=registered_directory,json=registeredDirectory,proto3" json:"registered_directory,omitempty"` + // The common name of the certificate, e.g. the domain name of the TRISA endpoint. + // To use other name fields such as the legal business name, you must use search. + CommonName string `protobuf:"bytes,3,opt,name=common_name,json=commonName,proto3" json:"common_name,omitempty"` +} + +func (x *StatusRequest) Reset() { + *x = StatusRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatusRequest) ProtoMessage() {} + +func (x *StatusRequest) ProtoReflect() protoreflect.Message { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead. +func (*StatusRequest) Descriptor() ([]byte, []int) { + return file_trisa_gds_api_v1beta1_api_proto_rawDescGZIP(), []int{7} +} + +func (x *StatusRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *StatusRequest) GetRegisteredDirectory() string { + if x != nil { + return x.RegisteredDirectory + } + return "" +} + +func (x *StatusRequest) GetCommonName() string { + if x != nil { + return x.CommonName + } + return "" +} + +type StatusReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // If no error is specified, the status request was successful. + Error *Error `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` + // Status information + VerificationStatus v1beta1.VerificationState `protobuf:"varint,2,opt,name=verification_status,json=verificationStatus,proto3,enum=trisa.gds.models.v1beta1.VerificationState" json:"verification_status,omitempty"` + ServiceStatus v1beta1.ServiceState `protobuf:"varint,3,opt,name=service_status,json=serviceStatus,proto3,enum=trisa.gds.models.v1beta1.ServiceState" json:"service_status,omitempty"` + VerifiedOn string `protobuf:"bytes,4,opt,name=verified_on,json=verifiedOn,proto3" json:"verified_on,omitempty"` // Should be an RFC 3339 Timestamp + FirstListed string `protobuf:"bytes,5,opt,name=first_listed,json=firstListed,proto3" json:"first_listed,omitempty"` // Should be an RFC 3339 Timestamp + LastUpdated string `protobuf:"bytes,6,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"` // Should be an RFC 3339 Timestamp +} + +func (x *StatusReply) Reset() { + *x = StatusReply{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StatusReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatusReply) ProtoMessage() {} + +func (x *StatusReply) ProtoReflect() protoreflect.Message { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StatusReply.ProtoReflect.Descriptor instead. +func (*StatusReply) Descriptor() ([]byte, []int) { + return file_trisa_gds_api_v1beta1_api_proto_rawDescGZIP(), []int{8} +} + +func (x *StatusReply) GetError() *Error { + if x != nil { + return x.Error + } + return nil +} + +func (x *StatusReply) GetVerificationStatus() v1beta1.VerificationState { + if x != nil { + return x.VerificationStatus + } + return v1beta1.VerificationState_NO_VERIFICATION +} + +func (x *StatusReply) GetServiceStatus() v1beta1.ServiceState { + if x != nil { + return x.ServiceStatus + } + return v1beta1.ServiceState_UNKNOWN +} + +func (x *StatusReply) GetVerifiedOn() string { + if x != nil { + return x.VerifiedOn + } + return "" +} + +func (x *StatusReply) GetFirstListed() string { + if x != nil { + return x.FirstListed + } + return "" +} + +func (x *StatusReply) GetLastUpdated() string { + if x != nil { + return x.LastUpdated + } + return "" +} + +type VerifyEmailRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"` +} + +func (x *VerifyEmailRequest) Reset() { + *x = VerifyEmailRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VerifyEmailRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifyEmailRequest) ProtoMessage() {} + +func (x *VerifyEmailRequest) ProtoReflect() protoreflect.Message { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VerifyEmailRequest.ProtoReflect.Descriptor instead. +func (*VerifyEmailRequest) Descriptor() ([]byte, []int) { + return file_trisa_gds_api_v1beta1_api_proto_rawDescGZIP(), []int{9} +} + +func (x *VerifyEmailRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *VerifyEmailRequest) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +type VerifyEmailReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // If no error is specified, the verify email request was successful + Error *Error `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` + // The verification status of the VASP entity. + Status v1beta1.VerificationState `protobuf:"varint,2,opt,name=status,proto3,enum=trisa.gds.models.v1beta1.VerificationState" json:"status,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + // Used to decrypt the emailed certificates in PKCS 12 format + Pkcs12Password string `protobuf:"bytes,4,opt,name=pkcs12password,proto3" json:"pkcs12password,omitempty"` +} + +func (x *VerifyEmailReply) Reset() { + *x = VerifyEmailReply{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VerifyEmailReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifyEmailReply) ProtoMessage() {} + +func (x *VerifyEmailReply) ProtoReflect() protoreflect.Message { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VerifyEmailReply.ProtoReflect.Descriptor instead. +func (*VerifyEmailReply) Descriptor() ([]byte, []int) { + return file_trisa_gds_api_v1beta1_api_proto_rawDescGZIP(), []int{10} +} + +func (x *VerifyEmailReply) GetError() *Error { + if x != nil { + return x.Error + } + return nil +} + +func (x *VerifyEmailReply) GetStatus() v1beta1.VerificationState { + if x != nil { + return x.Status + } + return v1beta1.VerificationState_NO_VERIFICATION +} + +func (x *VerifyEmailReply) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *VerifyEmailReply) GetPkcs12Password() string { + if x != nil { + return x.Pkcs12Password + } + return "" +} + +type SearchReply_Result struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The uniquely identifying components of the VASP in the directory service + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + RegisteredDirectory string `protobuf:"bytes,2,opt,name=registered_directory,json=registeredDirectory,proto3" json:"registered_directory,omitempty"` + CommonName string `protobuf:"bytes,3,opt,name=common_name,json=commonName,proto3" json:"common_name,omitempty"` + // Address to connect to the remote VASP on to perform a TRISA request + Endpoint string `protobuf:"bytes,4,opt,name=endpoint,proto3" json:"endpoint,omitempty"` +} + +func (x *SearchReply_Result) Reset() { + *x = SearchReply_Result{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchReply_Result) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchReply_Result) ProtoMessage() {} + +func (x *SearchReply_Result) ProtoReflect() protoreflect.Message { + mi := &file_trisa_gds_api_v1beta1_api_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SearchReply_Result.ProtoReflect.Descriptor instead. +func (*SearchReply_Result) Descriptor() ([]byte, []int) { + return file_trisa_gds_api_v1beta1_api_proto_rawDescGZIP(), []int{6, 0} +} + +func (x *SearchReply_Result) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *SearchReply_Result) GetRegisteredDirectory() string { + if x != nil { + return x.RegisteredDirectory + } + return "" +} + +func (x *SearchReply_Result) GetCommonName() string { + if x != nil { + return x.CommonName + } + return "" +} + +func (x *SearchReply_Result) GetEndpoint() string { + if x != nil { + return x.Endpoint + } + return "" +} + +var File_trisa_gds_api_v1beta1_api_proto protoreflect.FileDescriptor + +var file_trisa_gds_api_v1beta1_api_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2f, 0x67, 0x64, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x15, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x1a, 0x15, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, + 0x31, 0x2f, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x25, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2f, 0x67, 0x64, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, + 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2f, 0x67, 0x64, + 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2f, 0x63, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x35, 0x0a, 0x05, 0x45, 0x72, 0x72, + 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x22, 0xf2, 0x03, 0x0a, 0x0f, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x06, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, 0x4c, + 0x65, 0x67, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x52, 0x06, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x12, 0x3e, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, + 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x73, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, + 0x74, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x5f, 0x65, 0x6e, 0x64, 0x70, + 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74, 0x72, 0x69, 0x73, + 0x61, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x77, 0x65, + 0x62, 0x73, 0x69, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x77, 0x65, 0x62, + 0x73, 0x69, 0x74, 0x65, 0x12, 0x57, 0x0a, 0x11, 0x62, 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, + 0x5f, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x2a, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x65, + 0x6c, 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x42, 0x75, 0x73, 0x69, 0x6e, + 0x65, 0x73, 0x73, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x10, 0x62, 0x75, 0x73, + 0x69, 0x6e, 0x65, 0x73, 0x73, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x4b, 0x0a, + 0x0d, 0x76, 0x61, 0x73, 0x70, 0x5f, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, + 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x56, 0x41, 0x53, 0x50, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x0c, 0x76, 0x61, + 0x73, 0x70, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x73, + 0x74, 0x61, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x5f, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0d, 0x65, 0x73, 0x74, 0x61, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x4f, + 0x6e, 0x12, 0x42, 0x0a, 0x05, 0x74, 0x72, 0x69, 0x78, 0x6f, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2c, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x6d, 0x6f, 0x64, + 0x65, 0x6c, 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x54, 0x52, 0x49, 0x58, + 0x4f, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x6e, 0x61, 0x69, 0x72, 0x65, 0x52, 0x05, + 0x74, 0x72, 0x69, 0x78, 0x6f, 0x22, 0x86, 0x02, 0x0a, 0x0d, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x65, 0x72, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x32, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, + 0x64, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x45, + 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x31, 0x0a, 0x14, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x65, 0x72, 0x65, 0x64, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1f, + 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x43, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x2b, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x65, + 0x6c, 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x73, + 0x0a, 0x0d, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x31, 0x0a, 0x14, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x5f, 0x64, 0x69, + 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, + 0x72, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x4e, + 0x61, 0x6d, 0x65, 0x22, 0xc2, 0x03, 0x0a, 0x0b, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, + 0x70, 0x6c, 0x79, 0x12, 0x32, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, + 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x31, 0x0a, 0x14, 0x72, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x65, 0x72, 0x65, 0x64, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, + 0x64, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x65, + 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, + 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x58, 0x0a, 0x14, 0x69, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, + 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x13, 0x69, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x65, 0x12, 0x56, 0x0a, 0x13, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x65, 0x72, + 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, + 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, + 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x12, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x43, 0x65, + 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, + 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x76, 0x65, 0x72, 0x69, 0x66, + 0x69, 0x65, 0x64, 0x5f, 0x6f, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x76, 0x65, + 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x4f, 0x6e, 0x22, 0xfd, 0x01, 0x0a, 0x0d, 0x53, 0x65, 0x61, + 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, + 0x0a, 0x07, 0x77, 0x65, 0x62, 0x73, 0x69, 0x74, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x07, 0x77, 0x65, 0x62, 0x73, 0x69, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x72, 0x79, 0x12, 0x57, 0x0a, 0x11, 0x62, 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x5f, 0x63, + 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x2a, 0x2e, + 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x42, 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, + 0x73, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x10, 0x62, 0x75, 0x73, 0x69, 0x6e, + 0x65, 0x73, 0x73, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x4b, 0x0a, 0x0d, 0x76, + 0x61, 0x73, 0x70, 0x5f, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x09, 0x20, 0x03, + 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x6d, + 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x56, 0x41, + 0x53, 0x50, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x0c, 0x76, 0x61, 0x73, 0x70, + 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x22, 0x91, 0x02, 0x0a, 0x0b, 0x53, 0x65, 0x61, + 0x72, 0x63, 0x68, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x32, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, + 0x67, 0x64, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x43, 0x0a, 0x07, + 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, + 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x70, 0x6c, + 0x79, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x73, 0x1a, 0x88, 0x01, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x31, 0x0a, 0x14, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, + 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x72, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, + 0x1f, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x22, 0x73, 0x0a, 0x0d, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x31, 0x0a, + 0x14, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x5f, 0x64, 0x69, 0x72, 0x65, + 0x63, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, + 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, + 0x65, 0x22, 0xd5, 0x02, 0x0a, 0x0b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, + 0x79, 0x12, 0x32, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1c, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, + 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x5c, 0x0a, 0x13, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x6d, + 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x56, 0x65, + 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, + 0x12, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x12, 0x4d, 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x74, 0x72, + 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, 0x6f, + 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, + 0x64, 0x4f, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x69, 0x72, 0x73, 0x74, 0x5f, 0x6c, 0x69, 0x73, + 0x74, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x66, 0x69, 0x72, 0x73, 0x74, + 0x4c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6c, 0x61, + 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x22, 0x3a, 0x0a, 0x12, 0x56, 0x65, 0x72, + 0x69, 0x66, 0x79, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xcd, 0x01, 0x0a, 0x10, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, + 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x32, 0x0a, 0x05, 0x65, 0x72, + 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x72, 0x69, 0x73, + 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x43, + 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, + 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, + 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x26, 0x0a, + 0x0e, 0x70, 0x6b, 0x63, 0x73, 0x31, 0x32, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x70, 0x6b, 0x63, 0x73, 0x31, 0x32, 0x70, 0x61, 0x73, + 0x73, 0x77, 0x6f, 0x72, 0x64, 0x32, 0xbd, 0x01, 0x0a, 0x0f, 0x54, 0x52, 0x49, 0x53, 0x41, 0x43, + 0x6f, 0x6d, 0x70, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x54, 0x0a, 0x06, 0x4c, 0x6f, 0x6f, + 0x6b, 0x75, 0x70, 0x12, 0x24, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, + 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x74, 0x72, 0x69, 0x73, + 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, + 0x54, 0x0a, 0x06, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x24, 0x2e, 0x74, 0x72, 0x69, 0x73, + 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x22, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, + 0x70, 0x6c, 0x79, 0x22, 0x00, 0x32, 0xa7, 0x02, 0x0a, 0x0e, 0x54, 0x52, 0x49, 0x53, 0x41, 0x44, + 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x5a, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x65, 0x72, 0x12, 0x26, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x74, + 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x70, + 0x6c, 0x79, 0x22, 0x00, 0x12, 0x63, 0x0a, 0x0b, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x45, 0x6d, + 0x61, 0x69, 0x6c, 0x12, 0x29, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x56, 0x65, 0x72, 0x69, + 0x66, 0x79, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, + 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x45, 0x6d, 0x61, + 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x54, 0x0a, 0x06, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x12, 0x24, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x74, 0x72, 0x69, 0x73, + 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, + 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x72, + 0x69, 0x73, 0x61, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2f, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2f, + 0x70, 0x6b, 0x67, 0x2f, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2f, 0x67, 0x64, 0x73, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_trisa_gds_api_v1beta1_api_proto_rawDescOnce sync.Once + file_trisa_gds_api_v1beta1_api_proto_rawDescData = file_trisa_gds_api_v1beta1_api_proto_rawDesc +) + +func file_trisa_gds_api_v1beta1_api_proto_rawDescGZIP() []byte { + file_trisa_gds_api_v1beta1_api_proto_rawDescOnce.Do(func() { + file_trisa_gds_api_v1beta1_api_proto_rawDescData = protoimpl.X.CompressGZIP(file_trisa_gds_api_v1beta1_api_proto_rawDescData) + }) + return file_trisa_gds_api_v1beta1_api_proto_rawDescData +} + +var file_trisa_gds_api_v1beta1_api_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_trisa_gds_api_v1beta1_api_proto_goTypes = []interface{}{ + (*Error)(nil), // 0: trisa.gds.api.v1beta1.Error + (*RegisterRequest)(nil), // 1: trisa.gds.api.v1beta1.RegisterRequest + (*RegisterReply)(nil), // 2: trisa.gds.api.v1beta1.RegisterReply + (*LookupRequest)(nil), // 3: trisa.gds.api.v1beta1.LookupRequest + (*LookupReply)(nil), // 4: trisa.gds.api.v1beta1.LookupReply + (*SearchRequest)(nil), // 5: trisa.gds.api.v1beta1.SearchRequest + (*SearchReply)(nil), // 6: trisa.gds.api.v1beta1.SearchReply + (*StatusRequest)(nil), // 7: trisa.gds.api.v1beta1.StatusRequest + (*StatusReply)(nil), // 8: trisa.gds.api.v1beta1.StatusReply + (*VerifyEmailRequest)(nil), // 9: trisa.gds.api.v1beta1.VerifyEmailRequest + (*VerifyEmailReply)(nil), // 10: trisa.gds.api.v1beta1.VerifyEmailReply + (*SearchReply_Result)(nil), // 11: trisa.gds.api.v1beta1.SearchReply.Result + (*ivms101.LegalPerson)(nil), // 12: ivms101.LegalPerson + (*v1beta1.Contacts)(nil), // 13: trisa.gds.models.v1beta1.Contacts + (v1beta1.BusinessCategory)(0), // 14: trisa.gds.models.v1beta1.BusinessCategory + (v1beta1.VASPCategory)(0), // 15: trisa.gds.models.v1beta1.VASPCategory + (*v1beta1.TRIXOQuestionnaire)(nil), // 16: trisa.gds.models.v1beta1.TRIXOQuestionnaire + (v1beta1.VerificationState)(0), // 17: trisa.gds.models.v1beta1.VerificationState + (*v1beta1.Certificate)(nil), // 18: trisa.gds.models.v1beta1.Certificate + (v1beta1.ServiceState)(0), // 19: trisa.gds.models.v1beta1.ServiceState +} +var file_trisa_gds_api_v1beta1_api_proto_depIdxs = []int32{ + 12, // 0: trisa.gds.api.v1beta1.RegisterRequest.entity:type_name -> ivms101.LegalPerson + 13, // 1: trisa.gds.api.v1beta1.RegisterRequest.contacts:type_name -> trisa.gds.models.v1beta1.Contacts + 14, // 2: trisa.gds.api.v1beta1.RegisterRequest.business_category:type_name -> trisa.gds.models.v1beta1.BusinessCategory + 15, // 3: trisa.gds.api.v1beta1.RegisterRequest.vasp_category:type_name -> trisa.gds.models.v1beta1.VASPCategory + 16, // 4: trisa.gds.api.v1beta1.RegisterRequest.trixo:type_name -> trisa.gds.models.v1beta1.TRIXOQuestionnaire + 0, // 5: trisa.gds.api.v1beta1.RegisterReply.error:type_name -> trisa.gds.api.v1beta1.Error + 17, // 6: trisa.gds.api.v1beta1.RegisterReply.status:type_name -> trisa.gds.models.v1beta1.VerificationState + 0, // 7: trisa.gds.api.v1beta1.LookupReply.error:type_name -> trisa.gds.api.v1beta1.Error + 18, // 8: trisa.gds.api.v1beta1.LookupReply.identity_certificate:type_name -> trisa.gds.models.v1beta1.Certificate + 18, // 9: trisa.gds.api.v1beta1.LookupReply.signing_certificate:type_name -> trisa.gds.models.v1beta1.Certificate + 14, // 10: trisa.gds.api.v1beta1.SearchRequest.business_category:type_name -> trisa.gds.models.v1beta1.BusinessCategory + 15, // 11: trisa.gds.api.v1beta1.SearchRequest.vasp_category:type_name -> trisa.gds.models.v1beta1.VASPCategory + 0, // 12: trisa.gds.api.v1beta1.SearchReply.error:type_name -> trisa.gds.api.v1beta1.Error + 11, // 13: trisa.gds.api.v1beta1.SearchReply.results:type_name -> trisa.gds.api.v1beta1.SearchReply.Result + 0, // 14: trisa.gds.api.v1beta1.StatusReply.error:type_name -> trisa.gds.api.v1beta1.Error + 17, // 15: trisa.gds.api.v1beta1.StatusReply.verification_status:type_name -> trisa.gds.models.v1beta1.VerificationState + 19, // 16: trisa.gds.api.v1beta1.StatusReply.service_status:type_name -> trisa.gds.models.v1beta1.ServiceState + 0, // 17: trisa.gds.api.v1beta1.VerifyEmailReply.error:type_name -> trisa.gds.api.v1beta1.Error + 17, // 18: trisa.gds.api.v1beta1.VerifyEmailReply.status:type_name -> trisa.gds.models.v1beta1.VerificationState + 3, // 19: trisa.gds.api.v1beta1.TRISACompliance.Lookup:input_type -> trisa.gds.api.v1beta1.LookupRequest + 5, // 20: trisa.gds.api.v1beta1.TRISACompliance.Search:input_type -> trisa.gds.api.v1beta1.SearchRequest + 1, // 21: trisa.gds.api.v1beta1.TRISADirectory.Register:input_type -> trisa.gds.api.v1beta1.RegisterRequest + 9, // 22: trisa.gds.api.v1beta1.TRISADirectory.VerifyEmail:input_type -> trisa.gds.api.v1beta1.VerifyEmailRequest + 7, // 23: trisa.gds.api.v1beta1.TRISADirectory.Status:input_type -> trisa.gds.api.v1beta1.StatusRequest + 4, // 24: trisa.gds.api.v1beta1.TRISACompliance.Lookup:output_type -> trisa.gds.api.v1beta1.LookupReply + 6, // 25: trisa.gds.api.v1beta1.TRISACompliance.Search:output_type -> trisa.gds.api.v1beta1.SearchReply + 2, // 26: trisa.gds.api.v1beta1.TRISADirectory.Register:output_type -> trisa.gds.api.v1beta1.RegisterReply + 10, // 27: trisa.gds.api.v1beta1.TRISADirectory.VerifyEmail:output_type -> trisa.gds.api.v1beta1.VerifyEmailReply + 8, // 28: trisa.gds.api.v1beta1.TRISADirectory.Status:output_type -> trisa.gds.api.v1beta1.StatusReply + 24, // [24:29] is the sub-list for method output_type + 19, // [19:24] is the sub-list for method input_type + 19, // [19:19] is the sub-list for extension type_name + 19, // [19:19] is the sub-list for extension extendee + 0, // [0:19] is the sub-list for field type_name +} + +func init() { file_trisa_gds_api_v1beta1_api_proto_init() } +func file_trisa_gds_api_v1beta1_api_proto_init() { + if File_trisa_gds_api_v1beta1_api_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_trisa_gds_api_v1beta1_api_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Error); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trisa_gds_api_v1beta1_api_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RegisterRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trisa_gds_api_v1beta1_api_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RegisterReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trisa_gds_api_v1beta1_api_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LookupRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trisa_gds_api_v1beta1_api_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LookupReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trisa_gds_api_v1beta1_api_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trisa_gds_api_v1beta1_api_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trisa_gds_api_v1beta1_api_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StatusRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trisa_gds_api_v1beta1_api_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StatusReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trisa_gds_api_v1beta1_api_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VerifyEmailRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trisa_gds_api_v1beta1_api_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VerifyEmailReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trisa_gds_api_v1beta1_api_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchReply_Result); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_trisa_gds_api_v1beta1_api_proto_rawDesc, + NumEnums: 0, + NumMessages: 12, + NumExtensions: 0, + NumServices: 2, + }, + GoTypes: file_trisa_gds_api_v1beta1_api_proto_goTypes, + DependencyIndexes: file_trisa_gds_api_v1beta1_api_proto_depIdxs, + MessageInfos: file_trisa_gds_api_v1beta1_api_proto_msgTypes, + }.Build() + File_trisa_gds_api_v1beta1_api_proto = out.File + file_trisa_gds_api_v1beta1_api_proto_rawDesc = nil + file_trisa_gds_api_v1beta1_api_proto_goTypes = nil + file_trisa_gds_api_v1beta1_api_proto_depIdxs = nil +} diff --git a/pkg/trisa/gds/api/v1beta1/api_grpc.pb.go b/pkg/trisa/gds/api/v1beta1/api_grpc.pb.go new file mode 100644 index 0000000..fc17b62 --- /dev/null +++ b/pkg/trisa/gds/api/v1beta1/api_grpc.pb.go @@ -0,0 +1,294 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package api + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion7 + +// TRISAComplianceClient is the client API for TRISACompliance service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type TRISAComplianceClient interface { + // Interactions with the GDS during a TRISA transfer + Lookup(ctx context.Context, in *LookupRequest, opts ...grpc.CallOption) (*LookupReply, error) + Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchReply, error) +} + +type tRISAComplianceClient struct { + cc grpc.ClientConnInterface +} + +func NewTRISAComplianceClient(cc grpc.ClientConnInterface) TRISAComplianceClient { + return &tRISAComplianceClient{cc} +} + +func (c *tRISAComplianceClient) Lookup(ctx context.Context, in *LookupRequest, opts ...grpc.CallOption) (*LookupReply, error) { + out := new(LookupReply) + err := c.cc.Invoke(ctx, "/trisa.gds.api.v1beta1.TRISACompliance/Lookup", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tRISAComplianceClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchReply, error) { + out := new(SearchReply) + err := c.cc.Invoke(ctx, "/trisa.gds.api.v1beta1.TRISACompliance/Search", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// TRISAComplianceServer is the server API for TRISACompliance service. +// All implementations must embed UnimplementedTRISAComplianceServer +// for forward compatibility +type TRISAComplianceServer interface { + // Interactions with the GDS during a TRISA transfer + Lookup(context.Context, *LookupRequest) (*LookupReply, error) + Search(context.Context, *SearchRequest) (*SearchReply, error) + mustEmbedUnimplementedTRISAComplianceServer() +} + +// UnimplementedTRISAComplianceServer must be embedded to have forward compatible implementations. +type UnimplementedTRISAComplianceServer struct { +} + +func (UnimplementedTRISAComplianceServer) Lookup(context.Context, *LookupRequest) (*LookupReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method Lookup not implemented") +} +func (UnimplementedTRISAComplianceServer) Search(context.Context, *SearchRequest) (*SearchReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method Search not implemented") +} +func (UnimplementedTRISAComplianceServer) mustEmbedUnimplementedTRISAComplianceServer() {} + +// UnsafeTRISAComplianceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to TRISAComplianceServer will +// result in compilation errors. +type UnsafeTRISAComplianceServer interface { + mustEmbedUnimplementedTRISAComplianceServer() +} + +func RegisterTRISAComplianceServer(s grpc.ServiceRegistrar, srv TRISAComplianceServer) { + s.RegisterService(&_TRISACompliance_serviceDesc, srv) +} + +func _TRISACompliance_Lookup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LookupRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TRISAComplianceServer).Lookup(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/trisa.gds.api.v1beta1.TRISACompliance/Lookup", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TRISAComplianceServer).Lookup(ctx, req.(*LookupRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _TRISACompliance_Search_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SearchRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TRISAComplianceServer).Search(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/trisa.gds.api.v1beta1.TRISACompliance/Search", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TRISAComplianceServer).Search(ctx, req.(*SearchRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _TRISACompliance_serviceDesc = grpc.ServiceDesc{ + ServiceName: "trisa.gds.api.v1beta1.TRISACompliance", + HandlerType: (*TRISAComplianceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Lookup", + Handler: _TRISACompliance_Lookup_Handler, + }, + { + MethodName: "Search", + Handler: _TRISACompliance_Search_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "trisa/gds/api/v1beta1/api.proto", +} + +// TRISADirectoryClient is the client API for TRISADirectory service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type TRISADirectoryClient interface { + // Registration + Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterReply, error) + VerifyEmail(ctx context.Context, in *VerifyEmailRequest, opts ...grpc.CallOption) (*VerifyEmailReply, error) + // TODO: change to Info/Registration Status + Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusReply, error) +} + +type tRISADirectoryClient struct { + cc grpc.ClientConnInterface +} + +func NewTRISADirectoryClient(cc grpc.ClientConnInterface) TRISADirectoryClient { + return &tRISADirectoryClient{cc} +} + +func (c *tRISADirectoryClient) Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterReply, error) { + out := new(RegisterReply) + err := c.cc.Invoke(ctx, "/trisa.gds.api.v1beta1.TRISADirectory/Register", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tRISADirectoryClient) VerifyEmail(ctx context.Context, in *VerifyEmailRequest, opts ...grpc.CallOption) (*VerifyEmailReply, error) { + out := new(VerifyEmailReply) + err := c.cc.Invoke(ctx, "/trisa.gds.api.v1beta1.TRISADirectory/VerifyEmail", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *tRISADirectoryClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusReply, error) { + out := new(StatusReply) + err := c.cc.Invoke(ctx, "/trisa.gds.api.v1beta1.TRISADirectory/Status", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// TRISADirectoryServer is the server API for TRISADirectory service. +// All implementations must embed UnimplementedTRISADirectoryServer +// for forward compatibility +type TRISADirectoryServer interface { + // Registration + Register(context.Context, *RegisterRequest) (*RegisterReply, error) + VerifyEmail(context.Context, *VerifyEmailRequest) (*VerifyEmailReply, error) + // TODO: change to Info/Registration Status + Status(context.Context, *StatusRequest) (*StatusReply, error) + mustEmbedUnimplementedTRISADirectoryServer() +} + +// UnimplementedTRISADirectoryServer must be embedded to have forward compatible implementations. +type UnimplementedTRISADirectoryServer struct { +} + +func (UnimplementedTRISADirectoryServer) Register(context.Context, *RegisterRequest) (*RegisterReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method Register not implemented") +} +func (UnimplementedTRISADirectoryServer) VerifyEmail(context.Context, *VerifyEmailRequest) (*VerifyEmailReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method VerifyEmail not implemented") +} +func (UnimplementedTRISADirectoryServer) Status(context.Context, *StatusRequest) (*StatusReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") +} +func (UnimplementedTRISADirectoryServer) mustEmbedUnimplementedTRISADirectoryServer() {} + +// UnsafeTRISADirectoryServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to TRISADirectoryServer will +// result in compilation errors. +type UnsafeTRISADirectoryServer interface { + mustEmbedUnimplementedTRISADirectoryServer() +} + +func RegisterTRISADirectoryServer(s grpc.ServiceRegistrar, srv TRISADirectoryServer) { + s.RegisterService(&_TRISADirectory_serviceDesc, srv) +} + +func _TRISADirectory_Register_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RegisterRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TRISADirectoryServer).Register(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/trisa.gds.api.v1beta1.TRISADirectory/Register", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TRISADirectoryServer).Register(ctx, req.(*RegisterRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _TRISADirectory_VerifyEmail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VerifyEmailRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TRISADirectoryServer).VerifyEmail(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/trisa.gds.api.v1beta1.TRISADirectory/VerifyEmail", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TRISADirectoryServer).VerifyEmail(ctx, req.(*VerifyEmailRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _TRISADirectory_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TRISADirectoryServer).Status(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/trisa.gds.api.v1beta1.TRISADirectory/Status", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TRISADirectoryServer).Status(ctx, req.(*StatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _TRISADirectory_serviceDesc = grpc.ServiceDesc{ + ServiceName: "trisa.gds.api.v1beta1.TRISADirectory", + HandlerType: (*TRISADirectoryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Register", + Handler: _TRISADirectory_Register_Handler, + }, + { + MethodName: "VerifyEmail", + Handler: _TRISADirectory_VerifyEmail_Handler, + }, + { + MethodName: "Status", + Handler: _TRISADirectory_Status_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "trisa/gds/api/v1beta1/api.proto", +} diff --git a/pkg/trisa/gds/api/v1beta1/generate.go b/pkg/trisa/gds/api/v1beta1/generate.go new file mode 100644 index 0000000..30d98fb --- /dev/null +++ b/pkg/trisa/gds/api/v1beta1/generate.go @@ -0,0 +1,3 @@ +package api + +//go:generate protoc -I=../../../../../proto --go_out=. --go_opt=module=github.com/trisacrypto/trisa/pkg/trisa/gds/api/v1beta1 --go-grpc_out=. --go-grpc_opt=module=github.com/trisacrypto/trisa/pkg/trisa/gds/api/v1beta1 trisa/gds/api/v1beta1/api.proto diff --git a/pkg/trisa/gds/models/v1beta1/ca.pb.go b/pkg/trisa/gds/models/v1beta1/ca.pb.go new file mode 100644 index 0000000..132b939 --- /dev/null +++ b/pkg/trisa/gds/models/v1beta1/ca.pb.go @@ -0,0 +1,733 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.14.0 +// source: trisa/gds/models/v1beta1/ca.proto + +package models + +import ( + proto "github.com/golang/protobuf/proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type CertificateRequestState int32 + +const ( + CertificateRequestState_INITIALIZED CertificateRequestState = 0 + CertificateRequestState_READY_TO_SUBMIT CertificateRequestState = 1 + CertificateRequestState_PROCESSING CertificateRequestState = 2 + CertificateRequestState_DOWNLOADING CertificateRequestState = 3 + CertificateRequestState_DOWNLOADED CertificateRequestState = 4 + CertificateRequestState_COMPLETED CertificateRequestState = 5 + CertificateRequestState_CR_REJECTED CertificateRequestState = 6 + CertificateRequestState_CR_ERRORED CertificateRequestState = 7 +) + +// Enum value maps for CertificateRequestState. +var ( + CertificateRequestState_name = map[int32]string{ + 0: "INITIALIZED", + 1: "READY_TO_SUBMIT", + 2: "PROCESSING", + 3: "DOWNLOADING", + 4: "DOWNLOADED", + 5: "COMPLETED", + 6: "CR_REJECTED", + 7: "CR_ERRORED", + } + CertificateRequestState_value = map[string]int32{ + "INITIALIZED": 0, + "READY_TO_SUBMIT": 1, + "PROCESSING": 2, + "DOWNLOADING": 3, + "DOWNLOADED": 4, + "COMPLETED": 5, + "CR_REJECTED": 6, + "CR_ERRORED": 7, + } +) + +func (x CertificateRequestState) Enum() *CertificateRequestState { + p := new(CertificateRequestState) + *p = x + return p +} + +func (x CertificateRequestState) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (CertificateRequestState) Descriptor() protoreflect.EnumDescriptor { + return file_trisa_gds_models_v1beta1_ca_proto_enumTypes[0].Descriptor() +} + +func (CertificateRequestState) Type() protoreflect.EnumType { + return &file_trisa_gds_models_v1beta1_ca_proto_enumTypes[0] +} + +func (x CertificateRequestState) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use CertificateRequestState.Descriptor instead. +func (CertificateRequestState) EnumDescriptor() ([]byte, []int) { + return file_trisa_gds_models_v1beta1_ca_proto_rawDescGZIP(), []int{0} +} + +// Certificate requests are maintained separately from the VASP record since they should +// not be replicated. E.g. every directory process is responsible for certificate +// issuance and only public keys and certificate metadata should be exchanged between +// directories. +type CertificateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // ID only needs to be unique with the requesting directory service. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // VASP information for the request + Vasp string `protobuf:"bytes,2,opt,name=vasp,proto3" json:"vasp,omitempty"` + CommonName string `protobuf:"bytes,3,opt,name=common_name,json=commonName,proto3" json:"common_name,omitempty"` + // Request pipeline status + Status CertificateRequestState `protobuf:"varint,4,opt,name=status,proto3,enum=trisa.gds.models.v1beta1.CertificateRequestState" json:"status,omitempty"` + // Sectigo create single certificate batch metadata + AuthorityId int64 `protobuf:"varint,5,opt,name=authority_id,json=authorityId,proto3" json:"authority_id,omitempty"` + BatchId int64 `protobuf:"varint,6,opt,name=batch_id,json=batchId,proto3" json:"batch_id,omitempty"` + BatchName string `protobuf:"bytes,7,opt,name=batch_name,json=batchName,proto3" json:"batch_name,omitempty"` + BatchStatus string `protobuf:"bytes,8,opt,name=batch_status,json=batchStatus,proto3" json:"batch_status,omitempty"` + OrderNumber int64 `protobuf:"varint,9,opt,name=order_number,json=orderNumber,proto3" json:"order_number,omitempty"` + CreationDate string `protobuf:"bytes,10,opt,name=creation_date,json=creationDate,proto3" json:"creation_date,omitempty"` + Profile string `protobuf:"bytes,11,opt,name=profile,proto3" json:"profile,omitempty"` + RejectReason string `protobuf:"bytes,12,opt,name=reject_reason,json=rejectReason,proto3" json:"reject_reason,omitempty"` + // Currently there is no choice but to store the PKCS12 password on the server + // because the certificate issuance command is separated in time by human review, + // which means it cannot be ephemerally kept in memory during the certificate + // generation request handoff. Moreover, the value cannot be hashed since it must + // be sent in plaintext via the Sectigo API and used to decrypt the downloaded + // packet in order to retrieve the public key material. To mitigate issues with the + // storage of this data, it is encrypted so that only a directory service with the + // correct secret key (e.g. the directory service process that created the request) + // can read the original value. Because this value should not be replicated it is + // stored in the certificate request which is maintained by independent replicas. + Pkcs12Password []byte `protobuf:"bytes,13,opt,name=pkcs12password,proto3" json:"pkcs12password,omitempty"` + Pkcs12Signature []byte `protobuf:"bytes,14,opt,name=pkcs12signature,proto3" json:"pkcs12signature,omitempty"` + // Logging information timestamps + Created string `protobuf:"bytes,15,opt,name=created,proto3" json:"created,omitempty"` + Modified string `protobuf:"bytes,16,opt,name=modified,proto3" json:"modified,omitempty"` +} + +func (x *CertificateRequest) Reset() { + *x = CertificateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_gds_models_v1beta1_ca_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CertificateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CertificateRequest) ProtoMessage() {} + +func (x *CertificateRequest) ProtoReflect() protoreflect.Message { + mi := &file_trisa_gds_models_v1beta1_ca_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CertificateRequest.ProtoReflect.Descriptor instead. +func (*CertificateRequest) Descriptor() ([]byte, []int) { + return file_trisa_gds_models_v1beta1_ca_proto_rawDescGZIP(), []int{0} +} + +func (x *CertificateRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *CertificateRequest) GetVasp() string { + if x != nil { + return x.Vasp + } + return "" +} + +func (x *CertificateRequest) GetCommonName() string { + if x != nil { + return x.CommonName + } + return "" +} + +func (x *CertificateRequest) GetStatus() CertificateRequestState { + if x != nil { + return x.Status + } + return CertificateRequestState_INITIALIZED +} + +func (x *CertificateRequest) GetAuthorityId() int64 { + if x != nil { + return x.AuthorityId + } + return 0 +} + +func (x *CertificateRequest) GetBatchId() int64 { + if x != nil { + return x.BatchId + } + return 0 +} + +func (x *CertificateRequest) GetBatchName() string { + if x != nil { + return x.BatchName + } + return "" +} + +func (x *CertificateRequest) GetBatchStatus() string { + if x != nil { + return x.BatchStatus + } + return "" +} + +func (x *CertificateRequest) GetOrderNumber() int64 { + if x != nil { + return x.OrderNumber + } + return 0 +} + +func (x *CertificateRequest) GetCreationDate() string { + if x != nil { + return x.CreationDate + } + return "" +} + +func (x *CertificateRequest) GetProfile() string { + if x != nil { + return x.Profile + } + return "" +} + +func (x *CertificateRequest) GetRejectReason() string { + if x != nil { + return x.RejectReason + } + return "" +} + +func (x *CertificateRequest) GetPkcs12Password() []byte { + if x != nil { + return x.Pkcs12Password + } + return nil +} + +func (x *CertificateRequest) GetPkcs12Signature() []byte { + if x != nil { + return x.Pkcs12Signature + } + return nil +} + +func (x *CertificateRequest) GetCreated() string { + if x != nil { + return x.Created + } + return "" +} + +func (x *CertificateRequest) GetModified() string { + if x != nil { + return x.Modified + } + return "" +} + +type Certificate struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // x.509 metadata information for ease of reference + // note that the serial number as a hex string can be used with the Sectigo API + Version int64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` + SerialNumber []byte `protobuf:"bytes,2,opt,name=serial_number,json=serialNumber,proto3" json:"serial_number,omitempty"` + Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"` + SignatureAlgorithm string `protobuf:"bytes,4,opt,name=signature_algorithm,json=signatureAlgorithm,proto3" json:"signature_algorithm,omitempty"` + PublicKeyAlgorithm string `protobuf:"bytes,5,opt,name=public_key_algorithm,json=publicKeyAlgorithm,proto3" json:"public_key_algorithm,omitempty"` + // Issuer and subject information from Sectigo + Subject *Name `protobuf:"bytes,6,opt,name=subject,proto3" json:"subject,omitempty"` + Issuer *Name `protobuf:"bytes,7,opt,name=issuer,proto3" json:"issuer,omitempty"` + // Validity information + NotBefore string `protobuf:"bytes,8,opt,name=not_before,json=notBefore,proto3" json:"not_before,omitempty"` + NotAfter string `protobuf:"bytes,9,opt,name=not_after,json=notAfter,proto3" json:"not_after,omitempty"` + Revoked bool `protobuf:"varint,10,opt,name=revoked,proto3" json:"revoked,omitempty"` + // The ASN1 encoded full certificate without the trust chain + Data []byte `protobuf:"bytes,11,opt,name=data,proto3" json:"data,omitempty"` + // The complete trust chain including the leaf certificate as a gzip compressed + // PEM encoded file. This field can be deserialized into a trust.Provider. + Chain []byte `protobuf:"bytes,12,opt,name=chain,proto3" json:"chain,omitempty"` +} + +func (x *Certificate) Reset() { + *x = Certificate{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_gds_models_v1beta1_ca_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Certificate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Certificate) ProtoMessage() {} + +func (x *Certificate) ProtoReflect() protoreflect.Message { + mi := &file_trisa_gds_models_v1beta1_ca_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Certificate.ProtoReflect.Descriptor instead. +func (*Certificate) Descriptor() ([]byte, []int) { + return file_trisa_gds_models_v1beta1_ca_proto_rawDescGZIP(), []int{1} +} + +func (x *Certificate) GetVersion() int64 { + if x != nil { + return x.Version + } + return 0 +} + +func (x *Certificate) GetSerialNumber() []byte { + if x != nil { + return x.SerialNumber + } + return nil +} + +func (x *Certificate) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +func (x *Certificate) GetSignatureAlgorithm() string { + if x != nil { + return x.SignatureAlgorithm + } + return "" +} + +func (x *Certificate) GetPublicKeyAlgorithm() string { + if x != nil { + return x.PublicKeyAlgorithm + } + return "" +} + +func (x *Certificate) GetSubject() *Name { + if x != nil { + return x.Subject + } + return nil +} + +func (x *Certificate) GetIssuer() *Name { + if x != nil { + return x.Issuer + } + return nil +} + +func (x *Certificate) GetNotBefore() string { + if x != nil { + return x.NotBefore + } + return "" +} + +func (x *Certificate) GetNotAfter() string { + if x != nil { + return x.NotAfter + } + return "" +} + +func (x *Certificate) GetRevoked() bool { + if x != nil { + return x.Revoked + } + return false +} + +func (x *Certificate) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +func (x *Certificate) GetChain() []byte { + if x != nil { + return x.Chain + } + return nil +} + +// An X.509 distinguished name with the common elements of a DN. +type Name struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CommonName string `protobuf:"bytes,1,opt,name=common_name,json=commonName,proto3" json:"common_name,omitempty"` + SerialNumber string `protobuf:"bytes,2,opt,name=serial_number,json=serialNumber,proto3" json:"serial_number,omitempty"` + Organization []string `protobuf:"bytes,3,rep,name=organization,proto3" json:"organization,omitempty"` + OrganizationalUnit []string `protobuf:"bytes,4,rep,name=organizational_unit,json=organizationalUnit,proto3" json:"organizational_unit,omitempty"` + StreetAddress []string `protobuf:"bytes,5,rep,name=street_address,json=streetAddress,proto3" json:"street_address,omitempty"` + Locality []string `protobuf:"bytes,6,rep,name=locality,proto3" json:"locality,omitempty"` + Province []string `protobuf:"bytes,7,rep,name=province,proto3" json:"province,omitempty"` + PostalCode []string `protobuf:"bytes,8,rep,name=postal_code,json=postalCode,proto3" json:"postal_code,omitempty"` + Country []string `protobuf:"bytes,9,rep,name=country,proto3" json:"country,omitempty"` +} + +func (x *Name) Reset() { + *x = Name{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_gds_models_v1beta1_ca_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Name) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Name) ProtoMessage() {} + +func (x *Name) ProtoReflect() protoreflect.Message { + mi := &file_trisa_gds_models_v1beta1_ca_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Name.ProtoReflect.Descriptor instead. +func (*Name) Descriptor() ([]byte, []int) { + return file_trisa_gds_models_v1beta1_ca_proto_rawDescGZIP(), []int{2} +} + +func (x *Name) GetCommonName() string { + if x != nil { + return x.CommonName + } + return "" +} + +func (x *Name) GetSerialNumber() string { + if x != nil { + return x.SerialNumber + } + return "" +} + +func (x *Name) GetOrganization() []string { + if x != nil { + return x.Organization + } + return nil +} + +func (x *Name) GetOrganizationalUnit() []string { + if x != nil { + return x.OrganizationalUnit + } + return nil +} + +func (x *Name) GetStreetAddress() []string { + if x != nil { + return x.StreetAddress + } + return nil +} + +func (x *Name) GetLocality() []string { + if x != nil { + return x.Locality + } + return nil +} + +func (x *Name) GetProvince() []string { + if x != nil { + return x.Province + } + return nil +} + +func (x *Name) GetPostalCode() []string { + if x != nil { + return x.PostalCode + } + return nil +} + +func (x *Name) GetCountry() []string { + if x != nil { + return x.Country + } + return nil +} + +var File_trisa_gds_models_v1beta1_ca_proto protoreflect.FileDescriptor + +var file_trisa_gds_models_v1beta1_ca_proto_rawDesc = []byte{ + 0x0a, 0x21, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2f, 0x67, 0x64, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, + 0x6c, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x61, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x18, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x6d, + 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x22, 0xb3, 0x04, + 0x0a, 0x12, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x76, 0x61, 0x73, 0x70, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x76, 0x61, 0x73, 0x70, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x49, 0x0a, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x74, 0x72, 0x69, 0x73, + 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, + 0x79, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x61, 0x74, 0x63, 0x68, + 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x62, 0x61, 0x74, 0x63, 0x68, + 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x61, 0x74, 0x63, 0x68, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x74, 0x63, 0x68, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6f, 0x72, 0x64, 0x65, + 0x72, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, + 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, + 0x5f, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, + 0x65, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x70, + 0x6b, 0x63, 0x73, 0x31, 0x32, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x0d, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x70, 0x6b, 0x63, 0x73, 0x31, 0x32, 0x70, 0x61, 0x73, 0x73, 0x77, + 0x6f, 0x72, 0x64, 0x12, 0x28, 0x0a, 0x0f, 0x70, 0x6b, 0x63, 0x73, 0x31, 0x32, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x70, 0x6b, + 0x63, 0x73, 0x31, 0x32, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x18, 0x0a, + 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x6f, 0x64, 0x69, 0x66, + 0x69, 0x65, 0x64, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x6f, 0x64, 0x69, 0x66, + 0x69, 0x65, 0x64, 0x22, 0xbf, 0x03, 0x0a, 0x0b, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, + 0x0d, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x12, 0x2f, 0x0a, 0x13, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x61, 0x6c, + 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, + 0x6d, 0x12, 0x30, 0x0a, 0x14, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x5f, + 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x12, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, + 0x74, 0x68, 0x6d, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, + 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x36, 0x0a, + 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, + 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x06, 0x69, + 0x73, 0x73, 0x75, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x6f, 0x74, 0x5f, 0x62, 0x65, 0x66, + 0x6f, 0x72, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x6f, 0x74, 0x42, 0x65, + 0x66, 0x6f, 0x72, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x6f, 0x74, 0x5f, 0x61, 0x66, 0x74, 0x65, + 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x6f, 0x74, 0x41, 0x66, 0x74, 0x65, + 0x72, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x64, 0x18, 0x0a, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, + 0x61, 0x74, 0x61, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, + 0x14, 0x0a, 0x05, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, + 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0xbb, 0x02, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, + 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x23, 0x0a, 0x0d, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x4e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x12, 0x22, 0x0a, 0x0c, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2f, 0x0a, 0x13, 0x6f, 0x72, 0x67, 0x61, + 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x18, + 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x74, 0x72, + 0x65, 0x65, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x0d, 0x73, 0x74, 0x72, 0x65, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x1a, 0x0a, 0x08, + 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, + 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, 0x73, 0x74, + 0x61, 0x6c, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x70, + 0x6f, 0x73, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x72, 0x79, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x72, 0x79, 0x2a, 0xa0, 0x01, 0x0a, 0x17, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, + 0x0f, 0x0a, 0x0b, 0x49, 0x4e, 0x49, 0x54, 0x49, 0x41, 0x4c, 0x49, 0x5a, 0x45, 0x44, 0x10, 0x00, + 0x12, 0x13, 0x0a, 0x0f, 0x52, 0x45, 0x41, 0x44, 0x59, 0x5f, 0x54, 0x4f, 0x5f, 0x53, 0x55, 0x42, + 0x4d, 0x49, 0x54, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x50, 0x52, 0x4f, 0x43, 0x45, 0x53, 0x53, + 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x44, 0x4f, 0x57, 0x4e, 0x4c, 0x4f, 0x41, + 0x44, 0x49, 0x4e, 0x47, 0x10, 0x03, 0x12, 0x0e, 0x0a, 0x0a, 0x44, 0x4f, 0x57, 0x4e, 0x4c, 0x4f, + 0x41, 0x44, 0x45, 0x44, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4f, 0x4d, 0x50, 0x4c, 0x45, + 0x54, 0x45, 0x44, 0x10, 0x05, 0x12, 0x0f, 0x0a, 0x0b, 0x43, 0x52, 0x5f, 0x52, 0x45, 0x4a, 0x45, + 0x43, 0x54, 0x45, 0x44, 0x10, 0x06, 0x12, 0x0e, 0x0a, 0x0a, 0x43, 0x52, 0x5f, 0x45, 0x52, 0x52, + 0x4f, 0x52, 0x45, 0x44, 0x10, 0x07, 0x42, 0x42, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x72, 0x69, 0x73, 0x61, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, + 0x2f, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x74, 0x72, 0x69, 0x73, 0x61, + 0x2f, 0x67, 0x64, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_trisa_gds_models_v1beta1_ca_proto_rawDescOnce sync.Once + file_trisa_gds_models_v1beta1_ca_proto_rawDescData = file_trisa_gds_models_v1beta1_ca_proto_rawDesc +) + +func file_trisa_gds_models_v1beta1_ca_proto_rawDescGZIP() []byte { + file_trisa_gds_models_v1beta1_ca_proto_rawDescOnce.Do(func() { + file_trisa_gds_models_v1beta1_ca_proto_rawDescData = protoimpl.X.CompressGZIP(file_trisa_gds_models_v1beta1_ca_proto_rawDescData) + }) + return file_trisa_gds_models_v1beta1_ca_proto_rawDescData +} + +var file_trisa_gds_models_v1beta1_ca_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_trisa_gds_models_v1beta1_ca_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_trisa_gds_models_v1beta1_ca_proto_goTypes = []interface{}{ + (CertificateRequestState)(0), // 0: trisa.gds.models.v1beta1.CertificateRequestState + (*CertificateRequest)(nil), // 1: trisa.gds.models.v1beta1.CertificateRequest + (*Certificate)(nil), // 2: trisa.gds.models.v1beta1.Certificate + (*Name)(nil), // 3: trisa.gds.models.v1beta1.Name +} +var file_trisa_gds_models_v1beta1_ca_proto_depIdxs = []int32{ + 0, // 0: trisa.gds.models.v1beta1.CertificateRequest.status:type_name -> trisa.gds.models.v1beta1.CertificateRequestState + 3, // 1: trisa.gds.models.v1beta1.Certificate.subject:type_name -> trisa.gds.models.v1beta1.Name + 3, // 2: trisa.gds.models.v1beta1.Certificate.issuer:type_name -> trisa.gds.models.v1beta1.Name + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_trisa_gds_models_v1beta1_ca_proto_init() } +func file_trisa_gds_models_v1beta1_ca_proto_init() { + if File_trisa_gds_models_v1beta1_ca_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_trisa_gds_models_v1beta1_ca_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CertificateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trisa_gds_models_v1beta1_ca_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Certificate); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trisa_gds_models_v1beta1_ca_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Name); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_trisa_gds_models_v1beta1_ca_proto_rawDesc, + NumEnums: 1, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_trisa_gds_models_v1beta1_ca_proto_goTypes, + DependencyIndexes: file_trisa_gds_models_v1beta1_ca_proto_depIdxs, + EnumInfos: file_trisa_gds_models_v1beta1_ca_proto_enumTypes, + MessageInfos: file_trisa_gds_models_v1beta1_ca_proto_msgTypes, + }.Build() + File_trisa_gds_models_v1beta1_ca_proto = out.File + file_trisa_gds_models_v1beta1_ca_proto_rawDesc = nil + file_trisa_gds_models_v1beta1_ca_proto_goTypes = nil + file_trisa_gds_models_v1beta1_ca_proto_depIdxs = nil +} diff --git a/pkg/trisa/gds/models/v1beta1/generate.go b/pkg/trisa/gds/models/v1beta1/generate.go new file mode 100644 index 0000000..45b9c67 --- /dev/null +++ b/pkg/trisa/gds/models/v1beta1/generate.go @@ -0,0 +1,3 @@ +package models + +//go:generate protoc -I=../../../../../proto --go_out=. --go_opt=module=github.com/trisacrypto/trisa/pkg/trisa/gds/models/v1beta1 --go-grpc_out=. --go-grpc_opt=module=github.com/trisacrypto/trisa/pkg/trisa/gds/models/v1beta1 trisa/gds/models/v1beta1/ca.proto trisa/gds/models/v1beta1/models.proto diff --git a/pkg/trisa/gds/models/v1beta1/models.pb.go b/pkg/trisa/gds/models/v1beta1/models.pb.go new file mode 100644 index 0000000..13e96be --- /dev/null +++ b/pkg/trisa/gds/models/v1beta1/models.pb.go @@ -0,0 +1,1232 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.14.0 +// source: trisa/gds/models/v1beta1/models.proto + +package models + +import ( + proto "github.com/golang/protobuf/proto" + ivms101 "github.com/trisacrypto/trisa/pkg/ivms101" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type BusinessCategory int32 + +const ( + BusinessCategory_UNKNOWN_ENTITY BusinessCategory = 0 + BusinessCategory_PRIVATE_ORGANIZATION BusinessCategory = 1 + BusinessCategory_GOVERNMENT_ENTITY BusinessCategory = 2 + BusinessCategory_BUSINESS_ENTITY BusinessCategory = 3 + BusinessCategory_NON_COMMERCIAL_ENTITY BusinessCategory = 4 +) + +// Enum value maps for BusinessCategory. +var ( + BusinessCategory_name = map[int32]string{ + 0: "UNKNOWN_ENTITY", + 1: "PRIVATE_ORGANIZATION", + 2: "GOVERNMENT_ENTITY", + 3: "BUSINESS_ENTITY", + 4: "NON_COMMERCIAL_ENTITY", + } + BusinessCategory_value = map[string]int32{ + "UNKNOWN_ENTITY": 0, + "PRIVATE_ORGANIZATION": 1, + "GOVERNMENT_ENTITY": 2, + "BUSINESS_ENTITY": 3, + "NON_COMMERCIAL_ENTITY": 4, + } +) + +func (x BusinessCategory) Enum() *BusinessCategory { + p := new(BusinessCategory) + *p = x + return p +} + +func (x BusinessCategory) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (BusinessCategory) Descriptor() protoreflect.EnumDescriptor { + return file_trisa_gds_models_v1beta1_models_proto_enumTypes[0].Descriptor() +} + +func (BusinessCategory) Type() protoreflect.EnumType { + return &file_trisa_gds_models_v1beta1_models_proto_enumTypes[0] +} + +func (x BusinessCategory) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use BusinessCategory.Descriptor instead. +func (BusinessCategory) EnumDescriptor() ([]byte, []int) { + return file_trisa_gds_models_v1beta1_models_proto_rawDescGZIP(), []int{0} +} + +type VASPCategory int32 + +const ( + VASPCategory_UNKNOWN_VASP VASPCategory = 0 + VASPCategory_ATM VASPCategory = 1 + VASPCategory_EXCHANGE VASPCategory = 2 + VASPCategory_HIGH_RISK_EXCHANGE VASPCategory = 3 +) + +// Enum value maps for VASPCategory. +var ( + VASPCategory_name = map[int32]string{ + 0: "UNKNOWN_VASP", + 1: "ATM", + 2: "EXCHANGE", + 3: "HIGH_RISK_EXCHANGE", + } + VASPCategory_value = map[string]int32{ + "UNKNOWN_VASP": 0, + "ATM": 1, + "EXCHANGE": 2, + "HIGH_RISK_EXCHANGE": 3, + } +) + +func (x VASPCategory) Enum() *VASPCategory { + p := new(VASPCategory) + *p = x + return p +} + +func (x VASPCategory) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (VASPCategory) Descriptor() protoreflect.EnumDescriptor { + return file_trisa_gds_models_v1beta1_models_proto_enumTypes[1].Descriptor() +} + +func (VASPCategory) Type() protoreflect.EnumType { + return &file_trisa_gds_models_v1beta1_models_proto_enumTypes[1] +} + +func (x VASPCategory) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use VASPCategory.Descriptor instead. +func (VASPCategory) EnumDescriptor() ([]byte, []int) { + return file_trisa_gds_models_v1beta1_models_proto_rawDescGZIP(), []int{1} +} + +type VerificationState int32 + +const ( + VerificationState_NO_VERIFICATION VerificationState = 0 + VerificationState_SUBMITTED VerificationState = 1 + VerificationState_EMAIL_VERIFIED VerificationState = 2 + VerificationState_PENDING_REVIEW VerificationState = 3 + VerificationState_REVIEWED VerificationState = 4 + VerificationState_ISSUING_CERTIFICATE VerificationState = 5 + VerificationState_VERIFIED VerificationState = 6 + VerificationState_REJECTED VerificationState = 7 + VerificationState_APPEALED VerificationState = 8 + VerificationState_ERRORED VerificationState = 9 +) + +// Enum value maps for VerificationState. +var ( + VerificationState_name = map[int32]string{ + 0: "NO_VERIFICATION", + 1: "SUBMITTED", + 2: "EMAIL_VERIFIED", + 3: "PENDING_REVIEW", + 4: "REVIEWED", + 5: "ISSUING_CERTIFICATE", + 6: "VERIFIED", + 7: "REJECTED", + 8: "APPEALED", + 9: "ERRORED", + } + VerificationState_value = map[string]int32{ + "NO_VERIFICATION": 0, + "SUBMITTED": 1, + "EMAIL_VERIFIED": 2, + "PENDING_REVIEW": 3, + "REVIEWED": 4, + "ISSUING_CERTIFICATE": 5, + "VERIFIED": 6, + "REJECTED": 7, + "APPEALED": 8, + "ERRORED": 9, + } +) + +func (x VerificationState) Enum() *VerificationState { + p := new(VerificationState) + *p = x + return p +} + +func (x VerificationState) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (VerificationState) Descriptor() protoreflect.EnumDescriptor { + return file_trisa_gds_models_v1beta1_models_proto_enumTypes[2].Descriptor() +} + +func (VerificationState) Type() protoreflect.EnumType { + return &file_trisa_gds_models_v1beta1_models_proto_enumTypes[2] +} + +func (x VerificationState) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use VerificationState.Descriptor instead. +func (VerificationState) EnumDescriptor() ([]byte, []int) { + return file_trisa_gds_models_v1beta1_models_proto_rawDescGZIP(), []int{2} +} + +type ServiceState int32 + +const ( + ServiceState_UNKNOWN ServiceState = 0 + ServiceState_HEALTHY ServiceState = 1 + ServiceState_UNHEALTHY ServiceState = 2 + ServiceState_DANGER ServiceState = 3 + ServiceState_OFFLINE ServiceState = 4 + ServiceState_MAINTENANCE ServiceState = 5 +) + +// Enum value maps for ServiceState. +var ( + ServiceState_name = map[int32]string{ + 0: "UNKNOWN", + 1: "HEALTHY", + 2: "UNHEALTHY", + 3: "DANGER", + 4: "OFFLINE", + 5: "MAINTENANCE", + } + ServiceState_value = map[string]int32{ + "UNKNOWN": 0, + "HEALTHY": 1, + "UNHEALTHY": 2, + "DANGER": 3, + "OFFLINE": 4, + "MAINTENANCE": 5, + } +) + +func (x ServiceState) Enum() *ServiceState { + p := new(ServiceState) + *p = x + return p +} + +func (x ServiceState) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ServiceState) Descriptor() protoreflect.EnumDescriptor { + return file_trisa_gds_models_v1beta1_models_proto_enumTypes[3].Descriptor() +} + +func (ServiceState) Type() protoreflect.EnumType { + return &file_trisa_gds_models_v1beta1_models_proto_enumTypes[3] +} + +func (x ServiceState) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ServiceState.Descriptor instead. +func (ServiceState) EnumDescriptor() ([]byte, []int) { + return file_trisa_gds_models_v1beta1_models_proto_rawDescGZIP(), []int{3} +} + +// VASP represents the top-level directory entry for certificate public key exchange. +// The TRISA Directory service allows search and lookup of VASP entries and returns +// TRISA implementation details and certificate key material. VASPs must be registered +// with IVMS 101 identity data for the business entity as well as natural person +// entities for technical, legal, billing, and administrative contacts. +// +// A VASP entry is also the primary point of replication between directories that +// implement the directory replication service. It maintains the version information to +// detect changes with respect to a specific registered directory and faciliates +// anti-entropy gossip protocols. +type VASP struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A unique identifier generated by the directory service, should be a globally + // unique identifier partitioned specified by the registered directory field. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // The url of directory that registered this VASP, e.g. vaspdirectory.net. The + // id of the VASP must must be unique with respect to this field. + RegisteredDirectory string `protobuf:"bytes,2,opt,name=registered_directory,json=registeredDirectory,proto3" json:"registered_directory,omitempty"` + // The legal entity IVMS 101 data for VASP KYC information exchange. This is the + // IVMS 101 data that should be exchanged in the TRISA P2P protocol as the + // Originator, Intermediate, or Beneficiary VASP fields. A complete and valid + // identity record with country of registration is required. + Entity *ivms101.LegalPerson `protobuf:"bytes,3,opt,name=entity,proto3" json:"entity,omitempty"` + // Technical, legal, billing, and administrative contacts for the VASP. + Contacts *Contacts `protobuf:"bytes,4,opt,name=contacts,proto3" json:"contacts,omitempty"` + // Certificate information and public key material issued to the VASP to facilitate + // mTLS connections between TRISA partners. If the VASP has not been verified then + // the certificate will not be issued. This field is the most recently issued + // certificate but may or may not be revoked. + // In the white paper, this is referred to as the Identity EV-Cert. + IdentityCertificate *Certificate `protobuf:"bytes,5,opt,name=identity_certificate,json=identityCertificate,proto3" json:"identity_certificate,omitempty"` + // Signing-key certificates and public key material used to sign transactions. The + // primary use of signing-key certificates is to asymmetrically encrypt and sign + // per-transaction symmetric encryption keys. A VASP can maintain any number of + // signing certificates, which are idnetified by their signature or serial number. + SigningCertificates []*Certificate `protobuf:"bytes,6,rep,name=signing_certificates,json=signingCertificates,proto3" json:"signing_certificates,omitempty"` + // Domain name of the TRISA endpoint used as the common name for the certificate. + // This field must be unique per VASP as it identifies the Certificate and is used + // directly in lookups. + CommonName string `protobuf:"bytes,7,opt,name=common_name,json=commonName,proto3" json:"common_name,omitempty"` + // Travel Rule Implementation Endpoint - where other TRISA peers should connect. + // This should be an addr:port combination, e.g. trisa.vaspbot.net:443 + TrisaEndpoint string `protobuf:"bytes,8,opt,name=trisa_endpoint,json=trisaEndpoint,proto3" json:"trisa_endpoint,omitempty"` + // Business Information + Website string `protobuf:"bytes,9,opt,name=website,proto3" json:"website,omitempty"` + BusinessCategory BusinessCategory `protobuf:"varint,10,opt,name=business_category,json=businessCategory,proto3,enum=trisa.gds.models.v1beta1.BusinessCategory" json:"business_category,omitempty"` + VaspCategory VASPCategory `protobuf:"varint,11,opt,name=vasp_category,json=vaspCategory,proto3,enum=trisa.gds.models.v1beta1.VASPCategory" json:"vasp_category,omitempty"` + EstablishedOn string `protobuf:"bytes,12,opt,name=established_on,json=establishedOn,proto3" json:"established_on,omitempty"` // Should be a date in YYYY-MM-DD format + // TRIXO Questionnaire + Trixo *TRIXOQuestionnaire `protobuf:"bytes,13,opt,name=trixo,proto3" json:"trixo,omitempty"` + // Directory Service Metadata + VerificationStatus VerificationState `protobuf:"varint,14,opt,name=verification_status,json=verificationStatus,proto3,enum=trisa.gds.models.v1beta1.VerificationState" json:"verification_status,omitempty"` + ServiceStatus ServiceState `protobuf:"varint,15,opt,name=service_status,json=serviceStatus,proto3,enum=trisa.gds.models.v1beta1.ServiceState" json:"service_status,omitempty"` + VerifiedOn string `protobuf:"bytes,16,opt,name=verified_on,json=verifiedOn,proto3" json:"verified_on,omitempty"` // Should be an RFC 3339 Timestamp + FirstListed string `protobuf:"bytes,17,opt,name=first_listed,json=firstListed,proto3" json:"first_listed,omitempty"` // Should be an RFC 3339 Timestamp + LastUpdated string `protobuf:"bytes,18,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"` // Should be an RFC 3339 Timestamp + // The legal entity signature that is used to verify uniqueness or detect changes. + Signature []byte `protobuf:"bytes,19,opt,name=signature,proto3" json:"signature,omitempty"` + // Version is used for anti-entropy based replication + Version uint64 `protobuf:"varint,20,opt,name=version,proto3" json:"version,omitempty"` + // Temporary: verification token for light weight authentication for verification + // TODO: replace with admin API that uses authentication + AdminVerificationToken string `protobuf:"bytes,21,opt,name=admin_verification_token,json=adminVerificationToken,proto3" json:"admin_verification_token,omitempty"` +} + +func (x *VASP) Reset() { + *x = VASP{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_gds_models_v1beta1_models_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VASP) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VASP) ProtoMessage() {} + +func (x *VASP) ProtoReflect() protoreflect.Message { + mi := &file_trisa_gds_models_v1beta1_models_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VASP.ProtoReflect.Descriptor instead. +func (*VASP) Descriptor() ([]byte, []int) { + return file_trisa_gds_models_v1beta1_models_proto_rawDescGZIP(), []int{0} +} + +func (x *VASP) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *VASP) GetRegisteredDirectory() string { + if x != nil { + return x.RegisteredDirectory + } + return "" +} + +func (x *VASP) GetEntity() *ivms101.LegalPerson { + if x != nil { + return x.Entity + } + return nil +} + +func (x *VASP) GetContacts() *Contacts { + if x != nil { + return x.Contacts + } + return nil +} + +func (x *VASP) GetIdentityCertificate() *Certificate { + if x != nil { + return x.IdentityCertificate + } + return nil +} + +func (x *VASP) GetSigningCertificates() []*Certificate { + if x != nil { + return x.SigningCertificates + } + return nil +} + +func (x *VASP) GetCommonName() string { + if x != nil { + return x.CommonName + } + return "" +} + +func (x *VASP) GetTrisaEndpoint() string { + if x != nil { + return x.TrisaEndpoint + } + return "" +} + +func (x *VASP) GetWebsite() string { + if x != nil { + return x.Website + } + return "" +} + +func (x *VASP) GetBusinessCategory() BusinessCategory { + if x != nil { + return x.BusinessCategory + } + return BusinessCategory_UNKNOWN_ENTITY +} + +func (x *VASP) GetVaspCategory() VASPCategory { + if x != nil { + return x.VaspCategory + } + return VASPCategory_UNKNOWN_VASP +} + +func (x *VASP) GetEstablishedOn() string { + if x != nil { + return x.EstablishedOn + } + return "" +} + +func (x *VASP) GetTrixo() *TRIXOQuestionnaire { + if x != nil { + return x.Trixo + } + return nil +} + +func (x *VASP) GetVerificationStatus() VerificationState { + if x != nil { + return x.VerificationStatus + } + return VerificationState_NO_VERIFICATION +} + +func (x *VASP) GetServiceStatus() ServiceState { + if x != nil { + return x.ServiceStatus + } + return ServiceState_UNKNOWN +} + +func (x *VASP) GetVerifiedOn() string { + if x != nil { + return x.VerifiedOn + } + return "" +} + +func (x *VASP) GetFirstListed() string { + if x != nil { + return x.FirstListed + } + return "" +} + +func (x *VASP) GetLastUpdated() string { + if x != nil { + return x.LastUpdated + } + return "" +} + +func (x *VASP) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +func (x *VASP) GetVersion() uint64 { + if x != nil { + return x.Version + } + return 0 +} + +func (x *VASP) GetAdminVerificationToken() string { + if x != nil { + return x.AdminVerificationToken + } + return "" +} + +// At least one of the following contact information is required for the VASP to be +// registered in a TRISA directory. Contact information should be kept private in the +// directory service and only used for email communication or verification. +type Contacts struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Technical *Contact `protobuf:"bytes,1,opt,name=technical,proto3" json:"technical,omitempty"` + Administrative *Contact `protobuf:"bytes,2,opt,name=administrative,proto3" json:"administrative,omitempty"` + Legal *Contact `protobuf:"bytes,3,opt,name=legal,proto3" json:"legal,omitempty"` + Billing *Contact `protobuf:"bytes,4,opt,name=billing,proto3" json:"billing,omitempty"` +} + +func (x *Contacts) Reset() { + *x = Contacts{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_gds_models_v1beta1_models_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Contacts) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Contacts) ProtoMessage() {} + +func (x *Contacts) ProtoReflect() protoreflect.Message { + mi := &file_trisa_gds_models_v1beta1_models_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Contacts.ProtoReflect.Descriptor instead. +func (*Contacts) Descriptor() ([]byte, []int) { + return file_trisa_gds_models_v1beta1_models_proto_rawDescGZIP(), []int{1} +} + +func (x *Contacts) GetTechnical() *Contact { + if x != nil { + return x.Technical + } + return nil +} + +func (x *Contacts) GetAdministrative() *Contact { + if x != nil { + return x.Administrative + } + return nil +} + +func (x *Contacts) GetLegal() *Contact { + if x != nil { + return x.Legal + } + return nil +} + +func (x *Contacts) GetBilling() *Contact { + if x != nil { + return x.Billing + } + return nil +} + +type Contact struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Name is required to identify and address the contact + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // An email address is required for all contacts + Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"` + // Phone number is optional, but it is strongly suggested + Phone string `protobuf:"bytes,3,opt,name=phone,proto3" json:"phone,omitempty"` + // Token for email verification + Verified bool `protobuf:"varint,4,opt,name=verified,proto3" json:"verified,omitempty"` + Token string `protobuf:"bytes,5,opt,name=token,proto3" json:"token,omitempty"` + // Optional KYC data if required for the directory service contact. + Person *ivms101.NaturalPerson `protobuf:"bytes,6,opt,name=person,proto3" json:"person,omitempty"` +} + +func (x *Contact) Reset() { + *x = Contact{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_gds_models_v1beta1_models_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Contact) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Contact) ProtoMessage() {} + +func (x *Contact) ProtoReflect() protoreflect.Message { + mi := &file_trisa_gds_models_v1beta1_models_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Contact.ProtoReflect.Descriptor instead. +func (*Contact) Descriptor() ([]byte, []int) { + return file_trisa_gds_models_v1beta1_models_proto_rawDescGZIP(), []int{2} +} + +func (x *Contact) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Contact) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *Contact) GetPhone() string { + if x != nil { + return x.Phone + } + return "" +} + +func (x *Contact) GetVerified() bool { + if x != nil { + return x.Verified + } + return false +} + +func (x *Contact) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *Contact) GetPerson() *ivms101.NaturalPerson { + if x != nil { + return x.Person + } + return nil +} + +type TRIXOQuestionnaire struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Should be the name of the country or an ISO-3166-1 code. + PrimaryNationalJurisdiction string `protobuf:"bytes,1,opt,name=primary_national_jurisdiction,json=primaryNationalJurisdiction,proto3" json:"primary_national_jurisdiction,omitempty"` + // Name of primary financial regulator or supervisory authority. + PrimaryRegulator string `protobuf:"bytes,2,opt,name=primary_regulator,json=primaryRegulator,proto3" json:"primary_regulator,omitempty"` + // Is the VASP permitted to send and/or receive transfers of virtual assets in the + // jurisdictions in which it operates? + // One of yes, no, partially + FinancialTransfersPermitted string `protobuf:"bytes,3,opt,name=financial_transfers_permitted,json=financialTransfersPermitted,proto3" json:"financial_transfers_permitted,omitempty"` + // Other jurisdictions in which the entity operates. + OtherJurisdictions []*Jurisdiction `protobuf:"bytes,4,rep,name=other_jurisdictions,json=otherJurisdictions,proto3" json:"other_jurisdictions,omitempty"` + // Does the VASP have a programme that sets minimum AML, CFT, KYC/CDD and sanctions + // standards per the requirements of the jurisdiction(s) regulatory regimes where + // it is licensed/approved/registered? + // Either yes or no + HasRequiredRegulatoryProgram string `protobuf:"bytes,5,opt,name=has_required_regulatory_program,json=hasRequiredRegulatoryProgram,proto3" json:"has_required_regulatory_program,omitempty"` + // Does the VASP conduct KYC/CDD before permitting its customers to send/receive + // virtual asset transfers? + ConductsCustomerKyc bool `protobuf:"varint,6,opt,name=conducts_customer_kyc,json=conductsCustomerKyc,proto3" json:"conducts_customer_kyc,omitempty"` + // At what threshold does the VASP conduct KYC? + KycThreshold float32 `protobuf:"fixed32,7,opt,name=kyc_threshold,json=kycThreshold,proto3" json:"kyc_threshold,omitempty"` + // Is the VASP required to comply with the application of the Travel Rule standards + // in the jurisdiction(s) where it is licensed/approved/registered? + MustComplyTravelRule bool `protobuf:"varint,8,opt,name=must_comply_travel_rule,json=mustComplyTravelRule,proto3" json:"must_comply_travel_rule,omitempty"` + // Applicable Travel Regulations the VASP must comply with. + ApplicableRegulations []string `protobuf:"bytes,9,rep,name=applicable_regulations,json=applicableRegulations,proto3" json:"applicable_regulations,omitempty"` + // What is the minimum threshold for travel rule compliance? + ComplianceThreshold float32 `protobuf:"fixed32,10,opt,name=compliance_threshold,json=complianceThreshold,proto3" json:"compliance_threshold,omitempty"` + // Is the VASP required by law to safeguard PII? + MustSafeguardPii bool `protobuf:"varint,11,opt,name=must_safeguard_pii,json=mustSafeguardPii,proto3" json:"must_safeguard_pii,omitempty"` + // Does the VASP secure and protect PII, including PII received from other VASPs + // under the Travel Rule? (yes/no) + SafeguardsPii string `protobuf:"bytes,12,opt,name=safeguards_pii,json=safeguardsPii,proto3" json:"safeguards_pii,omitempty"` +} + +func (x *TRIXOQuestionnaire) Reset() { + *x = TRIXOQuestionnaire{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_gds_models_v1beta1_models_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TRIXOQuestionnaire) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TRIXOQuestionnaire) ProtoMessage() {} + +func (x *TRIXOQuestionnaire) ProtoReflect() protoreflect.Message { + mi := &file_trisa_gds_models_v1beta1_models_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TRIXOQuestionnaire.ProtoReflect.Descriptor instead. +func (*TRIXOQuestionnaire) Descriptor() ([]byte, []int) { + return file_trisa_gds_models_v1beta1_models_proto_rawDescGZIP(), []int{3} +} + +func (x *TRIXOQuestionnaire) GetPrimaryNationalJurisdiction() string { + if x != nil { + return x.PrimaryNationalJurisdiction + } + return "" +} + +func (x *TRIXOQuestionnaire) GetPrimaryRegulator() string { + if x != nil { + return x.PrimaryRegulator + } + return "" +} + +func (x *TRIXOQuestionnaire) GetFinancialTransfersPermitted() string { + if x != nil { + return x.FinancialTransfersPermitted + } + return "" +} + +func (x *TRIXOQuestionnaire) GetOtherJurisdictions() []*Jurisdiction { + if x != nil { + return x.OtherJurisdictions + } + return nil +} + +func (x *TRIXOQuestionnaire) GetHasRequiredRegulatoryProgram() string { + if x != nil { + return x.HasRequiredRegulatoryProgram + } + return "" +} + +func (x *TRIXOQuestionnaire) GetConductsCustomerKyc() bool { + if x != nil { + return x.ConductsCustomerKyc + } + return false +} + +func (x *TRIXOQuestionnaire) GetKycThreshold() float32 { + if x != nil { + return x.KycThreshold + } + return 0 +} + +func (x *TRIXOQuestionnaire) GetMustComplyTravelRule() bool { + if x != nil { + return x.MustComplyTravelRule + } + return false +} + +func (x *TRIXOQuestionnaire) GetApplicableRegulations() []string { + if x != nil { + return x.ApplicableRegulations + } + return nil +} + +func (x *TRIXOQuestionnaire) GetComplianceThreshold() float32 { + if x != nil { + return x.ComplianceThreshold + } + return 0 +} + +func (x *TRIXOQuestionnaire) GetMustSafeguardPii() bool { + if x != nil { + return x.MustSafeguardPii + } + return false +} + +func (x *TRIXOQuestionnaire) GetSafeguardsPii() string { + if x != nil { + return x.SafeguardsPii + } + return "" +} + +type Jurisdiction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Country string `protobuf:"bytes,1,opt,name=country,proto3" json:"country,omitempty"` + RegulatorName string `protobuf:"bytes,2,opt,name=regulator_name,json=regulatorName,proto3" json:"regulator_name,omitempty"` + LicenseNumber string `protobuf:"bytes,3,opt,name=license_number,json=licenseNumber,proto3" json:"license_number,omitempty"` +} + +func (x *Jurisdiction) Reset() { + *x = Jurisdiction{} + if protoimpl.UnsafeEnabled { + mi := &file_trisa_gds_models_v1beta1_models_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Jurisdiction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Jurisdiction) ProtoMessage() {} + +func (x *Jurisdiction) ProtoReflect() protoreflect.Message { + mi := &file_trisa_gds_models_v1beta1_models_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Jurisdiction.ProtoReflect.Descriptor instead. +func (*Jurisdiction) Descriptor() ([]byte, []int) { + return file_trisa_gds_models_v1beta1_models_proto_rawDescGZIP(), []int{4} +} + +func (x *Jurisdiction) GetCountry() string { + if x != nil { + return x.Country + } + return "" +} + +func (x *Jurisdiction) GetRegulatorName() string { + if x != nil { + return x.RegulatorName + } + return "" +} + +func (x *Jurisdiction) GetLicenseNumber() string { + if x != nil { + return x.LicenseNumber + } + return "" +} + +var File_trisa_gds_models_v1beta1_models_proto protoreflect.FileDescriptor + +var file_trisa_gds_models_v1beta1_models_proto_rawDesc = []byte{ + 0x0a, 0x25, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2f, 0x67, 0x64, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, + 0x6c, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x18, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, + 0x64, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x1a, 0x15, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2f, 0x69, 0x76, 0x6d, 0x73, 0x31, + 0x30, 0x31, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x21, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2f, + 0x67, 0x64, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2f, 0x63, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe4, 0x08, 0x0a, 0x04, + 0x56, 0x41, 0x53, 0x50, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x31, 0x0a, 0x14, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, + 0x65, 0x64, 0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x13, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x44, 0x69, + 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x2c, 0x0a, 0x06, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, + 0x31, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x52, 0x06, 0x65, + 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x3e, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, + 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, + 0x67, 0x64, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x73, 0x52, 0x08, 0x63, 0x6f, 0x6e, + 0x74, 0x61, 0x63, 0x74, 0x73, 0x12, 0x58, 0x0a, 0x14, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, + 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x13, 0x69, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x74, 0x79, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, + 0x58, 0x0a, 0x14, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x69, + 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, + 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x65, 0x52, 0x13, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x43, 0x65, 0x72, + 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x72, + 0x69, 0x73, 0x61, 0x5f, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0d, 0x74, 0x72, 0x69, 0x73, 0x61, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, + 0x74, 0x12, 0x18, 0x0a, 0x07, 0x77, 0x65, 0x62, 0x73, 0x69, 0x74, 0x65, 0x18, 0x09, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x77, 0x65, 0x62, 0x73, 0x69, 0x74, 0x65, 0x12, 0x57, 0x0a, 0x11, 0x62, + 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, + 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, + 0x64, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x42, 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, + 0x72, 0x79, 0x52, 0x10, 0x62, 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x43, 0x61, 0x74, 0x65, + 0x67, 0x6f, 0x72, 0x79, 0x12, 0x4b, 0x0a, 0x0d, 0x76, 0x61, 0x73, 0x70, 0x5f, 0x63, 0x61, 0x74, + 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x74, 0x72, + 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x56, 0x41, 0x53, 0x50, 0x43, 0x61, 0x74, 0x65, 0x67, + 0x6f, 0x72, 0x79, 0x52, 0x0c, 0x76, 0x61, 0x73, 0x70, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, + 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x73, 0x74, 0x61, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, + 0x5f, 0x6f, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x65, 0x73, 0x74, 0x61, 0x62, + 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x4f, 0x6e, 0x12, 0x42, 0x0a, 0x05, 0x74, 0x72, 0x69, 0x78, + 0x6f, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, + 0x67, 0x64, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x54, 0x52, 0x49, 0x58, 0x4f, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, + 0x6e, 0x61, 0x69, 0x72, 0x65, 0x52, 0x05, 0x74, 0x72, 0x69, 0x78, 0x6f, 0x12, 0x5c, 0x0a, 0x13, + 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x74, 0x72, 0x69, 0x73, + 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x12, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x4d, 0x0a, 0x0e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0f, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x6d, + 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x76, 0x65, 0x72, + 0x69, 0x66, 0x69, 0x65, 0x64, 0x5f, 0x6f, 0x6e, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x4f, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x69, + 0x72, 0x73, 0x74, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x66, 0x69, 0x72, 0x73, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x12, 0x21, 0x0a, + 0x0c, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x18, 0x12, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, + 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x13, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x18, + 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x14, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x0a, 0x18, 0x61, 0x64, 0x6d, 0x69, + 0x6e, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, 0x61, 0x64, 0x6d, 0x69, + 0x6e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x22, 0x8c, 0x02, 0x0a, 0x08, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x73, 0x12, + 0x3f, 0x0a, 0x09, 0x74, 0x65, 0x63, 0x68, 0x6e, 0x69, 0x63, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x6d, + 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, + 0x6e, 0x74, 0x61, 0x63, 0x74, 0x52, 0x09, 0x74, 0x65, 0x63, 0x68, 0x6e, 0x69, 0x63, 0x61, 0x6c, + 0x12, 0x49, 0x0a, 0x0e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, + 0x76, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, + 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x52, 0x0e, 0x61, 0x64, 0x6d, + 0x69, 0x6e, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x76, 0x65, 0x12, 0x37, 0x0a, 0x05, 0x6c, + 0x65, 0x67, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x74, 0x72, 0x69, + 0x73, 0x61, 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x52, 0x05, 0x6c, + 0x65, 0x67, 0x61, 0x6c, 0x12, 0x3b, 0x0a, 0x07, 0x62, 0x69, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2e, 0x67, 0x64, + 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x52, 0x07, 0x62, 0x69, 0x6c, 0x6c, 0x69, 0x6e, + 0x67, 0x22, 0xab, 0x01, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x1a, 0x0a, + 0x08, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x08, 0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, + 0x2e, 0x0a, 0x06, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x16, 0x2e, 0x69, 0x76, 0x6d, 0x73, 0x31, 0x30, 0x31, 0x2e, 0x4e, 0x61, 0x74, 0x75, 0x72, 0x61, + 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x52, 0x06, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x22, + 0xb8, 0x05, 0x0a, 0x12, 0x54, 0x52, 0x49, 0x58, 0x4f, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, + 0x6e, 0x6e, 0x61, 0x69, 0x72, 0x65, 0x12, 0x42, 0x0a, 0x1d, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72, + 0x79, 0x5f, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x6a, 0x75, 0x72, 0x69, 0x73, + 0x64, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x1b, 0x70, + 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x4e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x4a, 0x75, + 0x72, 0x69, 0x73, 0x64, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x0a, 0x11, 0x70, 0x72, + 0x69, 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x72, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x74, 0x6f, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, + 0x67, 0x75, 0x6c, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x42, 0x0a, 0x1d, 0x66, 0x69, 0x6e, 0x61, 0x6e, + 0x63, 0x69, 0x61, 0x6c, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x73, 0x5f, 0x70, + 0x65, 0x72, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x1b, + 0x66, 0x69, 0x6e, 0x61, 0x6e, 0x63, 0x69, 0x61, 0x6c, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, + 0x72, 0x73, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x74, 0x74, 0x65, 0x64, 0x12, 0x57, 0x0a, 0x13, 0x6f, + 0x74, 0x68, 0x65, 0x72, 0x5f, 0x6a, 0x75, 0x72, 0x69, 0x73, 0x64, 0x69, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x74, 0x72, 0x69, 0x73, 0x61, + 0x2e, 0x67, 0x64, 0x73, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x4a, 0x75, 0x72, 0x69, 0x73, 0x64, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x12, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x4a, 0x75, 0x72, 0x69, 0x73, 0x64, 0x69, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x45, 0x0a, 0x1f, 0x68, 0x61, 0x73, 0x5f, 0x72, 0x65, 0x71, 0x75, + 0x69, 0x72, 0x65, 0x64, 0x5f, 0x72, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x74, 0x6f, 0x72, 0x79, 0x5f, + 0x70, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x1c, 0x68, + 0x61, 0x73, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, + 0x74, 0x6f, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x12, 0x32, 0x0a, 0x15, 0x63, + 0x6f, 0x6e, 0x64, 0x75, 0x63, 0x74, 0x73, 0x5f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, + 0x5f, 0x6b, 0x79, 0x63, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x63, 0x6f, 0x6e, 0x64, + 0x75, 0x63, 0x74, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x4b, 0x79, 0x63, 0x12, + 0x23, 0x0a, 0x0d, 0x6b, 0x79, 0x63, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0c, 0x6b, 0x79, 0x63, 0x54, 0x68, 0x72, 0x65, 0x73, + 0x68, 0x6f, 0x6c, 0x64, 0x12, 0x35, 0x0a, 0x17, 0x6d, 0x75, 0x73, 0x74, 0x5f, 0x63, 0x6f, 0x6d, + 0x70, 0x6c, 0x79, 0x5f, 0x74, 0x72, 0x61, 0x76, 0x65, 0x6c, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x6d, 0x75, 0x73, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x6c, + 0x79, 0x54, 0x72, 0x61, 0x76, 0x65, 0x6c, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x35, 0x0a, 0x16, 0x61, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x72, 0x65, 0x67, 0x75, 0x6c, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x15, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x31, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, + 0x5f, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x02, + 0x52, 0x13, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x54, 0x68, 0x72, 0x65, + 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x6d, 0x75, 0x73, 0x74, 0x5f, 0x73, 0x61, + 0x66, 0x65, 0x67, 0x75, 0x61, 0x72, 0x64, 0x5f, 0x70, 0x69, 0x69, 0x18, 0x0b, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x10, 0x6d, 0x75, 0x73, 0x74, 0x53, 0x61, 0x66, 0x65, 0x67, 0x75, 0x61, 0x72, 0x64, + 0x50, 0x69, 0x69, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x61, 0x66, 0x65, 0x67, 0x75, 0x61, 0x72, 0x64, + 0x73, 0x5f, 0x70, 0x69, 0x69, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x61, 0x66, + 0x65, 0x67, 0x75, 0x61, 0x72, 0x64, 0x73, 0x50, 0x69, 0x69, 0x22, 0x76, 0x0a, 0x0c, 0x4a, 0x75, + 0x72, 0x69, 0x73, 0x64, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x67, 0x75, 0x6c, 0x61, 0x74, 0x6f, + 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x72, 0x65, + 0x67, 0x75, 0x6c, 0x61, 0x74, 0x6f, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x6c, + 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x4e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x2a, 0x87, 0x01, 0x0a, 0x10, 0x42, 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x43, + 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x0e, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, + 0x57, 0x4e, 0x5f, 0x45, 0x4e, 0x54, 0x49, 0x54, 0x59, 0x10, 0x00, 0x12, 0x18, 0x0a, 0x14, 0x50, + 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x5f, 0x4f, 0x52, 0x47, 0x41, 0x4e, 0x49, 0x5a, 0x41, 0x54, + 0x49, 0x4f, 0x4e, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x47, 0x4f, 0x56, 0x45, 0x52, 0x4e, 0x4d, + 0x45, 0x4e, 0x54, 0x5f, 0x45, 0x4e, 0x54, 0x49, 0x54, 0x59, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, + 0x42, 0x55, 0x53, 0x49, 0x4e, 0x45, 0x53, 0x53, 0x5f, 0x45, 0x4e, 0x54, 0x49, 0x54, 0x59, 0x10, + 0x03, 0x12, 0x19, 0x0a, 0x15, 0x4e, 0x4f, 0x4e, 0x5f, 0x43, 0x4f, 0x4d, 0x4d, 0x45, 0x52, 0x43, + 0x49, 0x41, 0x4c, 0x5f, 0x45, 0x4e, 0x54, 0x49, 0x54, 0x59, 0x10, 0x04, 0x2a, 0x4f, 0x0a, 0x0c, + 0x56, 0x41, 0x53, 0x50, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x0c, + 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x56, 0x41, 0x53, 0x50, 0x10, 0x00, 0x12, 0x07, + 0x0a, 0x03, 0x41, 0x54, 0x4d, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x45, 0x58, 0x43, 0x48, 0x41, + 0x4e, 0x47, 0x45, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x48, 0x49, 0x47, 0x48, 0x5f, 0x52, 0x49, + 0x53, 0x4b, 0x5f, 0x45, 0x58, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x03, 0x2a, 0xbd, 0x01, + 0x0a, 0x11, 0x56, 0x65, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x12, 0x13, 0x0a, 0x0f, 0x4e, 0x4f, 0x5f, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, + 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x55, 0x42, 0x4d, + 0x49, 0x54, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x45, 0x4d, 0x41, 0x49, 0x4c, + 0x5f, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x50, + 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x5f, 0x52, 0x45, 0x56, 0x49, 0x45, 0x57, 0x10, 0x03, 0x12, + 0x0c, 0x0a, 0x08, 0x52, 0x45, 0x56, 0x49, 0x45, 0x57, 0x45, 0x44, 0x10, 0x04, 0x12, 0x17, 0x0a, + 0x13, 0x49, 0x53, 0x53, 0x55, 0x49, 0x4e, 0x47, 0x5f, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, + 0x43, 0x41, 0x54, 0x45, 0x10, 0x05, 0x12, 0x0c, 0x0a, 0x08, 0x56, 0x45, 0x52, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x06, 0x12, 0x0c, 0x0a, 0x08, 0x52, 0x45, 0x4a, 0x45, 0x43, 0x54, 0x45, 0x44, + 0x10, 0x07, 0x12, 0x0c, 0x0a, 0x08, 0x41, 0x50, 0x50, 0x45, 0x41, 0x4c, 0x45, 0x44, 0x10, 0x08, + 0x12, 0x0b, 0x0a, 0x07, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x45, 0x44, 0x10, 0x09, 0x2a, 0x61, 0x0a, + 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0b, 0x0a, + 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x48, 0x45, + 0x41, 0x4c, 0x54, 0x48, 0x59, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x48, 0x45, 0x41, + 0x4c, 0x54, 0x48, 0x59, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x41, 0x4e, 0x47, 0x45, 0x52, + 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x04, 0x12, + 0x0f, 0x0a, 0x0b, 0x4d, 0x41, 0x49, 0x4e, 0x54, 0x45, 0x4e, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x05, + 0x42, 0x42, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, + 0x72, 0x69, 0x73, 0x61, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2f, 0x74, 0x72, 0x69, 0x73, 0x61, + 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x74, 0x72, 0x69, 0x73, 0x61, 0x2f, 0x67, 0x64, 0x73, 0x2f, 0x6d, + 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_trisa_gds_models_v1beta1_models_proto_rawDescOnce sync.Once + file_trisa_gds_models_v1beta1_models_proto_rawDescData = file_trisa_gds_models_v1beta1_models_proto_rawDesc +) + +func file_trisa_gds_models_v1beta1_models_proto_rawDescGZIP() []byte { + file_trisa_gds_models_v1beta1_models_proto_rawDescOnce.Do(func() { + file_trisa_gds_models_v1beta1_models_proto_rawDescData = protoimpl.X.CompressGZIP(file_trisa_gds_models_v1beta1_models_proto_rawDescData) + }) + return file_trisa_gds_models_v1beta1_models_proto_rawDescData +} + +var file_trisa_gds_models_v1beta1_models_proto_enumTypes = make([]protoimpl.EnumInfo, 4) +var file_trisa_gds_models_v1beta1_models_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_trisa_gds_models_v1beta1_models_proto_goTypes = []interface{}{ + (BusinessCategory)(0), // 0: trisa.gds.models.v1beta1.BusinessCategory + (VASPCategory)(0), // 1: trisa.gds.models.v1beta1.VASPCategory + (VerificationState)(0), // 2: trisa.gds.models.v1beta1.VerificationState + (ServiceState)(0), // 3: trisa.gds.models.v1beta1.ServiceState + (*VASP)(nil), // 4: trisa.gds.models.v1beta1.VASP + (*Contacts)(nil), // 5: trisa.gds.models.v1beta1.Contacts + (*Contact)(nil), // 6: trisa.gds.models.v1beta1.Contact + (*TRIXOQuestionnaire)(nil), // 7: trisa.gds.models.v1beta1.TRIXOQuestionnaire + (*Jurisdiction)(nil), // 8: trisa.gds.models.v1beta1.Jurisdiction + (*ivms101.LegalPerson)(nil), // 9: ivms101.LegalPerson + (*Certificate)(nil), // 10: trisa.gds.models.v1beta1.Certificate + (*ivms101.NaturalPerson)(nil), // 11: ivms101.NaturalPerson +} +var file_trisa_gds_models_v1beta1_models_proto_depIdxs = []int32{ + 9, // 0: trisa.gds.models.v1beta1.VASP.entity:type_name -> ivms101.LegalPerson + 5, // 1: trisa.gds.models.v1beta1.VASP.contacts:type_name -> trisa.gds.models.v1beta1.Contacts + 10, // 2: trisa.gds.models.v1beta1.VASP.identity_certificate:type_name -> trisa.gds.models.v1beta1.Certificate + 10, // 3: trisa.gds.models.v1beta1.VASP.signing_certificates:type_name -> trisa.gds.models.v1beta1.Certificate + 0, // 4: trisa.gds.models.v1beta1.VASP.business_category:type_name -> trisa.gds.models.v1beta1.BusinessCategory + 1, // 5: trisa.gds.models.v1beta1.VASP.vasp_category:type_name -> trisa.gds.models.v1beta1.VASPCategory + 7, // 6: trisa.gds.models.v1beta1.VASP.trixo:type_name -> trisa.gds.models.v1beta1.TRIXOQuestionnaire + 2, // 7: trisa.gds.models.v1beta1.VASP.verification_status:type_name -> trisa.gds.models.v1beta1.VerificationState + 3, // 8: trisa.gds.models.v1beta1.VASP.service_status:type_name -> trisa.gds.models.v1beta1.ServiceState + 6, // 9: trisa.gds.models.v1beta1.Contacts.technical:type_name -> trisa.gds.models.v1beta1.Contact + 6, // 10: trisa.gds.models.v1beta1.Contacts.administrative:type_name -> trisa.gds.models.v1beta1.Contact + 6, // 11: trisa.gds.models.v1beta1.Contacts.legal:type_name -> trisa.gds.models.v1beta1.Contact + 6, // 12: trisa.gds.models.v1beta1.Contacts.billing:type_name -> trisa.gds.models.v1beta1.Contact + 11, // 13: trisa.gds.models.v1beta1.Contact.person:type_name -> ivms101.NaturalPerson + 8, // 14: trisa.gds.models.v1beta1.TRIXOQuestionnaire.other_jurisdictions:type_name -> trisa.gds.models.v1beta1.Jurisdiction + 15, // [15:15] is the sub-list for method output_type + 15, // [15:15] is the sub-list for method input_type + 15, // [15:15] is the sub-list for extension type_name + 15, // [15:15] is the sub-list for extension extendee + 0, // [0:15] is the sub-list for field type_name +} + +func init() { file_trisa_gds_models_v1beta1_models_proto_init() } +func file_trisa_gds_models_v1beta1_models_proto_init() { + if File_trisa_gds_models_v1beta1_models_proto != nil { + return + } + file_trisa_gds_models_v1beta1_ca_proto_init() + if !protoimpl.UnsafeEnabled { + file_trisa_gds_models_v1beta1_models_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VASP); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trisa_gds_models_v1beta1_models_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Contacts); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trisa_gds_models_v1beta1_models_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Contact); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trisa_gds_models_v1beta1_models_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TRIXOQuestionnaire); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trisa_gds_models_v1beta1_models_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Jurisdiction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_trisa_gds_models_v1beta1_models_proto_rawDesc, + NumEnums: 4, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_trisa_gds_models_v1beta1_models_proto_goTypes, + DependencyIndexes: file_trisa_gds_models_v1beta1_models_proto_depIdxs, + EnumInfos: file_trisa_gds_models_v1beta1_models_proto_enumTypes, + MessageInfos: file_trisa_gds_models_v1beta1_models_proto_msgTypes, + }.Build() + File_trisa_gds_models_v1beta1_models_proto = out.File + file_trisa_gds_models_v1beta1_models_proto_rawDesc = nil + file_trisa_gds_models_v1beta1_models_proto_goTypes = nil + file_trisa_gds_models_v1beta1_models_proto_depIdxs = nil +} diff --git a/pkg/trisa/handler/handler.go b/pkg/trisa/handler/handler.go new file mode 100644 index 0000000..c2d4dd0 --- /dev/null +++ b/pkg/trisa/handler/handler.go @@ -0,0 +1,165 @@ +package handler + +import ( + "crypto/rsa" + + "github.com/google/uuid" + protocol "github.com/trisacrypto/trisa/pkg/trisa/api/v1beta1" + "github.com/trisacrypto/trisa/pkg/trisa/crypto" + "github.com/trisacrypto/trisa/pkg/trisa/crypto/aesgcm" + "github.com/trisacrypto/trisa/pkg/trisa/crypto/rsaoeap" + "google.golang.org/protobuf/proto" +) + +// Envelope wraps a SecureEnvelope containing all of the information necessary to access +// the payload data. The envelope can be edited and resealed to simplify TRISA exchanges. +type Envelope struct { + ID string + Payload *protocol.Payload + Cipher crypto.Crypto +} + +// New creates a new envelope, generating an ID if the ID is empty and creating a new +// AES-GCM cipher if the cipher is nil. +func New(id string, payload *protocol.Payload, cipher crypto.Crypto) *Envelope { + if id == "" { + id = uuid.New().String() + } + + if cipher == nil { + var err error + if cipher, err = aesgcm.New(nil, nil); err != nil { + panic(err) + } + } + + return &Envelope{ID: id, Payload: payload, Cipher: cipher} +} + +// Open a secure envelope using the private signing key paired with the public key that +// was used to encrypt the symmetric payload encryption key. The open method decrypts +// the payload key, then decrypts and verifies the payload data using the algorithm +// information stored in the envelope. It returns a data structure with discovered +// cipher and decrypted Payload for access. On error returns *protocol.Error so that +// the error can be directly returned to the client. +func Open(in *protocol.SecureEnvelope, key interface{}) (_ *Envelope, err error) { + var ( + asym crypto.Cipher + encryptionKey []byte + hmacSecret []byte + payloadData []byte + ) + + // Check the algorithms to make sure they're supported + // TODO: allow more algorithms than just AES256-GCM and HMAC-SHA256 + if in.EncryptionAlgorithm != "AES256-GCM" { + return nil, protocol.Errorf(protocol.UnhandledAlgorithm, "%s encryption unsupported", in.EncryptionAlgorithm) + } + if in.HmacAlgorithm != "HMAC-SHA256" { + return nil, protocol.Errorf(protocol.UnhandledAlgorithm, "%s hmac unsupported", in.HmacAlgorithm) + } + + // Create the asymmetric cipher with the private key to decrypt the payload key. + // TODO: add other asymmetric encryption algorithms + switch t := key.(type) { + case *rsa.PrivateKey: + if asym, err = rsaoeap.New(t); err != nil { + return nil, protocol.Errorf(protocol.InternalError, "could not create RSA cipher for asymmetric decryption: %s", err) + } + default: + return nil, protocol.Errorf(protocol.UnhandledAlgorithm, "could not use %T for asymetric decryption", t) + } + + // Decrypt the payload encryption key and hmac secret. + if encryptionKey, err = asym.Decrypt(in.EncryptionKey); err != nil { + return nil, protocol.Errorf(protocol.InvalidKey, "encryption key signed incorrectly: %s", err).WithRetry() + } + if hmacSecret, err = asym.Decrypt(in.HmacSecret); err != nil { + return nil, protocol.Errorf(protocol.InvalidKey, "hmac secret signed incorrectly: %s", err).WithRetry() + } + + // Create the envelope with the AES-GCM Cipher + // TODO: allow multiple Cipher/Signer types + env := &Envelope{ID: in.Id, Payload: &protocol.Payload{}} + if env.Cipher, err = aesgcm.New(encryptionKey, hmacSecret); err != nil { + return nil, protocol.Errorf(protocol.InternalError, "could not create AES-GCM cipher for symmetric decryption: %s", err) + } + + // Verify the signature and decrypt the payload + if err = env.Cipher.Verify(in.Payload, in.Hmac); err != nil { + return nil, protocol.Errorf(protocol.InvalidSignature, "could not verify HMAC signature: %s", err) + } + + if payloadData, err = env.Cipher.Decrypt(in.Payload); err != nil { + return nil, protocol.Errorf(protocol.InvalidKey, "could not decrypt payload with key: %s", err) + } + + // Parse the payload + if err = proto.Unmarshal(payloadData, env.Payload); err != nil { + return nil, protocol.Errorf(protocol.EnvelopeDecodeFail, "could not unmarshal payload from decrypted data: %s", err) + } + + return env, nil +} + +// Seal an envelope using the public signing key of the TRISA peer. The envelope uses +// the internal Cipher to encrypt the Payload then encrypts the keys in the Cipher with +// the public key. On error returns *protocol.Error so that the error can be directly +// returned to the client. +func (e *Envelope) Seal(key interface{}) (out *protocol.SecureEnvelope, err error) { + var ( + asym crypto.Cipher + payloadData []byte + ) + + // Create the asymmetric cipher with the private key to decrypt the payload key. + // TODO: add other asymmetric encryption algorithms + switch t := key.(type) { + case *rsa.PublicKey: + if asym, err = rsaoeap.New(t); err != nil { + return nil, protocol.Errorf(protocol.InternalError, "could not create RSA cipher for asymmetric encryption: %s", err) + } + default: + return nil, protocol.Errorf(protocol.UnhandledAlgorithm, "could not use %T for asymmetric encryption", t) + } + + if payloadData, err = proto.Marshal(e.Payload); err != nil { + return nil, protocol.Errorf(protocol.InternalError, "could not marshal payload data: %s", err) + } + + // Create the secure envelope with algorithm details + out = &protocol.SecureEnvelope{ + Id: e.ID, + EncryptionAlgorithm: e.Cipher.EncryptionAlgorithm(), + HmacAlgorithm: e.Cipher.SignatureAlgorithm(), + } + + // Encrypt and sign the payload + if out.Payload, err = e.Cipher.Encrypt(payloadData); err != nil { + return nil, protocol.Errorf(protocol.InternalError, "could not encrypt payload data: %s", err) + } + + if out.Hmac, err = e.Cipher.Sign(out.Payload); err != nil { + return nil, protocol.Errorf(protocol.InternalError, "could not sign payload data: %s", err) + } + + // Encrypt the payload encryption key and hmac secret + // TODO: Update the crypto interface to allow fetching the key and secret + keys := e.Cipher.(*aesgcm.AESGCM) + if out.EncryptionKey, err = asym.Encrypt(keys.EncryptionKey()); err != nil { + return nil, protocol.Errorf(protocol.InternalError, "could not encrypt payload encryption key: %s", err) + } + + if out.HmacSecret, err = asym.Encrypt(keys.HMACSecret()); err != nil { + return nil, protocol.Errorf(protocol.InternalError, "could not encrypt hmac secret: %s", err) + } + + return out, nil +} + +// Seal a payload using the specified symmetric key cipher and public signing key. This +// is a convienience method for users who do not want to directly Seal an Envelope. +func Seal(id string, payload *protocol.Payload, cipher crypto.Crypto, key interface{}) (*protocol.SecureEnvelope, error) { + env := &Envelope{ID: id, Payload: payload, Cipher: cipher} + return env.Seal(key) +} diff --git a/pkg/trisa/mtls/mtls.go b/pkg/trisa/mtls/mtls.go new file mode 100644 index 0000000..e864d49 --- /dev/null +++ b/pkg/trisa/mtls/mtls.go @@ -0,0 +1,91 @@ +package mtls + +import ( + "crypto/tls" + "crypto/x509" + "errors" + "fmt" + "net/url" + + "github.com/trisacrypto/trisa/pkg/trust" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials" +) + +// Config returns the standard TLS configuration for the TRISA network, loading the +// certificate from the specified provider. Using this TLS configuration ensures that +// all TRISA peer-to-peer connections are handled and verified correctly. +func Config(server *trust.Provider, clients trust.ProviderPool) (_ *tls.Config, err error) { + if !server.IsPrivate() { + return nil, errors.New("server provider must contain a private key to initialize TLS certs") + } + + var crt tls.Certificate + if crt, err = server.GetKeyPair(); err != nil { + return nil, err + } + + var pool *x509.CertPool + if pool, err = clients.GetCertPool(false); err != nil { + return nil, err + } + + return &tls.Config{ + Certificates: []tls.Certificate{crt}, + MinVersion: tls.VersionTLS12, + CurvePreferences: []tls.CurveID{ + tls.CurveP521, + tls.CurveP384, + tls.CurveP256, + }, + PreferServerCipherSuites: true, + CipherSuites: []uint16{ + tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, + tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + tls.TLS_RSA_WITH_AES_256_GCM_SHA384, + tls.TLS_RSA_WITH_AES_128_GCM_SHA256, + }, + ClientAuth: tls.RequireAndVerifyClientCert, + ClientCAs: pool, + }, nil +} + +// ServerCreds returns the grpc.ServerOption to create a gRPC server with mTLS. +func ServerCreds(server *trust.Provider, clients trust.ProviderPool) (_ grpc.ServerOption, err error) { + var conf *tls.Config + if conf, err = Config(server, clients); err != nil { + return nil, err + } + + creds := credentials.NewTLS(conf) + return grpc.Creds(creds), nil +} + +// ClientCreds returns the grpc.DialOption to create a gRPC client with mTLS. +func ClientCreds(endpoint string, client *trust.Provider, servers trust.ProviderPool) (_ grpc.DialOption, err error) { + if !client.IsPrivate() { + return nil, errors.New("client provider must contain a private key to initialize TLS certs") + } + + var crt tls.Certificate + if crt, err = client.GetKeyPair(); err != nil { + return nil, err + } + + var u *url.URL + if u, err = url.Parse(endpoint); err != nil { + return nil, fmt.Errorf("invalid endpoint: %q", err) + } + + var pool *x509.CertPool + if pool, err = servers.GetCertPool(false); err != nil { + return nil, err + } + + conf := &tls.Config{ + ServerName: u.Host, + Certificates: []tls.Certificate{crt}, + RootCAs: pool, + } + return grpc.WithTransportCredentials(credentials.NewTLS(conf)), nil +} diff --git a/pkg/trisa/peers/peer.go b/pkg/trisa/peers/peer.go new file mode 100644 index 0000000..1377c66 --- /dev/null +++ b/pkg/trisa/peers/peer.go @@ -0,0 +1,190 @@ +package peers + +import ( + "context" + "crypto/rsa" + "crypto/x509" + "errors" + "fmt" + "sync" + "time" + + api "github.com/trisacrypto/trisa/pkg/trisa/api/v1beta1" + "github.com/trisacrypto/trisa/pkg/trisa/mtls" + "google.golang.org/grpc" +) + +// Peer contains cached information about connections to other members of the TRISA +// network and facilitates directory service lookups and information exchanges. +// TODO: implement transfer stream and account confirmation endpoints. +type Peer struct { + sync.RWMutex + parent *Peers // Contains common configuration for all peers + info *PeerInfo // NOTE: common name cannot be modified after init, see String() + client api.TRISANetworkClient + stream api.TRISANetwork_TransferStreamClient // NOTE: currently unused +} + +// PeerInfo contains directory service information that uniquely identifies the peer. +// It is maintained separately from the Peer to allow for thread-safe reads and simpler +// marshalling and unmarshalling of JSON data about the peer. +// +// TODO: implement Marshaler and Unmarshaler to ensure signing key is base64 PEM encoded. +// TODO: allow different signing key types other than just RSA +type PeerInfo struct { + ID string + RegisteredDirectory string + CommonName string + Endpoint string + SigningKey *rsa.PublicKey +} + +// SigningKey returns the current signing key of the remote peer, if it's available +// (otherwise returns nil). If a key exchange is underway, this method blocks until a +// key has been retrieved from the remote peer. +func (p *Peer) SigningKey() *rsa.PublicKey { + p.RLock() + defer p.RUnlock() + return p.info.SigningKey +} + +// UpdateSigningKey if the key exchange was initiated from a remote TRISA peer. +func (p *Peer) UpdateSigningKey(key interface{}) error { + p.Lock() + defer p.Unlock() + + var ok bool + if p.info.SigningKey, ok = key.(*rsa.PublicKey); !ok { + return fmt.Errorf("unsupported public key type %T", key) + } + return nil +} + +// ExchangeKeys kicks of a key exchange with the remote peer. It locks to block multiple +// key exchanges from being issued and returns the key immediately if the key is already +// cached on the Peer (unless force is specified, then it will conduct a key exchange). +// This allows callers to ensure that they will get the public signing key when needed. +func (p *Peer) ExchangeKeys(force bool) (_ *rsa.PublicKey, err error) { + // This lock causes everyone who wants the public key of the peer to wait until the + // key exchange has been completed, reducing the number of retries overall. + // This lock will contend with the RLock in SigningKeys() and the locking performance + // could be improved; we err on the side of a hard lock for safety in the MVP. + p.Lock() + defer p.Unlock() + + // If force - then set the signing key to nil to ensure a key exchange occurs. + if force { + p.info.SigningKey = nil + } + + // If we have the signing key already, just return it. + if p.info.SigningKey != nil { + return p.info.SigningKey, nil + } + + var localKey *x509.Certificate + if localKey, err = p.parent.certs.GetLeafCertificate(); err != nil { + return nil, fmt.Errorf("invalid local signing key: %s", err) + } + + // Create the key exchange request + req := &api.SigningKey{ + Version: int64(localKey.Version), + Signature: localKey.Signature, + SignatureAlgorithm: localKey.SignatureAlgorithm.String(), + PublicKeyAlgorithm: localKey.PublicKeyAlgorithm.String(), + NotBefore: localKey.NotBefore.Format(time.RFC3339), + NotAfter: localKey.NotAfter.Format(time.RFC3339), + } + + if req.Data, err = x509.MarshalPKIXPublicKey(localKey.PublicKey); err != nil { + return nil, fmt.Errorf("could not marshal PKIX public key: %s", err) + } + + // Connect to the client if not already connected + if err = p.connect(); err != nil { + return nil, err + } + + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + + var rep *api.SigningKey + if rep, err = p.client.KeyExchange(ctx, req); err != nil { + return nil, err + } + + // Parse public keys from remote client + var pub interface{} + if pub, err = x509.ParsePKIXPublicKey(rep.Data); err != nil { + return nil, err + } + + var ok bool + if p.info.SigningKey, ok = pub.(*rsa.PublicKey); !ok { + return nil, fmt.Errorf("unsupported public key type %T", pub) + } + + return p.info.SigningKey, nil +} + +// Transfer sends the unary RPC request via the peer client, ensuring its connected. +func (p *Peer) Transfer(in *api.SecureEnvelope) (out *api.SecureEnvelope, err error) { + // Thread-safe assurance that we're connected to the remote peer. + if err = p.Connect(); err != nil { + return nil, err + } + + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + return p.client.Transfer(ctx, in) +} + +// Info returns details about the remote Peer. +func (p *Peer) Info() PeerInfo { + p.RLock() + defer p.RUnlock() + return *p.info +} + +// String returns the common name of the peer +func (p *Peer) String() string { + // NOTE: common name is only modified when the Peer is created, so it is safe to + // access the common name on the Peer as long as this rule is maintained. + return p.info.CommonName +} + +// Connect to the remote peer - thread safe. +func (p *Peer) Connect() (err error) { + p.Lock() + err = p.connect() + p.Unlock() + return err +} + +// Connect to the remote peer - not thread safe. +func (p *Peer) connect() (err error) { + // Are we already connected? + if p.client != nil { + return nil + } + + if p.info.Endpoint == "" { + return errors.New("peer does not have an endpoint to connect to") + } + + opts := make([]grpc.DialOption, 0, 1) + var opt grpc.DialOption + if opt, err = mtls.ClientCreds(p.info.Endpoint, p.parent.certs, p.parent.pool); err != nil { + return err + } + opts = append(opts, opt) + + var cc *grpc.ClientConn + if cc, err = grpc.Dial(p.info.Endpoint, opts...); err != nil { + return err + } + + p.client = api.NewTRISANetworkClient(cc) + return nil +} diff --git a/pkg/trisa/peers/peers.go b/pkg/trisa/peers/peers.go new file mode 100644 index 0000000..4061af6 --- /dev/null +++ b/pkg/trisa/peers/peers.go @@ -0,0 +1,254 @@ +package peers + +import ( + "context" + "crypto/rsa" + "crypto/tls" + "crypto/x509" + "errors" + "fmt" + "sync" + "time" + + trisads "github.com/trisacrypto/trisa/pkg/trisa/gds/api/v1beta1" + "github.com/trisacrypto/trisa/pkg/trust" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/peer" +) + +// Peers manages TRISA network connections to send requests to other TRISA nodes. +type Peers struct { + sync.RWMutex + certs *trust.Provider + pool trust.ProviderPool + peers map[string]*Peer + directoryURL string + directory trisads.TRISADirectoryClient +} + +// New creates a new Peers cache to look up peers from context or by endpoint. +func New(certs *trust.Provider, pool trust.ProviderPool, directoryURL string) *Peers { + return &Peers{ + certs: certs, + pool: pool, + peers: make(map[string]*Peer), + directoryURL: directoryURL, + } +} + +// Add creates or updates a peer in the peers cache with the specified info. +func (p *Peers) Add(info *PeerInfo) (err error) { + if info.CommonName == "" { + return errors.New("common name is required for all peers") + } + + // Critical section for Peers + var peer *Peer + if peer, err = p.Get(info.CommonName); err != nil { + return err + } + + // Critical section for peer + // Only update if data is available on info to avoid overwriting existing data + peer.Lock() + if info.ID != "" { + peer.info.ID = info.ID + } + if info.RegisteredDirectory != "" { + peer.info.RegisteredDirectory = info.RegisteredDirectory + } + if info.Endpoint != "" { + peer.info.Endpoint = info.Endpoint + } + if info.SigningKey != nil { + peer.info.SigningKey = info.SigningKey + } + peer.Unlock() + return nil +} + +// FromContext looks up the TLSInfo from the incoming gRPC connection to get the common +// name of the Peer from the certificate. If the Peer is already in the cache, it +// returns the peer information, otherwise it creates and caches the Peer info. +func (p *Peers) FromContext(ctx context.Context) (_ *Peer, err error) { + var ( + ok bool + gp *peer.Peer + tlsAuth credentials.TLSInfo + commonName string + ) + + if gp, ok = peer.FromContext(ctx); !ok { + return nil, errors.New("no peer found in context") + } + + if tlsAuth, ok = gp.AuthInfo.(credentials.TLSInfo); !ok { + return nil, fmt.Errorf("unexpected peer transport credentials type: %T", gp.AuthInfo) + } + + if len(tlsAuth.State.VerifiedChains) == 0 || len(tlsAuth.State.VerifiedChains[0]) == 0 { + return nil, errors.New("could not verify peer certificate") + } + + commonName = tlsAuth.State.VerifiedChains[0][0].Subject.CommonName + if commonName == "" { + return nil, errors.New("could not find common name on authenticated subject") + } + + // Critical section + return p.Get(commonName) +} + +// Get a cached peer by common name, creating it if necessary. Getting the Peer does +// not necessarily guarantee the peer with the common name exists +func (p *Peers) Get(commonName string) (*Peer, error) { + var ( + ok bool + peer *Peer + ) + + p.Lock() + // Check if peer is already cached in memory. If not, add the new peer. + if peer, ok = p.peers[commonName]; !ok { + peer = &Peer{ + parent: p, + info: &PeerInfo{CommonName: commonName}, + } + p.peers[commonName] = peer + + // TODO: Do a directory service lookup for the ID and registered ID + } + p.Unlock() + return peer, nil +} + +// Lookup uses the directory service to find the remote peer by common name. +func (p *Peers) Lookup(commonName string) (peer *Peer, err error) { + // Lookup the peer to ensure that a peer with common name is cached. + if peer, err = p.Get(commonName); err != nil { + return nil, err + } + + // Ensure we're connected to the directory service + if err = p.Connect(); err != nil { + return nil, err + } + + var rep *trisads.LookupReply + req := &trisads.LookupRequest{ + CommonName: commonName, + } + + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + + if rep, err = p.directory.Lookup(ctx, req); err != nil { + return nil, err + } + + if rep.Error != nil { + return nil, rep.Error + } + + // Parse the signing certificate and create the Peer info. + // If no signing certificates available, just ignore to do peer exchange. + info := &PeerInfo{ + ID: rep.Id, + RegisteredDirectory: rep.RegisteredDirectory, + CommonName: rep.CommonName, + Endpoint: rep.Endpoint, + } + + var pub interface{} + if pub, err = x509.ParsePKIXPublicKey(rep.SigningCertificate.Data); err == nil { + var ok bool + if info.SigningKey, ok = pub.(*rsa.PublicKey); !ok { + info.SigningKey = nil + } + } + + // Update the info on the peers + if err = p.Add(info); err != nil { + return nil, err + } + return nil, nil +} + +// Search uses the directory service to find a remote peer by name +func (p *Peers) Search(name string) (_ *Peer, err error) { + // Ensure we're connected to the directory service + if err = p.Connect(); err != nil { + return nil, err + } + + var rep *trisads.SearchReply + req := &trisads.SearchRequest{ + Name: []string{name}, + } + + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + + if rep, err = p.directory.Search(ctx, req); err != nil { + return nil, err + } + + if rep.Error != nil { + return nil, rep.Error + } + + if len(rep.Results) == 0 { + return nil, fmt.Errorf("could not find peer named %q", name) + } + + if len(rep.Results) > 1 { + return nil, fmt.Errorf("too many results returned for %q", name) + } + + // Create the peer info and update the cache + info := &PeerInfo{ + ID: rep.Results[0].Id, + RegisteredDirectory: rep.Results[0].RegisteredDirectory, + CommonName: rep.Results[0].CommonName, + Endpoint: rep.Results[0].Endpoint, + } + + // Update the info on the peers + if err = p.Add(info); err != nil { + return nil, err + } + return p.Get(info.CommonName) +} + +// Connect to the remote peer - thread safe. +func (p *Peers) Connect() (err error) { + p.Lock() + err = p.connect() + p.Unlock() + return err +} + +// Connect to the remote peer - not thread safe. +func (p *Peers) connect() (err error) { + // Are we already connected? + if p.directory != nil { + return nil + } + + if p.directoryURL == "" { + return errors.New("no directory service URL to dial") + } + + opts := make([]grpc.DialOption, 0, 1) + config := &tls.Config{} + opts = append(opts, grpc.WithTransportCredentials(credentials.NewTLS(config))) + + var cc *grpc.ClientConn + if cc, err = grpc.Dial(p.directoryURL, opts...); err != nil { + return err + } + + p.directory = trisads.NewTRISADirectoryClient(cc) + return nil +} diff --git a/pkg/trust/errors.go b/pkg/trust/errors.go new file mode 100644 index 0000000..e692a64 --- /dev/null +++ b/pkg/trust/errors.go @@ -0,0 +1,14 @@ +package trust + +import "errors" + +// Standard errors for error type checking +var ( + ErrDecodePrivateKey = errors.New("could not decode PEM private key") + ErrDecodeCertificate = errors.New("could not decode PEM certificate") + ErrDecodeCSR = errors.New("could not decode PEM certificate request") + ErrNoCertificates = errors.New("provider does not contain any certificates") + ErrKeyRequired = errors.New("private key required") + ErrZipEmpty = errors.New("zip archive contains no providers") + ErrZipTooMany = errors.New("multiple providers in zip, is this a provider pool?") +) diff --git a/pkg/trust/pem.go b/pkg/trust/pem.go new file mode 100644 index 0000000..0df66fa --- /dev/null +++ b/pkg/trust/pem.go @@ -0,0 +1,107 @@ +package trust + +import ( + "bytes" + "crypto/x509" + "encoding/pem" +) + +// PEMEncodePrivateKey as a PKCS8 ASN.1 DER key and write a PEM block with type "PRIVATE KEY" +func PEMEncodePrivateKey(key interface{}) ([]byte, error) { + pkcs8, err := x509.MarshalPKCS8PrivateKey(key) + if err != nil { + return nil, err + } + + var b bytes.Buffer + if err := pem.Encode(&b, &pem.Block{Type: BlockPrivateKey, Bytes: pkcs8}); err != nil { + return nil, err + } + + return b.Bytes(), nil +} + +// PEMDecodePrivateKey from a PEM encoded block. If the block type is "EC PRIVATE KEY", +// then the block is parsed as an EC private key in SEC 1, ASN.1 DER form. If the block +// is "RSA PRIVATE KEY" then it is decoded as a PKCS 1, ASN.1 DER form. If the block +// type is "PRIVATE KEY", the block is decoded as a PKCS 8 ASN.1 DER key, if that fails, +// then the PKCS 1 and EC parsers are tried in that order, before returning an error. +func PEMDecodePrivateKey(in []byte) (key interface{}, err error) { + block, _ := pem.Decode(in) + if block == nil { + return nil, ErrDecodePrivateKey + } + + return parsePrivateKey(block) +} + +func parsePrivateKey(block *pem.Block) (key interface{}, err error) { + // EC PRIVATE KEY specific handling + if block.Type == BlockECPrivateKey { + return x509.ParseECPrivateKey(block.Bytes) + } + + // RSA PRIVATE KEY specific handling + if block.Type == BlockRSAPrivateKey { + return x509.ParsePKCS1PrivateKey(block.Bytes) + } + + // Expect PRIVATE KEY if not EC or RSA at this point + if block.Type != BlockPrivateKey { + return nil, ErrDecodePrivateKey + } + + // Try parsing private key using PKCS8, PKCS1, then EC + if key, err = x509.ParsePKCS8PrivateKey(block.Bytes); err == nil { + return key, nil + } + + if key, err = x509.ParsePKCS1PrivateKey(block.Bytes); err == nil { + return key, nil + } + + if key, err = x509.ParseECPrivateKey(block.Bytes); err == nil { + return key, nil + } + + // Could not parse the private key + return nil, ErrDecodePrivateKey +} + +// PEMEncodeCertificate and write a PEM block with type "CERTIFICATE" +func PEMEncodeCertificate(c *x509.Certificate) ([]byte, error) { + var b bytes.Buffer + if err := pem.Encode(&b, &pem.Block{Type: BlockCertificate, Bytes: c.Raw}); err != nil { + return nil, err + } + + return b.Bytes(), nil +} + +// PEMDecodeCertificate from PEM encoded block with type "CERTIFICATE" +func PEMDecodeCertificate(in []byte) (*x509.Certificate, error) { + block, _ := pem.Decode(in) + if block == nil || block.Type != BlockCertificate { + return nil, ErrDecodeCertificate + } + return x509.ParseCertificate(block.Bytes) +} + +// PEMEncodeCSR and write a PEM block with type "CERTIFICATE REQUEST" +func PEMEncodeCSR(c *x509.CertificateRequest) ([]byte, error) { + var b bytes.Buffer + if err := pem.Encode(&b, &pem.Block{Type: BlockCertificateRequest, Bytes: c.Raw}); err != nil { + return nil, err + } + + return b.Bytes(), nil +} + +// PEMDecodeCSR from PEM encoded block with type "CERTIFICATE REQUEST" +func PEMDecodeCSR(in []byte) (*x509.CertificateRequest, error) { + block, _ := pem.Decode(in) + if block == nil || block.Type != BlockCertificateRequest { + return nil, ErrDecodeCSR + } + return x509.ParseCertificateRequest(block.Bytes) +} diff --git a/pkg/trust/pem_test.go b/pkg/trust/pem_test.go new file mode 100644 index 0000000..1728621 --- /dev/null +++ b/pkg/trust/pem_test.go @@ -0,0 +1,133 @@ +package trust_test + +import ( + "bytes" + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "crypto/rsa" + "crypto/x509" + "crypto/x509/pkix" + "encoding/pem" + "math/big" + "testing" + "time" + + "github.com/stretchr/testify/require" + "github.com/trisacrypto/trisa/pkg/trust" +) + +func TestPEMPrivateKey(t *testing.T) { + // Handling RSA keys (primary usage) + key, err := rsa.GenerateKey(rand.Reader, 4096) + require.NoError(t, err) + + data, err := trust.PEMEncodePrivateKey(key) + require.NoError(t, err) + + keyb, err := trust.PEMDecodePrivateKey(data) + require.NoError(t, err) + require.Equal(t, key, keyb) + + // Handling RSA PRIVATE KEY block type + var b bytes.Buffer + pkcs1 := x509.MarshalPKCS1PrivateKey(key) + err = pem.Encode(&b, &pem.Block{Type: trust.BlockRSAPrivateKey, Bytes: pkcs1}) + require.NoError(t, err) + + keyc, err := trust.PEMDecodePrivateKey(b.Bytes()) + require.NoError(t, err) + require.Equal(t, key, keyc) + + // Handling EC PRIVATE KEY block type + eckey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + require.NoError(t, err) + + ec, err := x509.MarshalECPrivateKey(eckey) + require.NoError(t, err) + + var c bytes.Buffer + err = pem.Encode(&c, &pem.Block{Type: trust.BlockECPrivateKey, Bytes: ec}) + require.NoError(t, err) + + keyd, err := trust.PEMDecodePrivateKey(c.Bytes()) + require.NoError(t, err) + require.Equal(t, eckey, keyd) +} + +func TestPEMCertificate(t *testing.T) { + crt, err := cert() + require.NoError(t, err) + + data, err := trust.PEMEncodeCertificate(crt) + require.NoError(t, err) + + crtb, err := trust.PEMDecodeCertificate(data) + require.NoError(t, err) + + require.Equal(t, crt, crtb) +} + +func cert() (*x509.Certificate, error) { + tpl := &x509.Certificate{ + SerialNumber: big.NewInt(42), + Subject: pkix.Name{ + CommonName: "TestNet", + Organization: []string{"Test"}, + Country: []string{"XX"}, + }, + NotBefore: time.Now(), + NotAfter: time.Now().AddDate(10, 0, 0), + SubjectKeyId: []byte{1, 2, 3, 4, 5, 6}, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth}, + KeyUsage: x509.KeyUsageDigitalSignature, + } + + key, err := rsa.GenerateKey(rand.Reader, 4096) + if err != nil { + return nil, err + } + + pub := &key.PublicKey + signed, err := x509.CreateCertificate(rand.Reader, tpl, tpl, pub, key) + if err != nil { + return nil, err + } + + return x509.ParseCertificate(signed) +} + +func TestPEMCertificateSigningRequest(t *testing.T) { + req, err := csr() + require.NoError(t, err) + + data, err := trust.PEMEncodeCSR(req) + require.NoError(t, err) + + reqb, err := trust.PEMDecodeCSR(data) + require.NoError(t, err) + + require.Equal(t, req, reqb) +} + +func csr() (*x509.CertificateRequest, error) { + tpl := &x509.CertificateRequest{ + Subject: pkix.Name{ + Organization: []string{"Test"}, + Country: []string{"XX"}, + }, + SignatureAlgorithm: x509.SHA512WithRSA, + } + + key, err := rsa.GenerateKey(rand.Reader, 4096) + if err != nil { + return nil, err + } + + der, err := x509.CreateCertificateRequest(rand.Reader, tpl, key) + if err != nil { + return nil, err + } + + return x509.ParseCertificateRequest(der) +} diff --git a/pkg/trust/pool.go b/pkg/trust/pool.go new file mode 100644 index 0000000..7a3c6f4 --- /dev/null +++ b/pkg/trust/pool.go @@ -0,0 +1,52 @@ +package trust + +import ( + "crypto/x509" + "fmt" +) + +// ProviderPool is a collection of provider objects, used to collectively manage the +// public trust certificates of peers in the TRISA network. The Pool maps common names +// to the Provider certificates and ensures that only public providers without private +// keys are stored in the pool. +type ProviderPool map[string]*Provider + +// NewPool from the specified providers (optional). +func NewPool(providers ...*Provider) ProviderPool { + pool := make(ProviderPool) + for _, p := range providers { + pool.Add(p) + } + return pool +} + +// Add a provider to the pool, mapping its common name to the provider. +func (pool ProviderPool) Add(p *Provider) { + pool[p.String()] = p.Public() +} + +// GetCertPool returns the x509.CertPool certificates of all provider certificates with +// the intermediate and root CA certificates. If requested, the pool can also load the +// system certificates pool if any system certificates exit. +func (pool ProviderPool) GetCertPool(includeSystem bool) (_ *x509.CertPool, err error) { + var certPool *x509.CertPool + if includeSystem { + if certPool, _ = x509.SystemCertPool(); certPool == nil { + certPool = x509.NewCertPool() + } + } else { + certPool = x509.NewCertPool() + } + + for name, provider := range pool { + for i, asn1Data := range provider.chain.Certificate { + var cert *x509.Certificate + if cert, err = x509.ParseCertificate(asn1Data); err != nil { + return nil, fmt.Errorf("could not parse certificate %d of %s: %s", i, name, err) + } + certPool.AddCert(cert) + } + } + + return certPool, nil +} diff --git a/pkg/trust/testdata/128106.zip b/pkg/trust/testdata/128106.zip new file mode 100644 index 0000000..08b3654 Binary files /dev/null and b/pkg/trust/testdata/128106.zip differ diff --git a/pkg/trust/trust.go b/pkg/trust/trust.go new file mode 100644 index 0000000..4a020e5 --- /dev/null +++ b/pkg/trust/trust.go @@ -0,0 +1,269 @@ +/* +Package trust provides support for handling PEM-encoded certificate chains. Its primary +functionality is a trust Provider that manages a single chain (either public or public +and private). A ProviderPool manages only public chains and is used to facilitate mTLS +exchanges. This package also includes certificate serialization management and helpers, +including compression utilities. +*/ +package trust + +import ( + "bytes" + "crypto/rand" + "crypto/rsa" + "crypto/tls" + "crypto/x509" + "encoding/pem" + "fmt" + + "software.sslmate.com/src/go-pkcs12" +) + +// PEM Block types +const ( + BlockPublickKey = "PUBLIC KEY" + BlockPrivateKey = "PRIVATE KEY" + BlockRSAPublicKey = "RSA PUBLIC KEY" + BlockRSAPrivateKey = "RSA PRIVATE KEY" + BlockECPrivateKey = "EC PRIVATE KEY" + BlockCertificate = "CERTIFICATE" + BlockCertificateRequest = "CERTIFICATE REQUEST" +) + +// Provider wraps a PEM-encoded certificate chain, which can optionally include private +// keys. Providers with keys (private providers) are used to instantiate mTLS servers, +// while public Providers are used in ProviderPools to facilitate mTLS clients. +type Provider struct { + chain tls.Certificate + key interface{} +} + +// New creates a Provider from PEM encoded blocks. +func New(chain []byte) (p *Provider, err error) { + p = &Provider{} + if err = p.Decode(chain); err != nil { + return nil, err + } + return p, nil +} + +// Decrypt pfxData from a PKCS12 encoded file using the specified password. The data +// must contain at least one certificate and only one private key. The first certificate +// in the data is assumed to be the leaf certificate and subsequent certificates are the +// CA chain. Certificates are appended to the provider leaf first, then CA chain. +func Decrypt(pfxData []byte, password string) (p *Provider, err error) { + p = &Provider{} + + var crt *x509.Certificate + var ca []*x509.Certificate + if p.key, crt, ca, err = pkcs12.DecodeChain(pfxData, password); err != nil { + return nil, err + } + + p.chain.Certificate = append(p.chain.Certificate, crt.Raw) + for _, c := range ca { + p.chain.Certificate = append(p.chain.Certificate, c.Raw) + } + return p, nil +} + +// Encrypt Provider as pfxData containing a private key, the end-entity certificate as +// the leaf certificate, and the rest of the chain as CA certificates. The private key +// is encrypted with the provided password, however, because of the weak encryption +// primitives used by PKCS#12, it is strongly recommended that a hardcoded password +// (such as pkcs12.DefaultPassword) is specified and the pfxData is protected using +// other means. See the software.sslmate.com go-pkcs12 package for more details. +// +// This method will return an error if the private key is nil, if there are no +// certificates stored on the provider, or if the certs cannot be parsed as x509 certs. +func (p *Provider) Encrypt(password string) (pfxData []byte, err error) { + if len(p.chain.Certificate) == 0 { + return nil, ErrNoCertificates + } + + if p.key == nil { + return nil, ErrKeyRequired + } + + // Assume certificate is the first element in the chain + var crt *x509.Certificate + if crt, err = x509.ParseCertificate(p.chain.Certificate[0]); err != nil { + return nil, fmt.Errorf("could not parse leaf certificate: %s", err) + } + + var ca []*x509.Certificate + if len(p.chain.Certificate) > 1 { + ca = make([]*x509.Certificate, len(p.chain.Certificate)-1) + for i, cacrt := range p.chain.Certificate[1:] { + if ca[i], err = x509.ParseCertificate(cacrt); err != nil { + return nil, fmt.Errorf("could not parse certificate %d: %s", i+1, err) + } + } + } + + return pkcs12.Encode(rand.Reader, p.key, crt, ca, password) +} + +// Decode PEM blocks and adds them to the provider. Certificates are appended to the +// Provider chain and Private Keys are Unmarshalled from PKCS8. All other block types +// return an error and stop processing the block or chain. Only the private key is +// verified for correctness, certificates are unvalidated. +func (p *Provider) Decode(in []byte) (err error) { + var block *pem.Block + for { + block, in = pem.Decode(in) + if block == nil { + break + } + + switch block.Type { + case BlockCertificate: + p.chain.Certificate = append(p.chain.Certificate, block.Bytes) + case BlockPrivateKey, BlockECPrivateKey, BlockRSAPrivateKey: + if p.key, err = parsePrivateKey(block); err != nil { + return err + } + default: + return fmt.Errorf("unhandled block type %q", block.Type) + } + } + return nil +} + +// Encode Provider in PCKS12 PEM format for serialization. Certificates are written to +// the array first. If the private key exists, it is written as the last PEM block. +func (p *Provider) Encode() (_ []byte, err error) { + var b bytes.Buffer + var block []byte + + for i, asn1Data := range p.chain.Certificate { + var crt *x509.Certificate + if crt, err = x509.ParseCertificate(asn1Data); err != nil { + return nil, fmt.Errorf("could not parse certificate %d: %s", i, err) + } + + if block, err = PEMEncodeCertificate(crt); err != nil { + return nil, fmt.Errorf("could not encode certificate %d: %s", i, err) + } + + b.Write(block) + } + + if p.key != nil { + if block, err = PEMEncodePrivateKey(p.key); err != nil { + return nil, fmt.Errorf("could not encode private key: %s", err) + } + + b.Write(block) + } + + return b.Bytes(), nil +} + +// GetCertPool returns the x509.CertPool certificate set representing the root, +// intermediate, and leaf certificates of the Provider. This pool is provider-specific +// and does not include system certificates. +func (p *Provider) GetCertPool() (_ *x509.CertPool, err error) { + pool := x509.NewCertPool() + for _, c := range p.chain.Certificate { + var x509Cert *x509.Certificate + if x509Cert, err = x509.ParseCertificate(c); err != nil { + return nil, err + } + pool.AddCert(x509Cert) + } + return pool, nil +} + +// GetKeyPair returns a tls.Certificate parsed from the PEM encoded data maintained by +// the provider. This method uses tls.X509KeyPair to ensure that the public/private key +// pair are suitable for use with an HTTP Server. +func (p *Provider) GetKeyPair() (_ tls.Certificate, err error) { + if p.key == nil { + return tls.Certificate{}, ErrKeyRequired + } + + var block []byte + var certs bytes.Buffer + for i, asn1Data := range p.chain.Certificate { + var crt *x509.Certificate + if crt, err = x509.ParseCertificate(asn1Data); err != nil { + return tls.Certificate{}, fmt.Errorf("could not parse certificate %d: %s", i, err) + } + + if block, err = PEMEncodeCertificate(crt); err != nil { + return tls.Certificate{}, fmt.Errorf("could not encode certificate %d: %s", i, err) + } + + certs.Write(block) + } + + var key []byte + if key, err = PEMEncodePrivateKey(p.key); err != nil { + return tls.Certificate{}, err + } + + return tls.X509KeyPair(certs.Bytes(), key) +} + +// GetLeafCertificate returns the parsed x509 leaf certificate if it exists, returning +// an error if there are no certificates or if there is a parse error. +func (p *Provider) GetLeafCertificate() (*x509.Certificate, error) { + if p.chain.Leaf != nil { + return p.chain.Leaf, nil + } + + if len(p.chain.Certificate) == 0 { + return nil, ErrNoCertificates + } + return x509.ParseCertificate(p.chain.Certificate[0]) +} + +// GetKey returns the private key, or nil if this is a public provider. +func (p *Provider) GetKey() interface{} { + return p.key +} + +// GetRSAKeys returns a fully constructed RSA PrivateKey that includes the public key +// material property. This method errors if the key is not an RSA key or does not exist. +func (p *Provider) GetRSAKeys() (key *rsa.PrivateKey, err error) { + if p.key == nil { + return nil, ErrKeyRequired + } + + var ok bool + if key, ok = p.key.(*rsa.PrivateKey); !ok { + return nil, fmt.Errorf("private key is not RSA but is %T", p.key) + } + + var cert *x509.Certificate + if cert, err = p.GetLeafCertificate(); err != nil { + return nil, err + } + + key.PublicKey = *cert.PublicKey.(*rsa.PublicKey) + return key, nil +} + +// IsPrivate returns true if the Provider contains a non-nil key. +func (p *Provider) IsPrivate() bool { + return p.key != nil +} + +// Public returns a Provider without the key. If the Provider is already public, then +// the pointer to the same Provider is returned (does not clone). +func (p *Provider) Public() *Provider { + if p.key == nil { + return p + } + return &Provider{chain: p.chain, key: nil} +} + +// String returns the common name of the Provider from the leaf certificate. +func (p *Provider) String() string { + cert, err := p.GetLeafCertificate() + if err != nil { + return "" + } + return cert.Subject.CommonName +} diff --git a/pkg/trust/trust_test.go b/pkg/trust/trust_test.go new file mode 100644 index 0000000..59d85ad --- /dev/null +++ b/pkg/trust/trust_test.go @@ -0,0 +1,226 @@ +package trust_test + +import ( + "crypto/rand" + "crypto/rsa" + "crypto/tls" + "crypto/x509" + "crypto/x509/pkix" + "math/big" + "sync" + "testing" + "time" + + "github.com/stretchr/testify/require" + "github.com/trisacrypto/trisa/pkg/trust" + "software.sslmate.com/src/go-pkcs12" +) + +func TestPrivateProvider(t *testing.T) { + pfxData, err := chain() + require.NoError(t, err) + + p, err := trust.Decrypt(pfxData, pkcs12.DefaultPassword) + require.NoError(t, err) + require.True(t, p.IsPrivate()) + require.Equal(t, "Test", p.String()) + + pool, err := p.GetCertPool() + require.NoError(t, err) + require.Len(t, pool.Subjects(), 3) + + pair, err := p.GetKeyPair() + require.NoError(t, err) + require.NotNil(t, pair.PrivateKey) + require.Len(t, pair.Certificate, 3) + + // Test encrypt/decrypt + pfxData, err = p.Encrypt("supersecretsquirrel") + require.NoError(t, err) + + _, err = trust.Decrypt(pfxData, "knockknock") + require.Error(t, err) + + o, err := trust.Decrypt(pfxData, "supersecretsquirrel") + require.NoError(t, err) + require.Equal(t, p, o) + require.True(t, o.IsPrivate()) + + // Test encode/decode + pfxData, err = p.Encode() + require.NoError(t, err) + + o = &trust.Provider{} + require.NotEqual(t, p, o) + require.NoError(t, o.Decode(pfxData)) + require.Equal(t, p, o) + require.True(t, o.IsPrivate()) +} + +func TestPublicProvider(t *testing.T) { + pfxData, err := chain() + require.NoError(t, err) + + priv, err := trust.Decrypt(pfxData, pkcs12.DefaultPassword) + require.NoError(t, err) + + p := priv.Public() + require.NotEqual(t, p, priv) + + o := p.Public() + require.Equal(t, &p, &o) + + require.False(t, p.IsPrivate()) + require.Equal(t, "Test", p.String()) + + pool, err := p.GetCertPool() + require.NoError(t, err) + require.Len(t, pool.Subjects(), 3) + + _, err = p.GetKeyPair() + require.Error(t, err) + + // Test encrypt + _, err = p.Encrypt("supersecretsquirrel") + require.Error(t, err) + + // Test encode/decode + pfxData, err = p.Encode() + require.NoError(t, err) + + o = &trust.Provider{} + require.NotEqual(t, p, o) + require.NoError(t, o.Decode(pfxData)) + require.Equal(t, p, o) + require.False(t, o.IsPrivate()) +} + +// TestCA variables +var ( + initCAonce sync.Once + rootCA tls.Certificate + intermediateCA tls.Certificate +) + +// Create a chain with a leaf node, an intermediate, and root ca + private key. +func chain() (data []byte, err error) { + initCAonce.Do(initCA) + + tmpl := &x509.Certificate{ + SerialNumber: big.NewInt(44), + Subject: pkix.Name{ + CommonName: "Test", + Organization: []string{"Test Net"}, + Country: []string{"XX"}, + }, + NotBefore: time.Now(), + NotAfter: time.Now().AddDate(0, 0, 7), + SubjectKeyId: []byte{1, 2, 3, 4, 5, 6}, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth}, + KeyUsage: x509.KeyUsageDigitalSignature, + } + + priv, _ := rsa.GenerateKey(rand.Reader, 4096) + pub := &priv.PublicKey + + // Sign the certificate + var ca *x509.Certificate + if ca, err = x509.ParseCertificate(intermediateCA.Certificate[0]); err != nil { + return nil, err + } + + var signed []byte + if signed, err = x509.CreateCertificate(rand.Reader, tmpl, ca, pub, priv); err != nil { + return nil, err + } + + var cert *x509.Certificate + if cert, err = x509.ParseCertificate(signed); err != nil { + return nil, err + } + + var rca *x509.Certificate + if rca, err = x509.ParseCertificate(rootCA.Certificate[0]); err != nil { + return nil, err + } + + return pkcs12.Encode(rand.Reader, priv, cert, []*x509.Certificate{ca, rca}, pkcs12.DefaultPassword) +} + +func initCA() { + // Root CA + rootCAtmpl := &x509.Certificate{ + SerialNumber: big.NewInt(42), + Subject: pkix.Name{ + CommonName: "Test Root CA", + Organization: []string{"Test Root"}, + Country: []string{"XX"}, + }, + NotBefore: time.Now(), + NotAfter: time.Now().AddDate(10, 0, 0), + IsCA: true, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth}, + KeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign, + BasicConstraintsValid: true, + } + + priv, _ := rsa.GenerateKey(rand.Reader, 4096) + data, err := x509.CreateCertificate(rand.Reader, rootCAtmpl, rootCAtmpl, &priv.PublicKey, priv) + if err != nil { + panic(err) + } + + if rootCA, err = parseCertificate(data, priv); err != nil { + panic(err) + } + + // Intermediate CA + interCAtmpl := &x509.Certificate{ + SerialNumber: big.NewInt(43), + Subject: pkix.Name{ + CommonName: "Test Intermediate CA", + Organization: []string{"Test Intermediate"}, + Country: []string{"XX"}, + }, + NotBefore: time.Now(), + NotAfter: time.Now().AddDate(10, 0, 0), + IsCA: true, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth}, + KeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign | x509.KeyUsageCRLSign, + BasicConstraintsValid: true, + } + + ca, err := x509.ParseCertificate(rootCA.Certificate[0]) + if err != nil { + panic(err) + } + + priv, _ = rsa.GenerateKey(rand.Reader, 4096) + if data, err = x509.CreateCertificate(rand.Reader, interCAtmpl, ca, &priv.PublicKey, priv); err != nil { + panic(err) + } + + if intermediateCA, err = parseCertificate(data, priv); err != nil { + panic(err) + } + +} + +func parseCertificate(data []byte, priv *rsa.PrivateKey) (tls.Certificate, error) { + crt, err := x509.ParseCertificate(data) + if err != nil { + return tls.Certificate{}, err + } + + certPEMBlock, err := trust.PEMEncodeCertificate(crt) + if err != nil { + return tls.Certificate{}, err + } + + keyPEMBlock, err := trust.PEMEncodePrivateKey(priv) + if err != nil { + return tls.Certificate{}, err + } + + return tls.X509KeyPair(certPEMBlock, keyPEMBlock) +} diff --git a/pkg/trust/zip.go b/pkg/trust/zip.go new file mode 100644 index 0000000..a93fec9 --- /dev/null +++ b/pkg/trust/zip.go @@ -0,0 +1,444 @@ +package trust + +import ( + "archive/zip" + "bytes" + "compress/gzip" + "fmt" + "io" + "io/ioutil" + "os" + "path/filepath" + "strings" + + "software.sslmate.com/src/go-pkcs12" +) + +// Compression +const ( + CompressionGZIP = ".gz" + CompressionZIP = ".zip" + CompressionNone = ".pem" + CompressionAuto = "auto" +) + +var validFormats = map[string]struct{}{ + CompressionGZIP: {}, + CompressionZIP: {}, + CompressionNone: {}, + CompressionAuto: {}, +} + +// Serializer maintains options for compression, encoding, and pkcs12 encryption when +// serializing and deserializing Provider and ProviderPool objects to and from disk. +type Serializer struct { + // During extraction, if marked as private the serializer will expect PKCS12 + // decryption from the incoming data. During compression, if marked not private, + // then the serializer will only serialize the public Provider. This has no effect + // on ProviderPool serialization which can only be serialized/deserialized with the + // public certificates. + Private bool + + // The password for encryption or decryption; required if Private is set to true, + // if empty then the pkcs12.DefaultPassword, "changeit" is used. + Password string + + // Format is one of "gz", "zip", "pem" (for no compression) and auto. If auto, then + // during extraction the format is detected from the file extension, otherwise an + // error is returned if directly from bytes. During compression if auto, then the + // format is "gz" for Providers and "zip" for ProviderPools. + Format string + + // Internal helper fields + path string + multiple bool +} + +// NewSerializer creates a serializer with default options ready to either extract or +// compress a Provider or a ProviderPool. The serializer takes additional positional +// arguments of password and format respectively. +func NewSerializer(private bool, opts ...string) (_ *Serializer, err error) { + serializer := &Serializer{Private: private} + + if len(opts) > 0 { + serializer.Password = opts[0] + } + if serializer.Private && serializer.Password == "" { + serializer.Password = pkcs12.DefaultPassword + } + + if len(opts) > 1 { + serializer.Format = opts[1] + if _, err = serializer.getFormat(); err != nil { + return nil, err + } + } else { + serializer.Format = CompressionAuto + } + + return serializer, nil +} + +// Extract a Provider object from the given data, decompressing according to the format +// and decoding or decrypting the data as needed. Returns an error if the format is not +// correctly set or available. +func (s *Serializer) Extract(data []byte) (p *Provider, err error) { + b := bytes.NewReader(data) + return s.Read(b) +} + +// ExtractPool from the given data, decompressing according to the format and decoding +// or decrypting the data as needed. Returns an error if the format is not correctly set +// or available on the serializer object. +func (s *Serializer) ExtractPool(data []byte) (pool ProviderPool, err error) { + b := bytes.NewReader(data) + return s.ReadPool(b) +} + +// Read and extract a Provider from the reader object. If the Format is CompressionZip, +// this method expects an io.ReadCloser, returned from the zip.File.Open method. Archive +// handling must happen before this method is called. +func (s *Serializer) Read(r io.Reader) (_ *Provider, err error) { + // Set internal fields for downstream computation + s.multiple = false + var mode string + if mode, err = s.getFormat(); err != nil { + return nil, err + } + + // Load the data into memory + var data []byte + + switch mode { + case CompressionGZIP: + if r, err = gzip.NewReader(r); err != nil { + return nil, err + } + fallthrough + case CompressionNone, CompressionZIP: + if data, err = ioutil.ReadAll(r); err != nil { + return nil, err + } + default: + return nil, fmt.Errorf("unhandled format %q", mode) + } + + if s.Private { + return Decrypt(data, s.Password) + } + + return New(data) +} + +// ReadPool and extract a ProviderPool from the reader objects. If no readers are +// provided then an empty pool is returned. If the Format is CompressionZip, this method +// expects that the archive has been opened and is operating on all internal readers. +func (s *Serializer) ReadPool(readers ...io.Reader) (pool ProviderPool, err error) { + pool = make(ProviderPool) + for _, r := range readers { + var p *Provider + if p, err = s.Read(r); err != nil { + return nil, err + } + pool.Add(p) + } + return pool, nil +} + +// ReadFile and extract a Provider from it. This function expects only a single provider +// so it handles Zip archives specially, requiring that the Zip archive only has a +// single file in it, otherwise an error is returned. +func (s *Serializer) ReadFile(path string) (p *Provider, err error) { + // Set internal fields for downstream computation + s.path = path + + // Open ZIP archive for reading if the extension is .zip + var mode string + if mode, err = s.getFormat(); err != nil { + return nil, err + } + + if mode == CompressionZIP { + var archive *zip.ReadCloser + if archive, err = zip.OpenReader(path); err != nil { + return nil, err + } + defer archive.Close() + + switch len(archive.File) { + case 0: + return nil, ErrZipEmpty + case 1: + var rc io.ReadCloser + if rc, err = archive.File[0].Open(); err != nil { + return nil, err + } + defer rc.Close() + return s.Read(rc) + default: + return nil, ErrZipTooMany + } + } + + // Handle all other file types + var f *os.File + if f, err = os.Open(path); err != nil { + return nil, err + } + + return s.Read(f) +} + +// ReadPoolFile and extract a ProviderPool from it. This method primarily expects a Zip +// archive with multiple public provider files contained. +// TODO: handle directories +func (s *Serializer) ReadPoolFile(path string) (p ProviderPool, err error) { + // Set internal fields for downstream computation + s.path = path + + // Open ZIP archive for reading if the extension is .zip + var mode string + if mode, err = s.getFormat(); err != nil { + return nil, err + } + + if mode == CompressionZIP { + var archive *zip.ReadCloser + if archive, err = zip.OpenReader(path); err != nil { + return nil, err + } + defer archive.Close() + + readers := make([]io.Reader, 0, len(archive.File)) + for _, f := range archive.File { + var rc io.ReadCloser + if rc, err = f.Open(); err != nil { + return nil, err + } + defer rc.Close() + readers = append(readers, rc) + } + return s.ReadPool(readers...) + } + + // Handle all other file types + var f *os.File + if f, err = os.Open(path); err != nil { + return nil, err + } + + return s.ReadPool(f) +} + +// Compress a Provider into the given format with the specified encryption or encoding. +func (s *Serializer) Compress(p *Provider) (data []byte, err error) { + // Set internal fields for downstream computation + s.multiple = false + + var b bytes.Buffer + if err = s.Write(p, &b); err != nil { + return nil, err + } + + return b.Bytes(), nil +} + +// CompressPool into the given format with the specified encryption or encoding. +func (s *Serializer) CompressPool(pool ProviderPool) (data []byte, err error) { + // Set internal fields for downstream computation + s.multiple = len(pool) > 1 + + var b bytes.Buffer + if err = s.WritePool(pool, &b); err != nil { + return nil, err + } + + return b.Bytes(), nil +} + +// Write the provider encoded to the writer object. +func (s *Serializer) Write(p *Provider, w io.Writer) (err error) { + // Set internal fields for downstream computation + s.multiple = false + var mode string + if mode, err = s.getFormat(); err != nil { + return err + } + + // Serialize the data + var data []byte + if s.Private { + if data, err = p.Encrypt(s.Password); err != nil { + return err + } + } else { + if data, err = p.Encode(); err != nil { + return err + } + } + + // Compress and write the data to disk + switch mode { + case CompressionGZIP: + archive := gzip.NewWriter(w) + if _, err = archive.Write(data); err != nil { + return err + } + return archive.Close() + case CompressionZIP: + archive := zip.NewWriter(w) + name := p.String() + ".pem" + name = strings.ReplaceAll(strings.ToLower(name), " ", "_") + + var rc io.Writer + if rc, err = archive.Create(name); err != nil { + return err + } + if _, err = rc.Write(data); err != nil { + return err + } + return archive.Close() + case CompressionNone: + _, err = w.Write(data) + return err + default: + return fmt.Errorf("unhandled format %q", mode) + } +} + +// WritePool encoded to the writer object. +func (s *Serializer) WritePool(pool ProviderPool, w io.Writer) (err error) { + // Set internal fields for downstream computation + s.multiple = len(pool) > 1 + + // getFormat checks to ensure that we're not writing multiple providers to a non-Zip file + var mode string + if mode, err = s.getFormat(); err != nil { + return err + } + + // Compress and write the data to disk + switch mode { + case CompressionGZIP: + archive := gzip.NewWriter(w) + for _, p := range pool { + // Only write public pools to disk + p = p.Public() + var data []byte + if data, err = p.Encode(); err != nil { + return err + } + if _, err = archive.Write(data); err != nil { + return err + } + } + return archive.Close() + case CompressionZIP: + archive := zip.NewWriter(w) + for _, p := range pool { + // Only write public pools to disk + p = p.Public() + var data []byte + if data, err = p.Encode(); err != nil { + return err + } + + name := p.String() + ".pem" + name = strings.ReplaceAll(strings.ToLower(name), " ", "_") + + var rc io.Writer + if rc, err = archive.Create(name); err != nil { + return err + } + if _, err = rc.Write(data); err != nil { + return err + } + } + return archive.Close() + case CompressionNone: + for _, p := range pool { + // Only write public pools to disk + p = p.Public() + var data []byte + if data, err = p.Encode(); err != nil { + return err + } + if _, err = w.Write(data); err != nil { + return err + } + } + default: + return fmt.Errorf("unhandled format %q", mode) + } + + return nil +} + +// WriteFile with the encoded provider object. +func (s *Serializer) WriteFile(p *Provider, path string) (err error) { + // Set internal fields for downstream computation + s.path = path + s.multiple = false + + var f *os.File + if f, err = os.Create(path); err != nil { + return err + } + + return s.Write(p, f) +} + +// WritePoolFile with the encoded provider pool object. +func (s *Serializer) WritePoolFile(pool ProviderPool, path string) (err error) { + // Set internal fields for downstream computation + s.path = path + s.multiple = len(pool) > 1 + + var f *os.File + if f, err = os.Create(path); err != nil { + return err + } + + return s.WritePool(pool, f) +} + +func (s *Serializer) getFormat() (string, error) { + if s.Format == "" { + s.Format = CompressionAuto + } else { + s.Format = strings.ToLower(s.Format) + } + + if _, ok := validFormats[s.Format]; !ok { + return "", fmt.Errorf("%q not a valid serializer format", s.Format) + } + + var ext string + if s.path != "" { + ext = filepath.Ext(s.path) + } + + if s.Format == CompressionAuto { + if ext != "" { + if _, ok := validFormats[ext]; !ok { + return "", fmt.Errorf("%q is not a valid serializer format", s.Format) + } + return ext, nil + } + + if s.multiple { + return CompressionZIP, nil + } + return CompressionGZIP, nil + } + + if ext != "" && ext != s.Format { + return "", fmt.Errorf("cannot write %s format to %s", s.Format, s.path) + } + + if s.multiple && s.Format != CompressionZIP { + return "", fmt.Errorf("cannot write multiple providers to %s", s.Format) + } + + return s.Format, nil +} diff --git a/pkg/trust/zip_test.go b/pkg/trust/zip_test.go new file mode 100644 index 0000000..e4cf996 --- /dev/null +++ b/pkg/trust/zip_test.go @@ -0,0 +1,91 @@ +package trust_test + +import ( + "bytes" + "io/ioutil" + "os" + "testing" + + "github.com/stretchr/testify/require" + "github.com/trisacrypto/trisa/pkg/trust" + "software.sslmate.com/src/go-pkcs12" +) + +func TestNewSerializer(t *testing.T) { + stream, err := trust.NewSerializer(false) + require.NoError(t, err) + require.False(t, stream.Private) + require.Equal(t, stream.Format, trust.CompressionAuto) + require.Empty(t, stream.Password) + + stream, err = trust.NewSerializer(true) + require.NoError(t, err) + require.True(t, stream.Private) + require.Equal(t, pkcs12.DefaultPassword, stream.Password) + require.Equal(t, stream.Format, trust.CompressionAuto) + + stream, err = trust.NewSerializer(true, "supersecret") + require.NoError(t, err) + require.True(t, stream.Private) + require.Equal(t, "supersecret", stream.Password) + require.Equal(t, stream.Format, trust.CompressionAuto) + + stream, err = trust.NewSerializer(false, "", trust.CompressionZIP) + require.NoError(t, err) + require.False(t, stream.Private) + require.Empty(t, stream.Password) + require.Equal(t, stream.Format, trust.CompressionZIP) + + stream, err = trust.NewSerializer(true, "supersecret", trust.CompressionNone) + require.NoError(t, err) + require.True(t, stream.Private) + require.Equal(t, "supersecret", stream.Password) + require.Equal(t, stream.Format, trust.CompressionNone) + + stream, err = trust.NewSerializer(true, "", "foo") + require.Nil(t, stream) + require.Error(t, err) +} + +func TestSeralizer(t *testing.T) { + // Test Serializer on Sectigo data, e.g. a client can read a private Provider from + // a PCKS12 encrypted file and that the Directory service can extract the Public + // keys and write them in a gzip format that can then be decrompressed and loaded by + // other clients. This should exercise the primary serialization code. + + serializer, err := trust.NewSerializer(true, "qDhAwnfMjgDEzzUC") + require.NoError(t, err) + + // Decode from Sectigo encoding + provider, err := serializer.ReadFile("testdata/128106.zip") + require.NoError(t, err) + require.True(t, provider.IsPrivate()) + + // Create temporary file for reading and writing + f, err := ioutil.TempFile("", "128106*.gz") + require.NoError(t, err) + path := f.Name() + f.Close() + defer os.Remove(path) + t.Logf("created temporary file at %s", path) + + // Compress public provider to gzip file + serializer, err = trust.NewSerializer(false) + err = serializer.WriteFile(provider.Public(), path) + require.NoError(t, err) + + // Read public provider from gzip file + serializer, err = trust.NewSerializer(false, "", trust.CompressionGZIP) + require.NoError(t, err) + o, err := serializer.ReadFile(path) + require.NoError(t, err) + require.False(t, o.IsPrivate()) + + pb, err := provider.Public().Encode() + require.NoError(t, err) + + ob, err := o.Encode() + require.NoError(t, err) + + require.True(t, bytes.Equal(pb, ob)) +} diff --git a/pkg/version.go b/pkg/version.go new file mode 100644 index 0000000..1ca6ffc --- /dev/null +++ b/pkg/version.go @@ -0,0 +1,21 @@ +/* +Package pkg describes the TRISA Go package (reference implementation). +*/ +package pkg + +import "fmt" + +// Version component constants for the current build. +const ( + VersionMajor = 0 + VersionMinor = 1 + VersionPatch = 0 +) + +// Version returns the semantic version for the current build. +func Version() string { + if VersionPatch > 0 { + return fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch) + } + return fmt.Sprintf("%d.%d", VersionMajor, VersionMinor) +} diff --git a/proto/ivms101/enum.proto b/proto/ivms101/enum.proto index 9d25962..f1284a8 100644 --- a/proto/ivms101/enum.proto +++ b/proto/ivms101/enum.proto @@ -33,7 +33,7 @@ syntax = "proto3"; package ivms101; -option go_package = "github.com/trisacrypto/testnet/pkg/ivms101"; +option go_package = "github.com/trisacrypto/trisa/pkg/ivms101"; /*************************************************** diff --git a/proto/ivms101/identity.proto b/proto/ivms101/identity.proto index 9f35ae4..9a777d7 100644 --- a/proto/ivms101/identity.proto +++ b/proto/ivms101/identity.proto @@ -33,7 +33,7 @@ syntax = "proto3"; package ivms101; -option go_package = "github.com/trisacrypto/testnet/pkg/ivms101"; +option go_package = "github.com/trisacrypto/trisa/pkg/ivms101"; import "ivms101/ivms101.proto"; import "ivms101/enum.proto"; diff --git a/proto/ivms101/ivms101.proto b/proto/ivms101/ivms101.proto index 7fbaf79..5bcbfce 100644 --- a/proto/ivms101/ivms101.proto +++ b/proto/ivms101/ivms101.proto @@ -33,7 +33,7 @@ syntax = "proto3"; package ivms101; -option go_package = "github.com/trisacrypto/testnet/pkg/ivms101"; +option go_package = "github.com/trisacrypto/trisa/pkg/ivms101"; import "ivms101/enum.proto"; diff --git a/proto/trisa/gds/api/v1beta1/api.proto b/proto/trisa/gds/api/v1beta1/api.proto index f7a33d6..5ac95d5 100644 --- a/proto/trisa/gds/api/v1beta1/api.proto +++ b/proto/trisa/gds/api/v1beta1/api.proto @@ -1,11 +1,11 @@ syntax = "proto3"; -package trisads.api.v1alpha1; -option go_package = "github.com/trisacrypto/testnet/pkg/trisads/pb/api/v1alpha1;api"; +package trisa.gds.api.v1beta1; +option go_package = "github.com/trisacrypto/trisa/pkg/trisa/gds/api/v1beta1;api"; import "ivms101/ivms101.proto"; -import "trisads/models/v1alpha1/models.proto"; -import "trisads/models/v1alpha1/ca.proto"; +import "trisa/gds/models/v1beta1/models.proto"; +import "trisa/gds/models/v1beta1/ca.proto"; service TRISACompliance { @@ -39,7 +39,7 @@ message RegisterRequest { ivms101.LegalPerson entity = 1; // Technical, legal, billing, and administrative contacts for the VASP. - trisads.models.v1alpha1.Contacts contacts = 2; + trisa.gds.models.v1beta1.Contacts contacts = 2; // Travel Rule Implementation Endpoint - where other TRISA peers should connect. // This should be an addr:port combination, e.g. trisa.vaspbot.net:443 @@ -52,12 +52,12 @@ message RegisterRequest { // Business Information string website = 5; - trisads.models.v1alpha1.BusinessCategory business_category = 6; - trisads.models.v1alpha1.VASPCategory vasp_category = 7; + trisa.gds.models.v1beta1.BusinessCategory business_category = 6; + trisa.gds.models.v1beta1.VASPCategory vasp_category = 7; string established_on = 8; // Should be a date in YYYY-MM-DD format // TRIXO Questionnaire - trisads.models.v1alpha1.TRIXOQuestionnaire trixo = 9; + trisa.gds.models.v1beta1.TRIXOQuestionnaire trixo = 9; } message RegisterReply { @@ -71,7 +71,7 @@ message RegisterReply { string common_name = 4; // The verification status of the VASP entity. - trisads.models.v1alpha1.VerificationState status = 5; + trisa.gds.models.v1beta1.VerificationState status = 5; string message = 6; } @@ -109,8 +109,8 @@ message LookupReply { // Certificate information if the VASP is available and verified. The identity // certificate is used to establish mTLS connections, the signing certificate is // used on a per-transaction basis. - trisads.models.v1alpha1.Certificate identity_certificate = 6; - trisads.models.v1alpha1.Certificate signing_certificate = 7; + trisa.gds.models.v1beta1.Certificate identity_certificate = 6; + trisa.gds.models.v1beta1.Certificate signing_certificate = 7; // Other VASP information that faciliates P2P exchanges string name = 8; @@ -132,8 +132,8 @@ message SearchRequest { // Search filters to condition the search on. Only VASPs that are in the // country(ies) or category(ies) specified are returned. repeated string country = 7; - repeated trisads.models.v1alpha1.BusinessCategory business_category = 8; - repeated trisads.models.v1alpha1.VASPCategory vasp_category = 9; + repeated trisa.gds.models.v1beta1.BusinessCategory business_category = 8; + repeated trisa.gds.models.v1beta1.VASPCategory vasp_category = 9; } message SearchReply { @@ -174,8 +174,8 @@ message StatusReply { Error error = 1; // Status information - trisads.models.v1alpha1.VerificationState verification_status = 2; - trisads.models.v1alpha1.ServiceState service_status = 3; + trisa.gds.models.v1beta1.VerificationState verification_status = 2; + trisa.gds.models.v1beta1.ServiceState service_status = 3; string verified_on = 4; // Should be an RFC 3339 Timestamp string first_listed = 5; // Should be an RFC 3339 Timestamp string last_updated = 6; // Should be an RFC 3339 Timestamp @@ -191,7 +191,7 @@ message VerifyEmailReply { Error error = 1; // The verification status of the VASP entity. - trisads.models.v1alpha1.VerificationState status = 2; + trisa.gds.models.v1beta1.VerificationState status = 2; string message = 3; // Used to decrypt the emailed certificates in PKCS 12 format diff --git a/proto/trisa/gds/models/v1beta1/ca.proto b/proto/trisa/gds/models/v1beta1/ca.proto index f0238d9..afbbb28 100644 --- a/proto/trisa/gds/models/v1beta1/ca.proto +++ b/proto/trisa/gds/models/v1beta1/ca.proto @@ -1,7 +1,7 @@ syntax="proto3"; -package trisads.models.v1beta1; -option go_package = "github.com/trisacrypto/directory/pkg/trisads/models/v1beta1;models"; +package trisa.gds.models.v1beta1; +option go_package = "github.com/trisacrypto/trisa/pkg/trisa/gds/models/v1beta1;models"; // Certificate requests are maintained separately from the VASP record since they should diff --git a/proto/trisa/gds/models/v1beta1/models.proto b/proto/trisa/gds/models/v1beta1/models.proto index f75c1a6..faeb9e6 100644 --- a/proto/trisa/gds/models/v1beta1/models.proto +++ b/proto/trisa/gds/models/v1beta1/models.proto @@ -1,10 +1,10 @@ syntax = "proto3"; -package trisads.models.v1beta1; -option go_package = "github.com/trisacrypto/directory/pkg/trisads/models/v1beta1;models"; +package trisa.gds.models.v1beta1; +option go_package = "github.com/trisacrypto/trisa/pkg/trisa/gds/models/v1beta1;models"; import "ivms101/ivms101.proto"; -import "trisads/models/v1beta1/ca.proto"; +import "trisa/gds/models/v1beta1/ca.proto"; // VASP represents the top-level directory entry for certificate public key exchange. // The TRISA Directory service allows search and lookup of VASP entries and returns