protoutil: add NewAny method for deterministic serialization (#2462)

This commit is contained in:
Caleb Doxsey 2021-08-09 17:51:57 -06:00 committed by GitHub
parent b051c7db03
commit 6af0655206
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 90 additions and 148 deletions

View file

@ -11,6 +11,7 @@ import (
"github.com/pomerium/pomerium/pkg/cryptutil"
"github.com/pomerium/pomerium/pkg/grpc/databroker"
"github.com/pomerium/pomerium/pkg/protoutil"
)
type encryptedRecordStream struct {
@ -185,13 +186,8 @@ func (e *encryptedBackend) encrypt(in *anypb.Any) (out *anypb.Any, err error) {
}
encrypted := cryptutil.Encrypt(e.cipher, plaintext, nil)
out, err = anypb.New(&wrapperspb.BytesValue{
out = protoutil.NewAny(&wrapperspb.BytesValue{
Value: encrypted,
})
if err != nil {
return nil, err
}
return out, nil
}