crypto

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package crypto provides AES-256-GCM encryption for sensitive stored values. The encryption key is loaded from the SCANORAMA_SECRET_KEY environment variable (exactly 64 hex characters = 32 bytes). If the variable is absent, a random ephemeral key is generated and a warning is logged — credentials encrypted with an ephemeral key are lost on restart, so set the variable in production.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(encoded string) (string, error)

Decrypt decrypts a hex-encoded "nonce||ciphertext" string produced by Encrypt. Returns "" for an empty input.

func Encrypt

func Encrypt(plaintext string) (string, error)

Encrypt encrypts plaintext using AES-256-GCM and returns a hex-encoded "nonce||ciphertext" string safe to store in a TEXT column. Returns "" for an empty plaintext (no-op, avoids storing encrypted empty strings).

Types

This section is empty.

Jump to

Keyboard shortcuts

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