Documentation ¶
Index ¶
- Constants
- Variables
- func CombinePathAndFile(path, fileName string) string
- func Decode(input string) ([]byte, error)
- func DecryptBytes(passphrase, cipherText []byte) ([]byte, error)
- func Encode(b []byte) string
- func EncryptBytes(passphrase, message []byte) ([]byte, error)
- func GetRandBytes(n int) ([]byte, error)
- func GetRandString(n int) (string, error)
- func HashString(path string) []byte
- func NewChunkWithSpan(data []byte) (swarm.Chunk, error)
- func NewChunkWithoutSpan(data []byte) (swarm.Chunk, error)
- type Address
- type Reference
- type SharingReference
Constants ¶
const ( // MaxChunkLength is the maximum size of a chunk MaxChunkLength = 4096 // PathSeparator is string of unix filesystem PathSeparator = "/" // MaxPodNameLength defines how long a pod name can be MaxPodNameLength = 64 // SpanLength of a chunk SpanLength = 8 // DeletedFeedMagicWord is written in a feed after it gets deleted from fairOS DeletedFeedMagicWord = "__Fair__" )
const (
// AddressLength defines the length for the address
AddressLength = 20
)
Variables ¶
var ( // ErrEmptyString is returned when a hex string is empty. ErrEmptyString = &decError{"empty hex string"} // ErrMissingPrefix is returned when a hex string does not have a 0x prefix. ErrMissingPrefix = &decError{"hex string without 0x prefix"} // ErrOddLength is returned when a hex string has an odd length. ErrOddLength = &decError{"hex string of odd length"} )
Functions ¶
func CombinePathAndFile ¶ added in v0.5.3
CombinePathAndFile joins filename with provided path
func DecryptBytes ¶ added in v0.9.1
DecryptBytes decrypts the cipherText using the passphrase
func EncryptBytes ¶ added in v0.9.1
EncryptBytes encrypts the message using the passphrase
func GetRandBytes ¶ added in v0.9.1
GetRandBytes return random bytes array of length n
func GetRandString ¶ added in v0.8.0
GetRandString return random string of length n
func HashString ¶
HashString returns the bmt hash of a string skipcq: TCV-001
func NewChunkWithSpan ¶ added in v0.5.0
NewChunkWithSpan returns a chunk with span
Types ¶
type Address ¶
type Address [AddressLength]byte
Address is a simplified implementation of eth address
func HexToAddress ¶
HexToAddress creates a new address from given hex string
func NewAddress ¶
NewAddress returns a new address from the given byte address
type Reference ¶
type Reference struct {
R []byte `json:"swarm"`
}
Reference is used for creating pod sharing references
func ParseHexReference ¶
ParseHexReference creates a Reference from a Reference string
type SharingReference ¶
type SharingReference struct {
// contains filtered or unexported fields
}
SharingReference is used for sharing files
func NewSharingReference ¶
func NewSharingReference(b []byte, n int64) SharingReference
NewSharingReference creates a reference from swarm reference and time
func ParseSharingReference ¶
func ParseSharingReference(s string) (a SharingReference, err error)
ParseSharingReference creates a SharingReference from a SharingReference string
func (SharingReference) GetNonce ¶
func (ref SharingReference) GetNonce() int64
GetNonce returns the nonce
func (SharingReference) GetRef ¶
func (ref SharingReference) GetRef() []byte
GetRef returns the reference
func (SharingReference) String ¶
func (ref SharingReference) String() string