This library provides interface to Keeper® Secrets Manager and can be used to access your Keeper vault, read and update existing records, rotate passwords and more. Keeper Secrets Manager is an open source project with contributions from Keeper's engineering team and partners.
Keeper Secrets Manager authenticates your API requests using advanced encryption that uses locally stored private key, device id and client id. To register your device and generate private key you will need to generate a One-Time Access Token via Web Vault or Keeper Commander CLI.
Secrets Manager > Applications > Create Application - will let you chose application name, shared folder(s) and permissions and generate One-Time Access Token. Note: Keeper does not store One-Time Access Tokens - save or copy the token offline for later use.
One-Time Access Tokens can be generated as needed: Secrets Manager > Applications > Application Name > Devices Tab > Edit > Add Device button - will let you create new Device and generate its One-Time Access Token.
Login to Keeper with Commander CLI and perform following:
-
Create Application
$ sm app create [NAME]
-
Share Secrets to the Application
$ sm share add --app [NAME] --secret [UID] --editable
--app
- Name of the Application.--secret
- Record UID or Shared Folder UID--editable
- if omitted defaults to false
-
Create client
$ sm client add --app [NAME] --unlock-ip --count 1
go get github.com/keeper-security/secrets-manager-go/core
package main
// Import Secrets Manager
import ksm "github.com/keeper-security/secrets-manager-go/core"
func main() {
// Establish connection
// One time secrets generated via Web Vault or Commander CLI
clientOptions := &ksm.ClientOptions{
Token: "US:ONE_TIME_TOKEN_BASE64",
Config: ksm.NewFileKeyValueStorage("ksm-config.json")}
sm := ksm.NewSecretsManager(clientOptions)
// One time tokens can be used only once - afterwards use the generated config file
// sm := ksm.NewSecretsManager(&ksm.ClientOptions{Config: ksm.NewFileKeyValueStorage("ksm-config.json")})
// Retrieve all records
allRecords, _ := sm.GetSecrets([]string{})
// Get password from first record:
password := allRecords[0].Password()
// WARNING: Avoid logging sensitive data
print("My password from Keeper: ", password)
}
sm := ksm.NewSecretsManager(&ksm.ClientOptions{Config: ksm.NewFileKeyValueStorage("ksm-config.json")})
if records, err := sm.GetSecrets([]string{}); err == nil {
for _, r := range records {
fmt.Println("\tTitle: " + r.Title())
for i, f := range r.Files {
fmt.Printf("\t\tfile #%d -> name: %s", i, f.Name)
f.SaveFile("/tmp/"+f.Name, true)
}
}
}
sm := ksm.NewSecretsManager(&ksm.ClientOptions{Config: ksm.NewFileKeyValueStorage("ksm-config.json")})
if records, err := sm.GetSecrets([]string{}); err == nil && len(records) > 0 {
record := records[0]
newPassword := fmt.Sprintf("Test Password - " + time.Now().Format(time.RFC850))
record.SetPassword(newPassword)
if err := sm.Save(record); err != nil {
fmt.Println("Error saving record: " + err.Error())
}
}
Listed in priority order
- Environment variable
- Configuration store
- Code
clientKey
- One Time Access Token used during initializationhostname
- Keeper Backend host. Available values:keepersecurity.com
keepersecurity.eu
keepersecurity.com.au
govcloud.keepersecurity.us
Drag&Drop records into the shared folder or select from the record menu any of the options to CreateDuplicate/Move or create new records straight into the shared folder. As an alternative use: Secrets Manager > Application > Application Name > Folders & Records > Edit and use search field to add any folders or records then click Save.
sm share add --app [NAME] --secret [UID2]
sm share add --app [NAME] --secret [UID3] --editable
sm := ksm.NewSecretsManager(&ksm.ClientOptions{Config: ksm.NewFileKeyValueStorage("ksm-config.json")})
allSecrets, _ := sm.GetSecrets([]string{})
secretToUpdate = allSecrets[0]
secretToUpdate.SetPassword("NewPassword123$")
secretsManager.Save(secretToUpdate)
- KSM-551 - Stop generating UIDs that start with "-"
- KSM-555 - Added new field types and updated PAM field types
- KSM-497 - Expose additional methods to create record from data, options and UID
- KSM-467 - Fixed ExpiresOn conversion from UnixTimeMilliseconds.
- KSM-450 - Added
folderUid
andinnerFolderUid
to Record - KSM-451 - Fix
subFolderUid
crash on empty string value
- KSM-414 - Added support for Folders
- KSM-435 - Improved Passkey field type support
- KSM-409 New field type: Passkey
- KSM-404 New filed type: script and modification to some record types
- KSM-384 Support for record Transactions
- KSM-317 - Notation improvements
- KSM-356 - Create custom fields
- KSM-365 - Fixed KEY_CLINET_KEY is missing error
- KSM-366 - Avoid exceptions/panics and return errors instead
- KSM-367 - Fixed license not shown on pkg.go.dev
- KSM-288 - Record removal
- KSM-306 - Added support for Japan and Canada data centers
- KSM-312 - Improve password generation entropy
For additional information please check our detailed Go SDK docs for Keeper Secrets Manager.