encryption

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package encryption provides utilities for encrypting and decrypting arbitrary JSON-like data structures used in the git-calendar project.

It recursively walks maps and slices, encrypting leaf values using AES-SIV with additional authenticated data (AAD) derived from the field path. Encrypted values are base64-encoded strings.

Decryption performs the reverse operation, restoring the original data structure and value types via JSON unmarshaling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptFields

func DecryptFields(v any, key, aad []byte) (any, error)

DecryptField accepts a map[string]any, []any or pure string and returns a the same type with decrypted values using the key+aad. The encrypted text is expected to be base64 encoded. It works recursively.

func DeriveKey

func DeriveKey(password string, salt []byte) []byte

Creates a key based on the provided 'password' plus 'salt'.

func EncryptFields

func EncryptFields(v any, key, aad []byte) (any, error)

EncryptFields accepts anything and returns a new any with values encrypted using key+add and base64 encoded. It works recursively.

Types

This section is empty.

Jump to

Keyboard shortcuts

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