wnfs

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: GPL-3.0 Imports: 16 Imported by: 0

README

wnfs-go

go language implementation of the fission web-native file system, using the typescript implementation as a reference.

Development Status: Work-In-Progress

This repo is very much a work-in-progress, and doesn't yet produce proper WNFS data. Don't rely on this.

Security Status: Insecure

This repo has the beginnings of an implementation of a private, encrypted-at-rest filesystem. It is not finished and is not reliable for keeping your data secure. Don't use this to store private data until this message is removed.

Documentation

Index

Constants

View Source
const (
	// PreviousLinkName is the string for a historical backpointer in wnfs
	PreviousLinkName = "previous"
	// FileHierarchyNamePrivate is the root of encrypted files on WNFS
	FileHierarchyNamePrivate = "private"
	// FileHierarchyNamePublic is the root of public files on WNFS
	FileHierarchyNamePublic = "public"
	// FileHierarchyNamePretty is a link to a read-only branch at the root of a WNFS
	FileHierarchyNamePretty = "p"
)

Variables

View Source
var NewKey = private.NewKey

Functions

func HAMTContents

func HAMTContents(ctx context.Context, bs blockservice.BlockService, id cid.Cid) (map[string]string, error)

func Merge

func Merge(ctx context.Context, aFs, bFs WNFS) (err error)

func NodeIsPrivate

func NodeIsPrivate(n Node) bool

Types

type CommitResult

type CommitResult struct {
	Root        cid.Cid
	PrivateName *PrivateName
	PrivateKey  *Key
}

type Factory

type Factory struct {
	BlockService blockservice.BlockService
	Ratchets     ratchet.Store
	Decryption   private.DecryptionStore
}

func (Factory) Load

func (fac Factory) Load(ctx context.Context, id cid.Cid) (fs WNFS, err error)

func (Factory) LoadWithDecryption

func (fac Factory) LoadWithDecryption(ctx context.Context, id cid.Cid, name private.Name, key private.Key) (fs WNFS, err error)

type HistoryEntry

type HistoryEntry = base.HistoryEntry

type Key

type Key = private.Key

type Node

type Node = base.Node

type PosixFS

type PosixFS interface {
	// directories (trees)
	Ls(pathStr string) ([]fs.DirEntry, error)
	Mkdir(pathStr string) error

	// files
	Write(pathStr string, f fs.File) error
	Cat(pathStr string) ([]byte, error)
	Open(pathStr string) (fs.File, error)

	// general
	// Mv(from, to string) error
	Cp(pathStr, srcPathStr string, src fs.FS) error
	Rm(pathStr string) error
}

type PrivateFS

type PrivateFS interface {
	RootKey() private.Key
	PrivateName() (PrivateName, error)
}

type PrivateName

type PrivateName = private.Name

type StructuredDataFile

type StructuredDataFile interface {
	fs.File
	Data() (interface{}, error)
}

func NewLDFile

func NewLDFile(name string, data interface{}) StructuredDataFile

type WNFS

type WNFS interface {
	fs.FS
	fs.ReadDirFile // wnfs root is a directory file
	PosixFS
	PrivateFS

	Cid() cid.Cid
	History(ctx context.Context, pathStr string, generations int) ([]HistoryEntry, error)
	Commit() (CommitResult, error)
}

func FromCID

func FromCID(ctx context.Context, bserv blockservice.BlockService, rs ratchet.Store, id cid.Cid, rootKey Key, rootName PrivateName) (WNFS, error)

func NewEmptyFS

func NewEmptyFS(ctx context.Context, bserv blockservice.BlockService, rs ratchet.Store, rootKey Key) (WNFS, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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