Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Untyped serialized protobuf handlers/hooks/middlewares #121

Open
tim2CF opened this issue Mar 29, 2021 · 3 comments
Open

Untyped serialized protobuf handlers/hooks/middlewares #121

tim2CF opened this issue Mar 29, 2021 · 3 comments

Comments

@tim2CF
Copy link

tim2CF commented Mar 29, 2021

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.

@Gabriella439
Copy link
Contributor

@tim2CF: I might be misunderstanding the question, but he only way to deal with untyped gRPC payloads is to treat them as opaque ByteStrings. In the absence of a schema there isn't a weakly-typed representation that you can fall back on to decode the payload.

@tim2CF
Copy link
Author

tim2CF commented Mar 30, 2021

@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.

@Gabriella439
Copy link
Contributor

@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 ByteStrings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants