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 InitV1Directory(directory, password string) ([32]byte, [128]byte, error)
- func NewProfile(name string) *model.Profile
- func ReadEncryptedFile(directory, filename string, key [32]byte) ([]byte, error)
- func ReadProfile(directory string, key [32]byte, salt [128]byte) (*model.Profile, error)
- func UpgradeV0Profile(profile *model.Profile, directory, password string) error
- type FileStore
- type ProfileStoreV1
- func (ps *ProfileStoreV1) ChangePassword(oldpass, newpass, eventID string)
- func (ps *ProfileStoreV1) CheckPassword(checkpass string) bool
- func (ps *ProfileStoreV1) Delete()
- func (ps *ProfileStoreV1) GetNewPeerMessage() *event.Event
- func (ps *ProfileStoreV1) GetProfileCopy(timeline bool) *model.Profile
- func (ps *ProfileStoreV1) GetStatusMessages() []*event.Event
- func (ps *ProfileStoreV1) Shutdown()
- 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
func InitV1Directory ¶ added in v0.11.1
InitV1Directory generates a key and salt from a password, writes a SALT and VERSION file and returns the key and salt
func NewProfile ¶
NewProfile creates a new profile for use in the profile store.
func ReadEncryptedFile ¶ added in v0.3.15
ReadEncryptedFile reads data from an encrypted file in directory with key
func ReadProfile ¶
ReadProfile reads a profile from storqage and returns the profile directory should be $appDir/profiles/$rand
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 CreateProfileWriterStore ¶
func CreateProfileWriterStore(eventManager event.Manager, directory, password string, profile *model.Profile) *ProfileStoreV1
CreateProfileWriterStore creates a profile store backed by a filestore listening for events and saving them directory should be $appDir/profiles/$rand
func LoadProfileWriterStore ¶
func LoadProfileWriterStore(eventManager event.Manager, 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) ChangePassword ¶
func (ps *ProfileStoreV1) ChangePassword(oldpass, newpass, eventID string)
ChangePassword restores all data under a new password's encryption
func (*ProfileStoreV1) CheckPassword ¶ added in v0.8.9
func (ps *ProfileStoreV1) CheckPassword(checkpass string) bool
CheckPassword returns true if the given password produces the same key as the current stored key, otherwise false.
func (*ProfileStoreV1) Delete ¶
func (ps *ProfileStoreV1) Delete()
Delete removes all stored files for this stored profile
func (*ProfileStoreV1) GetNewPeerMessage ¶
func (ps *ProfileStoreV1) GetNewPeerMessage() *event.Event
GetNewPeerMessage is for AppService to call on Reload events, to reseed the AppClient with the loaded peers
func (*ProfileStoreV1) GetProfileCopy ¶
func (ps *ProfileStoreV1) GetProfileCopy(timeline bool) *model.Profile
GetProfileCopy returns a copy of the stored profile
func (*ProfileStoreV1) GetStatusMessages ¶
func (ps *ProfileStoreV1) GetStatusMessages() []*event.Event
GetStatusMessages creates an array of status messages for all peers and group servers from current information
func (*ProfileStoreV1) Shutdown ¶
func (ps *ProfileStoreV1) Shutdown()
Shutdown shuts down the queue / thread
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