Documentation ¶
Index ¶
- func CreateKey(password string, salt []byte) [32]byte
- func CreateKeySalt(password string) ([32]byte, [128]byte, error)
- func DecryptFile(ciphertext []byte, key [32]byte) ([]byte, error)
- func EncryptFileData(data []byte, key [32]byte) ([]byte, error)
- func ReadEncryptedFile(directory, filename string, key [32]byte) ([]byte, error)
- type FileStore
- type ProfileStoreV1
- type StreamStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateKeySalt ¶ added in v0.3.15
CreateKeySalt derives a key and salt from a password: returns key, salt, err
func DecryptFile ¶ added in v0.3.15
DecryptFile decrypts the passed ciphertext with the supplied key.
func EncryptFileData ¶ added in v0.3.15
EncryptFileData encrypts the data with the supplied key
Types ¶
type FileStore ¶
type FileStore interface { Write([]byte) error Read() ([]byte, error) Delete() ChangeKey(newkey [32]byte) }
FileStore is a primitive around storing encrypted files
type ProfileStoreV1 ¶
type ProfileStoreV1 struct {
// contains filtered or unexported fields
}
ProfileStoreV1 storage for profiles and message streams that uses in memory key and fs stored salt instead of in memory password
func LoadProfileWriterStore ¶
func LoadProfileWriterStore(directory, password string) (*ProfileStoreV1, error)
LoadProfileWriterStore loads a profile store from filestore listening for events and saving them directory should be $appDir/profiles/$rand
func (*ProfileStoreV1) GetProfileCopy ¶
func (ps *ProfileStoreV1) GetProfileCopy(timeline bool) *model.Profile
GetProfileCopy returns a copy of the stored profile
type StreamStore ¶
type StreamStore interface { Write(message model.Message) WriteN(messages []model.Message) Read() []model.Message Delete() }
StreamStore provides a stream like interface to encrypted storage
func NewStreamStore ¶
func NewStreamStore(directory string, filenameBase string, key [32]byte) (store StreamStore)
NewStreamStore returns an initialized StreamStore ready for reading and writing