accountutils

package
v2.446.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: Apache-2.0, MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InMemoryDir                 = ":memory:"
	DefaultPushKeyFilename      = "push.key"
	AccountMetafileName         = "account_meta"
	AccountNetConfFileName      = "account_net_conf"
	MessengerDatabaseFilename   = "messenger.sqlite"
	ReplicationDatabaseFilename = "replication.sqlite"
	StorageKeyName              = "storage"
	StorageKeySize              = 32
	StorageSaltSize             = 16
)

Variables

This section is empty.

Functions

func CreateDataDir added in v2.431.0

func CreateDataDir(dir string) error

func GetAccountAppStorage added in v2.331.0

func GetAccountAppStorage(rootDir string, accountID string, key []byte, salt []byte) (datastore.Datastore, error)

func GetAccountDir added in v2.315.0

func GetAccountDir(rootDir, accountID string) string

func GetAccountMetaForName

func GetAccountMetaForName(ctx context.Context, rootDir string, accountID string, storageKey []byte, storageSalt []byte, logger *zap.Logger) (*accounttypes.AccountMetadata, error)

func GetAccountsDir added in v2.315.0

func GetAccountsDir(rootDir string) string

func GetDevicePushKeyForPath

func GetDevicePushKeyForPath(filePath string, createIfMissing bool) (pk *[cryptoutil.KeySize]byte, sk *[cryptoutil.KeySize]byte, err error)

func GetGlobalAppStorage added in v2.431.0

func GetGlobalAppStorage(rootDir string, ks NativeKeystore) (datastore.Batching, func() error, error)

func GetGormDBForPath added in v2.311.2

func GetGormDBForPath(dbPath string, key []byte, salt []byte, logger *zap.Logger) (*gorm.DB, func(), error)

func GetMessengerDBForPath

func GetMessengerDBForPath(dir string, key []byte, salt []byte, logger *zap.Logger) (*gorm.DB, func(), error)

func GetOrCreateAppStorageSaltForAccount added in v2.431.0

func GetOrCreateAppStorageSaltForAccount(ks NativeKeystore, accountID string) ([]byte, error)

func GetOrCreateGlobalAppStorageSalt added in v2.431.0

func GetOrCreateGlobalAppStorageSalt(ks NativeKeystore) ([]byte, error)

func GetOrCreateGlobalSalt added in v2.431.0

func GetOrCreateGlobalSalt(ks NativeKeystore, name string) ([]byte, error)

func GetOrCreateIPFSDatastoreSaltForAccount added in v2.431.0

func GetOrCreateIPFSDatastoreSaltForAccount(ks NativeKeystore, accountID string) ([]byte, error)

func GetOrCreateMasterStorageKey added in v2.331.0

func GetOrCreateMasterStorageKey(ks NativeKeystore) ([]byte, error)

func GetOrCreateMessengerDBSaltForAccount added in v2.431.0

func GetOrCreateMessengerDBSaltForAccount(ks NativeKeystore, accountID string) ([]byte, error)

func GetOrCreateRootDatastoreSaltForAccount added in v2.431.0

func GetOrCreateRootDatastoreSaltForAccount(ks NativeKeystore, accountID string) ([]byte, error)

func GetOrCreateSaltForAccount added in v2.431.0

func GetOrCreateSaltForAccount(ks NativeKeystore, accountID string, name string) ([]byte, error)

func GetOrCreateStorageKeyForAccount added in v2.331.0

func GetOrCreateStorageKeyForAccount(ks NativeKeystore, accountID string) ([]byte, error)

func GetReplicationDBForPath added in v2.311.2

func GetReplicationDBForPath(dir string, logger *zap.Logger) (*gorm.DB, func(), error)

func GetRootDatastoreForPath

func GetRootDatastoreForPath(dir string, key []byte, salt []byte, logger *zap.Logger) (datastore.Batching, error)

func ListAccounts

func ListAccounts(ctx context.Context, rootDir string, ks NativeKeystore, logger *zap.Logger) ([]*accounttypes.AccountMetadata, error)

Types

type MemNativeKeystore added in v2.431.0

type MemNativeKeystore struct {
	// contains filtered or unexported fields
}

func (*MemNativeKeystore) Get added in v2.431.0

func (ks *MemNativeKeystore) Get(key string) ([]byte, error)

func (*MemNativeKeystore) Put added in v2.431.0

func (ks *MemNativeKeystore) Put(key string, value []byte) error

type NativeKeystore added in v2.319.0

type NativeKeystore interface {
	Put(key string, data []byte) error
	Get(key string) ([]byte, error)
}

func NewMemNativeKeystore added in v2.431.0

func NewMemNativeKeystore() NativeKeystore

Jump to

Keyboard shortcuts

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