Skip to content

Latest commit

 

History

History
27 lines (24 loc) · 619 Bytes

KV.md

File metadata and controls

27 lines (24 loc) · 619 Bytes

KV Secrets Engine

vaultx supports the Vault KV secrets engine via KV() on the client.

Usage

Store secret:

// Store secret
secretData := map[string]interface{}{
    "username": "dbuser",
    "password": "3hvu2ZLxwauHrNaZjJbJARHE",
}
err := vltx.KV().UpsertSecret(ctx, secretPath, secretData)
if err != nil {
	return err
}

Retrieve secret:

secret, err := vltx.KV().GetSecret(ctx, secretPath)
if err != nil {
	return err
}

fmt.Printf("secret username: %s\n", secret.Data["username"])
fmt.Printf("secret password: %s\n", secret.Data["password"])