Skip to content

Commit

Permalink
[OPS-901] Fix Secrets Versioning
Browse files Browse the repository at this point in the history
- Secret version should be unix milli but was timestamp
- Secret file-name updated to be exclusively filename and not path
  • Loading branch information
Eli Fabens committed Aug 3, 2021
1 parent 767a146 commit bece743
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"net/http/httputil"
"net/url"
"os"
"path/filepath"
"regexp"
"strconv"
"strings"
Expand Down Expand Up @@ -1490,7 +1491,7 @@ func (c *ToznySDKV3) CreateSecret(ctx context.Context, secretDetails CreateSecre
SecretName: secretDetails.SecretName,
}
recordType := GetRecordType(recordTypeOptions)
timestamp := time.Now().String()
timestamp := fmt.Sprintf("%d", time.Now().UnixNano()/int64(time.Millisecond))
plain := map[string]string{
"secretType": secretDetails.SecretType,
"secretName": secretDetails.SecretName,
Expand Down Expand Up @@ -1552,7 +1553,7 @@ func (c *ToznySDKV3) WriteFile(ctx context.Context, options WriteFileOptions) (*
fmt.Printf("WriteFile: Could not delete %s: %+v", encryptionInfo.EncryptedFileName, err)
}
}()
options.Plain[SecretFilenameMetadataKey] = options.FileName
options.Plain[SecretFilenameMetadataKey] = filepath.Base(options.FileName)
sizeKB := encryptionInfo.Size / 1024
if sizeKB >= 1 {
options.Plain[SecretFileSizeMetadataKey] = fmt.Sprintf("%d", sizeKB)
Expand Down

0 comments on commit bece743

Please sign in to comment.