Skip to content

Commit

Permalink
REL-4187 - GoLang SDK v16.6.1 - Fixed Folder Management and CreatePay…
Browse files Browse the repository at this point in the history
…load (#31)

* KSM-451 - Fixed subFolderUid in CreatePayload - omitempty to avoid KA crash (#30)

* KSM-450 - Added innerFolderUid to the Record (#29)
  • Loading branch information
maksimu authored Jul 25, 2023
1 parent 630ad64 commit 126a43f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Secrets Management Go SDK

![Go](https://github.com/keeper-security/secrets-manager-go/actions/workflows/test.go.yml/badge.svg)

<p align="center">
<a href="https://docs.keeper.io/secrets-manager/secrets-manager/developer-sdk-library/golang-sdk">View docs</a>
</p>
Expand Down Expand Up @@ -148,6 +150,11 @@ secretsManager.Save(secretToUpdate)
# Change Log
## 1.6.1
* KSM-450 - Added `folderUid` and `innerFolderUid` to Record
* KSM-451 - Fix `subFolderUid` crash on empty string value
## 1.6.0
* KSM-414 - Added support for Folders
Expand Down
5 changes: 5 additions & 0 deletions core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ secretsManager.Save(secretToUpdate)
# Change Log
## 1.6.1
* KSM-450 - Added `folderUid` and `innerFolderUid` to Record
* KSM-451 - Fix `subFolderUid` crash on empty string value
## 1.6.0
* KSM-414 - Added support for Folders
Expand Down
12 changes: 12 additions & 0 deletions core/dtos.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type Record struct {
Uid string
folderKeyBytes []byte
folderUid string
innerFolderUid string
Files []*KeeperFile
Revision int64
IsEditable bool
Expand All @@ -50,6 +51,10 @@ func (r *Record) FolderUid() string {
return r.folderUid
}

func (r *Record) InnerFolderUid() string {
return r.innerFolderUid
}

func (r *Record) Password() string {
password := ""
// password (if `login` type)
Expand Down Expand Up @@ -420,6 +425,11 @@ func NewRecordFromJson(recordDict map[string]interface{}, secretKey []byte, fold
if uid, ok := recordDict["recordUid"]; ok {
record.Uid = strings.TrimSpace(uid.(string))
}
if innerFolderUid, ok := recordDict["innerFolderUid"]; ok {
if ifuid, ok := innerFolderUid.(string); ok {
record.innerFolderUid = strings.TrimSpace(ifuid)
}
}
if revision, ok := recordDict["revision"].(float64); ok {
record.Revision = int64(revision)
}
Expand Down Expand Up @@ -895,6 +905,7 @@ func NewRecordClone(templateRecordUid string, records []*Record, newRecordUid st
Uid: recordUid,
folderKeyBytes: folderKeyBytesCopy,
folderUid: templateRecord.folderUid,
innerFolderUid: templateRecord.innerFolderUid,
Files: filesCopy,
Revision: templateRecord.Revision,
IsEditable: templateRecord.IsEditable,
Expand Down Expand Up @@ -978,6 +989,7 @@ func NewRecord(templateRecordUid string, records []*Record, newRecordUid string)
Uid: recordUid,
folderKeyBytes: folderKeyBytesCopy,
folderUid: templateRecord.folderUid,
innerFolderUid: templateRecord.innerFolderUid,
Files: []*KeeperFile{},
Revision: templateRecord.Revision,
IsEditable: templateRecord.IsEditable,
Expand Down
4 changes: 2 additions & 2 deletions core/keeper_globals.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

const (
versionMajor string = "16"
version string = "16.6.0"
keeperSecretsManagerClientId string = "mg16.6.0" // Golang client ID starts with "mg" + version
version string = "16.6.1"
keeperSecretsManagerClientId string = "mg16.6.1" // Golang client ID starts with "mg" + version
defaultKeeperHostname string = "keepersecurity.com"
clientIdHashTag string = "KEEPER_SECRETS_MANAGER_CLIENT_ID" // Tag for hashing the client key to client id
)
Expand Down
2 changes: 1 addition & 1 deletion core/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ type CreatePayload struct {
FolderUid string `json:"folderUid"`
FolderKey string `json:"folderKey"`
Data string `json:"data"`
SubFolderUid string `json:"subFolderUid"`
SubFolderUid string `json:"subFolderUid,omitempty"`
}

func (p *CreatePayload) CreatePayloadToJson() (string, error) {
Expand Down

0 comments on commit 126a43f

Please sign in to comment.