services

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2020 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IVBlockSize = 16

Initialization vector size is 16 bytes this corresponds to the block size of the cipher key used in encrypted writer

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 EncryptedFileReader added in v0.0.10

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

EncryptedFileReader reads an encrypted stream and decrypts them from the decoded stream decoded bytes are then written to the writer

func (*EncryptedFileReader) Read added in v0.0.10

func (e *EncryptedFileReader) Read(b []byte) (int, error)

type EncryptedFileWriter added in v0.0.10

type EncryptedFileWriter struct {
	IV  []byte
	Key []byte
	// contains filtered or unexported fields
}

EncryptedFileWriter writes while encrypting the written bytes using the encryption key provided

func (*EncryptedFileWriter) EncodeKey added in v0.0.10

func (e *EncryptedFileWriter) EncodeKey() string

EncodeKey returns a base64 hash of the IV+Key used for encryption

func (*EncryptedFileWriter) Write added in v0.0.10

func (e *EncryptedFileWriter) Write(p []byte) (n int, err 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,
	ic ipfs.Client,
) *Space

func (*Space) AddItems

func (s *Space) AddItems(ctx context.Context, sourcePaths []string, targetPath string, bucketName string) (<-chan domain.AddItemResult, domain.AddItemsResponse, 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 (s *Space) GenerateFileSharingLink(
	ctx context.Context,
	path string,
	bucketName string,
) (domain.FileSharingInfo, error)

func (*Space) GenerateKeyPair

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

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) GetPublicKey added in v0.0.11

func (s *Space) GetPublicKey(ctx context.Context) (string, 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) ([]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) ([]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 string, bucketName string) (domain.OpenFileInfo, error)

func (*Space) OpenSharedFile added in v0.0.10

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

OpenSharedFile fetched the ipfs file and decrypts it with the key. Then returns the decrypted files location.

func (*Space) RegisterSyncer

func (s *Space) RegisterSyncer(sync Syncer)

func (*Space) ShareBucket added in v0.0.8

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

type Syncer

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

Jump to

Keyboard shortcuts

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