Open tim2CF opened 3 years ago
@tim2CF: I might be misunderstanding the question, but he only way to deal with untyped gRPC payloads is to treat them as opaque ByteString
s. In the absence of a schema there isn't a weakly-typed representation that you can fall back on to decode the payload.
@Gabriel439 Yes, exactly! Some sort of middleware with payload as opaque ByteString
is what I do want. Then we can sign it and put signature into metadata in case of client, and get signature from metadata and verify signature for given ByteString
payload in case of server.
@tim2CF: So I believe this is possible with the underlying grpc-haskell-core
package. Specifically, what I think you want to use is the Network.GRPC.LowLevel.Server.Unregistered
and Network.GRPC.LowLevel.Client.Unregistered
modules. Those operate in terms of raw ByteString
s
Are there any handlers/hooks/middlewares to work with untyped serialized request/response grpc payloads? Motivation is to do efficient signing and signature verification of request/response. Signature might be passed as metadata. Without such handlers/hooks/middlewares deterministic signing and verification is not efficient (need to serialize manually) and even not possible in general case, because proto3 standard does not guarantee deterministic serialization. We can do workarounds using libraries like this https://github.com/coingaming/signable#readme but in most cases being able to work with untyped payload is much more easier.