SPIKE Go SDK
Go to file
Volkan Özçelik 0fafdf87f0
Merge pull request #55 from spiffe/feature/secret-const
Feature/secret const
2025-09-10 21:09:53 -07:00
.github/workflows fix(ci): update test and lint steps to use make commands 2025-08-12 14:03:53 +03:00
api define env var names as consts. 2025-09-03 19:46:50 -07:00
assets Initial Commit 2024-11-27 10:03:10 -08:00
config add other constants. 2025-09-10 21:09:17 -07:00
crypto add key size as constant. 2025-08-23 16:30:20 -07:00
hack add other constants. 2025-09-10 21:09:31 -07:00
kv fix(lint): remove unnecessary blank lines and fix lint warnings 2025-08-10 22:19:39 +03:00
log define env var names as consts. 2025-09-03 19:46:50 -07:00
net Add cipher encrypt and decrypt apis into the sdk 2025-09-01 12:37:00 -07:00
retry fix(lint): rename MockRetrier struct to Retrier 2025-08-11 23:40:52 +03:00
security/mem lint update. 2025-08-10 10:23:54 -07:00
spiffe define env var names as consts. 2025-09-03 19:46:50 -07:00
spiffeid define env var names as consts. 2025-09-03 19:46:50 -07:00
system audit fixes. 2025-08-10 05:23:17 -07:00
validation audit fixes. 2025-08-10 05:23:17 -07:00
.gitignore Initial Commit 2024-11-27 10:03:10 -08:00
.golangci.yml chore(lint): add golangci-lint configuration file 2025-08-10 22:16:30 +03:00
CODEOWNERS Add @parlakisik as a Codeowner for SPIKE and SPIKE SDK 2025-08-13 21:15:20 +03:00
CODE_OF_CONDUCT.md add CoC and friend + minor code refactoring 2024-12-01 20:07:09 -08:00
CONTRIBUTING.md add CoC and friend + minor code refactoring 2024-12-01 20:07:09 -08:00
CONTRIBUTING_DCO.md add CoC and friend + minor code refactoring 2024-12-01 20:07:09 -08:00
LICENSE Initial commit 2024-11-27 08:16:46 -08:00
MAINTAINERS.md add CoC and friend + minor code refactoring 2024-12-01 20:07:09 -08:00
Makefile feat(make): add 'ci' target to run test and audit 2025-08-12 14:02:39 +03:00
README.md Change some logger signatures. 2025-08-30 14:08:00 -07:00
SECURITY.md update security doc. 2025-08-11 16:01:45 +03:00
go.mod fix(go-deps): revert auto-updated indirect dependencies 2025-08-12 15:36:42 +03:00
go.sum Fix failing unit tests and lint issues. 2025-08-13 13:17:59 +03:00
qodana.yaml Minor changes. 2025-03-29 20:56:57 -07:00

README.md

SPIKE

SPIKE Go SDK

This library is a convenient Go library for working with SPIKE.

It leverages the SPIFFE Workload API, providing high-level functionality that includes:

  • Establishing mutually authenticated TLS (mTLS) between workloads powered by SPIFFE.
  • Abstracting SPIKE REST API calls.

Documentation

See the Go Package documentation.

Quick Start

Prerequisites:

  1. Running SPIRE or another SPIFFE Workload API implementation.
  2. SPIFFE_ENDPOINT_SOCKET environment variable set to address of the Workload API (e.g. unix:///tmp/agent.sock).

Usage Example

package main

import (
	"fmt"

	spike "github.com/spiffe/spike-sdk-go/api"
)

func main() {
	api := spike.New() // Use the default Workload API Socket
	defer api.Close()  // Close the connection when done

	path := "tenants/demo/db/creds"

	// Create a Secret
	err := api.PutSecret(path, map[string]string{
		"username": "SPIKE",
		"password": "SPIKE_Rocks",
	})
	if err != nil {
		fmt.Println("Error writing secret:", err.Error())
		return
	}

	// Read the Secret
	secret, err := api.GetSecret(path)
	if err != nil {
		fmt.Println("Error reading secret:", err.Error())
		return
	}

	if secret == nil {
		fmt.Println("Secret not found.")
		return
	}

	fmt.Println("Secret found:")

	data := secret.Data
	for k, v := range data {
		fmt.Printf("%s: %s\n", k, v)
	}
}

A Note on Security

We take SPIKE's security seriously. If you believe you have found a vulnerability, please responsibily disclose it to security@spike.ist.

See SECURITY.md for additional details.

Community

Open Source is better together.

If you are a security enthusiast, join SPIFFE's Slack Workspace and let us change the world together 🤘.

Contributing

To contribute to SPIKE, follow the contributing guidelines to get started.

Use GitHub issues to request features or file bugs.

Communications

License

Mozilla Public License v2.0.