Detailed Go SDK docs for Keeper Secrets Manager
Find the latest Go SDK release at: https://github.com/Keeper-Security/secrets-manager-go
Find the Go source code in the GitHub repository
Using token only to generate a new config (for later usage) requires at least one read operation to bind the token and fully populate config.json
In order to retrieve secrets, you must first initialize the secrets manager client.
Parameter
Type
Required
Default
Description
token
string
Yes
Keeper Secrets Manager One time token
hostName
string
Yes
Server to connect to
verifySslCerts
bool
yes
Choose whether to verify SSL certificates or not
config
IKeyValueStorage
yes
File Storage Configuration
The NewSecretsManager
function will initialize Secrets Manager from provided parameters and store settings from ClientOptions
struct.
Parameter
Type
Required
Default
Description
uids
[]string
Yes
Empty slice
Record UIDs to get
Response
Type: []*Record
Records with the specified UIDs, or all records shared with the Secrets Manager client if no UIDs are provided
Example Usage
Retrieve all Secrets
Retrieve Secrets with a Filter
recordTitle
string
Yes
Record title to search for
Example Usage
Get a Password
Fields are found by type, for a list of field types see the Record Types documentation.
See Keeper Notation documentation to learn about Keeper Notation format and capabilities
Parameter
Type
Required
Default
Description
query
String
Yes
Keeper Notation query for getting a value from a specified field
Type: []interface{}
The value of the queried field
Parameter
Type
Required
Default
Description
url
string
Yes
TOTP Url
Record update commands don't update local record data on success (esp. updated record revision) so any consecutive updates to an already updated record will fail due to revision mismatch. Make sure to reload all updated records after each update batch.
Update Password
Parameter
Type
Required
Default
Description
password
string
Yes
New password to set to the record
Update Other Fields
Parameter
Type
Required
Default
Description
field
string
Yes
name of the field to update
value
string
Yes
Value to set the field to
Update Secret in Vault
Save the record to make the changes made appear in the
Parameter
Type
Required
Default
Description
record
KeeperRecord
Yes
Record with updated field to save changes for
Example Usage
Update Password
Update other fields
Each record field type is represented by a class. Cast the field to the corresponding class in order to correctly access the field's value. Check the Record Types documentation for a list of field types.
length
int
Yes
lowercase
int
Yes
uppercase
int
Yes
digits
int
Yes
specialCharacters
int
Yes
Each parameter indicates the minimum number of a type of character to include. For example, uppercase
indicates the minimum uppercase letters to include.
Parameter
Type
Required
Default
Description
title
string
Yes
Name of file to download
path
string
Yes
Path to save the file to
Response
Type: bool
Did the file save succeed
Example Usage
ownerRecord
Record
Yes
The record to attach the uploaded file to
file
KeeperFileUpload
Yes
The File to upload
name
string
Yes
What the name of the file will be in Keeper once uploaded
title
string
Yes
What the title of the file will be in Keeper once uploaded
type
string
Yes
The mime type of data in the file. 'application/octet-stream' for example
data
[]byte
Yes
File data as bytes
Example Usage
Shared folder UID
Shared folder must be accessible by the Secrets Manager Application
You and the Secrets Manager application must have edit permission
There must be at least one record in the shared folder
Created records and record fields must be formatted correctly
See the documentation for expected field formats for each record type
TOTP fields accept only URL generated outside of the KSM SDK
After record creation, you can upload file attachments using UploadFile
recordUid
string
No
auto generated random UID
folderUid
string
Yes
record
*RecordCreate
Yes
createOptions
CreateOptions
Yes
recordData
*RecordCreate
Yes
folders
[]*KeeperFolder
No
This example creates a login type record with a login value and a generated password.
Replace [FOLDER UID]
in the example with the UID of a shared folder that your Secrets Manager has access to.
Replace [FOLDER UID]
in the example with the UID of a shared folder that your Secrets Manager has access to.
This example creates a record with a custom record type.
The Go KSM SDK can delete records in the Keeper Vault.
recordUids
[]string
Yes
To protect against losing access to your secrets when network access is lost, the Go SDK allows caching of secrets to the local machine in an encrypted file.
Setup and Configure Cache
In order to setup caching in the Go SDK, use the function SetCache(cache ICache)
to set the cache to either one of the built-in memory or file based caches or use your own implementation.
The Go SDK includes a memory based cache and a file based cache for convenience.
Folders have full CRUD support - create, read, update and delete operations.
Downloads full folder hierarchy.
Response
Type: []*KeeperFolder, error
Example Usage
Requires CreateOptions
and folder name to be provided. The folder UID parameter in CreateOptions
is required - UID of a shared folder, while sub-folder UID is optional and if missing new regular folder is created directly under the parent (shared folder). There's no requirement for the sub-folder to be a direct descendant of the parent shared folder - it could be many levels deep.
createOptions
CreateOptions
Yes
The parent and sub-folder UIDs
folderName
string
Yes
The Folder name
folders
[]*KeeperFolder
No
List of folders to use in the search for parent and sub-folder from CreateOptions
Example Usage
Updates the folder metadata - currently folder name only.
folderUid
string
Yes
The folder UID
folderName
string
Yes
The new folder name
folders
[]*KeeperFolder
No
List of folders to use in the search for parent folder
Example Usage
Removes a list of folders. Use forceDeletion
flag to remove non-empty folders.
When using forceDeletion avoid sending parent with its children folder UIDs. Depending on the delete order you may get an error - ex. if parent force-deleted child first. There's no guarantee that list will always be processed in FIFO order.
Any folders UIDs missing from the vault or not shared to the KSM Application will not result in error.
folderUids
[]string
Yes
The folder UID list
forceDeletion
bool
Yes
Force deletion of non-empty folders
Example Usage
Description of each accessible field type Class in the Keeper Secrets Manager Go SDK
Use the GetFieldByType
function to access record fields.
All Record Fields extend the KeeperRecordField
class, and contain a Label
and Type
fields
Name
Type
Required
Default
Label
string
No
""
Type
string
Yes
""
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
EnforceGeneration
bool
No
false
Value
[]string
Yes
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
Value
[]string
Yes
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
Value
[]string
Yes
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
Value
[]string
Yes
Name
Type
Required
Default
First
string
No
""
Middle
string
No
""
Last
string
No
""
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
Value
[]Name
Yes
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
Value
[]int64
Yes
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
Value
[]int64
Yes
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
Value
[]int64
Yes
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
Value
[]string
Yes
Name
Type
Required
Default
Question
string
No
""
Answer
string
No
""
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
Value
[]SecurityQuestion
Yes
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
Value
[]string
Yes
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
Value
[]string
Yes
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
Value
[]string
Yes
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
Value
[]string
Yes
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
Value
[]string
Yes
Name
Type
Required
Default
Region
string
No
""
Number
string
No
""
Ext
string
No
""
Type
string
No
""
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
Value
[]Phone
Yes
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
Value
[]string
Yes
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
Value
[]string
Yes
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
Value
[]string
Yes
Name
Type
Required
Default
CardNumber
string
No
""
CardExpirationDate
string
No
""
CardSecurityCode
string
No
""
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
Value
[]PaymentCard
Yes
Name
Type
Required
Default
AccountType
string
No
""
RoutingNumber
string
No
""
AccountNumber
string
No
""
OtherType
string
No
""
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
Value
[]BankAccount
Yes
Name
Type
Required
Default
PublicKey
string
No
""
PrivateKey
string
No
""
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
Value
[]KeyPair
Yes
Name
Type
Required
Default
Hostname
string
No
""
Port
string
No
""
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
Value
[]Host
Yes
Name
Type
Required
Default
Street1
string
No
""
Street2
string
No
""
City
string
No
""
State
string
No
""
Country
string
No
""
Zip
string
No
""
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
Value
[]Address
Yes
Name
Type
Required
Default
Label
string
No
""
Required
bool
No
false
PrivacyScreen
bool
No
false
Value
[]string
Yes
Name
Type
Required
Default
Title
string
Yes
Name
string
Yes
Type
string
Yes
Size
int64
Yes
LastModified
int64
Yes