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

dataprotection

package
v0.26.249 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProtectObject added in v0.9.0

func ProtectObject(ctx context.Context, p Provider, v any) (string, error)

ProtectObject returns encrypted object value in base64url encoded format

func UnprotectObject added in v0.9.0

func UnprotectObject(ctx context.Context, p Provider, protected string, v any) error

UnprotectObject decrypts and unmarshals protected Base64 encoded string to a struct

Types

type Provider

type Provider interface {
	// Protect returns protected blob
	Protect(ctx context.Context, data []byte) ([]byte, error)
	// Unprotect returns unprotected data
	Unprotect(ctx context.Context, protected []byte) ([]byte, error)
	// IsReady returns true when provider has encryption keys
	IsReady() bool
	// PublicKey is returned for assymetric signer
	PublicKey() crypto.PublicKey
}

Provider interface for data protection

func NewSymmetric

func NewSymmetric(secret []byte) (Provider, error)

NewSymmetric returns `Provider` based on AES256-GCM encryption

Jump to

Keyboard shortcuts

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