Versions in this module Expand all Collapse all v0 v0.0.2 Dec 27, 2025 Changes in this version + const Magic + const Version + var ErrDecryptionFailed = errors.New("decryption failed (wrong password?)") + var ErrEmptyMessage = errors.New("message cannot be empty") + var ErrInvalidMagic = errors.New("invalid SMSG magic") + var ErrInvalidPayload = errors.New("invalid SMSG payload") + var ErrPasswordRequired = errors.New("password is required") + func DeriveKey(password string) []byte + func Encrypt(msg *Message, password string) ([]byte, error) + func EncryptBase64(msg *Message, password string) (string, error) + func EncryptWithHint(msg *Message, password, hint string) ([]byte, error) + func QuickDecrypt(encoded, password string) (string, error) + func QuickEncrypt(body, password string) (string, error) + func Validate(data []byte) error + type Attachment struct + Content string + MimeType string + Name string + Size int + type Header struct + Algorithm string + Hint string + Version string + func GetInfo(data []byte) (*Header, error) + func GetInfoBase64(encoded string) (*Header, error) + type Message struct + Attachments []Attachment + Body string + From string + Meta map[string]string + ReplyKey *PKIInfo + Subject string + Timestamp int64 + func Decrypt(data []byte, password string) (*Message, error) + func DecryptBase64(encoded, password string) (*Message, error) + func NewMessage(body string) *Message + func (m *Message) AddAttachment(name, content, mimeType string) *Message + func (m *Message) GetAttachment(name string) *Attachment + func (m *Message) SetMeta(key, value string) *Message + func (m *Message) WithFrom(from string) *Message + func (m *Message) WithReplyKey(publicKeyB64 string) *Message + func (m *Message) WithReplyKeyInfo(pki *PKIInfo) *Message + func (m *Message) WithSubject(subject string) *Message + func (m *Message) WithTimestamp(ts int64) *Message + type PKIInfo struct + Algorithm string + Fingerprint string + KeyID string + PublicKey string