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

fix(ci): update nanotdf create function signature to use options #374

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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
Loading