v1

package
v0.8.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2021 License: MIT Imports: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateKey added in v0.3.15

func CreateKey(password string, salt []byte) [32]byte

CreateKey derives a key from a password and salt

func CreateKeySalt added in v0.3.15

func CreateKeySalt(password string) ([32]byte, [128]byte, error)

CreateKeySalt derives a key and salt from a password: returns key, salt, err

func DecryptFile added in v0.3.15

func DecryptFile(ciphertext []byte, key [32]byte) ([]byte, error)

DecryptFile decrypts the passed ciphertext with the supplied key.

func EncryptFileData added in v0.3.15

func EncryptFileData(data []byte, key [32]byte) ([]byte, error)

EncryptFileData encrypts the data with the supplied key

func NewProfile

func NewProfile(name string) *model.Profile

NewProfile creates a new profile for use in the profile store.

func ReadEncryptedFile added in v0.3.15

func ReadEncryptedFile(directory, filename string, key [32]byte) ([]byte, error)

ReadEncryptedFile reads data from an encrypted file in directory with key

func ReadProfile

func ReadProfile(directory string, key [32]byte, salt [128]byte) (*model.Profile, error)

ReadProfile reads a profile from storqage and returns the profile directory should be $appDir/profiles/$rand

func UpgradeV0Profile

func UpgradeV0Profile(profile *model.Profile, directory, password string) error

UpgradeV0Profile takes a profile (presumably from a V0 store) and creates and writes a V1 store

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

func NewFileStore

func NewFileStore(directory string, filename string, key [32]byte) FileStore

NewFileStore instantiates a fileStore given a filename and a password

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) 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL