Features
Composable Units
Each sigil does one thing: compress, encode, encrypt, hash
In/Out Interface
In(data) transforms forward, Out(data) reverses (if reversible)
Chaining
Transmute() chains multiple sigils into a pipeline
Reversibility Awareness
Hash sigils explicitly cannot reverse - calling Out() returns error
Installation
import "github.com/Snider/Enchantrix/pkg/sigil"
// Chain sigils together
pipeline := sigil.Transmute(
sigil.NewCompressSigil("gzip"),
sigil.NewChaChaPolySigil(key),
sigil.NewBase64Sigil(),
)
encrypted := pipeline.In(plaintext)
decrypted := pipeline.Out(encrypted)
Usage
Standard Sigils
| Sigil | In() | Out() |
|---|---|---|
| Base64Sigil | Encode | Decode |
| HexSigil | Encode | Decode |
| CompressSigil | Compress | Decompress |
| ChaChaPolySigil | Encrypt | Decrypt |
| HashSigil | Hash | Error (irreversible) |
Design Principles
- Simplicity: Two methods, clear contract
- Composability: Sigils combine naturally
- Null safety: Defined behaviour for nil/empty inputs
- Error propagation: Clear error semantics
Quick Links
More from Lethean R&D Labs
Fancy helping out?
Spotted a bug? Got an idea? We'd love to hear from you.
Read the contributing guide →