crypto

package
v0.0.0-...-7e2b890 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package crypto provides authenticated symmetric encryption (AES-256-GCM) used to protect stored IRC SASL credentials at rest. The key is derived from the configured HERMES_SECRET_KEY.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Box

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

Box encrypts and decrypts small secrets with a fixed key.

func NewBox

func NewBox(secret string) (*Box, error)

NewBox derives a 32-byte key from secret (via SHA-256) and returns a Box. secret must be non-empty.

func (*Box) Decrypt

func (b *Box) Decrypt(data []byte) ([]byte, error)

Decrypt opens data produced by Encrypt.

func (*Box) DecryptString

func (b *Box) DecryptString(data []byte) (string, error)

DecryptString is a convenience wrapper returning the decrypted string.

func (*Box) Encrypt

func (b *Box) Encrypt(plaintext []byte) ([]byte, error)

Encrypt seals plaintext, returning nonce||ciphertext.

func (*Box) EncryptString

func (b *Box) EncryptString(s string) ([]byte, error)

EncryptString is a convenience wrapper returning encrypted bytes for a string.

Jump to

Keyboard shortcuts

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