Skip to content

Commit

Permalink
fix(ci): upate nanotdf create function signature to use options
Browse files Browse the repository at this point in the history
  • Loading branch information
sujankota committed Sep 9, 2024
1 parent 21f9b80 commit caa1851
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions pkg/handlers/nano-tdf.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,23 @@ package handlers
import (
"bytes"
"io"

"github.com/opentdf/platform/sdk"
)

func (h Handler) EncryptNanoBytes(b []byte, values []string, kasUrlPath string, ecdsaBinding bool) (*bytes.Buffer, error) {
var encrypted []byte
enc := bytes.NewBuffer(encrypted)

nanoTDFConfig, err := h.sdk.NewNanoTDFConfig()
if err != nil {
return nil, err
}

err = nanoTDFConfig.SetKasURL(h.platformEndpoint + kasUrlPath)
if err != nil {
return nil, err
}
err = nanoTDFConfig.SetAttributes(values)
if err != nil {
return nil, err
options := []sdk.NanoTDFOption{
sdk.WithKasURL(h.platformEndpoint + kasUrlPath),

Check failure on line 15 in pkg/handlers/nano-tdf.go

View workflow job for this annotation

GitHub Actions / lint

undefined: sdk.WithKasURL

Check failure on line 15 in pkg/handlers/nano-tdf.go

View workflow job for this annotation

GitHub Actions / lint

undefined: sdk.WithKasURL

Check failure on line 15 in pkg/handlers/nano-tdf.go

View workflow job for this annotation

GitHub Actions / lint

undefined: sdk.WithKasURL

Check failure on line 15 in pkg/handlers/nano-tdf.go

View workflow job for this annotation

GitHub Actions / Run govulncheck

undefined: sdk.WithKasURL

Check failure on line 15 in pkg/handlers/nano-tdf.go

View workflow job for this annotation

GitHub Actions / unit tests

undefined: sdk.WithKasURL
sdk.WithNanoDataAttributes(values),

Check failure on line 16 in pkg/handlers/nano-tdf.go

View workflow job for this annotation

GitHub Actions / lint

cannot use values (variable of type []string) as string value in argument to sdk.WithNanoDataAttributes

Check failure on line 16 in pkg/handlers/nano-tdf.go

View workflow job for this annotation

GitHub Actions / lint

cannot use values (variable of type []string) as string value in argument to sdk.WithNanoDataAttributes

Check failure on line 16 in pkg/handlers/nano-tdf.go

View workflow job for this annotation

GitHub Actions / lint

cannot use values (variable of type []string) as string value in argument to sdk.WithNanoDataAttributes

Check failure on line 16 in pkg/handlers/nano-tdf.go

View workflow job for this annotation

GitHub Actions / Run govulncheck

cannot use values (variable of type []string) as string value in argument to sdk.WithNanoDataAttributes

Check failure on line 16 in pkg/handlers/nano-tdf.go

View workflow job for this annotation

GitHub Actions / unit tests

cannot use values (variable of type []string) as string value in argument to sdk.WithNanoDataAttributes
}
if ecdsaBinding {
nanoTDFConfig.EnableECDSAPolicyBinding()
options = append(options, sdk.WithECDSAPolicyBinding())
}

// TODO: validate values are FQNs or return an error [https://github.com/opentdf/platform/issues/515]
_, err = h.sdk.CreateNanoTDF(enc, bytes.NewReader(b), *nanoTDFConfig)
_, err := h.sdk.CreateNanoTDF(enc, bytes.NewReader(b), options...)

Check failure on line 22 in pkg/handlers/nano-tdf.go

View workflow job for this annotation

GitHub Actions / lint

cannot use ... in call to non-variadic h.sdk.CreateNanoTDF (typecheck)

Check failure on line 22 in pkg/handlers/nano-tdf.go

View workflow job for this annotation

GitHub Actions / lint

cannot use ... in call to non-variadic h.sdk.CreateNanoTDF) (typecheck)

Check failure on line 22 in pkg/handlers/nano-tdf.go

View workflow job for this annotation

GitHub Actions / Run govulncheck

cannot use ... in call to non-variadic h.sdk.CreateNanoTDF

Check failure on line 22 in pkg/handlers/nano-tdf.go

View workflow job for this annotation

GitHub Actions / unit tests

cannot use ... in call to non-variadic h.sdk.CreateNanoTDF
if err != nil {
return nil, err
}
Expand Down

0 comments on commit caa1851

Please sign in to comment.