encrypt

package
v1.2.19 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Overview

Package encrypt provides reversible AES-256-GCM encryption and decryption utilities for securing sensitive data like API keys and credentials. We are not using it anywhere yet - we will introduce encryption for all the sensitive data in one go to avoid breaking changes

Index

Constants

This section is empty.

Variables

View Source
var ErrEncryptionKeyNotInitialized = errors.New("encryption key is not initialized")

Functions

func CompareHash added in v1.1.20

func CompareHash(hash string, password string) (bool, error)

CompareHash compares a hash and a password

func Decrypt

func Decrypt(ciphertext string) (string, error)

Decrypt decrypts a base64-encoded ciphertext using AES-256-GCM and returns the plaintext

func Encrypt

func Encrypt(plaintext string) (string, error)

Encrypt encrypts a plaintext string using AES-256-GCM and returns a base64-encoded ciphertext

func Hash added in v1.1.20

func Hash(password string) (string, error)

Hash hashes a password using bcrypt

func Init

func Init(key string, _logger schemas.Logger)

Init initializes the encryption key using Argon2id KDF to derive a secure 32-byte key from the provided passphrase. This ensures strong entropy regardless of passphrase length. The function accepts any passphrase but warns if it's too short (< 16 bytes).

Types

This section is empty.

Jump to

Keyboard shortcuts

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