services

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2020 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyFileSharingInfo = domain.FileSharingInfo{}

Functions

func IsPathDir

func IsPathDir(path string) bool

func PathExists

func PathExists(path string) bool

func RemoveDuplicates

func RemoveDuplicates(elements []string) []string

Types

type AddFileWatchFunc

type AddFileWatchFunc = func(addFileInfo domain.AddWatchFile) error

type CountingReader added in v0.0.19

type CountingReader struct {
	BytesRead int64
	// contains filtered or unexported fields
}

Reader that also counts the amount of Bytes read from the wrappeed reader

func NewCountingReader added in v0.0.19

func NewCountingReader(reader io.Reader) *CountingReader

func (*CountingReader) Read added in v0.0.19

func (r *CountingReader) Read(b []byte) (int, error)

type Space

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

Implementation for space.Service

func NewSpace

func NewSpace(
	st store.Store,
	tc textile.Client,
	syncer Syncer,
	cfg config.Config,
	env env.SpaceEnv,
	kc keychain.Keychain,
	v vault.Vault,
	h hub.HubAuth,
) *Space

func (*Space) AddItemWithReader added in v0.0.19

func (s *Space) AddItemWithReader(
	ctx context.Context,
	reader io.Reader,
	targetPath, bucketName string,
) (domain.AddItemResult, error)

AddItemWithReader uploads content of the reader to the targetPath on the bucket specified

Note: the AddItemResult returns an empty SourcePath

func (*Space) AddItems

func (s *Space) AddItems(ctx context.Context, sourcePaths []string, targetPath string, bucketName string) (<-chan domain.AddItemResult, domain.AddItemsResponse, error)

func (*Space) AddRecentlySharedPublicKeys added in v0.0.13

func (s *Space) AddRecentlySharedPublicKeys(ctx context.Context, pubkeys []crypto.PubKey) error

func (*Space) BackupKeysByPassphrase added in v0.0.13

func (s *Space) BackupKeysByPassphrase(ctx context.Context, uuid string, pass string, backupType domain.KeyBackupType) error

Uses the vault service to securely store the current keypair

func (*Space) BucketBackupRestore added in v0.0.28

func (s *Space) BucketBackupRestore(ctx context.Context, bucketSlug string) error

func (*Space) CreateBucket

func (s *Space) CreateBucket(ctx context.Context, slug string) (textile.Bucket, error)

Creates a bucket

func (*Space) CreateFolder

func (s *Space) CreateFolder(ctx context.Context, path string, bucketName string) error

func (*Space) CreateIdentity

func (s *Space) CreateIdentity(ctx context.Context, username string) (*domain.Identity, error)

Creates an identity in Space cloud services. Returns the created identity or an error if any.

func (*Space) CreateLocalKeysBackup added in v0.0.13

func (s *Space) CreateLocalKeysBackup(ctx context.Context, path string) error

Creates an obfuscated local file that contains everything needed to restore the state from this or another device

func (*Space) DeleteKeypair added in v0.0.13

func (s *Space) DeleteKeypair(ctx context.Context) error
func (s *Space) GenerateFileSharingLink(
	ctx context.Context,
	encryptionPassword string,
	path string,
	bucketName string,
	dbID string,
) (domain.FileSharingInfo, error)
func (s *Space) GenerateFilesSharingLink(
	ctx context.Context,
	encryptionPassword string,
	paths []string,
	bucketName, dbID string,
) (domain.FileSharingInfo, error)

GenerateFilesSharingLink zips multiple files together

func (*Space) GenerateKeyPair

func (s *Space) GenerateKeyPair(ctx context.Context, useForce bool) (string, error)

Generates a key pair and returns a mnemonic for recovering that key later on

func (*Space) GetAPISessionTokens added in v0.0.13

func (s *Space) GetAPISessionTokens(ctx context.Context) (*domain.APISessionTokens, error)

Return session token for central services authenticated access

func (*Space) GetConfig

func (s *Space) GetConfig(ctx context.Context) domain.AppConfig

func (*Space) GetHubAuthToken added in v0.0.12

func (s *Space) GetHubAuthToken(ctx context.Context) (string, error)

func (*Space) GetIdentityByUsername

func (s *Space) GetIdentityByUsername(ctx context.Context, username string) (*domain.Identity, error)

Gets an identity from Space cloud services given a username

func (*Space) GetMnemonic added in v0.0.13

func (s *Space) GetMnemonic(ctx context.Context) (string, error)

func (*Space) GetNotifications added in v0.0.13

func (s *Space) GetNotifications(ctx context.Context, seek string, limit int) ([]*domain.Notification, error)

func (*Space) GetNotificationsLastSeenAt added in v0.0.14

func (s *Space) GetNotificationsLastSeenAt() (int64, error)

func (*Space) GetPublicKey added in v0.0.11

func (s *Space) GetPublicKey(ctx context.Context) (string, error)

func (*Space) GetSharedByMeFiles added in v0.0.34

func (s *Space) GetSharedByMeFiles(ctx context.Context, seek string, limit int) ([]*domain.SharedDirEntry, string, error)

Returns a list of shared files the user has shared

func (*Space) GetSharedWithMeFiles added in v0.0.14

func (s *Space) GetSharedWithMeFiles(ctx context.Context, seek string, limit int) ([]*domain.SharedDirEntry, string, error)

Returns a list of shared files the user has received and accepted

func (*Space) HandleSharedFilesInvitation added in v0.0.13

func (s *Space) HandleSharedFilesInvitation(ctx context.Context, invitationId string, accept bool) error

HandleSharedFilesInvitation accepts or rejects an invitation based on the invitation id

func (*Space) InitializeMasterAppToken added in v0.1.0

func (s *Space) InitializeMasterAppToken(ctx context.Context) (*permissions.AppToken, error)

func (*Space) JoinBucket added in v0.0.8

func (s *Space) JoinBucket(ctx context.Context, slug string, threadinfo *domain.ThreadInfo) (bool, error)

func (*Space) ListBuckets added in v0.0.10

func (s *Space) ListBuckets(ctx context.Context) ([]textile.Bucket, error)

Returns a list of buckets the current user has access to

func (*Space) ListDir

func (s *Space) ListDir(ctx context.Context, path string, bucketName string, listMembers bool) ([]domain.FileInfo, error)

ListDir returns children entries at path in a bucket

func (*Space) ListDirs

func (s *Space) ListDirs(ctx context.Context, path string, bucketName string, listMembers bool) ([]domain.FileInfo, error)

ListDirs lists all children entries at path in a bucket Unlike ListDir, it includes all subfolders children recursively

func (*Space) OpenFile

func (s *Space) OpenFile(ctx context.Context, path, bucketName, dbID string) (domain.OpenFileInfo, error)

Copies a file inside a bucket into a temp, unencrypted version of the file in the local file system Include dbID if opening a shared file. Use dbID = "" otherwise.

func (*Space) OpenSharedFile added in v0.0.10

func (s *Space) OpenSharedFile(ctx context.Context, hash, password, filename string) (domain.OpenFileInfo, error)

OpenSharedFile fetched the ipfs file and decrypts it with the key. Then returns the decrypted files location. NOTE: This only opens public link shared files and not those shared via direct invites.

func (*Space) RecentlySharedPublicKeys added in v0.0.13

func (s *Space) RecentlySharedPublicKeys(ctx context.Context) ([]crypto.PubKey, error)

func (*Space) RecoverKeysByLocalBackup added in v0.0.13

func (s *Space) RecoverKeysByLocalBackup(ctx context.Context, path string) error

Restores the state by receiving the path to a local backup Warning: This will delete any local state before restoring the backup

func (*Space) RecoverKeysByPassphrase added in v0.0.13

func (s *Space) RecoverKeysByPassphrase(ctx context.Context, uuid string, pass string, backupType domain.KeyBackupType) error

Uses vault service to fetch and decrypt a keypair set

func (*Space) RegisterSyncer

func (s *Space) RegisterSyncer(sync Syncer)

func (*Space) RemoveDirOrFile added in v0.1.3

func (s *Space) RemoveDirOrFile(ctx context.Context, path, bucketName string) error

Removes a file or directory from a bucket Note: If removing a file a user has been shared, call the RemoveMember method instead, as this works only for local buckets.

func (*Space) RestoreKeyPairFromMnemonic added in v0.0.13

func (s *Space) RestoreKeyPairFromMnemonic(ctx context.Context, mnemonic string) error

func (*Space) SearchFiles added in v0.0.30

func (s *Space) SearchFiles(ctx context.Context, query string) ([]domain.SearchFileEntry, error)

func (*Space) SetNotificationsLastSeenAt added in v0.0.14

func (s *Space) SetNotificationsLastSeenAt(timestamp int64) error

func (*Space) ShareBucket added in v0.0.8

func (s *Space) ShareBucket(ctx context.Context, slug string) (*domain.ThreadInfo, error)

func (*Space) ShareFilesViaPublicKey added in v0.0.13

func (s *Space) ShareFilesViaPublicKey(ctx context.Context, paths []domain.FullPath, pubkeys []crypto.PubKey) error

func (*Space) TestPassphrase added in v0.0.13

func (s *Space) TestPassphrase(ctx context.Context, uuid string, pass string) error

Tests a passphrase without storing anything to check if the passphrase is correct

func (*Space) ToggleBucketBackup added in v0.0.13

func (s *Space) ToggleBucketBackup(ctx context.Context, bucketSlug string, bucketBackup bool) error

func (*Space) TruncateData added in v0.0.30

func (s *Space) TruncateData(ctx context.Context) error

TruncateData removes all data from local machine

func (*Space) UnshareFilesViaPublicKey added in v0.1.3

func (s *Space) UnshareFilesViaPublicKey(ctx context.Context, paths []domain.FullPath, pubkeys []crypto.PubKey) error

type Syncer

type Syncer interface {
	AddFileWatch(addFileInfo domain.AddWatchFile) error
	GetOpenFilePath(bucketSlug, bucketPath, dbID, cid string) (string, bool)
}

Jump to

Keyboard shortcuts

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