Module: storjd/utils

Source:

Methods


<static> createComplexKeyFromSeed(seed64)

Returns a HD key object using corrent key derivation path using the given seed
Parameters:
Name Type Description
seed64 buffer 64 byte seed for generating key
Source:
See:
Returns:
Type
HDKey

<static> createShardDownloader(farmer, hash, token)

Returns a request object for downloading a shard from a farmer
Parameters:
Name Type Description
farmer array Farmer contact object
hash string The hash of the shard to upload
token string The authorized transfer token
Source:
Returns:
Type
https.ClientRequest

<static> createShardUploader(farmer, hash, token)

Returns a request object for uploading a shard to a farmer
Parameters:
Name Type Description
farmer array Farmer contact object
hash string The hash of the shard to upload
token string The authorized transfer token
Source:
Returns:
Type
https.ClientRequest

<static> getContactURL(contact)

Returns a stringified URL from the supplied contact object
Parameters:
Name Type Description
contact array
Properties
Name Type Description
0 string Node identity key
1 object
Properties
Name Type Description
hostname string
port string
protocol string
Source:
Returns:
Type
string

<static> getNextPowerOfTwo(number)

Returns the next power of two number
Parameters:
Name Type Description
number number
Source:
Returns:
Type
number

<static> isCompatibleVersion(version)

Returns whether or not the supplied semver tag is compatible
Parameters:
Name Type Description
version string The semver tag from the contact
Source:
Returns:
Type
boolean

<static> isHexaString(a)

Determines if a value is hexadecimal string
Parameters:
Name Type Description
a * The value to be tested
Source:
Returns:
Type
boolean

<static> isValidContact(contact, loopback)

Determines if the supplied contact is valid
Parameters:
Name Type Description
contact array The contact information for a given peer
loopback boolean Allows contacts that are localhost
Source:
Returns:
Type
boolean

<static> isValidHDNodeKey(hdKey)

Checks if the supplied HD key is valid (base58 encoded) and proper length
Parameters:
Name Type Description
hdKey string The HD key in base 58 encoding
Source:
Returns:
isValidHDKey
Type
boolean

<static> isValidNodeIndex(hdIndex)

Checks if the input is a non-hardened HD key index
Parameters:
Name Type Description
hdIndex number The HD key index
Source:
Returns:
isValidHDKeyIndex
Type
boolean

<static> rmd160(input, encoding)

Returns the RIPEMD-160 hash of the input
Parameters:
Name Type Description
input string | buffer Data to hash
encoding string The encoding type of the data
Source:
Returns:
Type
buffer

<static> rmd160sha256(input, encoding)

Returns the RIPEMD-160 SHA-256 hash of this input
Parameters:
Name Type Description
input string | buffer Data to hash
encoding string The encoding type of the data
Source:
Returns:
Type
buffer

<static> sha256(input, encoding)

Returns the SHA-256 hash of the input
Parameters:
Name Type Description
input string | buffer Data to hash
encoding string The encoding type of the data
Source:
Returns:
Type
buffer