Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
EncryptedKeySize = chacha20.KeySize
)
Functions ¶
This section is empty.
Types ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage provides the Open and Create functions, using an arbitrary storage implementation. You should create the Storage from NewPlainStorage or NewEncryptedStorage.
func NewEncryptedStorage ¶
NewEncryptedStorage creates a Storage encrypted by unauthenticated ChaCha20X. The key must be chacha20.KeySize. The salt is created at random, using rand.Read.
The file can be modified without any sign of change, similarly as plain-text files. Beware that the key is already on the client's computer, so it's possible to re-encrypt an arbitrary data.
func NewPlainStorage ¶
NewPlainStorage creates a Storage.
func (*Storage) Create ¶
func (s *Storage) Create(name string) (io.WriteCloser, error)
Create creates (or truncate, if exists) the file.
func (*Storage) Open ¶
func (s *Storage) Open(name string) (io.ReadCloser, error)
Open opens the file.
func (*Storage) ReadInterface ¶
ReadInterface will read the given resp interface, from the file. It uses gob.
func (*Storage) WriteInterface ¶
WriteInterface will write given data interface into a file. It uses gob.