helpers

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEncryption  = errors.New("encryption failed")
	ErrDecryption  = errors.New("decryption failed")
	ErrInvalidKey  = errors.New("invalid encryption key")
	ErrInvalidData = errors.New("invalid data")
)

Functions

This section is empty.

Types

type EncryptionHelper

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

func GetEncryptionInstance

func GetEncryptionInstance() (*EncryptionHelper, error)

GetInstance returns a singleton instance of EncryptionHelper

func (*EncryptionHelper) DecryptBytes

func (eh *EncryptionHelper) DecryptBytes(encryptedData string) ([]byte, error)

DecryptBytes decrypts a base64 encoded encrypted data to bytes

func (*EncryptionHelper) EncryptBytes

func (eh *EncryptionHelper) EncryptBytes(data []byte) (string, error)

EncryptBytes encrypts byte array and returns base64 encoded result

type SensitiveData

type SensitiveData string

SensitiveData represents an encrypted string

func NewSensitiveData

func NewSensitiveData(plaintext string) (SensitiveData, error)

NewSensitiveData creates a new encrypted sensitive data

func (SensitiveData) Decrypt

func (s SensitiveData) Decrypt() (string, error)

Decrypt decrypts the sensitive data

func (SensitiveData) String

func (s SensitiveData) String() string

String implements Stringer interface

Jump to

Keyboard shortcuts

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