Documentation
¶
Index ¶
- func Decrypt(data []byte, password string) ([]byte, error)
- func Encrypt(plaintext []byte, password string) ([]byte, error)
- func EnsureInsideDir(baseDir, target string) error
- func RejectSymlinkIfExists(path string) error
- type GitStore
- func (g *GitStore) Cleanup() error
- func (g *GitStore) Clone(ctx context.Context, allowCreate bool) error
- func (g *GitStore) CommitAndPush(ctx context.Context, message string) error
- func (g *GitStore) ListEncryptedFiles() ([]string, error)
- func (g *GitStore) ReadEncryptedFile(relPath string, password string) ([]byte, error)
- func (g *GitStore) WriteEncryptedFile(relPath string, plaintext []byte, password string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Encrypt ¶
Encrypt encrypts plaintext using AES-256-GCM with a password-derived key. Output format: salt (16 bytes) || nonce (12 bytes) || ciphertext+tag.
func EnsureInsideDir ¶
EnsureInsideDir checks that target stays inside baseDir and does not traverse any symlinked parent directories.
func RejectSymlinkIfExists ¶
RejectSymlinkIfExists rejects writes through an existing symlink path.
Types ¶
type GitStore ¶
GitStore manages an encrypted git repository of signing assets.
func (*GitStore) Clone ¶
Clone clones the git repo. If allowCreate is true (push mode), falls back to initializing an empty repo when the branch doesn't exist. If false (pull mode), fails when the branch is missing.
func (*GitStore) CommitAndPush ¶
CommitAndPush stages all changes, commits, and pushes.
func (*GitStore) ListEncryptedFiles ¶
ListEncryptedFiles returns relative paths (without .enc) of all encrypted files.
func (*GitStore) ReadEncryptedFile ¶
ReadEncryptedFile reads and decrypts a file from the repo. Rejects symlinks to prevent reading outside the clone directory.