v1

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 16 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 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

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

Jump to

Keyboard shortcuts

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