security

package
v2.36.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Overview

********************************************************************

  • Copyright (c) Intel Corporation 2025
  • SPDX-License-Identifier: Apache-2.0 *********************************************************************

********************************************************************

  • Copyright (c) Intel Corporation 2025
  • SPDX-License-Identifier: Apache-2.0 *********************************************************************

********************************************************************

  • Copyright (c) Intel Corporation 2025
  • SPDX-License-Identifier: Apache-2.0 *********************************************************************

********************************************************************

  • Copyright (c) Intel Corporation 2025
  • SPDX-License-Identifier: Apache-2.0 *********************************************************************

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyNotFound = errors.New("key not found")

ErrKeyNotFound indicates a requested key was not found in storage.

Functions

This section is empty.

Types

type Crypto

type Crypto struct {
	EncryptionKey string
}

func (Crypto) Decrypt

func (c Crypto) Decrypt(cipherText string) (string, error)

Decrypt cipher text using AES-GCM with the provided key.

func (Crypto) Encrypt

func (c Crypto) Encrypt(plainText string) (string, error)

Encrypt encrypts a string.

func (Crypto) EncryptWithKey

func (c Crypto) EncryptWithKey(plainText, key string) (string, error)

Encrypt encrypts a string with provided key.

func (Crypto) GenerateKey

func (c Crypto) GenerateKey() string

func (Crypto) ReadAndDecryptFile

func (c Crypto) ReadAndDecryptFile(filePath string) (config.Configuration, error)

Read encrypted data from file and decrypt it.

type Cryptor

type Cryptor interface {
	Decrypt(cipherText string) (string, error)
	Encrypt(plainText string) (string, error)
	EncryptWithKey(plainText, key string) (string, error)
	GenerateKey() string
	ReadAndDecryptFile(filePath string) (config.Configuration, error)
}

type Keyring

type Keyring interface {
	Set(serviceName, key, value string) error
	Get(serviceName, key string) (string, error)
	Delete(serviceName, key string) error
}

Keyring interface to abstract the keyring operations.

type RealKeyring

type RealKeyring struct{}

RealKeyring struct to implement the Keyring interface using the real keyring package.

func (RealKeyring) Delete added in v2.32.0

func (r RealKeyring) Delete(serviceName, key string) error

Delete method to delete a key-value pair from the real keyring.

func (RealKeyring) Get

func (r RealKeyring) Get(serviceName, key string) (string, error)

Get method to get a value from the real keyring by key.

func (RealKeyring) Set

func (r RealKeyring) Set(serviceName, key, value string) error

Set method to set a key-value pair in the real keyring.

type Storage

type Storage struct {
	ServiceName string
	Keyring     Keyring
}

func NewKeyRingStorage

func NewKeyRingStorage(serviceName string) Storage

NewKeyRingStorage function to create a new Storage instance with RealKeyring.

func NewStorage

func NewStorage(serviceName string, kr Keyring) Storage

NewStorage function to create a new Storage instance with a keyring interface (for testing).

func (Storage) DeleteKeyValue added in v2.32.0

func (s Storage) DeleteKeyValue(key string) error

DeleteKeyValue method to delete a key-value pair from the keyring.

func (Storage) GetKeyValue

func (s Storage) GetKeyValue(key string) (string, error)

GetKeyValue method to get a value from the keyring by key.

func (Storage) SetKeyValue

func (s Storage) SetKeyValue(key, value string) error

SetKeyValue method to set a key-value pair in the keyring.

type Storager

type Storager interface {
	GetKeyValue(key string) (string, error)
	SetKeyValue(key, value string) error
	DeleteKeyValue(key string) error
}

Storager is the interface for secret storage operations. Implementations can be keyring-based (local) or remote (Vault). Currently supports simple key-value operations; blob/hierarchical storage can be added later if needed.

Jump to

Keyboard shortcuts

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