encryption

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashID

func HashID(id string) (string, error)

HashID generates a hash for the id

Types

type Encryption

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

func NewEncryption

func NewEncryption(opts ...OptionsFunc) Encryption

func (Encryption) Decrypt

func (e Encryption) Decrypt(ciphertext string) (string, error)

Decrypt return the input text decrypted

func (Encryption) Encrypt

func (e Encryption) Encrypt(text string) (string, error)

Encrypt return the input text encripted

func (Encryption) GenerateEncryptionKey

func (e Encryption) GenerateEncryptionKey() (string, error)

func (*Encryption) Options

func (e *Encryption) Options(opts ...OptionsFunc)

Options provides the options to encryption

type MockEncription

type MockEncription struct {
	mock.Mock
}

func NewMockEncryption

func NewMockEncryption() *MockEncription

func (*MockEncription) Decrypt

func (e *MockEncription) Decrypt(ciphertext string) (string, error)

func (*MockEncription) Encrypt

func (e *MockEncription) Encrypt(text string) (string, error)

func (*MockEncription) GenerateEncryptionKey

func (e *MockEncription) GenerateEncryptionKey() (string, error)

type OptionsFunc

type OptionsFunc func(opts *Encryption)

OptionsFunc defines the signature for an option function to set encryption

func WithKey

func WithKey(key string) OptionsFunc

WithKey sets the encryption key

Jump to

Keyboard shortcuts

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