diff --git a/go.mod b/go.mod index 5d887dde..721b2c46 100644 --- a/go.mod +++ b/go.mod @@ -9,10 +9,10 @@ require ( github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.21.0 github.com/miekg/pkcs11 v1.1.1 - golang.org/x/crypto v0.25.0 - google.golang.org/genproto/googleapis/api v0.0.0-20240725223205-93522f1f2a9f + golang.org/x/crypto v0.26.0 + google.golang.org/genproto/googleapis/api v0.0.0-20240812133136-8ffd90a71988 google.golang.org/grpc v1.65.0 - google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.4.0 + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 google.golang.org/protobuf v1.34.2 ) @@ -22,12 +22,12 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/stretchr/testify v1.7.0 // indirect - golang.org/x/mod v0.19.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect - golang.org/x/tools v0.23.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240725223205-93522f1f2a9f // indirect + golang.org/x/mod v0.20.0 // indirect + golang.org/x/net v0.28.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.24.0 // indirect + golang.org/x/text v0.17.0 // indirect + golang.org/x/tools v0.24.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240812133136-8ffd90a71988 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 3f13e8fc..56616076 100644 --- a/go.sum +++ b/go.sum @@ -67,8 +67,8 @@ go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= +golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= +golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= 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= @@ -77,8 +77,8 @@ golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8= -golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= +golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= 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= @@ -88,8 +88,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= 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= @@ -97,8 +97,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= 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-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -108,15 +108,15 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk= -golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4= +golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= +golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 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= @@ -127,8 +127,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg= -golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI= +golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= +golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -138,10 +138,10 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 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-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto/googleapis/api v0.0.0-20240725223205-93522f1f2a9f h1:b1Ln/PG8orm0SsBbHZWke8dDp2lrCD4jSmfglFpTZbk= -google.golang.org/genproto/googleapis/api v0.0.0-20240725223205-93522f1f2a9f/go.mod h1:AHT0dDg3SoMOgZGnZk29b5xTbPHMoEC8qthmBLJCpys= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240725223205-93522f1f2a9f h1:RARaIm8pxYuxyNPbBQf5igT7XdOyCNtat1qAT2ZxjU4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240725223205-93522f1f2a9f/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240812133136-8ffd90a71988 h1:+/tmTy5zAieooKIXfzDm9KiA3Bv6JBwriRN9LY+yayk= +google.golang.org/genproto/googleapis/api v0.0.0-20240812133136-8ffd90a71988/go.mod h1:4+X6GvPs+25wZKbQq9qyAXrwIRExv7w0Ea6MgZLZiDM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240812133136-8ffd90a71988 h1:V71AcdLZr2p8dC9dbOIMCpqi4EmRl8wUwnJzXXLmbmc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240812133136-8ffd90a71988/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= 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= @@ -149,8 +149,8 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.4.0 h1:9SxA29VM43MF5Z9dQu694wmY5t8E/Gxr7s+RSxiIDmc= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.4.0/go.mod h1:yZOK5zhQMiALmuweVdIVoQPa6eIJyXn2B9g5dJDhqX4= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 h1:F29+wU6Ee6qgu9TddPgooOdaqsxTMunOoj8KA5yuS5A= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1/go.mod h1:5KF+wpkbTSbGcR9zteSqZV6fqFOWBl4Yde8En8MryZA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/proto/healthcheck.pb.go b/proto/healthcheck.pb.go index 5cd3dbe0..c3b7445f 100644 --- a/proto/healthcheck.pb.go +++ b/proto/healthcheck.pb.go @@ -14,8 +14,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 -// protoc v4.25.0 +// protoc-gen-go v1.34.2 +// protoc v5.27.3 // source: healthcheck.proto package proto @@ -229,7 +229,7 @@ func file_healthcheck_proto_rawDescGZIP() []byte { var file_healthcheck_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_healthcheck_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_healthcheck_proto_goTypes = []interface{}{ +var file_healthcheck_proto_goTypes = []any{ (HealthCheckResponse_ServingStatus)(0), // 0: v3.HealthCheckResponse.ServingStatus (*HealthCheckRequest)(nil), // 1: v3.HealthCheckRequest (*HealthCheckResponse)(nil), // 2: v3.HealthCheckResponse @@ -253,7 +253,7 @@ func file_healthcheck_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_healthcheck_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_healthcheck_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*HealthCheckRequest); i { case 0: return &v.state @@ -265,7 +265,7 @@ func file_healthcheck_proto_init() { return nil } } - file_healthcheck_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_healthcheck_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*HealthCheckResponse); i { case 0: return &v.state diff --git a/proto/healthcheck_grpc.pb.go b/proto/healthcheck_grpc.pb.go index d3958e9f..0b80aae5 100644 --- a/proto/healthcheck_grpc.pb.go +++ b/proto/healthcheck_grpc.pb.go @@ -14,8 +14,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.0 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.27.3 // source: healthcheck.proto package proto @@ -29,8 +29,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Health_Check_FullMethodName = "/v3.Health/Check" @@ -44,7 +44,7 @@ type HealthClient interface { // Check implements the health check service for crypki. // Reference - https://github.com/grpc/grpc/blob/7324556353e831c57d30973db33df489c3ed3576/doc/health-checking.md Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) - Watch(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (Health_WatchClient, error) + Watch(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[HealthCheckResponse], error) } type healthClient struct { @@ -56,20 +56,22 @@ func NewHealthClient(cc grpc.ClientConnInterface) HealthClient { } func (c *healthClient) Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(HealthCheckResponse) - err := c.cc.Invoke(ctx, Health_Check_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Health_Check_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *healthClient) Watch(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (Health_WatchClient, error) { - stream, err := c.cc.NewStream(ctx, &Health_ServiceDesc.Streams[0], Health_Watch_FullMethodName, opts...) +func (c *healthClient) Watch(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[HealthCheckResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &Health_ServiceDesc.Streams[0], Health_Watch_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &healthWatchClient{stream} + x := &grpc.GenericClientStream[HealthCheckRequest, HealthCheckResponse]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -79,45 +81,35 @@ func (c *healthClient) Watch(ctx context.Context, in *HealthCheckRequest, opts . return x, nil } -type Health_WatchClient interface { - Recv() (*HealthCheckResponse, error) - grpc.ClientStream -} - -type healthWatchClient struct { - grpc.ClientStream -} - -func (x *healthWatchClient) Recv() (*HealthCheckResponse, error) { - m := new(HealthCheckResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Health_WatchClient = grpc.ServerStreamingClient[HealthCheckResponse] // HealthServer is the server API for Health service. // All implementations must embed UnimplementedHealthServer -// for forward compatibility +// for forward compatibility. type HealthServer interface { // Check implements the health check service for crypki. // Reference - https://github.com/grpc/grpc/blob/7324556353e831c57d30973db33df489c3ed3576/doc/health-checking.md Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) - Watch(*HealthCheckRequest, Health_WatchServer) error + Watch(*HealthCheckRequest, grpc.ServerStreamingServer[HealthCheckResponse]) error mustEmbedUnimplementedHealthServer() } -// UnimplementedHealthServer must be embedded to have forward compatible implementations. -type UnimplementedHealthServer struct { -} +// UnimplementedHealthServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedHealthServer struct{} func (UnimplementedHealthServer) Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Check not implemented") } -func (UnimplementedHealthServer) Watch(*HealthCheckRequest, Health_WatchServer) error { +func (UnimplementedHealthServer) Watch(*HealthCheckRequest, grpc.ServerStreamingServer[HealthCheckResponse]) error { return status.Errorf(codes.Unimplemented, "method Watch not implemented") } func (UnimplementedHealthServer) mustEmbedUnimplementedHealthServer() {} +func (UnimplementedHealthServer) testEmbeddedByValue() {} // UnsafeHealthServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to HealthServer will @@ -127,6 +119,13 @@ type UnsafeHealthServer interface { } func RegisterHealthServer(s grpc.ServiceRegistrar, srv HealthServer) { + // If the following call pancis, it indicates UnimplementedHealthServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Health_ServiceDesc, srv) } @@ -153,21 +152,11 @@ func _Health_Watch_Handler(srv interface{}, stream grpc.ServerStream) error { if err := stream.RecvMsg(m); err != nil { return err } - return srv.(HealthServer).Watch(m, &healthWatchServer{stream}) -} - -type Health_WatchServer interface { - Send(*HealthCheckResponse) error - grpc.ServerStream + return srv.(HealthServer).Watch(m, &grpc.GenericServerStream[HealthCheckRequest, HealthCheckResponse]{ServerStream: stream}) } -type healthWatchServer struct { - grpc.ServerStream -} - -func (x *healthWatchServer) Send(m *HealthCheckResponse) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Health_WatchServer = grpc.ServerStreamingServer[HealthCheckResponse] // Health_ServiceDesc is the grpc.ServiceDesc for Health service. // It's only intended for direct use with grpc.RegisterService, diff --git a/proto/sign.pb.go b/proto/sign.pb.go index 78356dfb..6c6a5e1d 100644 --- a/proto/sign.pb.go +++ b/proto/sign.pb.go @@ -3,8 +3,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 -// protoc v4.25.0 +// protoc-gen-go v1.34.2 +// protoc v5.27.3 // source: sign.proto package proto @@ -904,7 +904,7 @@ func file_sign_proto_rawDescGZIP() []byte { var file_sign_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_sign_proto_msgTypes = make([]protoimpl.MessageInfo, 11) -var file_sign_proto_goTypes = []interface{}{ +var file_sign_proto_goTypes = []any{ (HashAlgo)(0), // 0: v3.HashAlgo (Priority)(0), // 1: v3.Priority (*KeyMeta)(nil), // 2: v3.KeyMeta @@ -968,7 +968,7 @@ func file_sign_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_sign_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_sign_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*KeyMeta); i { case 0: return &v.state @@ -980,7 +980,7 @@ func file_sign_proto_init() { return nil } } - file_sign_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_sign_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*KeyMetas); i { case 0: return &v.state @@ -992,7 +992,7 @@ func file_sign_proto_init() { return nil } } - file_sign_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_sign_proto_msgTypes[2].Exporter = func(v any, i int) any { switch v := v.(*SSHCertificateSigningRequest); i { case 0: return &v.state @@ -1004,7 +1004,7 @@ func file_sign_proto_init() { return nil } } - file_sign_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_sign_proto_msgTypes[3].Exporter = func(v any, i int) any { switch v := v.(*SSHKey); i { case 0: return &v.state @@ -1016,7 +1016,7 @@ func file_sign_proto_init() { return nil } } - file_sign_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_sign_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*X509CertificateSigningRequest); i { case 0: return &v.state @@ -1028,7 +1028,7 @@ func file_sign_proto_init() { return nil } } - file_sign_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_sign_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*X509Certificate); i { case 0: return &v.state @@ -1040,7 +1040,7 @@ func file_sign_proto_init() { return nil } } - file_sign_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_sign_proto_msgTypes[6].Exporter = func(v any, i int) any { switch v := v.(*PublicKey); i { case 0: return &v.state @@ -1052,7 +1052,7 @@ func file_sign_proto_init() { return nil } } - file_sign_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_sign_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*BlobSigningRequest); i { case 0: return &v.state @@ -1064,7 +1064,7 @@ func file_sign_proto_init() { return nil } } - file_sign_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_sign_proto_msgTypes[8].Exporter = func(v any, i int) any { switch v := v.(*Signature); i { case 0: return &v.state diff --git a/proto/sign.pb.gw.go b/proto/sign.pb.gw.go index e6e163cc..fb6afdf1 100644 --- a/proto/sign.pb.gw.go +++ b/proto/sign.pb.gw.go @@ -106,11 +106,7 @@ func request_Signing_PostX509Certificate_0(ctx context.Context, marshaler runtim var protoReq X509CertificateSigningRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -140,11 +136,7 @@ func local_request_Signing_PostX509Certificate_0(ctx context.Context, marshaler var protoReq X509CertificateSigningRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -244,11 +236,7 @@ func request_Signing_PostUserSSHCertificate_0(ctx context.Context, marshaler run var protoReq SSHCertificateSigningRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -278,11 +266,7 @@ func local_request_Signing_PostUserSSHCertificate_0(ctx context.Context, marshal var protoReq SSHCertificateSigningRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -382,11 +366,7 @@ func request_Signing_PostHostSSHCertificate_0(ctx context.Context, marshaler run var protoReq SSHCertificateSigningRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -416,11 +396,7 @@ func local_request_Signing_PostHostSSHCertificate_0(ctx context.Context, marshal var protoReq SSHCertificateSigningRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -520,11 +496,7 @@ func request_Signing_PostSignBlob_0(ctx context.Context, marshaler runtime.Marsh var protoReq BlobSigningRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -554,11 +526,7 @@ func local_request_Signing_PostSignBlob_0(ctx context.Context, marshaler runtime var protoReq BlobSigningRequest var metadata runtime.ServerMetadata - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -588,6 +556,7 @@ func local_request_Signing_PostSignBlob_0(ctx context.Context, marshaler runtime // UnaryRPC :call SigningServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterSigningHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. func RegisterSigningHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SigningServer) error { mux.Handle("GET", pattern_Signing_GetX509CertificateAvailableSigningKeys_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -896,21 +865,21 @@ func RegisterSigningHandlerServer(ctx context.Context, mux *runtime.ServeMux, se // RegisterSigningHandlerFromEndpoint is same as RegisterSigningHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterSigningHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.DialContext(ctx, endpoint, opts...) + conn, err := grpc.NewClient(endpoint, opts...) if err != nil { return err } defer func() { if err != nil { if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } return } go func() { <-ctx.Done() if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) } }() }() @@ -928,7 +897,7 @@ func RegisterSigningHandler(ctx context.Context, mux *runtime.ServeMux, conn *gr // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SigningClient". // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SigningClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "SigningClient" to call the correct interceptors. +// "SigningClient" to call the correct interceptors. This client ignores the HTTP middlewares. func RegisterSigningHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SigningClient) error { mux.Handle("GET", pattern_Signing_GetX509CertificateAvailableSigningKeys_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { diff --git a/proto/sign_grpc.pb.go b/proto/sign_grpc.pb.go index bd9ac9cf..7f1e73d6 100644 --- a/proto/sign_grpc.pb.go +++ b/proto/sign_grpc.pb.go @@ -3,8 +3,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.0 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.27.3 // source: sign.proto package proto @@ -19,8 +19,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Signing_GetX509CertificateAvailableSigningKeys_FullMethodName = "/v3.Signing/GetX509CertificateAvailableSigningKeys" @@ -40,6 +40,8 @@ const ( // SigningClient is the client API for Signing 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. +// +// Signing service does signing operations using crypto keys in the HSM. type SigningClient interface { // GetX509CertificateAvailableSigningKeys returns all available keys that can sign X509 certificates. GetX509CertificateAvailableSigningKeys(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*KeyMetas, error) @@ -79,8 +81,9 @@ func NewSigningClient(cc grpc.ClientConnInterface) SigningClient { } func (c *signingClient) GetX509CertificateAvailableSigningKeys(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*KeyMetas, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(KeyMetas) - err := c.cc.Invoke(ctx, Signing_GetX509CertificateAvailableSigningKeys_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Signing_GetX509CertificateAvailableSigningKeys_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -88,8 +91,9 @@ func (c *signingClient) GetX509CertificateAvailableSigningKeys(ctx context.Conte } func (c *signingClient) GetX509CACertificate(ctx context.Context, in *KeyMeta, opts ...grpc.CallOption) (*X509Certificate, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(X509Certificate) - err := c.cc.Invoke(ctx, Signing_GetX509CACertificate_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Signing_GetX509CACertificate_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -97,8 +101,9 @@ func (c *signingClient) GetX509CACertificate(ctx context.Context, in *KeyMeta, o } func (c *signingClient) PostX509Certificate(ctx context.Context, in *X509CertificateSigningRequest, opts ...grpc.CallOption) (*X509Certificate, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(X509Certificate) - err := c.cc.Invoke(ctx, Signing_PostX509Certificate_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Signing_PostX509Certificate_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -106,8 +111,9 @@ func (c *signingClient) PostX509Certificate(ctx context.Context, in *X509Certifi } func (c *signingClient) GetUserSSHCertificateAvailableSigningKeys(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*KeyMetas, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(KeyMetas) - err := c.cc.Invoke(ctx, Signing_GetUserSSHCertificateAvailableSigningKeys_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Signing_GetUserSSHCertificateAvailableSigningKeys_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -115,8 +121,9 @@ func (c *signingClient) GetUserSSHCertificateAvailableSigningKeys(ctx context.Co } func (c *signingClient) GetUserSSHCertificateSigningKey(ctx context.Context, in *KeyMeta, opts ...grpc.CallOption) (*SSHKey, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(SSHKey) - err := c.cc.Invoke(ctx, Signing_GetUserSSHCertificateSigningKey_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Signing_GetUserSSHCertificateSigningKey_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -124,8 +131,9 @@ func (c *signingClient) GetUserSSHCertificateSigningKey(ctx context.Context, in } func (c *signingClient) PostUserSSHCertificate(ctx context.Context, in *SSHCertificateSigningRequest, opts ...grpc.CallOption) (*SSHKey, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(SSHKey) - err := c.cc.Invoke(ctx, Signing_PostUserSSHCertificate_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Signing_PostUserSSHCertificate_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -133,8 +141,9 @@ func (c *signingClient) PostUserSSHCertificate(ctx context.Context, in *SSHCerti } func (c *signingClient) GetHostSSHCertificateAvailableSigningKeys(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*KeyMetas, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(KeyMetas) - err := c.cc.Invoke(ctx, Signing_GetHostSSHCertificateAvailableSigningKeys_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Signing_GetHostSSHCertificateAvailableSigningKeys_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -142,8 +151,9 @@ func (c *signingClient) GetHostSSHCertificateAvailableSigningKeys(ctx context.Co } func (c *signingClient) GetHostSSHCertificateSigningKey(ctx context.Context, in *KeyMeta, opts ...grpc.CallOption) (*SSHKey, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(SSHKey) - err := c.cc.Invoke(ctx, Signing_GetHostSSHCertificateSigningKey_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Signing_GetHostSSHCertificateSigningKey_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -151,8 +161,9 @@ func (c *signingClient) GetHostSSHCertificateSigningKey(ctx context.Context, in } func (c *signingClient) PostHostSSHCertificate(ctx context.Context, in *SSHCertificateSigningRequest, opts ...grpc.CallOption) (*SSHKey, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(SSHKey) - err := c.cc.Invoke(ctx, Signing_PostHostSSHCertificate_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Signing_PostHostSSHCertificate_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -160,8 +171,9 @@ func (c *signingClient) PostHostSSHCertificate(ctx context.Context, in *SSHCerti } func (c *signingClient) GetBlobAvailableSigningKeys(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*KeyMetas, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(KeyMetas) - err := c.cc.Invoke(ctx, Signing_GetBlobAvailableSigningKeys_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Signing_GetBlobAvailableSigningKeys_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -169,8 +181,9 @@ func (c *signingClient) GetBlobAvailableSigningKeys(ctx context.Context, in *emp } func (c *signingClient) GetBlobSigningKey(ctx context.Context, in *KeyMeta, opts ...grpc.CallOption) (*PublicKey, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(PublicKey) - err := c.cc.Invoke(ctx, Signing_GetBlobSigningKey_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Signing_GetBlobSigningKey_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -178,8 +191,9 @@ func (c *signingClient) GetBlobSigningKey(ctx context.Context, in *KeyMeta, opts } func (c *signingClient) PostSignBlob(ctx context.Context, in *BlobSigningRequest, opts ...grpc.CallOption) (*Signature, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Signature) - err := c.cc.Invoke(ctx, Signing_PostSignBlob_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Signing_PostSignBlob_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -188,7 +202,9 @@ func (c *signingClient) PostSignBlob(ctx context.Context, in *BlobSigningRequest // SigningServer is the server API for Signing service. // All implementations must embed UnimplementedSigningServer -// for forward compatibility +// for forward compatibility. +// +// Signing service does signing operations using crypto keys in the HSM. type SigningServer interface { // GetX509CertificateAvailableSigningKeys returns all available keys that can sign X509 certificates. GetX509CertificateAvailableSigningKeys(context.Context, *emptypb.Empty) (*KeyMetas, error) @@ -220,9 +236,12 @@ type SigningServer interface { mustEmbedUnimplementedSigningServer() } -// UnimplementedSigningServer must be embedded to have forward compatible implementations. -type UnimplementedSigningServer struct { -} +// UnimplementedSigningServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedSigningServer struct{} func (UnimplementedSigningServer) GetX509CertificateAvailableSigningKeys(context.Context, *emptypb.Empty) (*KeyMetas, error) { return nil, status.Errorf(codes.Unimplemented, "method GetX509CertificateAvailableSigningKeys not implemented") @@ -261,6 +280,7 @@ func (UnimplementedSigningServer) PostSignBlob(context.Context, *BlobSigningRequ return nil, status.Errorf(codes.Unimplemented, "method PostSignBlob not implemented") } func (UnimplementedSigningServer) mustEmbedUnimplementedSigningServer() {} +func (UnimplementedSigningServer) testEmbeddedByValue() {} // UnsafeSigningServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to SigningServer will @@ -270,6 +290,13 @@ type UnsafeSigningServer interface { } func RegisterSigningServer(s grpc.ServiceRegistrar, srv SigningServer) { + // If the following call pancis, it indicates UnimplementedSigningServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Signing_ServiceDesc, srv) }