Documentation
¶
Overview ¶
Package secretbox provides authenticated symmetric encryption (AES-256-GCM) for secrets stored at rest (e.g. per-shop Telegram bot tokens).
Index ¶
Constants ¶
View Source
const KeySize = 32
KeySize is the required AES-256 key length in bytes.
Variables ¶
View Source
var ErrInvalidKey = errors.New("secretbox: key must be 32 bytes")
ErrInvalidKey is returned when the key is not KeySize bytes.
Functions ¶
This section is empty.
Types ¶
type Box ¶
type Box struct {
// contains filtered or unexported fields
}
Box seals and opens secrets with AES-256-GCM, and derives deterministic HMAC tags (for equality/uniqueness checks over encrypted-at-rest values).
func (*Box) HMAC ¶
HMAC returns a deterministic hex HMAC-SHA256 tag of s. Unlike Seal (random nonce → different ciphertext each call), HMAC yields the same tag for the same input, so it can back a UNIQUE index for detecting duplicate secrets without storing plaintext.
Click to show internal directories.
Click to hide internal directories.