From caa185193a135a6e42a00e65fbefe32a143c143d Mon Sep 17 00:00:00 2001 From: sujan kota Date: Mon, 9 Sep 2024 13:07:33 -0400 Subject: [PATCH] fix(ci): upate nanotdf create function signature to use options --- pkg/handlers/nano-tdf.go | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/pkg/handlers/nano-tdf.go b/pkg/handlers/nano-tdf.go index 8f6b2203..34f5ef98 100644 --- a/pkg/handlers/nano-tdf.go +++ b/pkg/handlers/nano-tdf.go @@ -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), + sdk.WithNanoDataAttributes(values), } 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...) if err != nil { return nil, err }