This commit introduces a new `rootfs` package that provides an encrypted passthrough storage system. The `LocalStorage` implementation uses the local file system as its backing store and encrypts all data at rest using the `chachapoly` package. The functionality is exposed through the main `crypt` package, providing a clean and simple API for creating and interacting with encrypted file-based storage.
15 lines
443 B
Go
15 lines
443 B
Go
package rootfs
|
|
|
|
import "io/fs"
|
|
|
|
// Storage defines the interface for a passthrough storage system.
|
|
type Storage interface {
|
|
// Read reads the data for the given key.
|
|
Read(key string) ([]byte, error)
|
|
// Write writes the data for the given key.
|
|
Write(key string, data []byte) error
|
|
// Delete deletes the data for the given key.
|
|
Delete(key string) error
|
|
// List lists the keys in the storage.
|
|
List(prefix string) ([]fs.FileInfo, error)
|
|
}
|