Skip to content

Commit

Permalink
debug: Use json
Browse files Browse the repository at this point in the history
  • Loading branch information
jachym-tousek-keboola committed Dec 20, 2024
1 parent 05fdca9 commit 43259e0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 44 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ require (
github.com/jpillora/longestcommon v0.0.0-20161227235612-adb9d91ee629
github.com/json-iterator/go v1.1.12
github.com/keboola/go-client v1.28.0
github.com/keboola/go-cloud-encrypt v0.0.0-20241220115809-c4525393e01f
github.com/keboola/go-cloud-encrypt v0.0.0-20241220144414-60e8b1329364
github.com/keboola/go-utils v1.2.0
github.com/klauspost/compress v1.17.11
github.com/klauspost/pgzip v1.2.6
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,8 @@ github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNU
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/keboola/go-client v1.28.0 h1:oXgyw9gSACMkEBmVjhx26rmeFP2nn/h+EpV5LEeD7ds=
github.com/keboola/go-client v1.28.0/go.mod h1:UKsl17jZA1xSa0jQrxw1MAo7GNj+OA5Y/MXjOp/6FkM=
github.com/keboola/go-cloud-encrypt v0.0.0-20241220115809-c4525393e01f h1:sqNzEEBTsCV4BxYUduJwRo0Penw/Yy9D7b+8XUu7XlE=
github.com/keboola/go-cloud-encrypt v0.0.0-20241220115809-c4525393e01f/go.mod h1:ynHaykn5QuPKbUB2uJYNN+feY/Hg5BCp/TDb+yOSoTo=
github.com/keboola/go-cloud-encrypt v0.0.0-20241220144414-60e8b1329364 h1:VwoJfyELACCGsPaQzIOMLQaQsP8iPplc54j6mGwZNUg=
github.com/keboola/go-cloud-encrypt v0.0.0-20241220144414-60e8b1329364/go.mod h1:ynHaykn5QuPKbUB2uJYNN+feY/Hg5BCp/TDb+yOSoTo=
github.com/keboola/go-jsonnet v0.20.1-0.20240430105602-71646d8d4fa9 h1:BY9wMWSN1SEIjhBJSrFWpLLS3DiAR+GNANOSTNtfzGA=
github.com/keboola/go-jsonnet v0.20.1-0.20240430105602-71646d8d4fa9/go.mod h1:pSOb2+VoKZjVbIB4z58am8q15yWO/VTEp6n1GxW3x0I=
github.com/keboola/go-mockoidc v0.0.0-20240405064136-5229d2b53db6 h1:HcvX1VQkiavyfqDzXeCsNYlhiPaLiGhU7jlIKUj8JOE=
Expand Down
39 changes: 0 additions & 39 deletions internal/pkg/service/stream/encryption/encode.go

This file was deleted.

5 changes: 3 additions & 2 deletions internal/pkg/service/stream/encryption/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package encryption

import (
"context"
"encoding/json"
"hash/crc32"

kms "cloud.google.com/go/kms/apiv1"
Expand Down Expand Up @@ -33,7 +34,7 @@ func NewGCPEncryptor(ctx context.Context, keyID string, logger log.Logger) (*GCP
}

func (encryptor *GCPEncryptor) Encrypt(ctx context.Context, plaintext []byte, metadata cloudencrypt.Metadata) ([]byte, error) {
additionalData, err := Encode(metadata)
additionalData, err := json.Marshal(metadata)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -61,7 +62,7 @@ func (encryptor *GCPEncryptor) Encrypt(ctx context.Context, plaintext []byte, me
}

func (encryptor *GCPEncryptor) Decrypt(ctx context.Context, ciphertext []byte, metadata cloudencrypt.Metadata) ([]byte, error) {
additionalData, err := Encode(metadata)
additionalData, err := json.Marshal(metadata)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 43259e0

Please sign in to comment.