Help us shape the future of Go! Take the 2026 Go Developer Survey

keystore

package
v0.0.26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AwsSmKeyService added in v0.0.13

type AwsSmKeyService struct {
	// contains filtered or unexported fields
}

func (*AwsSmKeyService) DeleteKey added in v0.0.13

func (s *AwsSmKeyService) DeleteKey(ctx context.Context, id string) error

func (*AwsSmKeyService) ListKeys added in v0.0.13

func (s *AwsSmKeyService) ListKeys(ctx context.Context) ([]string, error)

func (*AwsSmKeyService) RetrievePrivKey added in v0.0.13

func (s *AwsSmKeyService) RetrievePrivKey(ctx context.Context, id string) (*jwk.Jwk, error)

func (*AwsSmKeyService) RetrievePubKey added in v0.0.13

func (s *AwsSmKeyService) RetrievePubKey(ctx context.Context, id string) (*jwk.Jwk, error)

func (*AwsSmKeyService) SaveKey added in v0.0.13

func (s *AwsSmKeyService) SaveKey(ctx context.Context, id string, priv *jwk.Jwk) error

type AwsSmStorageConfig added in v0.0.13

type AwsSmStorageConfig struct {
	AwsCfg      *aws.Config
	MountPath   string
	KeyBasePath string
	KmsKeyID    *string
}

type FileStorageConfig

type FileStorageConfig struct {
	FilePath string
}

type KeyService

type KeyService interface {
	// SaveKey saves a JWK to the key storage. it supports local file, and hashicorp vault
	SaveKey(ctx context.Context, id string, jwk *jwk.Jwk) error

	// RetrieveKey retrieves a public JWK by its ID.
	RetrievePubKey(ctx context.Context, id string) (*jwk.Jwk, error)

	// RetrieveKey retrieves a private JWK by its ID.
	RetrievePrivKey(ctx context.Context, id string) (*jwk.Jwk, error)

	// DeleteKey deletes a JWK by its ID.
	DeleteKey(ctx context.Context, id string) error

	// ListKeys returns all available key IDs.
	ListKeys(ctx context.Context) ([]string, error)
}

KeyService defines methods for generating, saving, and retrieving JWKs.

func NewAwsSmKeyService added in v0.0.13

func NewAwsSmKeyService(cfg *AwsSmStorageConfig) (KeyService, error)

func NewKeyService

func NewKeyService(storageType StorageType, config interface{}) (KeyService, error)

type LocalFileKeyService

type LocalFileKeyService struct {
	FilePath string
	// contains filtered or unexported fields
}

func (*LocalFileKeyService) DeleteKey

func (s *LocalFileKeyService) DeleteKey(ctx context.Context, id string) error

func (*LocalFileKeyService) ListKeys

func (s *LocalFileKeyService) ListKeys(ctx context.Context) ([]string, error)

func (*LocalFileKeyService) RetrievePrivKey

func (s *LocalFileKeyService) RetrievePrivKey(ctx context.Context, id string) (*jwktype.Jwk, error)

RetrievePrivKey returns the private JWK for the given id.

func (*LocalFileKeyService) RetrievePubKey

func (s *LocalFileKeyService) RetrievePubKey(ctx context.Context, id string) (*jwktype.Jwk, error)

RetrievePubKey returns the public JWK for the given id.

func (*LocalFileKeyService) SaveKey

func (s *LocalFileKeyService) SaveKey(ctx context.Context, id string, jwk *jwktype.Jwk) error

SaveKey saves or updates a JWK in the local file.

type StorageType

type StorageType int
const (
	FileStorage StorageType = iota
	VaultStorage
	AwsSmStorage
)

func (StorageType) String

func (s StorageType) String() string

type VaultKeyService

type VaultKeyService struct {
	// contains filtered or unexported fields
}

func (*VaultKeyService) DeleteKey

func (s *VaultKeyService) DeleteKey(ctx context.Context, id string) error

func (*VaultKeyService) ListKeys

func (s *VaultKeyService) ListKeys(ctx context.Context) ([]string, error)

func (*VaultKeyService) RetrievePrivKey

func (s *VaultKeyService) RetrievePrivKey(ctx context.Context, id string) (*jwk.Jwk, error)

func (*VaultKeyService) RetrievePubKey

func (s *VaultKeyService) RetrievePubKey(ctx context.Context, id string) (*jwk.Jwk, error)

func (*VaultKeyService) SaveKey

func (s *VaultKeyService) SaveKey(ctx context.Context, id string, priv *jwk.Jwk) error

type VaultStorageConfig

type VaultStorageConfig struct {
	Address     string
	Token       string
	MountPath   string
	KeyBasePath string
	Namespace   string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL