{"id":20908980,"url":"https://github.com/jaredpetersen/vaultx","last_synced_at":"2025-10-29T08:34:03.347Z","repository":{"id":40323993,"uuid":"485220932","full_name":"jaredpetersen/vaultx","owner":"jaredpetersen","description":"🔐 Developer-focused alternative to the official Vault package","archived":false,"fork":false,"pushed_at":"2022-05-15T01:41:35.000Z","size":83,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-19T14:57:36.497Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaredpetersen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null},"funding":{"github":"jaredpetersen","custom":["https://cash.app/$jaredtpetersen","https://paypal.me/jaredtpetersen"]}},"created_at":"2022-04-25T04:20:40.000Z","updated_at":"2023-03-10T12:12:24.000Z","dependencies_parsed_at":"2022-08-09T17:20:30.982Z","dependency_job_id":null,"html_url":"https://github.com/jaredpetersen/vaultx","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredpetersen%2Fvaultx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredpetersen%2Fvaultx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredpetersen%2Fvaultx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredpetersen%2Fvaultx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaredpetersen","download_url":"https://codeload.github.com/jaredpetersen/vaultx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243301129,"owners_count":20269286,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T14:09:42.712Z","updated_at":"2025-10-29T08:34:03.266Z","avatar_url":"https://github.com/jaredpetersen.png","language":"Go","funding_links":["https://github.com/sponsors/jaredpetersen","https://cash.app/$jaredtpetersen","https://paypal.me/jaredtpetersen"],"categories":[],"sub_categories":[],"readme":"# vaultx\n[![CI](https://github.com/jaredpetersen/vaultx/actions/workflows/ci.yaml/badge.svg)](https://github.com/jaredpetersen/vaultx/actions/workflows/ci.yaml)\n[![Go Reference](https://pkg.go.dev/badge/github.com/jaredpetersen/vaultx.svg)](https://pkg.go.dev/github.com/jaredpetersen/vaultx)\n\nvaultx is an alternative to the official Vault Go package that is designed with the developer in mind.\n\nThe official Vault package is very useful, but it has a number of issues that make it difficult to integrate Vault\ninto your applications:\n- Tied tightly to the HTTP API, making accomplishing basic functionality involve writing expansive blocks of code\n- Types are very generic, so you lose out on type safety and must know the HTTP API in order interact with it\n- Automatic renewal of authentication credentials is not well-supported\n\nvaultx seeks to address these issues and make Vault a joy to use in Go.\n\n## Usage\nTo create your vault client, create a new configuration struct and pass it to vaultx's `New()` function:\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/jaredpetersen/vaultx\"\n\tvaultxauth \"github.com/jaredpetersen/vaultx/auth\"\n)\n\nconst k8sRole = \"my-app\"\nconst vaultKVSecretPath = \"my-secret\"\nconst vaultTransitKey = \"transit-key\"\n\nfunc main() {\n\tctx := context.Background()\n\n\tcfg := vaultx.NewConfig(\"https://vault.mydomain.com\")\n\tcfg.Auth.Method = vaultxauth.NewKubernetesMethod(vaultxauth.KubernetesConfig{Role: k8sRole})\n\n\tvltx := vaultx.New(cfg)\n\n\terr := vltx.Auth().Login(ctx)\n\tif err != nil {\n\t\tfmt.Println(\"Failed to authenticate against Vault\")\n\t\tos.Exit(1)\n\t}\n\n\t// Store secret\n\tsecretData := map[string]interface{}{\n\t\t\"username\": \"dbuser\",\n\t\t\"password\": \"3hvu2ZLxwauHrNaZjJbJARHE\",\n\t}\n\terr = vltx.KV().UpsertSecret(ctx, vaultKVSecretPath, secretData)\n\tif err != nil {\n\t\tfmt.Println(\"Failed to store secret\")\n\t\tos.Exit(1)\n\t}\n\n\t// Get secret\n\tsecret, err := vltx.KV().GetSecret(ctx, vaultKVSecretPath)\n\tif err != nil {\n\t\tfmt.Println(\"Failed to retrieve secret\")\n\t\tos.Exit(1)\n\t}\n\n\tfmt.Printf(\"secret username: %s\\n\", secret.Data[\"username\"])\n\tfmt.Printf(\"secret password: %s\\n\", secret.Data[\"password\"])\n\n\t// Encrypt data\n\tplaintext := \"encrypt me\"\n\tencrypted, err := vltx.Transit().Encrypt(ctx, vaultTransitKey, []byte(plaintext))\n\tif err != nil {\n\t\tfmt.Println(\"Failed to encrypt data\")\n\t\tos.Exit(1)\n\t}\n\n\tfmt.Printf(\"encrypted: %s\\n\", encrypted)\n\n\t// Decrypt data\n\tdecrypted, err := vltx.Transit().Decrypt(ctx, vaultTransitKey, encrypted)\n\tif err != nil {\n\t\tfmt.Println(\"Failed to decrypt data\")\n\t\tos.Exit(1)\n\t}\n\n\tfmt.Printf(\"decrypted: %s\\n\", string(decrypted))\n}\n```\n\n## Install\n```shell\ngo get github.com/jaredpetersen/vaultx\n```\n\n## Sponsorship\nIf you or your company uses vaultx, please consider contributing to the project via\n[GitHub Sponsors](https://github.com/sponsors/jaredpetersen). There's some cool work that we'd like to do -- like\nend-to-end integration tests -- but cloud computing isn't free.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredpetersen%2Fvaultx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaredpetersen%2Fvaultx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredpetersen%2Fvaultx/lists"}