diff --git a/README.md b/README.md index 5f92eaa..cb02011 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,15 @@ # lily anne hall *research publications* -## white papers +## white papers, technical specifications -* [Storj: a peer-to-peer cloud storage network](./Storj/Storj.Whitepaper.V2.pdf) (Contributor -- Storj, 2016) - -## experiments +### Storj * [KFS: a LevelDB sharding algorithm based on the XOR metric](./Storj/kfs) (Author -- Storj, 2016) +* [Storj: a peer-to-peer cloud storage network](./Storj/Storj.Whitepaper.V2.pdf) (Contributor -- Storj, 2016) +* [Protocol Specification V2](./Storj/protocol-v2) (Author -- Storj, 2016) +* [SIP 0003: Remote Notifications and Triggers](./Storj/sip-0003) (Author -- Storj, 2016) +* [SIP 0004: Contract Transfers and Renewals](./Storj/sip-0004) (Contributor -- Storj, 2016) +* [SIP 0032: Hierarchically Deterministic Node IDs](./Storj/sip-0032) (Contributor -- Storj, 2016) ## security audits diff --git a/Storj/core/CONTRIBUTING.md b/Storj/core/CONTRIBUTING.md deleted file mode 100644 index 22372c0..0000000 --- a/Storj/core/CONTRIBUTING.md +++ /dev/null @@ -1,114 +0,0 @@ -Contributing -============ - -Want to contribute, but not sure where to start? Check out our [issue -board](http://waffle.io/storj/core)! - -This document outlines general patterns and conventions for contributing -to the project. For in-depth documentation on StorjCORE, [read the -documentation](http://storj.github.io/core). - -Contributor License Agreement ------------------------------ - -By submitting pull requests, you agree that your work may be licensed under -one of: - -* GNU Affero General Public License Version 3 (or later) -* GNU Lesser General Public License Version 3 (or later) - -You also assert that you have completed the -[Contributor License Agreement](https://storj.io/cla) - -Reporting Issues ----------------- - -When submitting an issue, please take care to follow the -`ISSUE_TEMPLATE.md` and include as much information as possible. Bonus points -for a corresponding pull request that fixes the issue. - -Pull Requests for Swag ----------------------- -We love pull requests, so to encourage more of them we are offering -awesome swag. Only SIGNIFICANT pull requests count. Fixing a comma -doesn’t count, but fixing a bug, adding more test coverage, or writing -guides & documentation does. - -- Make 1x pull requests to get into the contributors list and website -- Make 2x pull requests, we will send you a packet of stickers -- Make 5x pull requests, and we will send you a t-shirt and more stickers -- Make 10x pull requests, and you get a job interview with James + other swag - -If we miss a milestones (probably because we are working hard), just let -us know so we can get you your swag. - -Style & Conventions -------------------- - -### Style Guide - -StorjCORE adheres to -[Felix's Node.js Style Guide](https://github.com/felixge/node-style-guide). -Please take the time to review the style guide and take care to follow it. - -### Project Structure - -* `bin/` - Command line utilities linked during global installation -* `dist/` - Placeholder for browser bundles generated with `npm run build` -* `doc/` - Markdown documentation on various topics not covered by JSDoc -* `lib/` - All core classes and modules -* `script/` - Miscellaneous scripts and utilities used for development -* `test/` - Unit and integration tests for core classes and modules - -### Inline Documentation - -You should also make the best use of [JSDoc](http://usejsdoc.org/) comments as -shown throughout the source code. These annotation are used to generate the -library's documentation website. Please be as descriptive as possible and take -care to familiarize yourself with all of the possible JSDoc tags for -being as thorough as possible. - -Test Coverage -------------- - -Pull requests submitted without additional test coverage are unlikely to be -merged. Pull requests that decrease test coverage will be rejected. If your -submission fixes a bug that was not previously caught with the test suite, then -please add an additional test that does cover it. - -You can run the coverage report with: - -``` -npm run coverage -``` - -Linting -------- - -To help maintain consistent expectations for code quality and enforcing these -conventions, there is an included `.jshintrc` file. Most editors support using -this to alert you of offending code in real time but, if your editor does not, -you can run the linter with: - -``` -npm run linter -``` - -Alternatively, the linter will run as part of the test suite as well, which can -be executed with: - -``` -npm test -``` - -Credits -------- - -Before sending your PR, go ahead and add yourself to the `contributors` array -in the `package.json` file - you earned it :thumbsup:. - -![HACK THE PLANET](http://i.giphy.com/X1OGEvUf2t58A.gif) - ---- - -Have fun and be excellent! diff --git a/Storj/core/INSTALL.md b/Storj/core/INSTALL.md deleted file mode 100644 index 99b28df..0000000 --- a/Storj/core/INSTALL.md +++ /dev/null @@ -1,80 +0,0 @@ -### Prerequisites - -* Node.js LTS (v4.x.x) -* Python 2.7 -* Git 2.x.x - -### Installing on GNU/Linux & Mac OSX - -Install Node.js and it's package manager NPM using Node Version Manager: - -``` -curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash -``` - -> Detailed NVM installation instructions can be found [here](https://github.com/creationix/nvm#install-script). - -After NVM is installed, source your `~/.bashrc`, `~/.profile`, or `~/.zshrc` -depending on your shell of choice: - -``` -source ~/.zshrc -``` - -Now that you can call the `nvm` program, install Node.js (which comes with NPM): - -``` -nvm install 4.4.4 -``` - -> You'll also need to make sure you have a C++ compiler installed before -> proceeding to the next step. Debian based distributions can install the -> `build-essential` package using APT and Mac OSX users can install with -> `xcode-select --install` and follow the wizard. - -### Installing on Windows (Manual) - -Download [Node.js LTS](https://nodejs.org/en/download/) for Windows, launch the -installer and follow the setup instructions. Restart your PC, then test it from -the command prompt: - -``` -node --version -npm --version -``` - -Install the [latest version of Python 2.7](https://www.python.org/ftp/python/2.7.11/python-2.7.11.amd64.msi), -launch the installer and follow the instructions. To use Python from the shell -and add it to the system you have to add the path in "System Variables": - -Navigate to: - -``` -Control Panel > System > Advanced System Settings > Environment Variables > System Variables > Path > Edit -``` - -Then add `;C:\Python27` or the installation path and test it in the command -prompt by running: - -``` -python -V -``` - -Next, install [Git](https://git-for-windows.github.io/) for your Windows -version. Then, install [Visual Studio Community 2015](https://www.visualstudio.com/) -and during the setup choose `Custom Installation > Programming Languages` and -select **Visual C++** and **Common Tools for Visual C++**. - -Finally, set the new environment variable in the Windows command prompt with: - -```` -setx GYP_MSVS_VERSION 2015 -``` - -### Installing on Windows (Automated) - -Install utilizing automated script - -https://github.com/Storj/storj-automation/archive/master.zip - -Run the `install.bat` located in `/Windows/storj-automate` diff --git a/Storj/core/ISSUE_TEMPLATE.md b/Storj/core/ISSUE_TEMPLATE.md deleted file mode 100644 index 465dc4b..0000000 --- a/Storj/core/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,41 +0,0 @@ -### Package Versions - -Replace the values below using the output from `npm list storj`. Use ```npm list -g storj``` if installed globally. - -``` -storj-bridge@0.6.5 /home/gordon/Code/storj-bridge -└── storj@0.6.5 -> /home/gordon/Code/storj-core -``` - -Replace the values below using the output from `node --version`. - -``` -v4.2.3 -``` - -### Expected Behavior - -Please describe the program's expected behavior. Include an example of your -usage code in the back ticks below if applicable. - -``` - -``` - -### Actual Behavior - -Please describe the program's actual behavior. Please include any stack traces -or log output in the back ticks below. - -``` - -``` - -### Steps to Reproduce - -Please include the steps the reproduce the issue, numbered below. Include as -much detail as possible. - -1. ... -2. ... -3. ... diff --git a/Storj/core/README.md b/Storj/core/README.md deleted file mode 100644 index fe4960d..0000000 --- a/Storj/core/README.md +++ /dev/null @@ -1,59 +0,0 @@ -[![Storj](https://nodei.co/npm/storj-lib.png?downloads=true)](http://storj.github.io/core) -========================================================================================== - -[![Build Status](https://img.shields.io/travis/Storj/core.svg?style=flat-square)](https://travis-ci.org/Storj/core) -[![Coverage Status](https://img.shields.io/coveralls/Storj/core.svg?style=flat-square)](https://coveralls.io/r/Storj/core) -[![NPM](https://img.shields.io/npm/v/storj-lib.svg?style=flat-square)](https://www.npmjs.com/package/storj-lib) -[![License](https://img.shields.io/badge/license-AGPL3.0-blue.svg?style=flat-square)](https://raw.githubusercontent.com/Storj/core/master/LICENSE) - -This package exposes a module that provides all of the tools needed to -integrate with the Storj network. You must have Node.js v6.9.1, Python v2.x.x, -and Git installed. [Complete documentation can be found here](http://storj.github.io/core). - -``` -npm install storj-lib --save -``` - -> If you want access to the [Storj CLI](https://github.com/storj/core-cli), -> you must install it separately or use the [`storj`](https://github.com/storj/npm-meta) -> metapackage to install both the core library *and* command line interface. - -Usage Examples --------------- - -- [Example 1 - Creating a User](https://github.com/Storj/core/blob/master/example/1-create-user.js) -- [Example 2 - Generating a KeyPair](https://github.com/Storj/core/blob/master/example/2-generate-keypair.js) -- [Example 3 - Authenticating with a KeyPair](https://github.com/Storj/core/blob/master/example/3-authenticate-with-keypair.js) -- [Example 4 - Listing Keys](https://github.com/Storj/core/blob/master/example/4a-list-keys.js) -- [Example 4b - Add/Remove Keys](https://github.com/Storj/core/blob/master/example/4b-add-remove-keys.js) -- [Example 5a - List Buckets](https://github.com/Storj/core/blob/master/example/5a-list-buckets.js) -- [Example 5b - Add/Remove Bucket](https://github.com/Storj/core/blob/master/example/5b-add-remove-bucket.js) -- [Example 6a - Upload File](https://github.com/Storj/core/blob/master/example/6a-upload-file.js) -- [Example 6b - Download File](https://github.com/Storj/core/blob/master/example/6b-download-file.js) -- [Example 6c - List Bucket Files](https://github.com/Storj/core/blob/master/example/6c-list-bucket-files.js) -- [Example 6d - Delete File from Bucket](https://github.com/Storj/core/blob/master/example/6d-delete-file-from-bucket.js) - -License -------- - -Storj Core - Implementation of the Storj protocol for Node.js -Copyright (C) 2016 Storj Labs, Inc - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published -by the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -*Certain parts of this program are licensed under the GNU Lesser General -Public License as published by the Free Software Foundation. You can -redistribute it and/or modify it under the terms either version 3 of the -License, or (at your option) any later version.* - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). diff --git a/Storj/core/TRUSTED_KEYS b/Storj/core/TRUSTED_KEYS deleted file mode 100644 index 5878d7a..0000000 --- a/Storj/core/TRUSTED_KEYS +++ /dev/null @@ -1,2 +0,0 @@ -xpub6AHweYHAxk1EhJSBctQD1nLWPog6Sy2eTpKQLExR1hfzTyyZQWvU4EYNXv1NJN7GpLYXnDLt4PzN874g6zSjAQdFCHZN7U7nbYKYVDUzD42 -xpub6BUG8pGsfYw7jFBkSx3WivxrnyEJK71FwLvwUVXZrVFWCxAf9d9wN53rCbvkszffYTGWktME7Qz1xXudXSUGPjWtZGYnZLiDgSJW1WKK7g9 diff --git a/Storj/core/dist/.gitkeep b/Storj/core/dist/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/Storj/core/doc/assets/tunneling-diagram b/Storj/core/doc/assets/tunneling-diagram deleted file mode 100644 index 1213e26..0000000 --- a/Storj/core/doc/assets/tunneling-diagram +++ /dev/null @@ -1 +0,0 @@ -7R1bb6O4+tdU2vPQiEsgyeO0nc6s1O1W067mnKcjmtCEMyT0EDqd2V+/n8Gf8QUTEgxk2kRRlBjHxt/9ZnPmXq5/fEqD59UfySKMzxxr8ePMvTpznNnMgk/S8LNocG3PLVqWabQo2uyy4T76O6SN9I/Ll2gRboWOWZLEWfQsNs6TzSacZ0JbkKbJq9jtKYnFWZ+DJZ2RTkga7udBjPdRtn6NFtmKttr+rLzwOYyWKzr11PGLC4/B/NsyTV42dL4zx33KX8XldYBj0Xm3q2CRvHJN7keAa5okMDD5tv5xGcYEtgg2/F/2E+/1zL1YZesYftjwNb98rfkzXVb9n2FxabihCyum040Hl8gfvgfxCx3vLo2+B1mozLN9jdZxsIFfF6+rKAvvn4M5ufQK9CPew3McRJvzNFyoN0Nv/3uYZiEltbyJ3tynMFmHWfoTutCrYwotSoYIvFcOpVPatuKw6U1oY0DJaMlGLoEBXyg8qmGDFM8BR4EKoZRnzaIYcQeP2J3RagmSfMym6/fV9WMPfvnY1mb1Y8oPdauHfwA/E5Lg0F9FHVoI8ZAo4K2CoofFekiY5WLpPXOrhXuHKfmlBnG03MD3OawhTKHhKdlk9/QfpANZcQRC6QPtuI4WC3LxYgvwiTbLm/CJrMItW77QheVNWZp8Cy+TOIGxrzZJznxpkgVIURbhtiTaZPnSvQt4AzAurZF35sEdX8JvWBj+hjfpnmaXyQaGBiYlE4XBNnsNt2Rl5O5xNhB7Vv7CVRUS3vHaYpP+YzqaCpQ9G/nFfPRFR+Rw74xV3DsWDtMG+1MV+/0zOh0JBV2FpOuK+KeqEuiY0wuAD8LpU1Wonzi9HafrsHmEnD6j1h9P2QuwG+lPgNgqWSabIP5YtgIewBgEa6bAAkcU/wuz7CcFV/CSJdBUjnCTJMAPeT8Zqjrox8FjGMMQizCVSKGgDzRkic0H0E9//pvcE6Cc/vwPvUWRmugMl5cMn2TJWmxS3s+CdBmi1WbVyy7fHrnj8dSZeFPfsfwZHYK5DrORa1usB2XAKjTSGe4IoTce3p+OZr7n2ROQoe5kJg1frIOOyBvC0iS2NMuUmj/NFrFNXtJ5qMzyIU0DAifsRjlYu1Jmy5az1t+03N+TrH0ZkrXd4UtxwyUrMVw34i4befmILGYXQdSDbqF80qcmpSAfRJUCO5x0qWFdqsXnESrTKvfYjwlIFtF3+LokX7HpMZVbYPiKfhVNgOMNtt29PMbRnBuCv2h4rtrhqjrKs7SMoCzTMATylwnsOn9Vxnr2Dq8w+aqPrzABaj6+QimzW21R74YyldV/gGVKWXDY5Uv479PtpLZ4j25nDvFBdCXG07nFfjipynZupwabx+h2qqoSWiwAUxbMiUNgXcYJkDnJkcDHLWRjTPqp4Y8o41xF+EU8xQM9WJsQjg6Rqp+a+7R3yTbKokSgZKTcG6nDY5JlybqK9mVaz8jtIVlf0L9dTcu2h/z+gX1busT1MvQchOiId0AtkfAcb1bnoO72f89tWUujltrbyQVyLn1Yx5rsc6OmfFxpMYCJ2ntWVr/3HxBc5tzcYzBcBvVzvf793BzmA/m5airs40l5t/RzNfg8Qu1tY8SxhTaeJ2twWxtqZtKpjO8K0d28XxEnZnUKHFJopUJzxa4qbF7V42+9qheuXF/nV5pqVABorlIwlkkbhcjzREMmaRgHWfRdnKEVkisSQ8Dk1m+fHx7u/pVXoEAYwFK9eg6bIsobYEkPwwq8RHFcFQVYpsEiAsBKgqApGhtxa70qciQf2kWhy3EnOnsid5pAm6qLc7R9vT8hbR+kjXtFGjU8+xKo+ZV3J1DRShMEasEvvQhUqnpPWrN/JGt4vwMkq3Gt3l0hR8qCehjU7MM3aFI7ZNgVKpY7jCtUUSt0fXKF2rlCOnweoyuEJkGHQp0X6WVtS0WpC/nXG3WFsGJ+EM3tVIR3ruBfO7k8DbfR31qOI0y1M6bL+L4BYltby01UD6V4ffTXGjm+K5YknVOcNsaMFMjEYaR/JE9PW6AGGZN7Bi8nvVS112ts15ZC5D2mHWlIoVeNXcB8GI09UZm5CS+fNPYB+DxGjT1psI+je36nZkP/VRb2hMYa+mT3HOQDsbtaVfLpxO4t2V2DzyNkdxbWGyTqwuJsHUZdBLT6AOlWprvBqIvOUOzAPn/r+aijxTHVJr0gGe9pECSrm0reE5LbetqHFcZIuzPwt67OxXVFtSP1b13mwrby85vD/7q4+f3+MzR+uYMBlDLq3x5ewFYko3zYbIBM5iFk4RoVRxvOyGnr0Y43I2djTTWGsanNzO91R9PbtNnoYARDI22YxdZJIK978aJP0HYrXjDWYDY7c5B4ccZU1GHMhdKNKXHhtzc8uypZrd10WRddVumlVR0pQoijEK9C/xQnL7SlD1W/SLX+TN/sqCLdl9BY+QfOIx9Bsqv/Dr2nW4cpQsbiBE7t3UJVdjsXmlDar+dCNyn5bqKfi9UIkr5ylzNftt3cPa/XqpixlKmer3Op0KquiWCM3ST21F5I4vdS03ayM32fKv6iNn9nuocV+1cQhWDH8ZTBNbCq/1xaC2zE9UI24pqEnfJdCnidMC/TRxAgEg35c7TyWgp8V6qDZ4LzkG0DNXvjZ4dsGygnMZreQn3aY7S3PvKN81NY9Vil76mB/9OWs5aR4B24nkmR4Ol0RJHQT64HDxHqLmakqppfseSulURHg2KQ2K89rjpiQr93nQBFIAj//y/kZML8wjmUa0ArSAXLtp9/lBe5UYI1kYSbx20hEK3r32+v/vvw1+3txxuMAgF7yt1YyKeYv9HueX6bfS/BIT4UlIv/9mGg0rpgex8bnudjwtSVAohMi/QRQbLH+uMgCmxXEGF51ub5vAAQocV0+fhbrsiJ3IdP6TuJKKp0aoDa7778eUH2DnChzaYUfMz0Wrtf95jotcI26o5c8XDPPrcgvEl1aI8rYpyFjuxFH6rVXBXRmnSVrB9fYJ5dJ6/o0gN6rtybwfdDlGmek2rlm4ZDzPAcxVVP5qneOH2zvIiVAeLpfblP3AczovfNc96h6BP3bEGUhBzsUEbnR/aMeR93YRrBzRJv9ahx27wovDlu2+YKmuNWLSwzflR4K9Hm4eGeQ5wVzpK33ZZZUizoxbtUaNlvpWX/W6EKqA9Uaal64sWST/G1wystf6GtUHik1yCbmPuotDwKiwaFykCbmGfdl9PqI6rvHMmDlMn48rlKO06bUvpTQ8DYYVOzQc9KGI39iWh3j312/HjndncViXVaw9XY7u4twMEOZO+oMq+TuFTvtXeVeGvr9mqS4VgWiwenuONRnvamp8NLpoUmx35IPW7Fgctf79/rttxd+82EExltagUylLl1KKuhAaO1Csw47SWX9+fdx1spcXdIlk57ZnbT+ypQb8XRJjxHqzy/6o4cTQ5yv1O4G57q3Q6aDJDmc591J5YPUkT/1vOkLnpyuxJPcsHsYfqcVoSY1OfdZ5rMWmJ1NdcHavvKIzN0z61pXUntjLAUrqh8Ezdu+EK5HL1ouMparoKGSc3u/nHU2tX3ewhI/flTY3vELA2wKDC1jJjxpkL1JM2R9G9t1J/HZmaLz9t0JVrHmzQFulIylp3BaHpHhjyP4RgFBGJPpHUoaRmJcu1GecPa77akZTr8xfZhGCQttYb1HZpLVRsTizCscVqcyA+Z6UjMTaQN0cbFnKsmOE8mUfUTIWFPCNstAiay9DDFSW3IrIl0E9OANERq1l5y1XBbHjU5oVt95qLvjcpgm+VKO43Rv+7d5HXrC87ehfI4LrtkonmYi2ldsCMtt2/az4DuUHdjnaSJRnmAP619SJHriqH9oSSL+vC6m3AZbmghW6unPhJCbx3klOi5fCgSF+ScVNVGsQcLtYpyjhvsfDbwJOACDcf4LGCAowKBpxT2KsMK6DNMrU3Vc944gtDult6ClMxAICWvhO2jdF7Uh5HWawjWsyz+Avskz/mTRPMelLv9ogf9RYprD0sS9HFykxbPFVXrLRXUWErvTiijN97OjNWonrjxVx7HYF7YVlULUhoW6L4NUuvDFtopUsTHpiBaKwhxH5ozQnJQlDKacS88+bR7CmQPHi4pMMsPAiOF3SjJf3ny6yNEuIv8zl1f9H0rTgnbnwBZZKMlBboTkQLFW+2QAC3VHIPITJ6/v4LKZ/KA1VVQnExXna7XPR28oj6AmOjn1OYmE8SkHlspEIDKnPzq1/ARPu+T+TdidLbI7VPP4I2VjzcqU8DiAnFvHmPVlrUInBhqZHfvYlEPT1xnmVm1usCQ1Qk/04SQXck34FWs/gBlT3r8Aw== \ No newline at end of file diff --git a/Storj/core/doc/command-line-interface.md b/Storj/core/doc/command-line-interface.md deleted file mode 100644 index 185739c..0000000 --- a/Storj/core/doc/command-line-interface.md +++ /dev/null @@ -1,97 +0,0 @@ -This package comes equipped with a command line interface for performing a -number of useful operations on the Storj network. The CLI program is generally -focused on interacting with a remote [Bridge](https://github.com/Storj/bridge) -service and makes use of the library's {@link BridgeClient} class to do so. In -addition to interacting with a bridge node, the tool also exposes some general -purpose utilities. - -To use the CLI, follow the instructions in the [README](https://github.com/Storj/core/blob/master/README.md) to install the module -**globally** or if you are working from within the git repository, you can use: - -``` -npm link -``` - -### Communicating with a Bridge - -Once you have access to the `storj` command, register and authenticate with the -bridge: - -``` -> $ storj register - [...] > Enter your email address > gordon@storj.io - [...] > Enter your password > ************* - - [info] Registered! Check your email to activate your account. -``` - -Follow the activation link you receive via email and come back to the CLI to -pair with your account: - -``` -> $ storj login - [...] > Enter your email address > gordon@storj.io - [...] > Enter your password > ************* - - [info] This device has been successfully paired. -``` - -Now you can create buckets, transfer files, and manage your bridge account. - -### Audits, Proofs, and Verifications - -The CLI also includes some utility commands for generating file possession -audits, proving possession, and verifying proofs. You can generate a challenge -set and merkle tree for a file easily: - -``` -> $ storj prepare-audits 2 CONTRIBUTING.md - [info] Generating challenges and merkle tree... - [info] - [info] Merkle Root - [info] ----------- - [info] 9c8c37935f58d46e3301efe4f44724b8785a81a5 - [info] - [info] Challenges - [info] ---------- - [info] c8573773616e072230d40131e7ce8537d384825e337e5903ff7367ddea798c52 - [info] 7c4d4f57f40d5c95f962e7cd72347e4077e1885aaffd8c1ccbbd02c8d7c48dce - [info] - [info] Merkle Leaves - [info] ------------- - [info] aaf42766d87a37e6dffbae7172fd0073006bf5f3 - [info] ccee086dbc8a16b93b79912cb37f3b037bbf8269 -``` - -A farmer can use parts of this data to prove possession of a file shard: - -``` -> $ storj prove-file aaf42766d87a37e6dffbae7172fd0073006bf5f3,ccee086dbc8a16b93b79912cb37f3b037bbf8269 c8573773616e072230d40131e7ce8537d384825e337e5903ff7367ddea798c52 CONTRIBUTING.md - [info] Generating proof of possession... - [info] - [info] Challenge Response - [info] ------------------ - [info] [["153a0d4b1d228043992fec585cadb51974b053f7"],"ccee086dbc8a16b93b79912cb37f3b037bbf8269"] -``` - -The result of this operation can be used by the original renter to verify the -the proof and confirm that the farmer still has possession of the file: - -``` -> $ storj verify-proof 9c8c37935f58d46e3301efe4f44724b8785a81a5 2 '[["153a0d4b1d228043992fec585cadb51974b053f7"],"ccee086dbc8a16b93b79912cb37f3b037bbf8269"]' - [info] - [info] Expected: 9c8c37935f58d46e3301efe4f44724b8785a81a5 - [info] Actual: 9c8c37935f58d46e3301efe4f44724b8785a81a5 - [info] - [info] The proof response is valid -``` - -For more detailed usage information of the command line interface, run -`storj --help`. - -### Temporary Files -On Windows temporary files are stored: - -``` -C:\Users\\AppData\Local\Temp -``` diff --git a/Storj/core/doc/contract-topics.md b/Storj/core/doc/contract-topics.md deleted file mode 100644 index f51e870..0000000 --- a/Storj/core/doc/contract-topics.md +++ /dev/null @@ -1,130 +0,0 @@ -Nodes solicit storage contracts with the network by publishing information -about their storage requirements as outlined in {@tutorial protocol-spec}. -Storj implements a distributed publish/subscribe system based on an algorithm -called [Quasar](https://github.com/kadtools/kad-quasar). - -Quasar works by allowing nodes to advertise topics of interest to their -neighbors and keeping a record of these topics in their neighborhood by storing -them in an attenuated bloom filter. Each node has a view of the topics in which -their neighbors are interested up to 3 hops away. By the nature of this -design, the network forms gravity wells wherein messages of interest are -efficiently relayed to nodes that are subscribed to the topic without flooding -the network. - -This approach works well when there is a diverse number of topics. The Storj -protocol leverages this by defining a matrix of *criteria* and *descriptors* -in the form of opcodes representing the degree of which the criteria must be -met. - -### Criteria - -At the time of writing, there are 4 criteria column in the topic matrix: - -* Size -* Duration -* Availability -* Speed - -#### Size - -Refers to the size of the data to be stored. - -#### Duration - -Refers to the length of time for which the data should be stored. - -#### Availability - -Refers to the relative uptime of required by the contract for retrieval of the -stored data. - -#### Speed - -Refers to the throughput desired for retrieval of the stored data. - -### Descriptors - -At the time of writing, there are 3 descriptor opcodes representing *low*, -*medium*, and *high* degrees of the criteria. - -* Low: `0x01` -* Medium: `0x02` -* High: `0x03` - -The ranges represented by these descriptors are advisory and may change based -on network performance and improvements to hardware over time. - -``` -------------------------------------------------------------------------------- -| Descriptor | Size | Duration | Availability | Speed | -|-----------------|-------------|------------|--------------|-----------------| -| Low (`0x01`) | 0mb - 8mb | 0d - 30d | 0% - 50% | 0mbps - 6mbps | -|-----------------|-------------|------------|--------------|-----------------| -| Medium (`0x02`) | 8mb - 16mb | 30d - 90d | 50% - 80% | 6mbps - 12mbps | -|-----------------|-------------|------------|--------------|-----------------| -| High (`0x03`) | 16mb - 32mb | 90d - 270d | 80% - 99% | 12mbps - 32mbps | -------------------------------------------------------------------------------- -``` - -### Topic Format - -When publishing or subscribing to a given topic representing the degrees of -these criteria, nodes must serialize the opcodes as the hex representation of -the bytes in proper sequence. This sequence is defined as: - -``` -prefix|size|duration|availability|speed -``` - -The first byte, "prefix", is the **static identifier** for a contract -publication. Contracts are not the only type of publication shared in the -network, so the prefix acts as a namespace for a type of publication topic. - -**The prefix for a contract publication is:** `0x0f`. - -To illustrate by example, we can determine the proper topic by analyzing the -*use case* for a given file shard. For instance, if we want to store an asset -that is displayed on a web page we can infer the following: - -* The file is small -* The file may change often, so we should only store it for medium duration -* The file needs to always be available -* The file should be transferred quickly - -Using the matrix, we can determine the proper opcode sequence: - -``` -[0x0f, 0x01, 0x02, 0x03, 0x03] -``` - -Serialized as hex, our topic string becomes: - -``` -0f01020303 -``` - -Another example, by contrast, is data *backup*. Data backup is quite different -than the previous example: - -* The file is large (perhaps part of a hard drive backup) -* The file will not change and should be stored long term -* The file will not be accessed often, if ever -* The file does not need to be transferred at high speed - -Using the matrix, we can determine the proper opcode sequence: - -``` -[0x0f, 0x03, 0x03, 0x01, 0x01] -``` - -Serialized as hex, our topic string becomes: - -``` -0f03030101 -``` - -The resulting hex string from the serialized opcode byte sequence should be -used as the `topic` parameter of a `PUBLISH` RPC as defined in the -{@tutorial protocol-spec}. Nodes that are subscribed to the topic will receive -the proposed storage contract and may begin contract negotiation with you -directly. diff --git a/Storj/core/doc/data-transfer.md b/Storj/core/doc/data-transfer.md deleted file mode 100644 index f3cbd2a..0000000 --- a/Storj/core/doc/data-transfer.md +++ /dev/null @@ -1,29 +0,0 @@ -Transfering file shards to farmers is a simple process. After a successful -`CONSIGN` or `RETRIEVE` RPC yields a token, the renter may construct an HTTP -request to the farmer, to push or pull the data. - -#### Uploading Shards - -To upload a shard to a given farmer, construct an HTTP request: - -* Method: `POST` -* Path: `/shards/{hash}?token={token}` -* Headers: - * `content-type: application/octet-stream` - * `x-storj-node-id: {farmer node id}` - -Then simply write the encrypted shard to the request. Farmers will respond with -appropriate status codes and messages to indicate the result. - -#### Downloading Shards - -To download a shard from a given farmer, construct an HTTP request: - -* Method: `GET` -* Path: `/shards/{hash}?token={token}` -* Headers: - * `content-type: application/octet-stream` - * `x-storj-node-id: {farmer node id}` - -You will receive the shard as a response of type `application/octet-stream` if -you are authorized. diff --git a/Storj/core/doc/environment-variables.md b/Storj/core/doc/environment-variables.md deleted file mode 100644 index c4bfb81..0000000 --- a/Storj/core/doc/environment-variables.md +++ /dev/null @@ -1,39 +0,0 @@ -Below is a list of environment variables that can be used to alter the -behavior of the core library and associated tooling. - -#### `STORJ_NETWORK` - -This value will be postfixed to your announced protocol version in the network. -A value of `testnet` would advertise to the network you are running -`0.7.0-testnet`, which will isolate you to other nodes running the same exact -version. See {@tutorial private-testnet} for more information. - -#### `STORJ_ALLOW_LOOPBACK` - -By default, the {@link Network} class will drop and ignore message from nodes -who identify themeselves as a loopback interface like `localhost`, `127.0.0.1`, -etc. This is a security precaution to prevent others from causing you to send -messages to yourself as well as prevent invalid contacts in your routing table. - -To disable this feature (primarily for local testing), set this variable to `1`. - -#### `STORJ_BRIDGE` - -This variable will change the default URI for the {@link BridgeClient} class. -The default value is `https://api.storj.io`. If you run your own bridge, -testing one locally, or otherwise would like to default to a different host, -set this variable. - -This works well with the CLI (see {@tutorial command-line-interface}) when -testing against other bridges. - -#### `STORJ_KEYPASS` - -This variable will set the `--keypass` used to unlock the keyring. - -Setting your password will make it so other users can't grep it with `ps -a`. - -#### `STORJ_TEMP` - -This variable will set the folder to which the encrypted file will be placed -when uploading a file. Shards will also be placed in this folder during upload. diff --git a/Storj/core/doc/file-encryption.md b/Storj/core/doc/file-encryption.md deleted file mode 100644 index a0e80d8..0000000 --- a/Storj/core/doc/file-encryption.md +++ /dev/null @@ -1,114 +0,0 @@ -This document serves to provide a detailed account of how files are encrypted -by default by Storj Core to promote interoperability between different -implementations of clients. - -#### Sharding and Encryption Scheme - -Before data is stored in the network, the Storj Core library automatically -handles file encryption, sharding, and key management for you. - -In order of operations: - -1. Complete file is encrypted with a unique key and initialization vector -2. File is demultiplexed (or "sharded") into individual chunks -3. Each shard is offered to the network and transferred -4. Key and IV are encrypted with a passphrase and stored locally - -#### Key and Initialization Vector Generation - -Files are encrypted using [AES-256-CTR](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard). Use -of CTR allows for random read-access to known indices. File `keys` are -generated via one of two methods: - -* Local PBKDF2 key derivation (default) -* Passphrase-based deterministic key derivation (recommended) - -##### PBKDF2 Key Derivation - -By default, the `key` for each file is the result of a standard key derivation -function, [PBKDF2](https://en.wikipedia.org/wiki/PBKDF2). PBKDF2 generates a -key from a password and a salt. These two values are randomly generated bytes: - -* Password: 512 random bytes -* Salt: 32 random bytes - -The key length of the PBKDF2 is 512 bytes, should use 25000 iterations, and use -SHA-512 as the digest. To create the cipher/decipher and initialization vector, -derive the SHA-256 hash of the resulting PBKDF2 for the cipher/decipher `key` -and use the first 16 bytes of the original salt as the `iv`. The -{@link DataCipherKeyIv} class represents these values, and provides methods for -their generation. - -The {@link KeyRing} class stores the original `password` and `salt` locally in -an encrypted JSON document keyed by the ObjectId returned from -[Storj Bridge](https://github.com/Storj/bridge) for the file object. The -cleartext JSON document has two properties: `pass` and `salt`. - -``` -{ - "pass": "c7c311ee213d10baefd620a004d76485190d82...", - "salt": "6d33490c999e9d613ccf4b146446763df15de2..." -} -``` - -This JSON string is encrypted with AES-256-CBC using a user-defined passphrase, -and encoded as [Base58](https://en.wikipedia.org/wiki/Base58). Each of those -encrypted JSON documents is stored in a directory called `key.ring/`, where the -file name is the ObjectId returned from [Storj Bridge](https://github.com/Storj/bridge) for the file object. - -###### Portable Key Ring Format - -Because the keys in the key ring are generated and stored locally, files -encrypted with these keys cannot be accessed by other machines without first -duplicating the key files onto that machine. To mitigate this, Storj Core can -create a simple portable key ring archive. - -A {@link KeyRing} created by Storj Core can be exported into a portable format, -which is simply a gzipped tape archive (`.tar.gz` or `.tgz`). Importing this -archive simply entails: - -1. Decompress and unpack the archive -2. Decrypt each JSON document using the original passphrase -3. Encrypt each document with the passphrase of the target keyring -4. Move the files into the target keyring, optionally overwriting conflicts - -##### Passphrase-based Key Derivation - -Rather than relying on locally-generated keys, it is recommended that the user -generate a high-entropy passphrase, and generate keys from it via a -deterministic key derivation process. Using this method, the user may grant -access to all encrypted files by simply transferring the passphrase. Storj Core -offers tools for this based on Bitcoin's BIP39 Mnemonic passphrases. - -{@link KeyRing} provides tools for generating a mnemonic passphrase and -writing it to disk. If a mnemonic is found, Storj Core will prefer -passphrase-based key derivation to PBKDF2 derivation. Storj clients should -create a file key as follows: - -1. Prepend the passphrase to the Bucket ID -2. Calculate the `sha512` hash of the resulting string -3. Take the first 64 bits of the resulting hash to make the **Bucket Key** -4. Prepend the Bucket Key to the File ID -5. Calculate the `sha512` hash of the resulting string -6. Take the first 64 bits of the resulting hash to make the **File Key** - -As any client with access to the passphrase can easily generate file keys on -demand, this provides additional portability of files between machines and -applications. - -It is strongly recommended that users write down the passphrase, and keep it in -a secure place. - -###### Public Bucket Key Storage - -Public Buckets are a feature of Bridge, not a feature of Storj. When a Public -Bucket is created, the Bucket Key is stored with Bridge. It is then provided to -clients requesting PUSH or PULL tokens from that bucket. - -#### References - -* {@link DataCipherKeyIv} -* {@link DeterministicKeyIV} -* {@link EncryptStream} -* {@link DecryptStream} -* {@link KeyRing} diff --git a/Storj/core/doc/index.json b/Storj/core/doc/index.json deleted file mode 100644 index c55cabd..0000000 --- a/Storj/core/doc/index.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "protocol-spec": { - "title": "Protocol Specification" - }, - "data-transfer": { - "title": "Transferring File Shards" - }, - "contract-topics": { - "title": "Publishing Storage Contracts" - }, - "private-testnet": { - "title": "Running a Test Network" - }, - "tunnel-connections": { - "title": "Tunnelling Connections" - }, - "renting-data": { - "title": "Renting Data to the Network" - }, - "command-line-interface": { - "title": "Using the Command Line Tools" - }, - "environment-variables": { - "title": "Environment Variables" - }, - "file-encryption": { - "title": "File Encryption Standards" - } -} diff --git a/Storj/core/doc/private-testnet.md b/Storj/core/doc/private-testnet.md deleted file mode 100644 index 4539da0..0000000 --- a/Storj/core/doc/private-testnet.md +++ /dev/null @@ -1,70 +0,0 @@ -Setting up a private or partitioned version of the Storj network is very simple. -The Storj protocol requires the inclusion of a `protocol` property nested -inside the `contact` data included in every RPC message. See -{@tutorial protocol-spec} for more information on the RPC message format. - -### Protocol Identifier Format - -Nodes on the Storj network identify the version of the protocol they are -running with the use of a [semantic version](http://semver.org/) tag. When a -node is trying to determine whether or not another node is compatible with her -version of the protocol, she checks the following: - -* Is the `MAJOR` version the same? -* Is the `MAJOR` version `0`? -* Is the `MINOR` version the same? - -If both nodes are running the *same* `MAJOR` version and that version is -**not** `0`, then the nodes are compatible. If the `MAJOR` version **is** `0`, -then the nodes are compatible *only* if the `MINOR` version is the same. - -For example: - -* `0.5.1` **is** compatible with `0.5.3` -* `0.5.1` **is not** compatible with `0.6.0` -* `1.5.1` **is** compatible with `1.13.0` -* `2.1.0` **is not** compatible with `1.13.0` - -### Special Identifiers - -The semantic versions specification also allows for special identifiers by -postfixing the version with a hyphen followed by some identifier. This is where -the network partitioning magic happens. - -Let's say, for example, I work for "Widgets Ltd" and I want to deploy a Storj -network within the Widgets Ltd private network. Every workstation would run a -modified version of [`storj/farmer`](https://github.com/storj/farmer) or maybe -my own custom interface built atop `storj/core`. - -I would simply change my Storj-based software to use the version -`1.5.0-widgetsltd`. The Storj protocol sees this identifies as a *strict* match -and therefore any nodes running this version of the software will only -communicate with nodes running the **exact** protocol identifier. - -### Changing the Version - -Changing the version in `storj/core` is easy as pie. In your code, simply -import the module and change the identifier like so: - -``` -// Import core library -var storj = require('storj'); - -// Modify protocol version -storj.version.protocol = '1.5.0-widgetsltd'; - -// Get on with your stuff... -``` - -If you are running "vanilla" Storj software, you can change the protocol -version by setting the `STORJ_NETWORK` environment variable. This will add a -postfix to the protocol version, which will partition the network to nodes -that are running that *exact* version: - -``` -STORJ_NETWORK=testnet storjshare --datadir /path/to/shards -``` - -This concept applies broadly to deploying a custom Storj network for any -purpose. This could be used for a public testnet (`x.x.x-testnet`) or for the -private network example above. diff --git a/Storj/core/doc/renting-data.md b/Storj/core/doc/renting-data.md deleted file mode 100644 index fd1662d..0000000 --- a/Storj/core/doc/renting-data.md +++ /dev/null @@ -1,302 +0,0 @@ -This tutorial covers the process for using StorjCORE to rent data to farmers on -the network programmatically using a number of tools included in the library. -This walkthrough should also serve as an overview for a number of the tools -included in the library and how they work together. - -### Bootstrapping - -Before we can join the network, we need to set up a few required components: - -* {@link KeyPair} - for representing our identity on the network -* {@link StorageAdapter} - for persisting our contracts and shard metadata -* {@link StorageManager} - for managing our persistence layer - -Start by importing the `storj` module and instantiating these objects: - -``` -var storj = require('storj'); -var keypair = new storj.KeyPair(); -var persistence = new storj.EmbeddedStorageAdapter('/path/to/datadir'); -var manager = new storj.StorageManager(persistence); -``` - -Now that we have a way of identifying ourselves to the network and keeping a -record of our contracts, we can use the {@link RenterInterface} to join the -network. - -``` -var renter = new storj.RenterInterface({ - keyPair: keypair, - storageManager: manager, - rpcAddress: 'ip.or.hostname', - rpcPort: 1337 -}); - -renter.join(function(err) { - if (err) { - return console.error('Failed to join the network'); - } - - // CONTINUED IN NEXT EXAMPLE... -}); -``` - -### File Preparation - -Now that we have a connection to the network, we are ready to store some data. -Before we can actually store the data, we need to get some information about -the shards we need to store. We need to know: - -* The hash of each shard that will be stored -* The size of each shard that will be stored -* The length of time we wish to store the data -* The number of audits we intend to issue over the life of the contract - -To get this information we need to process the file using a few more of the -core components: - -* {@link FileDemuxer} - for breaking the file into shards -* {@link DataCipherKeyIv} - for generating encryption key -* {@link EncryptStream} - for encrypting the shards -* {@link Contract} - for constructing the terms of the storage - -We will start by demultiplexing the file into several shard streams. Let's -break our file into 6 shards. We will start by creating a {@link FileDemuxer}: - -``` -var demuxer = new storj.FileDemuxer('/path/to/file'); -``` - -Now that we have prepared to shard a file, we need to set up event listeners on -the demuxer for whenever a new shard stream is available. Once a shard stream -is available, we need to encrypt it and calculate it's hash and size so we can -create an appropriate {@link Contract} to offer the network. In addition we -will write the encrypted shard to temporary storage so we don't have to process -the file again when we are ready to transfer the data: - -``` -var tmpdir = require('os').tmpdir(); -var crypto = require('crypto'); -var path = require('path'); - -demuxer.on('shard', function(shardStream) { - var tmpName = path.join(tmpdir, crypto.randomBytes(6).toString('hex')); - var tmpFile = fs.createWriteStream(tmpName); - var key = new storj.DataCipherKeyIv('password', 'salt'); - var encrypter = new storj.EncryptStream(key); - var hasher = crypto.createHash('sha256'); - var size = 0; - - encrypter.on('data', function(bytes) { - hasher.update(bytes); - size += bytes.length; - }); - - tmpFile.on('finish', function() { - // CONTINUED IN NEXT EXAMPLE... - }); - - shardStream.pipe(encrypter).pipe(tmpFile); -}); -``` - -### Contract Negotiation - -When each shard is finished being encrypted and we know it's size and hash, it -is time to create a {@link Contract} and offer it to the network. The example -below is continued from inside the `tmpFile.on('finish', callback)` in the -example above: - -``` -var hash = utils.rmd160sha256(hasher.digest()); -var contract = new storj.Contract({ - renter_id: keypair.getNodeID(), - data_size: size, - data_hash: hash, - store_begin: Date.now(), - store_end: Date.now() + 604800000, // 7 days from now - audit_count: 12 -}); - -renter.getStorageOffer(contract, function(err, farmer, contract) { - // CONTINUED IN NEXT EXAMPLE... -}); -``` - -Now we have created a {@link Contract} for the shard and we are waiting for an -offer from a farmer on the network. When we receive one, the callback supplied -to {@link RenterInterface#getStorageOffer} above will trigger and we can -proceed to transfer the shard to the farmer, but first we need to tell the -farmer we are ready to transfer the shard to them and include the audit -information they will need in the future. We will be using: - -* {@link AuditStream} - for generating audit challenges and merkle tree -* {@link StorageItem} - for storing our private record of challenges - -Let's continue by reading the encrypted shard temporary file we just created -and generating the challenges and merkle tree and saving a copy of the contract -and associated challenges: - -``` -var item = new storj.StorageItem({ hash: hash }); -var auditGenerator = new storj.AuditStream(12); -var encryptedShard = fs.createReadStream(tmpName); - -auditGenerator.on('finish', function() { - item.addContract(farmer, contract); - item.addAuditRecords(farmer, auditGenerator); - - manager.save(item, function(err) { - if (err) { - return console.error(err); - } - - // CONTINUED IN NEXT EXAMPLE... - }); -}); - -encryptedShard.pipe(auditGenerator); -``` - -### Transferring Shards - -Now that we have stored a copy of our contract and challenges, it's time to -authorize a "data channel" (as described in {@tutorial data-channels}) and -transfer the shard to the farmer. - -``` -renter.getConsignToken(farmer, contract, auditGenerator, function(err, token) { - if (err) { - return console.error(err); - } - - var upload = storj.utils.createShardUploader(farmer, hash, token); - var encryptedShard = fs.createReadStream(tmpName); - - encryptedShard.pipe(upload).on('end', () => { - // CONTINUED IN THE NEXT EXAMPLE - }); -}); -``` - -Remember that these operations for contract negotiation and shard transfer are -taking place for **each** shard in the original file. You'll want to keep track -of shards and their associated contracts by grouping references to them -logically as the **file** that they compose. This is the responsibility of -implementing clients. If you do not wish to manage this yourself, consider -running a [Bridge](https://github.com/storj/bridge) or using the -[Storj API](https://storj.io). - -### Replicating Shards for Redundancy - -Once we have successfully consigned our data to a farmer, we can ensure that in -the event that farmer disappears, our data can be recovered from elsewhere. We -use mirrors to accomplish this. Mirroring is a method for *passively* -replicating our data, meaning that instead of uploading it again, we instruct a -new farmer to retrieve it from the location we already stored it. - - -> We are also going to use the [async](https://github.com/caolan/async) module -> for managing flow control. - -First we'll need to negotiate a few more contracts, then authorize some -retrieval tokens (outlined later in this document), and finally request some -mirrors. - -``` -var redundancy = 3; -var mirrors = []; - -function _getMirroringContract(n, next) { - renter.getStorageOffer(contract, function(err, mirror, contract) { - renter.getRetrieveToken(farmer, contract, function(err, token) { - if (err) { - return next(err); - } - - mirrors.push(mirror); - next(null, { farmer: farmer, hash: hash, token: token }); - }); - }); -} - -async.timesSeries(redundancy, _getMirroringContract, function(err, sources) { - if (err) { - return console.error(err); - } - - renter.getMirrorNodes(sources, mirrors, function(err, completed) { - if (err) { - return console.error('Failed to replicate to all mirrors'); - } - - console.info('Replicated to %s mirrors', completed.length); - }); -}); -``` - -### Auditing Farmer Storage - -Now that we have successfully consigned a shard, we will want to be sure that -the farmer is being honest about storing it. We can verify this by requesting -a proof using the challenges we generated previously. We will be using: - -* {@link Verification} - for validating the farmer's challenge response - -``` -var merkleRoot = auditGenerator.getPrivateRecord().root; -var treeDepth = auditGenerator.getPrivateRecord().depth; - -renter.getStorageProof(farmer, item, function(err, proof) { - if (err) { - return console.error(err); - } - - var verification = new storj.Verification(proof); - var verifyResult = verification.verify(merkleRoot, treeDepth); - - if (verifyResult[0] !== verifyResult[1]) { - return console.error('The proof is not valid'); - } - - manager.save(item, function(err) { - if (err) { - return console.error(err); - } - - // CONTINUED IN NEXT EXAMPLE - }); -}); -``` - -### Retrieving Shards - -Now that we have verified that the farmer is storing the shard, we know that we -can later retrieve it when needed. The process for doing this is very similar -to the process for storing the shard, only this time we'll be asking for a -retrieval token and we will be receiving data over the data channel instead of -sending. We'll also be using: - -* {@link DecryptStream} - for decrypting the shard stream - -``` -renter.getRetrieveToken(farmer, contract, function(err, token) { - if (err) { - return console.error(err); - } - - var download = utils.createShardDownloader(farmer, hash, token); - var decrypter = new storj.DecryptStream(keypair); - var fileDestination = fs.createWriteStream('/path/to/download/shard'); - - download.pipe(decrypter).pipe(fileDestination); - - fileDestination.on('finish', function() { - console.info('Successfully downloaded shard!'); - }); -}); -``` - -This concludes the tutorial. To dive deeper, follow the reference links -throughout this walkthrough and read the documentation on each of the classes -used here. diff --git a/Storj/core/doc/tunnel-connections.md b/Storj/core/doc/tunnel-connections.md deleted file mode 100644 index 08ca0cc..0000000 --- a/Storj/core/doc/tunnel-connections.md +++ /dev/null @@ -1,114 +0,0 @@ -One of the most daunting problems to tackle when designing a stable and -reliable distributed network is the traversal of various constraints such as -NAT and firewalls. In some cases, software can use various strategies to -"punch out" of these constraints and become publicly addressable on the -Internet. The StorjCORE library makes use of these strategies, but when they -fail we must devise more complex tactics for ensuring that network participants -are reachable by their peers. - -The Storj protocol defines a series of RPC messages that can be exchanged -in order to establish a "tunnel". See the {@tutorial protocol-spec} for more -detail on these RPC messages and their purposes. A tunnel is, in essence, a -proxy that allows a client that is not exposed to the Internet to be -addressable as if it were. - -This works by a private node opening a long-lived connection to a public node -who establishes a dedicated means for accepting messages on behalf of the -private node and "pipes" any data received via those means directly back to the -private node over the previously established connection. - -Once a tunnel has been established, the private node can begin identifying -herself to the network using her tunnel's address, instead of her own. Private -nodes do not need to use the tunnel to contact other nodes on the network, but -rather only *to be contacted*. - -### Announcing Willingness - -When a node joins the network and is publicly addressable, it has the ability -to announce to the network that it is willing and capable of tunneling -connections on behalf on nodes who are private or unable to punch out to -become addressable on the Internet. The process of doing this uses the same -publish/subscribe system described in the {@tutorial contract-topics} -specification which enables nodes to maintain a view of subscriptions in their -neighborhood of the network as described in the {@tutorial protocol-spec}. - -The difference between a contract publication and a tunnel announcement is in -the opcode used for the topic and in the contents of the publication. Tunnel -announcement publications use the opcode prefix `0x0e` followed by a single -criteria degree opcode to indicate their willingness to tunnel (`0x00` to -indicate "I am no longer tunneling" and `0x01` to indicate "I am ready to -tunnel"). - -Whenever the condition changes, such as a node's maximum number of tunnels is -reached or when a tunnel becomes available, it should issue a `PUBLISH` RPC -message to it's nearest neighbors. - -``` -{ - "method": "PUBLISH", - "params": { - "uuid": "7f0c40a2-e465-4f3e-b617-3d53460e34f7", - "topic": "0e01", - "contents": { - "address": "10.0.0.2", - "port": 1337 - }, - "publishers": [ - "48dc026fa01ae26822bfb23f98e725444d6775b0" - ], - "ttl": 1455228597837, - "contact": { - "address": "10.0.0.2", - "port": 1337, - "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0", - "protocol": "0.6.0" - }, - "nonce": 1455216323786, - "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..." - }, - "id": "7b6a2ab35da6826995abf3310a4875097df88cdb" -} -``` - -Public nodes should subscribe to these topics so that they can maintain an -up-to-date list of nodes who are capable and willing to tunnel connections, so -they can respond accurately to `FIND_TUNNEL` messages from private nodes. - -### Establishing a Tunnel - -After a private node has discovered some willing tunnels using the `FIND_TUNNEL` -RPC message defined in the {@tutorial protocol-spec}, it can now begin the -handshake to establish the tunnel. This begins by sending the `OPEN_TUNNEL` RPC -message to the desired tunneler node. The recipient of `OPEN_TUNNEL` will -check: - -* Do I have enough remaining tunnels? (based on arbitrary limit set by node) -* Am I already tunneling for this nodeID? -* Has a payment channel been opened? (**future spec**) - -If the tunneling node has enough tunnels, is not already tunneling the node, -and (in a future spec) if a payment channel has been opened for bandwidth, then -the tunneling node opens a new dedicated TCP socket on an available port -that will be used by the requester to send/receive HTTP messages. - -``` -{ - "result": { - "proxyPort": 12000, - "contact": { - "address": "10.0.0.3", - "port": 1337, - "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0", - "protocol": "0.6.0" - }, - "nonce": 1455216323786, - "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..." - }, - "id": "7b6a2ab35da6826995abf3310a4875097df88cdb" -} -``` - -Now the private node can open a TCP connect to the `proxyPort` provided and -messages sent to the tunneler that specify your node ID in the -`x-storj-node-id` header will be written to the connected socket. From there, -you may pipe this socket directly to your locally running node. diff --git a/Storj/core/docs/AuditStream.html b/Storj/core/docs/AuditStream.html deleted file mode 100644 index 4220d87..0000000 --- a/Storj/core/docs/AuditStream.html +++ /dev/null @@ -1,721 +0,0 @@ - - - - - JSDoc: Class: AuditStream - - - - - - - - - - -
- -

Class: AuditStream

- - - - - - -
- -
- -

AuditStream(audits)

- - -
- -
-
- - - - - - -

new AuditStream(audits)

- - - - - - -
- Represents a streaming audit challenge generator -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
audits - - -Number - - - - Total number of challenges to generate
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • LGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - -
Fires:
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

(static) fromRecords(challenges, tree) → {AuditStream}

- - - - - - -
- Returns a new instance from the predefined challenges and tree -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
challenges - - -Array - - - - The precomputed challenges
tree - - -Array - - - - The bottom leaves of the existing merkle tree
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -AuditStream - - -
-
- - - - - - - - - - - - - -

getPrivateRecord() → {Object}

- - - - - - -
- Returns the challenges, the tree depth, and merkle root -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- challenge - Private audit record with challenges -
- - - -
-
- Type -
-
- -Object - - -
-
- - - - - - - - - - - - - -

getPublicRecord() → {Array}

- - - - - - -
- Returns the bottom leaves of the merkle tree for sending to farmer -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- leaves - Bottom merkle leaves of audit tree -
- - - -
-
- Type -
-
- -Array - - -
-
- - - - - - - - - - - - - -

Events

- - - - - - - -

finish

- - - - - - -
- Triggered when the stream has ended -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/Blacklist.html b/Storj/core/docs/Blacklist.html deleted file mode 100644 index 2ceb0ab..0000000 --- a/Storj/core/docs/Blacklist.html +++ /dev/null @@ -1,484 +0,0 @@ - - - - - JSDoc: Class: Blacklist - - - - - - - - - - -
- -

Class: Blacklist

- - - - - - -
- -
- -

Blacklist()

- - -
- -
-
- - - - - - -

new Blacklist()

- - - - - - -
- Manage a blacklist file containing an object with key value pairs of -nodeids: timestamp -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
options.logger - - -Object - - - - Logger instance
options.store - - -Object - - - - The store that blacklist enteries will be -persisted to. This object must be compatible with the API of -abstract-blob-store
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • LGPL-3.0
- - - - - -
Source:
-
- - - - - -
See:
-
- -
- - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

push(nodeid)

- - - - - - -
- Push node to blacklist -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
nodeid - - -String - - - - Node id to be added to blacklist
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

toObject()

- - - - - - -
- Return list of blacklisted nodeids -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/BridgeClient.html b/Storj/core/docs/BridgeClient.html deleted file mode 100644 index ecab708..0000000 --- a/Storj/core/docs/BridgeClient.html +++ /dev/null @@ -1,6926 +0,0 @@ - - - - - JSDoc: Class: BridgeClient - - - - - - - - - - -
- -

Class: BridgeClient

- - - - - - -
- -
- -

BridgeClient(uriopt, options)

- - -
- -
-
- - - - - - -

new BridgeClient(uriopt, options)

- - - - - - -
- Represents a client interface to a given bridge server -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDefaultDescription
uri - - -String - - - - - - <optional>
- - - - - -
- - https://api.storj.io - - API base URI
options - - -Object - - - - - - - - - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
keyPair - - -KeyPair - - - - - - - - - - KeyPair instance for request signing
logger - - -Object - - - - - - - - - - Logger instance
requestTimeout - - -Object - - - - - - - - - - Timeout when making requests to the -bridge
transferConcurrency - - -Number - - - - - - - - - - Upload concurrency limit
transferRetries - - -Number - - - - - - - - - - Limit number of shard transfer -retries before getting a new contract
basicAuth - - -Object - - - - - - - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
email - - -String - - - - Email address for HTTP basic auth
password - - -String - - - - Password for HTTP basic auth
- -
blacklistFolder - - -String - - - - - - <optional>
- - - - - -
The folder that blacklist -entries will be persisted to if using the default fs-store
store - - -Object - - - - - - <optional>
- - - - - -
The store that blacklist enteries will be -persisted to. This object must be compatible with the API of -abstract-blob-store
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • LGPL-3.0
- - - - - -
Source:
-
- - - - - -
See:
-
- -
- - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

_shardUploadWorker(task, done)

- - - - - - -
- BridgeClient.prototype._shardUploadWorker - description -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
task - - -type - - - - description
done - - -type - - - - description
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

addPublicKey(pubkey, callback)

- - - - - - -
- Registers a public key for the caller -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
pubkey - - -String - - - - Hex encoded ECDSA (secp256k1) public key
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

addShardToFileStagingFrame(id, shard, options, callback)

- - - - - - -
- Adds the given shard metadata to the file staging frame -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
id - - -String - - - - Unique frame ID
shard - - -Object - - - - The shard metadata
options - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
retry - - -Number - - - - Retry the request this many times if failed
- -
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

createBucket(data, callback)

- - - - - - -
- Creates a new file bucket -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
data - - -Object - - - - Bucket parameters for creation
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

createExchangeReport(exchangeReport)

- - - - - - -
- Sends an exchange report -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
exchangeReport - - -ExchangeReport - - - - The result of a transfer operation
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

createFileSliceStream(options)

- - - - - - -
- Create a stream for a given slice of a file -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
options - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
bucket - - -String - - - - The bucket ID
file - - -String - - - - The file ID
start - - -Number - - - - The byte position to start slice
end - - -Number - - - - The byte position to end slice
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

createFileStagingFrame(callback)

- - - - - - -
- Creates a file staging frame -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

createFileStream(bucket, file, optionsopt, callback)

- - - - - - -
- Create a readable stream from the given bucket and file id -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
bucket - - -String - - - - - - - - - - The unique bucket ID
file - - -String - - - - - - - - - - The unique file ID
options - - -Object - - - - - - <optional>
- - - - - -
-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
exlude - - -Array - - - - - - <optional>
- - - - - -
Exclude these nodeID's from pointers
- -
callback - - -function - - - - - - - - - - Receives (err, stream)
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

createToken(id, operation, callback)

- - - - - - -
- Create bucket token -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
id - - -String - - - - Unique bucket ID
operation - - -String - - - - PUSH or PULL (file operation)
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

createUser(options, callback)

- - - - - - -
- Registers a user account -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
options - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
email - - -String - - - - Email address for verification email
password - - -String - - - - Password to register (auto hashed)
redirect - - -String - - - - URL to redirect to after verification
pubkey - - -String - - - - Optional ECDSA public key to register
- -
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

destroyBucketById(id, callback)

- - - - - - -
- Removes the bucket -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
id - - -String - - - - Unique bucket ID
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

destroyFileStagingFrameById(id, callback)

- - - - - - -
- Destroy an existing file staging frame -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
id - - -String - - - - Unique frame ID
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

destroyPublicKey(pubkey, callback)

- - - - - - -
- Disassociates the public key from the caller -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
pubkey - - -String - - - - Hex encoded ECDSA (secp256k1) public key
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

destroyUser(options, callback)

- - - - - - -
- Deactivates a user account -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
options - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
email - - -String - - - - Email address of user to deactivate
redirect - - -String - - - - URL to redirect after verification
- -
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

getBucketById(id, callback)

- - - - - - -
- Returns the bucket information by ID -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
id - - -String - - - - Unique bucket ID
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

getBuckets(callback)

- - - - - - -
- Lists the caller's file buckets -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

getContactByNodeId(nodeId, callback)

- - - - - - -
- Get the contact information for the given nodeID -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
nodeId - - -String - - - - The nodeID of the contact
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

getContactList(options, callback)

- - - - - - -
- Fetches the list of known contacts filtered according to the options -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
options - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
page - - -Number - - - - The page number of the contact list to fetch
connected - - -Boolean - - - - Filter results by connection status
- -
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

getFileInfo(bucket, file, callback)

- - - - - - -
- Get info about a file (bucket, mimetype, filename, frame, size, id) -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
bucket - - -String - - - - bucket id
file - - -String - - - - file id
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

getFilePointers(options, callback)

- - - - - - -
- Retrieves a series of file pointers from the bucket -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
options - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
bucket - - -String - - - - Unique bucket ID
token - - -String - - - - Token from BridgeClient#createToken
file - - -String - - - - The unique file pointer ID
skip - - -Number - - - - The starting index of pointers to resolve
limit - - -Number - - - - The number of pointers to resolve
- -
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

getFileStagingFrameById(id, callback)

- - - - - - -
- Fetch an existing file staging frame by it's ID -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
id - - -String - - - - Unique frame ID
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

getFileStagingFrames(callback)

- - - - - - -
- List all of the file staging frames -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

getFrameFromFile(bucket, file, callback)

- - - - - - -
- Gets the frame by it's ID -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
bucket - - -String - - - - Unique bucket ID
file - - -String - - - - Unique file ID
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

getInfo(callback)

- - - - - - -
- Get the remote Storj Bridge API documentation and version as JSON -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

getPublicKeys(callback)

- - - - - - -
- Returns list of associated public keys -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

listFilesInBucket(id, callback)

- - - - - - -
- Lists the files stored in a bucket -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
id - - -String - - - - Unique bucket ID
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

listMirrorsForFile(id, file, callback)

- - - - - - -
- Returns the established and available mirrors for a given file -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
id - - -String - - - - Unique bucket ID
file - - -String - - - - Unique file ID
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

removeFileFromBucket(id, file, callback)

- - - - - - -
- Removes a file from a bucket -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
id - - -String - - - - Unique bucket ID
file - - -String - - - - ID of the file to remove from bucket
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

replicateFileFromBucket(id, token, file, concurrency, callback)

- - - - - - -
- Instructs the bridge to find N mirroring farmers for redundancy -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
id - - -String - - - - Unique bucket ID
token - - -String - - - - Token from BridgeClient#createToken
file - - -String - - - - Path to file to store
concurrency - - -Number - - - - Upload concurrency
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

resetPassword(options, callback)

- - - - - - -
- Requests a password reset -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
options - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
email - - -String - - - - Email address of user to reset password
password - - -String - - - - The cleartext password to reset to
redirect - - -String - - - - URL to redirect adter confirmation
- -
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

resolveFileFromPointers(pointers, muxerOptionsopt, callback)

- - - - - - -
- Open a series of shard transfers based on the returned value of -BridgeClient#getFilePointers to resolve all the shards and -reassemble them together as a binary stream -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
pointers - - -Array - - - - - - - - - - Result of BridgeClient#getFilePointers
muxerOptions - - -Object - - - - - - <optional>
- - - - - -
Optional overrides for the file muxer
callback - - -function - - - - - - - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

storeFileInBucket(id, token, file, callback)

- - - - - - -
- Stores a file in the bucket -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
id - - -String - - - - Unique bucket ID
token - - -String - - - - Token from BridgeClient#createToken
file - - -String - - - - Path to file to store
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

updateBucketById(id, updates, callback)

- - - - - - -
- Updates the bucket -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
id - - -String - - - - Unique bucket ID
updates - - -Object - - - - Bucket update parameters
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/Contact.html b/Storj/core/docs/Contact.html deleted file mode 100644 index f94a123..0000000 --- a/Storj/core/docs/Contact.html +++ /dev/null @@ -1,632 +0,0 @@ - - - - - JSDoc: Class: Contact - - - - - - - - - - -
- -

Class: Contact

- - - - - - -
- -
- -

Contact(contact)

- - -
- -
-
- - - - - - -

new Contact(contact)

- - - - - - -
- Represents a Storj contact (or peer) -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
address - - -String - - - - - - - - - - Hostname of IP address
port - - -Number - - - - - - - - - - RPC port number
nodeID - - -String - - - - - - - - - - 160 bit node ID (hex)
hdKey - - -String - - - - - - <optional>
- - - - - -
extended hd public key
hdIndex - - -String - - - - - - <optional>
- - - - - -
derivation index for node
userAgent - - -String - - - - - - <optional>
- - - - - -
User agent identifier
protocol - - -String - - - - - - - - - - Semver tag for compatibility
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • LGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

(static) isValidUrl(uri) → {Boolean}

- - - - - - -
- Indicates if URL is valid contact -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
uri - - -String - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Boolean - - -
-
- - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/Contract.html b/Storj/core/docs/Contract.html deleted file mode 100644 index 4533c9f..0000000 --- a/Storj/core/docs/Contract.html +++ /dev/null @@ -1,4264 +0,0 @@ - - - - - JSDoc: Class: Contract - - - - - - - - - - -
- -

Class: Contract

- - - - - - -
- -
- -

Contract(contract, criteria)

- - -
- -
-
- - - - - - -

new Contract(contract, criteria)

- - - - - - -
- Represents a storage contract between a renter and a farmer -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contract - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
type - - -String - - - - - - - - - - Unique identifier for the contract
renter_hd_key - - -String - - - - - - <optional>
- - - - - -
Node extended public key in base58
renter_hd_index - - -Number - - - - - - <optional>
- - - - - -
Derivation index for signature
renter_id - - -String - - - - - - - - - - Node ID of the renter
renter_signature - - -String - - - - - - - - - - Renter's cryptographic signature
farmer_id - - -String - - - - - - - - - - Node ID of the farmer
farmer_signature - - -String - - - - - - - - - - Farmer's cryptographic signature
data_size - - -Number - - - - - - - - - - Number of bytes to store
data_hash - - -String - - - - - - - - - - RIPEMD-160 SHA-256 hash of the data
store_begin - - -Number - - - - - - - - - - UNIX timestamp to start contract
store_end - - -Number - - - - - - - - - - UNIX timestamp to end the contract
audit_count - - -Number - - - - - - - - - - Number of audits renter will perform
payment_storage_price - - -Number - - - - - - - - - - Total price for storage
payment_download_price - - -Number - - - - - - - - - - Price per download
payment_destination - - -String - - - - - - - - - - Bitcoin address to send funds
- -
criteria - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
size - - -Number - - - - Criteria degree OPCODE
duration - - -Number - - - - Criteria degree OPCODE
availability - - -Number - - - - Criteria degree OPCODE
speed - - -Number - - - - Criteria degree OPCODE
- -
- - - - - - -
- - -
Version:
-
  • 0
- - - - - - - - - - - - - - - - - - - - - -
License:
-
  • AGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -

Members

- - - -

(static) CRITERIA

- - - - -
- Defines some default criteria of a Contract -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) DEFAULTS

- - - - -
- Defines some default properties of a Contract -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) MATRIX

- - - - -
- Defines the criteria matrix for a Contract -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) Schema

- - - - -
- Defines the JSON Schema of a Contract -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - -

Methods

- - - - - - - -

(static) compare(c1, c2) → {Boolean}

- - - - - - -
- Compares two contracts against each other -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
c1 - - -Contract - - - - Contract to compare
c2 - - -Contract - - - - Contract to compare
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Boolean - - -
-
- - - - - - - - - - - - - -

(static) createTopic(criteria) → {Buffer}

- - - - - - -
- Create a topical OPCODE byte sequence from the provided criteria -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
criteria - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
size - - -Number - - - - Criteria degree OPCODE
duration - - -Number - - - - Criteria degree OPCODE
availability - - -Number - - - - Criteria degree OPCODE
speed - - -Number - - - - Criteria degree OPCODE
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Buffer - - -
-
- - - - - - - - - - - - - -

(static) diff(c1, c2) → {Array.<String>}

- - - - - - -
- Returns the property names between two contracts that differ -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
c1 - - -Contract - - - - Contract to compare
c2 - - -contract - - - - Contract to compare
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- changedProperties -
- - - -
-
- Type -
-
- -Array.<String> - - -
-
- - - - - - - - - - - - - -

(static) fromBuffer(buffer) → {Contract}

- - - - - - -
- Creates a contract from a Buffer -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
buffer - - -Buffer - - - - Raw binary blob of contract data
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Contract - - -
-
- - - - - - - - - - - - - -

(static) fromJSON(json) → {Contract}

- - - - - - -
- Creates a contract from a JSON string -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
json - - -String - - - - JSON encoded contract
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Contract - - -
-
- - - - - - - - - - - - - -

(static) fromObject(object) → {Contract}

- - - - - - -
- Creates a contract from a plain object -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
object - - -Object - - - - Dictionary of contract data
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Contract - - -
-
- - - - - - - - - - - - - -

get(field_name) → {String|Number|null}

- - - - - - -
- Returns the value for the given contract property -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
field_name - - -String - - - - Contract property to get
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- value -
- - - -
-
- Type -
-
- -String -| - -Number -| - -null - - -
-
- - - - - - - - - - - - - -

getHash() → {Buffer}

- - - - - - -
- Calculates the SHA-256 hash of the serialized contract -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Buffer - - -
-
- - - - - - - - - - - - - -

getSigningData() → {String}

- - - - - - -
- Returns the string representation of the contract, minus the signature -fields, sorted alphanumerically for signing and verifying -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -String - - -
-
- - - - - - - - - - - - - -

getTopicBuffer() → {Buffer}

- - - - - - -
- Return OPCODE byte sequence for contract publication topic -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Buffer - - -
-
- - - - - - - - - - - - - -

getTopicString() → {String}

- - - - - - -
- Return OPCODE byte sequence for contract publication topic as hex string -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -String - - -
-
- - - - - - - - - - - - - -

isComplete() → {Boolean}

- - - - - - -
- Checks if the contract is complete -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- completed -
- - - -
-
- Type -
-
- -Boolean - - -
-
- - - - - - - - - - - - - -

set(field_name) → {String|Number|null}

- - - - - - -
- Sets the contract property to the given value -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
field_name - - -String - - - - Contract property to get
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- value -
- - - -
-
- Type -
-
- -String -| - -Number -| - -null - - -
-
- - - - - - - - - - - - - -

sign(actor, secret) → {String}

- - - - - - -
- Signs the contract as the given actor -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
actor - - -String - - - - One of 'farmer' or 'renter'
secret - - -Buffer - - - - ECDSA private key
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- signature -
- - - -
-
- Type -
-
- -String - - -
-
- - - - - - - - - - - - - -

signExternal(secret) → {String}

- - - - - - -
- Signs the contract with the proved key and returns the signature -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
secret - - -String - - - - ECDSA private key
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- externalSignature -
- - - -
-
- Type -
-
- -String - - -
-
- - - - - - - - - - - - - -

toBuffer() → {Buffer}

- - - - - - -
- Converts the contract to Buffer -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Buffer - - -
-
- - - - - - - - - - - - - -

toJSON() → {String}

- - - - - - -
- Converts the contract to JSON string -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -String - - -
-
- - - - - - - - - - - - - -

toObject() → {Object}

- - - - - - -
- Converts the contract to a plain object -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Object - - -
-
- - - - - - - - - - - - - -

update(fields) → {Contract}

- - - - - - -
- Applies the provided fields to the contract and validates it -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fields - - -Object - - - - Contract properties to update
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- self -
- - - -
-
- Type -
-
- -Contract - - -
-
- - - - - - - - - - - - - -

verify(actor, pubkeyhash) → {Boolean}

- - - - - - -
- Verify the contract signature for the given actor -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
actor - - -String - - - - One of 'farmer' or 'renter'
pubkeyhash - - -Buffer - - - - ECDSA nodeID
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- isValidSignature -
- - - -
-
- Type -
-
- -Boolean - - -
-
- - - - - - - - - - - - - -

verifyExternal(signature, pubkeyhash) → {Boolean}

- - - - - - -
- Verify the provided signature for the contract -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
signature - - -String - - - - The contract signature to verify
pubkeyhash - - -String - - - - ECDSA nodeID
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- isValidSignature -
- - - -
-
- Type -
-
- -Boolean - - -
-
- - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/DataCipherKeyIv.html b/Storj/core/docs/DataCipherKeyIv.html deleted file mode 100644 index f5524ae..0000000 --- a/Storj/core/docs/DataCipherKeyIv.html +++ /dev/null @@ -1,722 +0,0 @@ - - - - - JSDoc: Class: DataCipherKeyIv - - - - - - - - - - -
- -

Class: DataCipherKeyIv

- - - - - - -
- -
- -

DataCipherKeyIv(passwordopt, saltopt)

- - -
- -
-
- - - - - - -

new DataCipherKeyIv(passwordopt, saltopt)

- - - - - - -
- Create a new random cipher key and initialization vector -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
password - - -String -| - -Buffer - - - - - - <optional>
- - - - - -
The unique cipher password
salt - - -String -| - -Buffer - - - - - - <optional>
- - - - - -
The unique salt
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • LGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

(static) fromObject(object) → {DataCipherKeyIv}

- - - - - - -
- Returns the a DataCipherKeyIv from an object -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
object - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
pass - - -Buffer -| - -String - - - - The unique password
salt - - -Buffer -| - -String - - - - The unique salt
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -DataCipherKeyIv - - -
-
- - - - - - - - - - - - - -

getCipherKeyIv() → {Array}

- - - - - - -
- Returns the cipher key and iv in an array -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Array - - -
-
- - - - - - - - - - - - - -

toObject() → {Array}

- - - - - - -
- Returns the key and iv as an array -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Array - - -
-
- - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/DecryptStream.html b/Storj/core/docs/DecryptStream.html deleted file mode 100644 index 2e0e1ca..0000000 --- a/Storj/core/docs/DecryptStream.html +++ /dev/null @@ -1,424 +0,0 @@ - - - - - JSDoc: Class: DecryptStream - - - - - - - - - - -
- -

Class: DecryptStream

- - - - - - -
- -
- -

DecryptStream(keyiv)

- - -
- -
-
- - - - - - -

new DecryptStream(keyiv)

- - - - - - -
- Represents a duplex stream capable of taking encrypted data as input and -producing output decrypted by a DataCipherKeyIv -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
keyiv - - -DataCipherKeyIv -| - -DeterministicKeyIv - - - - Object to use -for derivation function
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • LGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - -
Fires:
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - -

Events

- - - - - - - -

data

- - - - - - -
- Triggered when some input bytes have become decrypted output bytes -
- - - - - -
Type:
-
    -
  • - -Buffer - - -
  • -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

end

- - - - - - -
- Triggered when the stream has ended -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/DeterministicKeyIv.html b/Storj/core/docs/DeterministicKeyIv.html deleted file mode 100644 index 9c28887..0000000 --- a/Storj/core/docs/DeterministicKeyIv.html +++ /dev/null @@ -1,878 +0,0 @@ - - - - - JSDoc: Class: DeterministicKeyIv - - - - - - - - - - -
- -

Class: DeterministicKeyIv

- - - - - - -
- -
- -

DeterministicKeyIv(fileKey, fileId)

- - -
- -
-
- - - - - - -

new DeterministicKeyIv(fileKey, fileId)

- - - - - - -
- Create a new deterministic cipher key -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fileKey - - -String - - - - file key
fileId - - -String - - - - file id
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • LGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

(static) fromObject(object) → {DeterministicKeyIv}

- - - - - - -
- Returns the a DeterministicKeyIv from an object -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
object - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
pass - - -Buffer -| - -String - - - - The unique password
salt - - -Buffer -| - -String - - - - The unique salt
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -DeterministicKeyIv - - -
-
- - - - - - - - - - - - - -

(static) getDeterministicKey(seed, id) → {String}

- - - - - - -
- Calculates a deterministic key -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
seed - - -Buffer -| - -String - - - - Deterministic seed or bucket key
id - - -Buffer -| - -String - - - - Unique bucket or file id
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -String - - -
-
- - - - - - - - - - - - - -

getCipherKeyIv() → {Array}

- - - - - - -
- Returns the cipher key and iv in an array -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Array - - -
-
- - - - - - - - - - - - - -

toObject() → {Array}

- - - - - - -
- Returns the key and iv as an array -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Array - - -
-
- - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/EmbeddedStorageAdapter.html b/Storj/core/docs/EmbeddedStorageAdapter.html deleted file mode 100644 index 6c87221..0000000 --- a/Storj/core/docs/EmbeddedStorageAdapter.html +++ /dev/null @@ -1,1882 +0,0 @@ - - - - - JSDoc: Class: EmbeddedStorageAdapter - - - - - - - - - - -
- -

Class: EmbeddedStorageAdapter

- - - - - - -
- -
- -

EmbeddedStorageAdapter(storageDirPath)

- - -
- -
-
- - - - - - -

new EmbeddedStorageAdapter(storageDirPath)

- - - - - - -
- Implements an LevelDB/KFS storage adapter interface -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
storageDirPath - - -String - - - - Path to store the level db
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • AGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - -

Extends

- - - - - - - - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

createReadStream() → {ReadableStream}

- - - - - - -
- Calls the implemented StorageAdapter#_keys and returns a readable -stream containing each stored item -
- - - - - - - - - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -ReadableStream - - -
-
- - - - - - - - - - - - - -

del(key, callback)

- - - - - - -
- Calls the implemented StorageAdapter#_del -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -String - - - - Shard hash to delete the data for
callback - - -function - - - - Called with error or StorageItem
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

flush(callback)

- - - - - - -
- Calls the implemented StorageAdapter#_flush -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - - Called with error or null
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

get(key, callback)

- - - - - - -
- Calls the implemented StorageAdapter#_get and validates the result -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -String - - - - Shard hash to get metadata for
callback - - -function - - - - Called with error or StorageItem
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

peek(key, callback)

- - - - - - -
- Calls the implemented StorageAdapter#_peek and validates the result -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -String - - - - Shard hash to get metadata for
callback - - -function - - - - Called with error or StorageItem
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

put(item, callback)

- - - - - - -
- Calls the implemented StorageAdapter#_put and validates the input -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
item - - -StorageItem - - - - Item to write to storage
callback - - -function - - - - Called on complete write
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

size(keyopt, callback)

- - - - - - -
- Calls the implemented StorageAdapter#_size -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
key - - -String - - - - - - <optional>
- - - - - -
Optional file key
callback - - -function - - - - - - - - - - Called with error or number of bytes stored
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

Events

- - - - - - - -

add

- - - - - - -
- Triggered when a new item is added -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
item - - -StorageItem - - - -
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

delete

- - - - - - -
- Triggered when an item is deleted -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
item - - -StorageItem - - - -
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

ready

- - - - - - -
- Triggered when the adapter is ready -
- - - - - - - - - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

update

- - - - - - -
- Triggered when an existing item is updated -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
itemBeforeUpdate - - -StorageItem - - - -
itemAfterUpdate - - -StorageItem - - - -
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/EncryptStream.html b/Storj/core/docs/EncryptStream.html deleted file mode 100644 index db50674..0000000 --- a/Storj/core/docs/EncryptStream.html +++ /dev/null @@ -1,424 +0,0 @@ - - - - - JSDoc: Class: EncryptStream - - - - - - - - - - -
- -

Class: EncryptStream

- - - - - - -
- -
- -

EncryptStream(keyiv)

- - -
- -
-
- - - - - - -

new EncryptStream(keyiv)

- - - - - - -
- Represents a duplex stream capable of taking cleartext data as input and -producing output encrypted with DataCipherKeyIv -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
keyiv - - -DataCipherKeyIv -| - -DeterministicKeyIv - - - - Object to use -for derivation function
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • LGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - -
Fires:
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - -

Events

- - - - - - - -

data

- - - - - - -
- Triggered when some input bytes have become encrypted output bytes -
- - - - - -
Type:
-
    -
  • - -Buffer - - -
  • -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

end

- - - - - - -
- Triggered when the stream has ended -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/ExchangeReport.html b/Storj/core/docs/ExchangeReport.html deleted file mode 100644 index b184612..0000000 --- a/Storj/core/docs/ExchangeReport.html +++ /dev/null @@ -1,751 +0,0 @@ - - - - - JSDoc: Class: ExchangeReport - - - - - - - - - - -
- -

Class: ExchangeReport

- - - - - - -
- -
- -

ExchangeReport(options)

- - -
- -
-
- - - - - - -

new ExchangeReport(options)

- - - - - - -
- Represents a report to a bridge regarding the result of a shard exchange -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
options - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
reporterId - - -String - - - - - - - - - -
farmerId - - -String - - - - - - <optional>
- - - - - -
clientId - - -String - - - - - - <optional>
- - - - - -
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

begin(dataHash)

- - - - - - -
- Starts recording duration of exchange -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
dataHash - - -String - - - - The shard hash as reference
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

end(resultCode, resultMessage)

- - - - - - -
- Ends the recording time a set result code and message -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
resultCode - - -Number - - - - Exchange result code
resultMessage - - -String - - - - Exchange result message
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

toObject() → {Object}

- - - - - - -
- Returns a plain report object -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Object - - -
-
- - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/FarmerInterface.html b/Storj/core/docs/FarmerInterface.html deleted file mode 100644 index 6c279ae..0000000 --- a/Storj/core/docs/FarmerInterface.html +++ /dev/null @@ -1,3279 +0,0 @@ - - - - - JSDoc: Class: FarmerInterface - - - - - - - - - - -
- -

Class: FarmerInterface

- - - - - - -
- -
- -

FarmerInterface(options)

- - -
- -
-
- - - - - - -

new FarmerInterface(options)

- - - - - - -
- Creates and a new farmer interface -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
options - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDefaultDescription
paymentAddress - - -String - - - - - - - - - - - - Optional payment address
opcodeSubscriptions - - -Array - - - - - - - - - - - - Contract opcodes to farm
maxOfferConcurrency - - -Number - - - - - - - - - - - - Max offers to have pending
contractNegotiator - - -FarmerInterface~negotiator - - - - - - - - - - - -
keyPair - - -KeyPair - - - - - - - - - - - - Node's cryptographic identity
storageManager - - -StorageManager - - - - - - - - - - - - Storage manager backend
bridgeUri - - -String - - - - - - - - - - - - URL for bridge server seed lookup
logger - - -Object - - - - - - - - - - - - Logger instance
seedList - - -Array - - - - - - - - - - - - List of seed URIs to join
rpcAddress - - -String - - - - - - - - - - - - Public node IP or hostname
rpcPort - - -Number - - - - - - - - - - - - Listening port for RPC
doNotTraverseNat - - -Boolean - - - - - - - - - - - - Skip NAT traversal strategies
maxTunnels - - -Number - - - - - - - - - - - - Max number of tunnels to provide
tunnelServerPort - - -Number - - - - - - - - - - - - Port for tunnel server to use
tunnelGatewayRange - - -Object - - - - - - - - - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
min - - -Number - - - - Min port for gateway binding
max - - -Number - - - - Max port for gateway binding
- -
offerBackoffLimit - - -Number - - - - - - <optional>
- - - - - -
- - 4 - - Do not send offers if more -than N transfers are active
renterWhitelist - - -Array.<String> - - - - - - <optional>
- - - - - -
- - Node IDs to offer storage to
joinRetry - - -Object - - - - - - <optional>
- - - - - -
- - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
times - - -Number - - - - - - <optional>
- - - - - -
Times to retry joining net
interval - - -Number - - - - - - <optional>
- - - - - -
MS to wait before retrying
- -
- -
- - - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
keyPair - - -KeyPair - - - -
storageManager - - -StorageManager - - - -
node - - -kad.Node - - - - The underlying DHT node
triggerManager - - -TriggerManager - - - -
bridgeClient - - -BridgeClient - - - -
contact - - -Contact - - - -
transportAdapter - - -Transport - - - -
router - - -kad.Router - - - - The underlying DHT router
dataChannelServer - - -DataChannelServer - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • AGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - -
Fires:
- - - - - - - - - - - - - - - - - - -
- - -

Extends

- - - - - - - - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

connect(uri, callback)

- - - - - - -
- Connects to the node at the given URI -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
uri - - -String - - - - The storj protocol URI to connect
callback - - -function - - - - Called on connection or error
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

getPaymentAddress() → {String}

- - - - - - -
- Returns the payment address supplied or the derived one from keypair -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -String - - -
-
- - - - - - - - - - - - - -

join(callback)

- - - - - - -
- Wraps the super call to Network#join to listen for contract after -successfully establishing a connection to the network -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - - Called on successful join
- - - - - - -
- - - - - - - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

leave(callback)

- - - - - - -
- Disconnects from the network -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - - Called when successful disconnect
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

ping(neighbor, callback)

- - - - - - -
- Will ping a neighbor -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
neighbor - - -String - - - - A contact
callback - - -function - - - - Called on connection or error
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

publish(topic, contents, options)

- - - - - - -
- Publishes a topic with content to the network -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
topic - - -String - - - - The serialized opcode topic
contents - - -Object - - - - Arbitrary publication contents
options - - -Object - - - - Options to pass to kad-quasar
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

subscribe(topic, handler)

- - - - - - -
- Subscribes to a topic on the network -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
topic - - -String - - - - The serialized opcode topic
handler - - -Object - - - - Function to handle received publications
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -

Type Definitions

- - - - - - - -

negotiator(contract) → {Boolean}

- - - - - - -
- Called when a contract is found that meets subscription criteria and allows -us to modify the contract terms if we desire and then uses the return value -to determine if we should send the renter an offer -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contract - - -Contract - - - - The contract object to negotiate
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Boolean - - -
-
- - - - - - - - - - - -

Events

- - - - - - - -

connected

- - - - - - -
- Triggered when the node has entered the overlay network -
- - - - - - - - - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

disconnected

- - - - - - -
- Triggered when the node has exited the overlay network -
- - - - - - - - - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

error

- - - - - - -
- Triggered when an error occurs -
- - - - - - - - - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

ready

- - - - - - -
- Triggered when the transport's network interface is ready -
- - - - - - - - - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

unhandledOffer

- - - - - - -
- Triggered when a valid offer is received, but we are not waiting for one -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - - The farmer contact the offer is from
contract - - -Contract - - - - The complete contract, signed by us and farmer
- - -Protocol~unhandledOfferResolver - - - -
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

unhandledOfferResolved

- - - - - - -
- Triggered when an unhandled offer is handled by the -Network#unhandledOffer listener by calling the event's supplied -Network~unhandledOfferResolver -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - - The farmer contact the offer is from
contract - - -Contract - - - - The complete contract, signed by us and farmer
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/FileDemuxer.html b/Storj/core/docs/FileDemuxer.html deleted file mode 100644 index 1819260..0000000 --- a/Storj/core/docs/FileDemuxer.html +++ /dev/null @@ -1,819 +0,0 @@ - - - - - JSDoc: Class: FileDemuxer - - - - - - - - - - -
- -

Class: FileDemuxer

- - - - - - -
- -
- -

FileDemuxer(filePath, options)

- - -
- -
-
- - - - - - -

new FileDemuxer(filePath, options)

- - - - - - -
- Takes a single file read stream and outputs several output streams, used for -"shredding" a file and creating muliple out destination interfaces -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
filePath - - -String - - - - Path the file to demultiplex
options - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
shardSize - - -Number - - - - Size of each shard
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • LGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - -
Fires:
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

(static) getOptimalShardSize(fileInfo, accopt) → {Number}

- - - - - - -
- Determine the optimal shard size given an arbitrary file size in bytes -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDefaultDescription
fileInfo - - -Object - - - - - - - - - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
fileSize - - -Number - - - - The number of bytes in the given file
shardConcurrency - - -Number - - - - Num of shards uploaded at once
- -
acc - - -Number - - - - - - <optional>
- - - - - -
- - 1 - - Accumulator (number of recursions)
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- shardSize -
- - - -
-
- Type -
-
- -Number - - -
-
- - - - - - - - - - - - - -

Events

- - - - - - - -

finish

- - - - - - -
- Triggered when the demuxer has finished writing to all shards -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

shard

- - - - - - -
- Triggered when the demuxer has a shard ready to stream -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
shard - - -ReadableStream - - - - The file shard as a readable stream
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/FileMuxer.html b/Storj/core/docs/FileMuxer.html deleted file mode 100644 index 391920d..0000000 --- a/Storj/core/docs/FileMuxer.html +++ /dev/null @@ -1,699 +0,0 @@ - - - - - JSDoc: Class: FileMuxer - - - - - - - - - - -
- -

Class: FileMuxer

- - - - - - -
- -
- -

FileMuxer(options)

- - -
- -
-
- - - - - - -

new FileMuxer(options)

- - - - - - -
- Accepts multiple ordered input sources and exposes them as a single -contiguous readable stream. Used for re-assembly of shards. -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
options - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
shards - - -Number - - - - Number of total shards to be multiplexed
length - - -Number - - - - Number of total bytes of input
sourceDrainWait - - -Number - - - - Time to wait for a new input after -all inputs are drained before entire stream is consumed
sourceIdleWait - - -Number - - - - Time to wait for source to make -more data available between next read
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • LGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - -
Fires:
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

addInputSource(readable, hash, exchangeReport, bridgeClient)

- - - - - - -
- Adds an additional input stream to the multiplexer -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
readable - - -ReadableStream - - - - Readable input stream from file shard
hash - - -String - - - - Hash of the shard
exchangeReport - - -ExchangeReport - - - - Instance of exchange report
bridgeClient - - -BridgeClient - - - - An instance of bridge client for reporting
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

Events

- - - - - - - -

drain

- - - - - - -
- Triggered when the muxer has drained one of the supplied inputs -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
input - - -ReadableStream - - - - The drained input stream
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/KeyPair.html b/Storj/core/docs/KeyPair.html deleted file mode 100644 index 298272b..0000000 --- a/Storj/core/docs/KeyPair.html +++ /dev/null @@ -1,926 +0,0 @@ - - - - - JSDoc: Class: KeyPair - - - - - - - - - - -
- -

Class: KeyPair

- - - - - - -
- -
- -

KeyPair(privateKey)

- - -
- -
-
- - - - - - -

new KeyPair(privateKey)

- - - - - - -
- Represents a ECDSA key pair -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
privateKey - - -String -| - -Buffer -| - -undefined - - - - WIF encoded ECDSA private key
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • LGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

getAddress() → {String}

- - - - - - -
- Returns the bitcoin address version of the nodeID -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- address - Base58 encoded address -
- - - -
-
- Type -
-
- -String - - -
-
- - - - - - - - - - - - - -

getNodeID() → {String}

- - - - - - -
- Returns the NodeID derived from the public key -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- nodeID - RIPEMD160 hash of public key -
- - - -
-
- Type -
-
- -String - - -
-
- - - - - - - - - - - - - -

getPrivateKey() → {String}

- - - - - - -
- Returns the private key -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- key -
- - - -
-
- Type -
-
- -String - - -
-
- - - - - - - - - - - - - -

getPublicKey() → {String}

- - - - - - -
- Returns the public key -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- key -
- - - -
-
- Type -
-
- -String - - -
-
- - - - - - - - - - - - - -

sign(message, options) → {String}

- - - - - - -
- Signs the supplied message with the private key -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
message - - -String -| - -Buffer - - - - The message to sign
options - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDefaultDescription
compact - - -Boolean - - - - - - <optional>
- - - - - -
- - true - - Compact signature format
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- signature -
- - - -
-
- Type -
-
- -String - - -
-
- - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/KeyRing.html b/Storj/core/docs/KeyRing.html deleted file mode 100644 index 57007a5..0000000 --- a/Storj/core/docs/KeyRing.html +++ /dev/null @@ -1,2237 +0,0 @@ - - - - - JSDoc: Class: KeyRing - - - - - - - - - - -
- -

Class: KeyRing

- - - - - - -
- -
- -

KeyRing(keyRingDir, passPhraseopt)

- - -
- -
-
- - - - - - -

new KeyRing(keyRingDir, passPhraseopt)

- - - - - - -
- A DataCipherKeyIv factory with file system persistence -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDefaultDescription
keyRingDir - - -String - - - - - - - - - - - - Path to store keyring directory
passPhrase - - -String - - - - - - <optional>
- - - - - -
- - '' - - Passphrase to encrypt/decrypt keyring
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • LGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

del(keyId)

- - - - - - -
- Delete the keyring file from disk -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
keyId - - -String - - - - Arbitrary key ID to delete
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

deleteDeterministicKey()

- - - - - - -
- Delete deterministic key from disk -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

export(outPath, callback)

- - - - - - -
- Export Keyring to compressed tarball -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
outPath - - -String - - - - Path to keyring to be compressed
callback - - -function - - - - Called when tarball has been written
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

exportMnemonic() → {String|null}

- - - - - - -
- Export mnemonic from KeyRing -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -String -| - -null - - -
-
- - - - - - - - - - - - - -

generate(keyId) → {KeyPair}

- - - - - - -
- Returns the stored KeyPair for the given id -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
keyId - - -String - - - - Generate a key for use with the given ID
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -KeyPair - - -
-
- - - - - - - - - - - - - -

generateBucketKey(bucketId) → {String|null}

- - - - - - -
- Retrieve the bucketKey -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
bucketId - - -String - - - - bucket id
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -String -| - -null - - -
-
- - - - - - - - - - - - - -

generateDeterministicKey()

- - - - - - -
- Generate and save deterministic key to disk -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

generateFileKey(bucketId, fileId) → {DataCipherKeyIv}

- - - - - - -
- Retrieve the fileKey -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
bucketId - - -String - - - - bucket id
fileId - - -String - - - - file id
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -DataCipherKeyIv - - -
-
- - - - - - - - - - - - - -

get(keyId) → {DataCipherKeyIv|DeterministicKeyIv|null}

- - - - - - -
- Returns the stored KeyPair for the given id -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
keyId - - -String - - - - Arbitrary key ID to load
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -DataCipherKeyIv -| - -DeterministicKeyIv -| - -null - - -
-
- - - - - - - - - - - - - -

import(inPath, passPhrase, overwriteConflictingIdsopt, callback)

- - - - - - -
- Import to Keyring from compressed tarball -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDefaultDescription
inPath - - -String - - - - - - - - - - - - Path to tarball to be imported
passPhrase - - -String - - - - - - - - - - - - Passphrase used to decrypt the imported tar
overwriteConflictingIds - - -Boolean - - - - - - <optional>
- - - - - -
- - false - - Overwrite conflicting key
callback - - -function - - - - - - - - - - - - Called on import finish
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

importMnemonic(mnemonic)

- - - - - - -
- Import mnemonic into KeyRing -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
mnemonic - - -String - - - - Mnemonic to transfer
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

reset(passPhrase, callback)

- - - - - - -
- Resets the keyring password -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
passPhrase - - -String - - - - New passphrase for keyring
callback - - -function - - - - Called on keyring password reset
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

set(keyId, dataCipherKey)

- - - - - - -
- Returns the stored KeyPair for the given id -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
keyId - - -String - - - - Arbitrary key ID to load
dataCipherKey - - -DataCipherKeyIv -| - -DeterministicKeyIv - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/Monitor.html b/Storj/core/docs/Monitor.html deleted file mode 100644 index 619a3d7..0000000 --- a/Storj/core/docs/Monitor.html +++ /dev/null @@ -1,1353 +0,0 @@ - - - - - JSDoc: Class: Monitor - - - - - - - - - - -
- -

Class: Monitor

- - - - - - -
- -
- -

Monitor(network, options)

- - -
- -
-
- - - - - - -

new Monitor(network, options)

- - - - - - -
- Wraps a Network instance and provides events for gathering -statistics about node operation -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
network - - -Network - - - - The network interface to monitor
options - - -Object - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • AGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

(static) getConnectedPeers(source, callback)

- - - - - - -
- Gets the list of currently known Contacts -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
source - - -Network - - - - The network instance to use
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

(static) getContractsDetails(source, callback)

- - - - - - -
- Gets the total contracts stored -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
source - - -Network - - - - The network instance to use
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

(static) getDiskUtilization(source, callback)

- - - - - - -
- Gets the amount of used space compared to amount shared -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
source - - -Network - - - - The network instance to use
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

(static) getPaymentAddressBalances(source, callback)

- - - - - - -
- Gets the balance of SJCX/SJCT from a FarmerInterface -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
source - - -Network - - - - The network instance to use
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

getSnapshot() → {Object}

- - - - - - -
- Returns the current snapshot -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- snapshot -
- - - -
-
- Type -
-
- -Object - - -
-
- - - - - - - - - - - - - -

start() → {Monitor}

- - - - - - -
- Starts the network monitor -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Monitor - - -
-
- - - - - - - - - - - - - -

stop() → {Monitor}

- - - - - - -
- Stops the network monitor -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Monitor - - -
-
- - - - - - - - - - - - - -

Events

- - - - - - - -

update

- - - - - - -
- Triggered when a valid offer is received, but we are not waiting for one -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
stats - - -Object - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/Network.html b/Storj/core/docs/Network.html deleted file mode 100644 index 3802ce6..0000000 --- a/Storj/core/docs/Network.html +++ /dev/null @@ -1,2795 +0,0 @@ - - - - - JSDoc: Class: Network - - - - - - - - - - -
- -

Class: Network

- - - - - - -
- -
- -

Network(options)

- - -
- -
-
- - - - - - -

new Network(options)

- - - - - - -
- Storj network interface -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
options - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
hdKey - - -String - - - - - - <optional>
- - - - - -
Extended SIP32 private key at 'group index'
hdIndex - - -Number - - - - - - <optional>
- - - - - -
Derivation index for hdKey
keyPair - - -KeyPair - - - - - - <optional>
- - - - - -
Node's cryptographic identity
storageManager - - -StorageManager - - - - - - - - - - Storage manager backend
bridgeUri - - -String - - - - - - - - - - URL for bridge server seed lookup
logger - - -Object - - - - - - - - - - Logger instance
seedList - - -Array - - - - - - - - - - List of seed URIs to join
rpcAddress - - -String - - - - - - - - - - Public node IP or hostname
rpcPort - - -Number - - - - - - - - - - Listening port for RPC
listenPort - - -Number - - - - - - - - - - Optional different listening port for RPC to bind to
doNotTraverseNat - - -Boolean - - - - - - - - - - Skip NAT traversal strategies
maxTunnels - - -Number - - - - - - - - - - Max number of tunnels to provide
maxConnections - - -Number - - - - - - - - - - Max concurrent connections
tunnelGatewayRange - - -Object - - - - - - - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
min - - -Number - - - - Min port for gateway bind
max - - -Number - - - - Max port for gateway bind
- -
joinRetry - - -Object - - - - - - <optional>
- - - - - -
-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
times - - -Number - - - - - - <optional>
- - - - - -
Times to retry joining net
interval - - -Number - - - - - - <optional>
- - - - - -
MS to wait before retrying
- -
- -
- - - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
keyPair - - -KeyPair - - - -
storageManager - - -StorageManager - - - -
node - - -kad.Node - - - - The underlying DHT node
triggerManager - - -TriggerManager - - - -
bridgeClient - - -BridgeClient - - - -
contact - - -Contact - - - -
transportAdapter - - -Transport - - - -
router - - -kad.Router - - - - The underlying DHT router
shardServer - - -ShardServer - - - -
offerManager - - -OfferManager - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • AGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - -
Fires:
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

connect(uri, callback)

- - - - - - -
- Connects to the node at the given URI -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
uri - - -String - - - - The storj protocol URI to connect
callback - - -function - - - - Called on connection or error
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

join(callback)

- - - - - - -
- Opens the connection to the network -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - - Called on successful network join
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

leave(callback)

- - - - - - -
- Disconnects from the network -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - - Called when successful disconnect
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

ping(neighbor, callback)

- - - - - - -
- Will ping a neighbor -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
neighbor - - -String - - - - A contact
callback - - -function - - - - Called on connection or error
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

publish(topic, contents, options)

- - - - - - -
- Publishes a topic with content to the network -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
topic - - -String - - - - The serialized opcode topic
contents - - -Object - - - - Arbitrary publication contents
options - - -Object - - - - Options to pass to kad-quasar
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

subscribe(topic, handler)

- - - - - - -
- Subscribes to a topic on the network -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
topic - - -String - - - - The serialized opcode topic
handler - - -Object - - - - Function to handle received publications
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

Events

- - - - - - - -

connected

- - - - - - -
- Triggered when the node has entered the overlay network -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

disconnected

- - - - - - -
- Triggered when the node has exited the overlay network -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

error

- - - - - - -
- Triggered when an error occurs -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

ready

- - - - - - -
- Triggered when the transport's network interface is ready -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

unhandledOffer

- - - - - - -
- Triggered when a valid offer is received, but we are not waiting for one -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - - The farmer contact the offer is from
contract - - -Contract - - - - The complete contract, signed by us and farmer
- - -Protocol~unhandledOfferResolver - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

unhandledOfferResolved

- - - - - - -
- Triggered when an unhandled offer is handled by the -Network#unhandledOffer listener by calling the event's supplied -Network~unhandledOfferResolver -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - - The farmer contact the offer is from
contract - - -Contract - - - - The complete contract, signed by us and farmer
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/OfferManager.html b/Storj/core/docs/OfferManager.html deleted file mode 100644 index b91c676..0000000 --- a/Storj/core/docs/OfferManager.html +++ /dev/null @@ -1,607 +0,0 @@ - - - - - JSDoc: Class: OfferManager - - - - - - - - - - -
- -

Class: OfferManager

- - - - - - -
- -
- -

OfferManager()

- - -
- -
-
- - - - - - -

new OfferManager()

- - - - - - -
- Simple management of a collection of OfferStreams that are keyable -by their associated Contract's data hash -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

addStream(offerStream)

- - - - - - -
- Adds the offer stream to the manager -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
offerStream - - -OfferStream - - - - The OfferStream to manage
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

getStream(dataHash) → {OfferStream|null}

- - - - - - -
- Returns the stream at the given key -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
dataHash - - -String - - - - The hash of the contract's data
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -OfferStream -| - -null - - -
-
- - - - - - - - - - - - - -

removeStream(dataHash)

- - - - - - -
- Removes the stream at the given key -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
dataHash - - -String - - - - The hash of the contract's data
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/OfferStream.html b/Storj/core/docs/OfferStream.html deleted file mode 100644 index 00fbbd7..0000000 --- a/Storj/core/docs/OfferStream.html +++ /dev/null @@ -1,1068 +0,0 @@ - - - - - JSDoc: Class: OfferStream - - - - - - - - - - -
- -

Class: OfferStream

- - - - - - -
- -
- -

OfferStream(contract, optionsopt)

- - -
- -
-
- - - - - - -

new OfferStream(contract, optionsopt)

- - - - - - -
- Manages a stream of offers for a given storage contract publication -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
contract - - -Contract - - - - - - - - - - Storage contract published to network
options - - -Object - - - - - - <optional>
- - - - - -
-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
maxOffers - - -Number - - - - - - <optional>
- - - - - -
Maximum number of offers to process
farmerBlacklist - - -Array.<String> - - - - - - <optional>
- - - - - -
Reject offers from nodeID
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

addOfferToQueue(contact, contract) → {Boolean}

- - - - - - -
- Adds the offer to the internal queue if there is room -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - - The sending farmer for the offer
contract - - -Contract - - - - The received offer contract
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- didAddOfferToQueue -
- - - -
-
- Type -
-
- -Boolean - - -
-
- - - - - - - - - - - - - -

destroy()

- - - - - - -
- Tears down listeners and ends the stream -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

Events

- - - - - - - -

data

- - - - - - -
- Triggered when an offer is received -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
data - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - - The sending farmer for the offer
contract - - -Contract - - - - The received offer contract
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

end

- - - - - - -
- Triggered when the maximum number of offers are received and processed -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

error

- - - - - - -
- Triggered if an error occurs -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
error - - -Error - - - - The error object with message
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/ProofStream.html b/Storj/core/docs/ProofStream.html deleted file mode 100644 index 03d4913..0000000 --- a/Storj/core/docs/ProofStream.html +++ /dev/null @@ -1,356 +0,0 @@ - - - - - JSDoc: Class: ProofStream - - - - - - - - - - -
- -

Class: ProofStream

- - - - - - -
- -
- -

ProofStream(merkleLeaves, hexChallenge)

- - -
- -
-
- - - - - - -

new ProofStream(merkleLeaves, hexChallenge)

- - - - - - -
- Provides interface for proving possession of a file for an -AuditStream -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
merkleLeaves - - -Array - - - - Bottom leaves of the audit merkle tree
hexChallenge - - -String - - - - The challenge data in hex to prepend to shard
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • LGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

getProofResult() → {Array}

- - - - - - -
- Returns the generated proof structure -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Array - - -
-
- - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/Protocol.html b/Storj/core/docs/Protocol.html deleted file mode 100644 index 7ca02d5..0000000 --- a/Storj/core/docs/Protocol.html +++ /dev/null @@ -1,5070 +0,0 @@ - - - - - JSDoc: Class: Protocol - - - - - - - - - - -
- -

Class: Protocol

- - - - - - -
- -
- -

Protocol(options)

- - -
- -
-
- - - - - - -

new Protocol(options)

- - - - - - -
- Defines the Storj protocol methods and mounts on a Network instance -to handle Storj protocol messages -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
options - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
network - - -Network - - - - Network instance to bind to
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • AGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

getRouteMap() → {Object}

- - - - - - -
- Returns bound references to the protocol handlers -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- handlers -
- - - -
-
- Type -
-
- -Object - - -
-
- - - - - - - - - - - - - -

handleAudit(params, callback)

- - - - - - -
- Handles AUDIT messages -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
params - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - - Sender contact information
audits - - -Array.<Object> - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
data_hash - - -String - - - - Shard data hash to audit
challenge - - -String - - - - Challenge string for audit
- -
- -
callback - - -Protocol~handleAuditCallback - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

handleConsign(params, callback)

- - - - - - -
- Handles CONSIGN messages -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
params - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - - Sender contact information
data_hash - - -String - - - - Shard data hash (contract key)
audit_tree - - -Array.<String> - - - - Bottom leaves of audit merkle tree
- -
callback - - -Protocol~handleConsignCallback - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

handleFindTunnel(params, callback)

- - - - - - -
- Handles FIND_TUNNEL messages -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
params - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - - Sender contact information
relayers - - -Array.<Contact> - - - - List of contacts who have already -relayed the FIND_TUNNEL request
- -
callback - - -Protocol~handleFindTunnelCallback - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

handleMirror(params, callback)

- - - - - - -
- Handles MIRROR messages -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
params - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - - Sender contact information
data_hash - - -String - - - - Shard hash to mirror
token - - -String - - - - Data channel authorization token
farmer - - -Contact - - - - The farmer to transfer data from
- -
callback - - -Protocol~handleMirrorCallback - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

handleOffer(params, callback)

- - - - - - -
- Handles OFFER messages -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
params - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - - Sender contact information
contract - - -Contract - - - - Serialized contract data
- -
callback - - -Protocol~handleOfferCallback - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - -
Fires:
- - - - - - - - - - - - - - - - - - - - - - - -

handleOpenTunnel(params, callback)

- - - - - - -
- Handles OPEN_TUNNEL messages -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
params - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - - Sender contact information
- -
callback - - -Protocol~handleOpenTunnelCallback - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

handleProbe(params, callback)

- - - - - - -
- Handles PROBE messages -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
params - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - - Sender contact information
- -
callback - - -Protocol~handleProbeCallback - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

handleRenew(params, callback)

- - - - - - -
- Handles RENEW messages -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
params - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - - Sender contact information
renter_id - - -String - - - - Renter nodeID of the original contract
renter_signature - - -String - - - - Contract signature from original -node ID
contract - - -Object - - - - Updated contract data
- -
callback - - -Protocol~handleRenewCallback - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - -
See:
-
- -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

handleRetrieve(params, callback)

- - - - - - -
- Handles RETRIEVE messages -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
params - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - - Sender contact information
data_hash - - -String - - - - RMD160(SHA256(shard_data))
- -
callback - - -Protocol~handleRetrieveCallback - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

handleTrigger(params, callback)

- - - - - - -
- Handles TRIGGER messages -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
params - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
behavior - - -String - - - - Trigger behavior name to process
contents - - -Object - - - - Trigger content payload
contact - - -Contact - - - - Sender contact information
- -
callback - - -Protocol~handleTriggerCallback - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - -
See:
-
- -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - -

Type Definitions

- - - - - - - -

handleAuditCallback(err, result)

- - - - - - - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
err - - -Error -| - -null - - - -
result - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
proofs - - -Array.<Array> - - - - Mapped list of proof responses
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

handleConsignCallback(err, result)

- - - - - - - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
err - - -Error -| - -null - - - -
result - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
token - - -String - - - - Data channel authorization token
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

handleFindTunnelCallback(err, result)

- - - - - - - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
err - - -Error -| - -null - - - -
result - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
tunnels - - -Array.<Contact> - - - - List of known tunnelers
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

handleMirrorCallback(err, result)

- - - - - - - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
err - - -Error -| - -null - - - -
result - - -Object - - - - Empty acknowledgement
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

handleOfferCallback(err, result)

- - - - - - - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
err - - -Error -| - -null - - - -
result - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contract - - -Contract - - - - Signed contract
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

handleOpenTunnelCallback(err, result)

- - - - - - - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
err - - -Error -| - -null - - - -
result - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
tunnel - - -String - - - - WebSocket URI including auth token
alias - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
address - - -String - - - - Gateway address on the tunneler
port - - -Number - - - - Gateway port on the tunneler
- -
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

handleProbeCallback(err, result)

- - - - - - - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
err - - -Error -| - -null - - - -
result - - -Object - - - - Empty acknowledgement
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

handleRenewCallback(err, result)

- - - - - - - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
err - - -Error -| - -null - - - -
result - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contract - - -Object - - - - Signed updated contract
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

handleRetrieveCallback(err, result)

- - - - - - - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
err - - -Error -| - -null - - - -
result - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
token - - -String - - - - Authorization token for data channel
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

handleTriggerCallback(err, result)

- - - - - - - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
err - - -Error -| - -null - - - -
result - - -Object - - - - Arbitrary key-value pairs
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

unhandledOfferResolver(erroropt)

- - - - - - - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
error - - -Error - - - - - - <optional>
- - - - - -
An error if the offer cannot be resolved
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/RAMStorageAdapter.html b/Storj/core/docs/RAMStorageAdapter.html deleted file mode 100644 index cfb6bac..0000000 --- a/Storj/core/docs/RAMStorageAdapter.html +++ /dev/null @@ -1,2259 +0,0 @@ - - - - - JSDoc: Class: RAMStorageAdapter - - - - - - - - - - -
- -

Class: RAMStorageAdapter

- - - - - - -
- -
- -

RAMStorageAdapter()

- - -
- -
-
- - - - - - -

new RAMStorageAdapter()

- - - - - - -
- Implements an in-memory storage adapter -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • AGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - -

Extends

- - - - - - - - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

(abstract) _close(callback)

- - - - - - -
- Closes the storage adapter -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - - Called on complete
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

(abstract) _open(callback)

- - - - - - -
- Opens the storage adapter -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - - Called on complete
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

(abstract) _size(callback)

- - - - - - -
- Returns the number of bytes stored -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - - Called on complete
- - - - - - -
- - - - - - - - -
Overrides:
-
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

createReadStream() → {ReadableStream}

- - - - - - -
- Calls the implemented StorageAdapter#_keys and returns a readable -stream containing each stored item -
- - - - - - - - - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -ReadableStream - - -
-
- - - - - - - - - - - - - -

del(key, callback)

- - - - - - -
- Calls the implemented StorageAdapter#_del -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -String - - - - Shard hash to delete the data for
callback - - -function - - - - Called with error or StorageItem
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

flush(callback)

- - - - - - -
- Calls the implemented StorageAdapter#_flush -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - - Called with error or null
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

get(key, callback)

- - - - - - -
- Calls the implemented StorageAdapter#_get and validates the result -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -String - - - - Shard hash to get metadata for
callback - - -function - - - - Called with error or StorageItem
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

peek(key, callback)

- - - - - - -
- Calls the implemented StorageAdapter#_peek and validates the result -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -String - - - - Shard hash to get metadata for
callback - - -function - - - - Called with error or StorageItem
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

put(item, callback)

- - - - - - -
- Calls the implemented StorageAdapter#_put and validates the input -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
item - - -StorageItem - - - - Item to write to storage
callback - - -function - - - - Called on complete write
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

size(keyopt, callback)

- - - - - - -
- Calls the implemented StorageAdapter#_size -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
key - - -String - - - - - - <optional>
- - - - - -
Optional file key
callback - - -function - - - - - - - - - - Called with error or number of bytes stored
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

Events

- - - - - - - -

add

- - - - - - -
- Triggered when a new item is added -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
item - - -StorageItem - - - -
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

delete

- - - - - - -
- Triggered when an item is deleted -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
item - - -StorageItem - - - -
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

ready

- - - - - - -
- Triggered when the adapter is ready -
- - - - - - - - - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

update

- - - - - - -
- Triggered when an existing item is updated -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
itemBeforeUpdate - - -StorageItem - - - -
itemAfterUpdate - - -StorageItem - - - -
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/RenterInterface.html b/Storj/core/docs/RenterInterface.html deleted file mode 100644 index c0c1878..0000000 --- a/Storj/core/docs/RenterInterface.html +++ /dev/null @@ -1,4698 +0,0 @@ - - - - - JSDoc: Class: RenterInterface - - - - - - - - - - -
- -

Class: RenterInterface

- - - - - - -
- -
- -

RenterInterface(options)

- - -
- -
-
- - - - - - -

new RenterInterface(options)

- - - - - - -
- Creates and a new renter interface -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
options - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
hdKey - - -String - - - - - - <optional>
- - - - - -
Extended key at 'group index' as per SIP32
hdIndex - - -Number - - - - - - <optional>
- - - - - -
Derivation index for hdKey
keyPair - - -KeyPair - - - - - - <optional>
- - - - - -
Node's cryptographic identity
storageManager - - -StorageManager - - - - - - - - - - Storage manager backend
bridgeUri - - -String - - - - - - - - - - URL for bridge server seed lookup
logger - - -Object - - - - - - - - - - Logger instance
seedList - - -Array - - - - - - - - - - List of seed URIs to join
rpcAddress - - -String - - - - - - - - - - Public node IP or hostname
rpcPort - - -Number - - - - - - - - - - Listening port for RPC
doNotTraverseNat - - -Boolean - - - - - - - - - - Skip NAT traversal strategies
maxTunnels - - -Number - - - - - - - - - - Max number of tunnels to provide
tunnelServerPort - - -Number - - - - - - - - - - Port for tunnel server to use
tunnelGatewayRange - - -Object - - - - - - - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
min - - -Number - - - - Min port for gateway bind
max - - -Number - - - - Max port for gateway bind
- -
rateLimiterOpts - - -Object - - - - - - - - - - Options for RateLimiter
joinRetry - - -Object - - - - - - <optional>
- - - - - -
-
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
times - - -Number - - - - - - <optional>
- - - - - -
Times to retry joining net
interval - - -Number - - - - - - <optional>
- - - - - -
MS to wait before retrying
- -
- -
- - - - - - -
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
keyPair - - -KeyPair - - - -
storageManager - - -StorageManager - - - -
node - - -kad.Node - - - - The underlying DHT node
triggerManager - - -TriggerManager - - - -
bridgeClient - - -BridgeClient - - - -
contact - - -Contact - - - -
transportAdapter - - -Transport - - - -
router - - -kad.Router - - - - The underlying DHT router
dataChannelServer - - -DataChannelServer - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • AGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - -
Fires:
- - - - - - - - - - - - - - - - - - -
- - -

Extends

- - - - - - - - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

connect(uri, callback)

- - - - - - -
- Connects to the node at the given URI -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
uri - - -String - - - - The storj protocol URI to connect
callback - - -function - - - - Called on connection or error
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

getConsignmentPointer(farmer, contract, audit, callback)

- - - - - - -
- Requests a consignment pointer from the given farmer for opening a -DataChannelClient for transferring the the data shard to the farmer -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
farmer - - -Contact - - - - The farmer contact object for requesting token
contract - - -Contract - - - - The storage contract for this consignment
audit - - -AuditStream - - - - The audit object for merkle leaves
callback - - -RenterInterface~getConsignmentPointerCallback - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

getMirrorNodes(sources, destinations, callback)

- - - - - - -
- Requests that the given destination farmers mirror the data from the sources -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
sources - - -Array.<Object> - - - - Pointers for each destination
destinations - - -Array.<Contact> - - - - The farmers to replicate to
callback - - -RenterInterface~getMirrorNodesCallback - - - - Results handler
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

getOfferStream(contract, offerStreamOptionsopt) → {OfferStream}

- - - - - - -
- Creates a readable stream of offers for the storage contract -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
contract - - -Contract - - - - - - - - - - The storage contract to publish
offerStreamOptions - - -Object - - - - - - <optional>
- - - - - -
Options passed to OfferStream
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- offerStream -
- - - -
-
- Type -
-
- -OfferStream - - -
-
- - - - - - - - - - - - - -

getRetrievalPointer(farmer, contract, callback)

- - - - - - -
- Requests a retrieval token from the given farmer for opening a -DataChannelClient for transferring the data shard from the farmer -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
farmer - - -Contact - - - - The farmer contact object for requesting token
contract - - -Contract - - - - The storage contract for this consignment
callback - - -RenterInterface~getRetrievalPointerCallback - - - - Token handler
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

getStorageProof(farmer, item, callback)

- - - - - - -
- Issues an audit request to the given farmer for the data and returns the -ProofStream#getProofResult structure for verification. -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
farmer - - -Contact - - - - Farmer contact from which proof is needed
item - - -StorageItem - - - - The storage item on which to perform the audit
callback - - -RenterInterface~getStorageProofCallback - - - - Proof handler
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

join(callback)

- - - - - - -
- Opens the connection to the network -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - - Called on successful network join
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

leave(callback)

- - - - - - -
- Disconnects from the network -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - - Called when successful disconnect
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

ping(neighbor, callback)

- - - - - - -
- Will ping a neighbor -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
neighbor - - -String - - - - A contact
callback - - -function - - - - Called on connection or error
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

publish(topic, contents, options)

- - - - - - -
- Publishes a topic with content to the network -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
topic - - -String - - - - The serialized opcode topic
contents - - -Object - - - - Arbitrary publication contents
options - - -Object - - - - Options to pass to kad-quasar
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

subscribe(topic, handler)

- - - - - - -
- Subscribes to a topic on the network -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
topic - - -String - - - - The serialized opcode topic
handler - - -Object - - - - Function to handle received publications
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -

Type Definitions

- - - - - - - -

getConsignmentPointerCallback(err, pointer)

- - - - - - -
- This callback is called upon receipt of a consignment token from -RenterInterface#getConsignmentPointer -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
err - - -Error -| - -null - - - - If requesting the token failed, an error object
pointer - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
farmer - - -Contact - - - -
hash - - -String - - - -
token - - -String - - - -
operation - - -String - - - -
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

getMirrorNodesCallback(err, results)

- - - - - - -
- This callback is called upon acknowledgement of a mirror request -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
err - - -Error -| - -null - - - - If requesting all mirrors failed, an error object
results - - -Array.<Contact> - - - - The farmers who successfully mirrored
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

getRetrievalPointerCallback(err, pointer)

- - - - - - -
- This callback is called upon receipt of a retrieval token from -RenterInterface#getRetrieveToken -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
err - - -Error -| - -null - - - - If requesting the token failed, an error object
pointer - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
farmer - - -Contact - - - -
hash - - -String - - - -
token - - -String - - - -
operation - - -String - - - -
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

getStorageProofCallback(err, proof)

- - - - - - -
- This callback is called upon receipt of an audit proof from -RenterInterface#getStorageProof -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
err - - -Error -| - -null - - - - If requesting the proof failed, an error object
proof - - -Array - - - - Result from ProofStream#getProofResult
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -

Events

- - - - - - - -

connected

- - - - - - -
- Triggered when the node has entered the overlay network -
- - - - - - - - - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

disconnected

- - - - - - -
- Triggered when the node has exited the overlay network -
- - - - - - - - - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

error

- - - - - - -
- Triggered when an error occurs -
- - - - - - - - - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

ready

- - - - - - -
- Triggered when the transport's network interface is ready -
- - - - - - - - - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

unhandledOffer

- - - - - - -
- Triggered when a valid offer is received, but we are not waiting for one -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - - The farmer contact the offer is from
contract - - -Contract - - - - The complete contract, signed by us and farmer
- - -Protocol~unhandledOfferResolver - - - -
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

unhandledOfferResolved

- - - - - - -
- Triggered when an unhandled offer is handled by the -Network#unhandledOffer listener by calling the event's supplied -Network~unhandledOfferResolver -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - - The farmer contact the offer is from
contract - - -Contract - - - - The complete contract, signed by us and farmer
- - - - - - -
- - - - - - -
Inherited From:
-
- - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/ShardServer.html b/Storj/core/docs/ShardServer.html deleted file mode 100644 index 1dcf475..0000000 --- a/Storj/core/docs/ShardServer.html +++ /dev/null @@ -1,1615 +0,0 @@ - - - - - JSDoc: Class: ShardServer - - - - - - - - - - -
- -

Class: ShardServer

- - - - - - -
- -
- -

ShardServer(options)

- - -
- -
-
- - - - - - -

new ShardServer(options)

- - - - - - -
- Creates a shard server for sending and receiving consigned file shards -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
options - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDefaultDescription
nodeID - - -String - - - - - - - - - - - - The farmer nodeID
storageManager - - -StorageManager - - - - - - - - - - - - Storage manager backend
logger - - -kad.Logger - - - - - - - - - - - - Logger to use from Network
tokenTtl - - -Number - - - - - - <optional>
- - - - - -
- - 1800000 - - Close after idle
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • AGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

accept(token, filehash, contact)

- - - - - - -
- Begin accepting data for the given file hash and token -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
token - - -String - - - - The authorization token created for transfer
filehash - - -String - - - - The shard hash to allow for the token
contact - - -Contact - - - - contact that negotiated the token
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

isAuthorized(token, hash)

- - - - - - -
- Validates the given token -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
token - - -String - - - -
hash - - -String - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

reject(token)

- - - - - - -
- Stop accepting data for the given token -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
token - - -String - - - - The authorization token created for transfer
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

routeConsignment(req, req)

- - - - - - -
- Receives the data stream and writes it to storage -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
req - - -http.IncomingMessage - - - -
req - - -http.ServerResponse - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

routeRetrieval(req, res)

- - - - - - -
- Pumps the data through to the client -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
req - - -http.IncomingMessage - - - -
res - - -http.ServerResponse - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

Events

- - - - - - - -

error

- - - - - - -
- Triggered when a error occurs -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
error - - -Error - - - - The error object
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

shardDownloaded

- - - - - - -
- Triggered when a shard has finished downloading from this instance -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
item - - -StorageItem - - - - The item associated with the download
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

shardUploaded

- - - - - - -
- Triggered when a shard has finished uploading to this instance -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
item - - -StorageItem - - - - The item associated with the upload
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/StorageAdapter.html b/Storj/core/docs/StorageAdapter.html deleted file mode 100644 index 6e460c7..0000000 --- a/Storj/core/docs/StorageAdapter.html +++ /dev/null @@ -1,3108 +0,0 @@ - - - - - JSDoc: Class: StorageAdapter - - - - - - - - - - -
- -

Class: StorageAdapter

- - - - - - -
- -
- -

StorageAdapter()

- - -
- -
-
- - - - - - -

new StorageAdapter()

- - - - - - -
- Abstract base class for storage adapter -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • AGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

(abstract) _close(callback)

- - - - - - -
- Closes the storage adapter -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - - Called on complete
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

(abstract) _del(key, callback)

- - - - - - -
- Delete the shard data at the given key -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -String - - - - Shard hash
callback - - -function - - - - Called on complete
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

(abstract) _flush(key, callback)

- - - - - - -
- Performs lookup and provides an StorageItem to the callback -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -String - - - - Shard hash
callback - - -function - - - - Called on complete
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

(abstract) _get(key, callback)

- - - - - - -
- Performs lookup and provides an StorageItem to the callback -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -String - - - - Shard hash
callback - - -function - - - - Called on complete
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

(abstract) _keys() → {ReadableStream}

- - - - - - -
- Returns the hashes of all shards stored -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -ReadableStream - - -
-
- - - - - - - - - - - - - -

(abstract) _open(callback)

- - - - - - -
- Opens the storage adapter -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - - Called on complete
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

(abstract) _peek(key, callback)

- - - - - - -
- Performs lookup and provides an StorageItem to the callback but does -not initialize any shard read/write stream -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -String - - - - Shard hash
callback - - -function - - - - Called on complete
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

(abstract) _put(key, item, callback)

- - - - - - -
- Stores the StorageItem -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -String - - - - Shard hash
item - - -Item - - - - Item to store
callback - - -function - - - - Called on complete
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

(abstract) _size(callback)

- - - - - - -
- Returns the number of bytes stored -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - - Called on complete
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

createReadStream() → {ReadableStream}

- - - - - - -
- Calls the implemented StorageAdapter#_keys and returns a readable -stream containing each stored item -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -ReadableStream - - -
-
- - - - - - - - - - - - - -

del(key, callback)

- - - - - - -
- Calls the implemented StorageAdapter#_del -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -String - - - - Shard hash to delete the data for
callback - - -function - - - - Called with error or StorageItem
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

flush(callback)

- - - - - - -
- Calls the implemented StorageAdapter#_flush -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - - Called with error or null
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

get(key, callback)

- - - - - - -
- Calls the implemented StorageAdapter#_get and validates the result -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -String - - - - Shard hash to get metadata for
callback - - -function - - - - Called with error or StorageItem
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

peek(key, callback)

- - - - - - -
- Calls the implemented StorageAdapter#_peek and validates the result -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -String - - - - Shard hash to get metadata for
callback - - -function - - - - Called with error or StorageItem
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

put(item, callback)

- - - - - - -
- Calls the implemented StorageAdapter#_put and validates the input -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
item - - -StorageItem - - - - Item to write to storage
callback - - -function - - - - Called on complete write
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

size(keyopt, callback)

- - - - - - -
- Calls the implemented StorageAdapter#_size -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
key - - -String - - - - - - <optional>
- - - - - -
Optional file key
callback - - -function - - - - - - - - - - Called with error or number of bytes stored
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

Events

- - - - - - - -

add

- - - - - - -
- Triggered when a new item is added -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
item - - -StorageItem - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

delete

- - - - - - -
- Triggered when an item is deleted -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
item - - -StorageItem - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

ready

- - - - - - -
- Triggered when the adapter is ready -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

update

- - - - - - -
- Triggered when an existing item is updated -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
itemBeforeUpdate - - -StorageItem - - - -
itemAfterUpdate - - -StorageItem - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/StorageItem.html b/Storj/core/docs/StorageItem.html deleted file mode 100644 index 0bf9e9e..0000000 --- a/Storj/core/docs/StorageItem.html +++ /dev/null @@ -1,1399 +0,0 @@ - - - - - JSDoc: Class: StorageItem - - - - - - - - - - -
- -

Class: StorageItem

- - - - - - -
- -
- -

StorageItem(data)

- - -
- -
-
- - - - - - -

new StorageItem(data)

- - - - - - -
- Represents a storage item, including contracts, challenges, the shard itself -along with metadata describing download count, payments, etc -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
data - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
hash - - -String -| - -null - - - - Shard hash to use as storage key
shard - - -Stream -| - -null - - - - Raw binary blob of shard
contracts - - -Object - - - - Dictionary of nodeID:Contract
trees - - -Object - - - - Dictionary of nodeID:merkleLeaves
challenges - - -Object - - - - Dictionary of nodeID:privateAuditData
meta - - -Object - - - - Dictionary of arbitrary nodeID:metadata
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • AGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

addAuditRecords(contact, audit)

- - - - - - -
- Adds the trees and challenges to the item keyed by nodeID -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - - The contact associated with the trees
audit - - -Audit -| - -AuditStream - - - - The audit or challenge generator
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

addContract(contact, contract)

- - - - - - -
- Adds the contract data keyed by nodeID and hdKey -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - - The contact associated with the trees
contract - - -Contract - - - - The storage contract instance
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

addMetaData(contact, meta)

- - - - - - -
- Adds the meta data keyed by nodeID -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - - The contact associated with the trees
meta - - -Object - - - - Arbitrary metadata about the shard
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

getContract(contact, contract) → {Contract|Boolean}

- - - - - - -
- Gets a contract data by a contact based on the hdKey or the nodeID -of the contact. It will return false if the contract is not found for the -contact, which will indicate that the contact is not authorized for -that specific contract. -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - - The contact associated with the trees
contract - - -Contract - - - - The storage contract instance
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Contract -| - -Boolean - - -
-
- - - - - - - - - - - - - -

removeContract(contact) → {Boolean}

- - - - - - -
- Deletes the contract for the given contact -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- didRemoveContract -
- - - -
-
- Type -
-
- -Boolean - - -
-
- - - - - - - - - - - - - -

toObject()

- - - - - - -
- Returns a plain object representation of the item -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

updateTimestamp()

- - - - - - -
- Updates the timestamp for the item -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/StorageManager.html b/Storj/core/docs/StorageManager.html deleted file mode 100644 index f7fee4f..0000000 --- a/Storj/core/docs/StorageManager.html +++ /dev/null @@ -1,1115 +0,0 @@ - - - - - JSDoc: Class: StorageManager - - - - - - - - - - -
- -

Class: StorageManager

- - - - - - -
- -
- -

StorageManager(storage, options)

- - -
- -
-
- - - - - - -

new StorageManager(storage, options)

- - - - - - -
- Interface for managing contracts, shards, and audits -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
storage - - -StorageAdapter - - - - Storage adapter to use
options - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeAttributesDescription
disableReaper - - -Boolean - - - - - - - - - - Don't perform periodic reaping of -stale contracts
logger - - -Object - - - - - - <optional>
- - - - - -
Logger to use for debugging
maxCapacity - - -Number - - - - - - - - - - Max number of bytes to allow in storage
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • AGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - -

Extends

- - - - -
    -
  • EventEmitter
  • -
- - - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

clean(callback)

- - - - - - -
- Enumerates all storage contracts and reaps stale data -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - - Called on complete
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

close(callback)

- - - - - - -
- Closes the underlying storage adapter -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - - Called on complete
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

load(hash, callback)

- - - - - - -
- Loads the storage Item at the given key -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
hash - - -String - - - - Shard hash to load data for
callback - - -function - - - - Called with error or StorageItem
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

open(callback)

- - - - - - -
- Opens the underlying storage adapter -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - - Called on complete
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

save(item, callback)

- - - - - - -
- Saves the storage StorageItem at the given key -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
item - - -StorageItem - - - - The StorageItem to store
callback - - -function - - - - Called on complete
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/StorageMigration.html b/Storj/core/docs/StorageMigration.html deleted file mode 100644 index d97b66a..0000000 --- a/Storj/core/docs/StorageMigration.html +++ /dev/null @@ -1,425 +0,0 @@ - - - - - JSDoc: Class: StorageMigration - - - - - - - - - - -
- -

Class: StorageMigration

- - - - - - -
- -
- -

StorageMigration(source, target)

- - -
- -
-
- - - - - - -

new StorageMigration(source, target)

- - - - - - -
- Migrates data stored with one StorageAdapter to another -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
source - - -StorageAdapter - - - - The source adapter
target - - -StorageAdapter - - - - The migration destination
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • AGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

start()

- - - - - - -
- Starts the migration process -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

stop()

- - - - - - -
- Stops the migration process -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/Transport.html b/Storj/core/docs/Transport.html deleted file mode 100644 index f23765f..0000000 --- a/Storj/core/docs/Transport.html +++ /dev/null @@ -1,943 +0,0 @@ - - - - - JSDoc: Class: Transport - - - - - - - - - - -
- -

Class: Transport

- - - - - - -
- -
- -

Transport(contact, options)

- - -
- -
-
- - - - - - -

new Transport(contact, options)

- - - - - - -
- Custom HTTP transport adapter -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -kad.Contact - - - - Contact object to binding to port
options - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
logger - - -Logger - - - - Logger for diagnositcs
maxTunnels - - -Number - - - - Number of tunnels to provide to network
doNotTraverseNat - - -Boolean - - - - Do not try to punch out of NAT
tunnelGatewayRange - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
min - - -Number - - - - Min port for gateway bind
max - - -Number - - - - Max port for gateway bind
- -
listenPort - - -Number - - - - Different port for the server to listen on (optional)
storageManager - - -StorageManager - - - -
bridgeClient - - -BridgeClient - - - -
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • AGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

createPortMapping(port, callback)

- - - - - - -
- Creates a port mapping with UPnP -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
port - - -Number - - - - The port to forward
callback - - -function - - - - Callback function
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

send(contact, message, callback)

- - - - - - -
- Sends the RPC message to the given contact -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - -
message - - -kad.Message - - - -
callback - - -function - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

Events

- - - - - - - -

connectionLimitReached

- - - - - - -
- Triggered when the max connections limit is reached -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/TriggerManager.html b/Storj/core/docs/TriggerManager.html deleted file mode 100644 index 11cd963..0000000 --- a/Storj/core/docs/TriggerManager.html +++ /dev/null @@ -1,1275 +0,0 @@ - - - - - JSDoc: Class: TriggerManager - - - - - - - - - - -
- -

Class: TriggerManager

- - - - - - -
- -
- -

TriggerManager()

- - -
- -
-
- - - - - - -

new TriggerManager()

- - - - - - -
- Implements behavior triggers as described in SIP-0003 -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • AGPL-3.0
- - - - - -
Source:
-
- - - - - -
See:
-
- -
- - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

add(nodeID, behaviors)

- - - - - - -
- Adds a trigger handler for the given nodeID and behavior -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
nodeID - - -String -| - -Array - - - - The nodeID(s) to authorize for the trigger -(supports `*` wildcard)
behaviors - - -Object - - - - Behavior name to {TriggerManager~triggerHandler}s
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

process(messageParams, callback)

- - - - - - -
- Process a received trigger message -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
messageParams - - -Object - - - - The received message params
callback - - -TriggerManager~processCallback - - - - Result of trigger process
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

remove(nodeID, behaviors)

- - - - - - -
- Removes a trigger handler for the given nodeID and behavior -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
nodeID - - -String -| - -Array - - - - The nodeID(s) to deauthorize for the trigger
behaviors - - -String -| - -Array - - - - Behavior name to unregister
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -

Type Definitions

- - - - - - - -

destroyTrigger()

- - - - - - -
- Optionally called from trigger handler to unregister the trigger handler -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

processCallback(err, params)

- - - - - - -
- Called upon the processing of a trigger message -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
err - - -Error -| - -null - - - - Optional error resulting from processing
params - - -Object - - - - Response parameters to send back
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

replyToSender(err, params)

- - - - - - -
- Passed to the trigger handler for replying to the message -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
err - - -Error -| - -null - - - - Optional error to respond with
params - - -Object - - - - Response parameters to return
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

triggerHandler(messageParams, replyToSender, destroyTrigger)

- - - - - - -
- Called when a trigger is received from authorized source -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
messageParams - - -Object - - - - The RPC message parameters
replyToSender - - -TriggerManager~replyToSender - - - - Respond to the trigger
destroyTrigger - - -TriggerManager~destroyTrigger - - - - Unregisters trigger
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/UploadState.html b/Storj/core/docs/UploadState.html deleted file mode 100644 index 3112556..0000000 --- a/Storj/core/docs/UploadState.html +++ /dev/null @@ -1,570 +0,0 @@ - - - - - JSDoc: Class: UploadState - - - - - - - - - - -
- -

Class: UploadState

- - - - - - -
- -
- -

UploadState(options)

- - -
- -
-
- - - - - - -

new UploadState(options)

- - - - - - -
- Internal state machine used by BridgeClient -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
options - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
id - - -String - - - - Bucket ID for the upload state
file - - -String - - - - Path to the file to track
numShards - - -Number - - - - The number of shards to transfer
concurrency - - -Number - - - - The number shards to transfer at once
worker - - -function - - - - The queue task processor function
onComplete - - -function - - - - Reference to callback after complete
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • LGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

cleanup()

- - - - - - -
- Unlinks the referenced tmp files -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

Events

- - - - - - - -

killed

- - - - - - -
- Triggered when the upload queue has been killed -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/Verification.html b/Storj/core/docs/Verification.html deleted file mode 100644 index 2810a89..0000000 --- a/Storj/core/docs/Verification.html +++ /dev/null @@ -1,408 +0,0 @@ - - - - - JSDoc: Class: Verification - - - - - - - - - - -
- -

Class: Verification

- - - - - - -
- -
- -

Verification(proof)

- - -
- -
-
- - - - - - -

new Verification(proof)

- - - - - - -
- Interface for verifying the result of an audit proof -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
proof - - -Array - - - - The result of ProofStream#getProofResult
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
License:
-
  • LGPL-3.0
- - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

verify(merkleRoot, totalDepth) → {Array}

- - - - - - -
- Verifies the proof given the merkle root and tree depth -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
merkleRoot - - -String - - - - Merkle root
totalDepth - - -Number - - - - Depth of merkle tree
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- result - Array with expected result and verified result -
- - - -
-
- Type -
-
- -Array - - -
-
- - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/assets/tunneling-diagram b/Storj/core/docs/assets/tunneling-diagram deleted file mode 100644 index 1213e26..0000000 --- a/Storj/core/docs/assets/tunneling-diagram +++ /dev/null @@ -1 +0,0 @@ -7R1bb6O4+tdU2vPQiEsgyeO0nc6s1O1W067mnKcjmtCEMyT0EDqd2V+/n8Gf8QUTEgxk2kRRlBjHxt/9ZnPmXq5/fEqD59UfySKMzxxr8ePMvTpznNnMgk/S8LNocG3PLVqWabQo2uyy4T76O6SN9I/Ll2gRboWOWZLEWfQsNs6TzSacZ0JbkKbJq9jtKYnFWZ+DJZ2RTkga7udBjPdRtn6NFtmKttr+rLzwOYyWKzr11PGLC4/B/NsyTV42dL4zx33KX8XldYBj0Xm3q2CRvHJN7keAa5okMDD5tv5xGcYEtgg2/F/2E+/1zL1YZesYftjwNb98rfkzXVb9n2FxabihCyum040Hl8gfvgfxCx3vLo2+B1mozLN9jdZxsIFfF6+rKAvvn4M5ufQK9CPew3McRJvzNFyoN0Nv/3uYZiEltbyJ3tynMFmHWfoTutCrYwotSoYIvFcOpVPatuKw6U1oY0DJaMlGLoEBXyg8qmGDFM8BR4EKoZRnzaIYcQeP2J3RagmSfMym6/fV9WMPfvnY1mb1Y8oPdauHfwA/E5Lg0F9FHVoI8ZAo4K2CoofFekiY5WLpPXOrhXuHKfmlBnG03MD3OawhTKHhKdlk9/QfpANZcQRC6QPtuI4WC3LxYgvwiTbLm/CJrMItW77QheVNWZp8Cy+TOIGxrzZJznxpkgVIURbhtiTaZPnSvQt4AzAurZF35sEdX8JvWBj+hjfpnmaXyQaGBiYlE4XBNnsNt2Rl5O5xNhB7Vv7CVRUS3vHaYpP+YzqaCpQ9G/nFfPRFR+Rw74xV3DsWDtMG+1MV+/0zOh0JBV2FpOuK+KeqEuiY0wuAD8LpU1Wonzi9HafrsHmEnD6j1h9P2QuwG+lPgNgqWSabIP5YtgIewBgEa6bAAkcU/wuz7CcFV/CSJdBUjnCTJMAPeT8Zqjrox8FjGMMQizCVSKGgDzRkic0H0E9//pvcE6Cc/vwPvUWRmugMl5cMn2TJWmxS3s+CdBmi1WbVyy7fHrnj8dSZeFPfsfwZHYK5DrORa1usB2XAKjTSGe4IoTce3p+OZr7n2ROQoe5kJg1frIOOyBvC0iS2NMuUmj/NFrFNXtJ5qMzyIU0DAifsRjlYu1Jmy5az1t+03N+TrH0ZkrXd4UtxwyUrMVw34i4befmILGYXQdSDbqF80qcmpSAfRJUCO5x0qWFdqsXnESrTKvfYjwlIFtF3+LokX7HpMZVbYPiKfhVNgOMNtt29PMbRnBuCv2h4rtrhqjrKs7SMoCzTMATylwnsOn9Vxnr2Dq8w+aqPrzABaj6+QimzW21R74YyldV/gGVKWXDY5Uv479PtpLZ4j25nDvFBdCXG07nFfjipynZupwabx+h2qqoSWiwAUxbMiUNgXcYJkDnJkcDHLWRjTPqp4Y8o41xF+EU8xQM9WJsQjg6Rqp+a+7R3yTbKokSgZKTcG6nDY5JlybqK9mVaz8jtIVlf0L9dTcu2h/z+gX1busT1MvQchOiId0AtkfAcb1bnoO72f89tWUujltrbyQVyLn1Yx5rsc6OmfFxpMYCJ2ntWVr/3HxBc5tzcYzBcBvVzvf793BzmA/m5airs40l5t/RzNfg8Qu1tY8SxhTaeJ2twWxtqZtKpjO8K0d28XxEnZnUKHFJopUJzxa4qbF7V42+9qheuXF/nV5pqVABorlIwlkkbhcjzREMmaRgHWfRdnKEVkisSQ8Dk1m+fHx7u/pVXoEAYwFK9eg6bIsobYEkPwwq8RHFcFQVYpsEiAsBKgqApGhtxa70qciQf2kWhy3EnOnsid5pAm6qLc7R9vT8hbR+kjXtFGjU8+xKo+ZV3J1DRShMEasEvvQhUqnpPWrN/JGt4vwMkq3Gt3l0hR8qCehjU7MM3aFI7ZNgVKpY7jCtUUSt0fXKF2rlCOnweoyuEJkGHQp0X6WVtS0WpC/nXG3WFsGJ+EM3tVIR3ruBfO7k8DbfR31qOI0y1M6bL+L4BYltby01UD6V4ffTXGjm+K5YknVOcNsaMFMjEYaR/JE9PW6AGGZN7Bi8nvVS112ts15ZC5D2mHWlIoVeNXcB8GI09UZm5CS+fNPYB+DxGjT1psI+je36nZkP/VRb2hMYa+mT3HOQDsbtaVfLpxO4t2V2DzyNkdxbWGyTqwuJsHUZdBLT6AOlWprvBqIvOUOzAPn/r+aijxTHVJr0gGe9pECSrm0reE5LbetqHFcZIuzPwt67OxXVFtSP1b13mwrby85vD/7q4+f3+MzR+uYMBlDLq3x5ewFYko3zYbIBM5iFk4RoVRxvOyGnr0Y43I2djTTWGsanNzO91R9PbtNnoYARDI22YxdZJIK978aJP0HYrXjDWYDY7c5B4ccZU1GHMhdKNKXHhtzc8uypZrd10WRddVumlVR0pQoijEK9C/xQnL7SlD1W/SLX+TN/sqCLdl9BY+QfOIx9Bsqv/Dr2nW4cpQsbiBE7t3UJVdjsXmlDar+dCNyn5bqKfi9UIkr5ylzNftt3cPa/XqpixlKmer3Op0KquiWCM3ST21F5I4vdS03ayM32fKv6iNn9nuocV+1cQhWDH8ZTBNbCq/1xaC2zE9UI24pqEnfJdCnidMC/TRxAgEg35c7TyWgp8V6qDZ4LzkG0DNXvjZ4dsGygnMZreQn3aY7S3PvKN81NY9Vil76mB/9OWs5aR4B24nkmR4Ol0RJHQT64HDxHqLmakqppfseSulURHg2KQ2K89rjpiQr93nQBFIAj//y/kZML8wjmUa0ArSAXLtp9/lBe5UYI1kYSbx20hEK3r32+v/vvw1+3txxuMAgF7yt1YyKeYv9HueX6bfS/BIT4UlIv/9mGg0rpgex8bnudjwtSVAohMi/QRQbLH+uMgCmxXEGF51ub5vAAQocV0+fhbrsiJ3IdP6TuJKKp0aoDa7778eUH2DnChzaYUfMz0Wrtf95jotcI26o5c8XDPPrcgvEl1aI8rYpyFjuxFH6rVXBXRmnSVrB9fYJ5dJ6/o0gN6rtybwfdDlGmek2rlm4ZDzPAcxVVP5qneOH2zvIiVAeLpfblP3AczovfNc96h6BP3bEGUhBzsUEbnR/aMeR93YRrBzRJv9ahx27wovDlu2+YKmuNWLSwzflR4K9Hm4eGeQ5wVzpK33ZZZUizoxbtUaNlvpWX/W6EKqA9Uaal64sWST/G1wystf6GtUHik1yCbmPuotDwKiwaFykCbmGfdl9PqI6rvHMmDlMn48rlKO06bUvpTQ8DYYVOzQc9KGI39iWh3j312/HjndncViXVaw9XY7u4twMEOZO+oMq+TuFTvtXeVeGvr9mqS4VgWiwenuONRnvamp8NLpoUmx35IPW7Fgctf79/rttxd+82EExltagUylLl1KKuhAaO1Csw47SWX9+fdx1spcXdIlk57ZnbT+ypQb8XRJjxHqzy/6o4cTQ5yv1O4G57q3Q6aDJDmc591J5YPUkT/1vOkLnpyuxJPcsHsYfqcVoSY1OfdZ5rMWmJ1NdcHavvKIzN0z61pXUntjLAUrqh8Ezdu+EK5HL1ouMparoKGSc3u/nHU2tX3ewhI/flTY3vELA2wKDC1jJjxpkL1JM2R9G9t1J/HZmaLz9t0JVrHmzQFulIylp3BaHpHhjyP4RgFBGJPpHUoaRmJcu1GecPa77akZTr8xfZhGCQttYb1HZpLVRsTizCscVqcyA+Z6UjMTaQN0cbFnKsmOE8mUfUTIWFPCNstAiay9DDFSW3IrIl0E9OANERq1l5y1XBbHjU5oVt95qLvjcpgm+VKO43Rv+7d5HXrC87ehfI4LrtkonmYi2ldsCMtt2/az4DuUHdjnaSJRnmAP619SJHriqH9oSSL+vC6m3AZbmghW6unPhJCbx3klOi5fCgSF+ScVNVGsQcLtYpyjhvsfDbwJOACDcf4LGCAowKBpxT2KsMK6DNMrU3Vc944gtDult6ClMxAICWvhO2jdF7Uh5HWawjWsyz+Avskz/mTRPMelLv9ogf9RYprD0sS9HFykxbPFVXrLRXUWErvTiijN97OjNWonrjxVx7HYF7YVlULUhoW6L4NUuvDFtopUsTHpiBaKwhxH5ozQnJQlDKacS88+bR7CmQPHi4pMMsPAiOF3SjJf3ny6yNEuIv8zl1f9H0rTgnbnwBZZKMlBboTkQLFW+2QAC3VHIPITJ6/v4LKZ/KA1VVQnExXna7XPR28oj6AmOjn1OYmE8SkHlspEIDKnPzq1/ARPu+T+TdidLbI7VPP4I2VjzcqU8DiAnFvHmPVlrUInBhqZHfvYlEPT1xnmVm1usCQ1Qk/04SQXck34FWs/gBlT3r8Aw== \ No newline at end of file diff --git a/Storj/core/docs/assets/tunneling.png b/Storj/core/docs/assets/tunneling.png deleted file mode 100644 index 7058f86..0000000 Binary files a/Storj/core/docs/assets/tunneling.png and /dev/null differ diff --git a/Storj/core/docs/fonts/OpenSans-Bold-webfont.eot b/Storj/core/docs/fonts/OpenSans-Bold-webfont.eot deleted file mode 100644 index 5d20d91..0000000 Binary files a/Storj/core/docs/fonts/OpenSans-Bold-webfont.eot and /dev/null differ diff --git a/Storj/core/docs/fonts/OpenSans-Bold-webfont.svg b/Storj/core/docs/fonts/OpenSans-Bold-webfont.svg deleted file mode 100644 index 3ed7be4..0000000 --- a/Storj/core/docs/fonts/OpenSans-Bold-webfont.svg +++ /dev/null @@ -1,1830 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/fonts/OpenSans-Bold-webfont.woff b/Storj/core/docs/fonts/OpenSans-Bold-webfont.woff deleted file mode 100644 index 1205787..0000000 Binary files a/Storj/core/docs/fonts/OpenSans-Bold-webfont.woff and /dev/null differ diff --git a/Storj/core/docs/fonts/OpenSans-BoldItalic-webfont.eot b/Storj/core/docs/fonts/OpenSans-BoldItalic-webfont.eot deleted file mode 100644 index 1f639a1..0000000 Binary files a/Storj/core/docs/fonts/OpenSans-BoldItalic-webfont.eot and /dev/null differ diff --git a/Storj/core/docs/fonts/OpenSans-BoldItalic-webfont.svg b/Storj/core/docs/fonts/OpenSans-BoldItalic-webfont.svg deleted file mode 100644 index 6a2607b..0000000 --- a/Storj/core/docs/fonts/OpenSans-BoldItalic-webfont.svg +++ /dev/null @@ -1,1830 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/fonts/OpenSans-BoldItalic-webfont.woff b/Storj/core/docs/fonts/OpenSans-BoldItalic-webfont.woff deleted file mode 100644 index ed760c0..0000000 Binary files a/Storj/core/docs/fonts/OpenSans-BoldItalic-webfont.woff and /dev/null differ diff --git a/Storj/core/docs/fonts/OpenSans-Italic-webfont.eot b/Storj/core/docs/fonts/OpenSans-Italic-webfont.eot deleted file mode 100644 index 0c8a0ae..0000000 Binary files a/Storj/core/docs/fonts/OpenSans-Italic-webfont.eot and /dev/null differ diff --git a/Storj/core/docs/fonts/OpenSans-Italic-webfont.svg b/Storj/core/docs/fonts/OpenSans-Italic-webfont.svg deleted file mode 100644 index e1075dc..0000000 --- a/Storj/core/docs/fonts/OpenSans-Italic-webfont.svg +++ /dev/null @@ -1,1830 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/fonts/OpenSans-Italic-webfont.woff b/Storj/core/docs/fonts/OpenSans-Italic-webfont.woff deleted file mode 100644 index ff652e6..0000000 Binary files a/Storj/core/docs/fonts/OpenSans-Italic-webfont.woff and /dev/null differ diff --git a/Storj/core/docs/fonts/OpenSans-Light-webfont.eot b/Storj/core/docs/fonts/OpenSans-Light-webfont.eot deleted file mode 100644 index 1486840..0000000 Binary files a/Storj/core/docs/fonts/OpenSans-Light-webfont.eot and /dev/null differ diff --git a/Storj/core/docs/fonts/OpenSans-Light-webfont.svg b/Storj/core/docs/fonts/OpenSans-Light-webfont.svg deleted file mode 100644 index 11a472c..0000000 --- a/Storj/core/docs/fonts/OpenSans-Light-webfont.svg +++ /dev/null @@ -1,1831 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/fonts/OpenSans-Light-webfont.woff b/Storj/core/docs/fonts/OpenSans-Light-webfont.woff deleted file mode 100644 index e786074..0000000 Binary files a/Storj/core/docs/fonts/OpenSans-Light-webfont.woff and /dev/null differ diff --git a/Storj/core/docs/fonts/OpenSans-LightItalic-webfont.eot b/Storj/core/docs/fonts/OpenSans-LightItalic-webfont.eot deleted file mode 100644 index 8f44592..0000000 Binary files a/Storj/core/docs/fonts/OpenSans-LightItalic-webfont.eot and /dev/null differ diff --git a/Storj/core/docs/fonts/OpenSans-LightItalic-webfont.svg b/Storj/core/docs/fonts/OpenSans-LightItalic-webfont.svg deleted file mode 100644 index 431d7e3..0000000 --- a/Storj/core/docs/fonts/OpenSans-LightItalic-webfont.svg +++ /dev/null @@ -1,1835 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/fonts/OpenSans-LightItalic-webfont.woff b/Storj/core/docs/fonts/OpenSans-LightItalic-webfont.woff deleted file mode 100644 index 43e8b9e..0000000 Binary files a/Storj/core/docs/fonts/OpenSans-LightItalic-webfont.woff and /dev/null differ diff --git a/Storj/core/docs/fonts/OpenSans-Regular-webfont.eot b/Storj/core/docs/fonts/OpenSans-Regular-webfont.eot deleted file mode 100644 index 6bbc3cf..0000000 Binary files a/Storj/core/docs/fonts/OpenSans-Regular-webfont.eot and /dev/null differ diff --git a/Storj/core/docs/fonts/OpenSans-Regular-webfont.svg b/Storj/core/docs/fonts/OpenSans-Regular-webfont.svg deleted file mode 100644 index 25a3952..0000000 --- a/Storj/core/docs/fonts/OpenSans-Regular-webfont.svg +++ /dev/null @@ -1,1831 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/fonts/OpenSans-Regular-webfont.woff b/Storj/core/docs/fonts/OpenSans-Regular-webfont.woff deleted file mode 100644 index e231183..0000000 Binary files a/Storj/core/docs/fonts/OpenSans-Regular-webfont.woff and /dev/null differ diff --git a/Storj/core/docs/index.html b/Storj/core/docs/index.html deleted file mode 100644 index 7281073..0000000 --- a/Storj/core/docs/index.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - JSDoc: Home - - - - - - - - - - -
- -

Home

- - - - - - - - -

- - - - - - - - - - - - - - - -
-

Storj

-

Build Status -Coverage Status -NPM -License

-

This package exposes a module that provides all of the tools needed to -integrate with the Storj network. You must have Node.js v6.9.1, Python v2.x.x, -and Git installed. Complete documentation can be found here.

-
npm install storj-lib --save
-
-
-

If you want access to the Storj CLI, -you must install it separately or use the storj -metapackage to install both the core library and command line interface.

-
-

Usage Examples

- -

License

-

Storj Core - Implementation of the Storj protocol for Node.js -Copyright (C) 2016 Storj Labs, Inc

-

This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published -by the Free Software Foundation, either version 3 of the License, or -(at your option) any later version.

-

Certain parts of this program are licensed under the GNU Lesser General -Public License as published by the Free Software Foundation. You can -redistribute it and/or modify it under the terms either version 3 of the -License, or (at your option) any later version.

-

This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details.

-

You should have received a copy of the GNU Affero General Public License -along with this program. If not, see -http://www.gnu.org/licenses/.

-
- - - - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/index.js.html b/Storj/core/docs/index.js.html deleted file mode 100644 index 725a0b3..0000000 --- a/Storj/core/docs/index.js.html +++ /dev/null @@ -1,161 +0,0 @@ - - - - - JSDoc: Source: index.js - - - - - - - - - - -
- -

Source: index.js

- - - - - - -
-
-
/**
- * @module storj
- * @license (AGPL-3.0 AND LGPL-3.0)
- */
-
-'use strict';
-
-require('./lib/patches')(); // NB: Apply any monkey patches
-
-/** {@link Network} */
-exports.Network = require('./lib/network');
-
-/** {@link Protocol} */
-exports.Protocol = require('./lib/network/protocol');
-
-/** {@link Renter} */
-exports.Renter = require('./lib/network/renter');
-
-/** {@link Farmer} */
-exports.Farmer = require('./lib/network/farmer');
-
-/** {@link Monitor} */
-exports.Monitor = require('./lib/network/monitor');
-
-/** {@link Transport} */
-exports.Transport = require('./lib/network/transport');
-
-/** {@link ShardServer} */
-exports.ShardServer = require('./lib/network/shard-server');
-
-/** {@link Contact} */
-exports.Contact = require('./lib/network/contact');
-
-/** {@link EncryptStream} */
-exports.EncryptStream = require('./lib/crypto-tools/encrypt-stream');
-
-/** {@link DecryptStream} */
-exports.DecryptStream = require('./lib/crypto-tools/decrypt-stream');
-
-/** {@link FileMuxer} */
-exports.FileMuxer = require('./lib/file-handling/file-muxer');
-
-/** {@link FileDemuxer} */
-exports.FileDemuxer = require('./lib/file-handling/file-demuxer');
-
-/** {@link Contract} */
-exports.Contract = require('./lib/contract');
-
-/** {@link OfferStream} */
-exports.OfferStream = require('./lib/contract/offer-stream');
-
-/** {@link OfferManager} */
-exports.OfferManager = require('./lib/contract/offer-manager');
-
-/** {@link AuditStream} */
-exports.AuditStream = require('./lib/audit-tools/audit-stream');
-
-/** {@link ProofStream} */
-exports.ProofStream = require('./lib/audit-tools/proof-stream');
-
-/** {@link Verification} */
-exports.Verification = require('./lib/audit-tools/verification');
-
-/** {@link StorageManager} */
-exports.StorageManager = require('./lib/storage/manager');
-
-/** {@link StorageAdapter} */
-exports.StorageAdapter = require('./lib/storage/adapter');
-
-/** {@link StorageMigration} */
-exports.StorageMigration = require('./lib/storage/migration');
-
-/** {@link EmbeddedStorageAdapter} */
-exports.EmbeddedStorageAdapter = require('./lib/storage/adapters/embedded');
-
-/** {@link RAMStorageAdapter} */
-exports.RAMStorageAdapter = require('./lib/storage/adapters/ram');
-
-/** {@link StorageItem} */
-exports.StorageItem = require('./lib/storage/item');
-
-/** {@link DataCipherKeyIv} */
-exports.DataCipherKeyIv = require('./lib/crypto-tools/cipher-key-iv');
-
-/** {@link DeterministicKeyIv} */
-exports.DeterministicKeyIv = require('./lib/crypto-tools/deterministic-key-iv');
-
-/** {@link KeyPair} */
-exports.KeyPair = require('./lib/crypto-tools/keypair');
-
-/** {@link KeyRing} */
-exports.KeyRing = require('./lib/crypto-tools/keyring');
-
-/** {@link BridgeClient} */
-exports.BridgeClient = require('./lib/bridge-client');
-
-/** {@link module:storj/version} */
-exports.version = require('./lib/version');
-
-/** {@link module:storj/constants} */
-exports.constants = require('./lib/constants');
-
-/** {@link module:storj/utils} */
-exports.utils = require('./lib/utils');
-
-/** {@link module:storj/deps} */
-exports.deps = require('./lib/deps');
-
-/** {@link module:storj/sips} */
-exports.sips = require('./lib/sips');
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_audit-tools_audit-stream.js.html b/Storj/core/docs/lib_audit-tools_audit-stream.js.html deleted file mode 100644 index e3f68a1..0000000 --- a/Storj/core/docs/lib_audit-tools_audit-stream.js.html +++ /dev/null @@ -1,223 +0,0 @@ - - - - - JSDoc: Source: lib/audit-tools/audit-stream.js - - - - - - - - - - -
- -

Source: lib/audit-tools/audit-stream.js

- - - - - - -
-
-
'use strict';
-
-var assert = require('assert');
-var crypto = require('crypto');
-var constants = require('../constants');
-var MerkleTree = require('mtree');
-var utils = require('../utils');
-var stream = require('readable-stream');
-var inherits = require('util').inherits;
-
-/**
- * Represents a streaming audit challenge generator
- * @constructor
- * @license LGPL-3.0
- * @param {Number} audits - Total number of challenges to generate
- * @emits AuditStream#finish
- */
-function AuditStream(audits) {
-  if (!(this instanceof AuditStream)) {
-    return new AuditStream(audits);
-  }
-
-  assert(typeof audits === 'number', 'Invalid number of audits supplied');
-  assert(!Number.isNaN(audits), 'Invalid number of audits supplied');
-  assert(Number.isFinite(audits), 'Invalid number of audits supplied');
-
-  this._audits = audits;
-  this._finished = false;
-  this._challenges = [];
-  this._inputs = this._prepareChallenges();
-
-  stream.Writable.call(this);
-  this.on('finish', this._generateTree.bind(this));
-}
-
-/**
- * Triggered when the stream has ended
- * @event AuditStream#finish
- */
-
-inherits(AuditStream, stream.Writable);
-
-/**
- * Returns the bottom leaves of the merkle tree for sending to farmer
- * @returns {Array} leaves - Bottom merkle leaves of audit tree
- */
-AuditStream.prototype.getPublicRecord = function() {
-  assert(this._finished, 'Challenge generation is not finished');
-
-  return this._tree.level(this._tree.levels() - 1)
-    .map((i) => i.toString('hex'));
-};
-
-/**
- * Returns the challenges, the tree depth, and merkle root
- * @returns {Object} challenge - Private audit record with challenges
- */
-AuditStream.prototype.getPrivateRecord = function() {
-  assert(this._finished, 'Challenge generation is not finished');
-
-  return {
-    root: this._tree.root(),
-    depth: this._tree.levels(),
-    challenges: this._challenges.map((i) => i.toString('hex'))
-  };
-};
-
-/**
- * Implements the underlying write method
- * @private
- */
-AuditStream.prototype._write = function(bytes, encoding, next) {
-  var self = this;
-
-  this._inputs.forEach(function(input, i) {
-    if (i < self._audits) {
-      input.update(bytes);
-    }
-  });
-  next();
-};
-
-/**
- * Prepares the challenge hasher instances
- * @private
- */
-AuditStream.prototype._prepareChallenges = function() {
-  var iterations = 0;
-  var inputs = [];
-
-  while (iterations < this._audits) {
-    var challenge = this._generateChallenge();
-    var input = this._createResponseInput(challenge);
-
-    this._challenges.push(challenge);
-    inputs.push(input);
-
-    iterations++;
-  }
-
-  while (iterations < utils.getNextPowerOfTwo(this._audits)) {
-    inputs.push(utils.rmd160sha256b(''));
-    iterations++;
-  }
-
-  return inputs;
-};
-
-/**
- * Generate the audit merkle tree from a series of challenges
- * @private
- */
-AuditStream.prototype._generateTree = function() {
-  var self = this;
-
-  this._finished = true;
-
-  this._tree = new MerkleTree(this._inputs.map(function(input, i) {
-    if (i >= self._audits) {
-      return input;
-    } else {
-      const rmd1 = crypto.createHash('rmd160').update(input.digest()).digest();
-      const sha = crypto.createHash('sha256').update(rmd1).digest();
-      const rmd2 = crypto.createHash('rmd160').update(sha).digest();
-      return rmd2;
-    }
-  }), utils.rmd160sha256b);
-};
-
-/**
- * Generate a random challenge buffer
- * @private
- * @returns {String} Hex encoded random bytes
- */
-AuditStream.prototype._generateChallenge = function() {
-  return crypto.randomBytes(constants.AUDIT_BYTES);
-};
-
-/**
- * Create a challenge response input to merkle tree
- * @private
- */
-AuditStream.prototype._createResponseInput = function(challenge) {
-  return crypto.createHash('sha256').update(challenge);
-};
-
-/**
- * Returns a new instance from the predefined challenges and tree
- * @param {Array} challenges - The precomputed challenges
- * @param {Array} tree - The bottom leaves of the existing merkle tree
- * @returns {AuditStream}
- */
-AuditStream.fromRecords = function(challenges, tree) {
-  assert(Array.isArray(challenges), 'Invalid challenges supplied');
-  assert(Array.isArray(tree), 'Invalid tree supplied');
-  assert(
-    tree.length === utils.getNextPowerOfTwo(challenges.length),
-    'Challenges and tree do not match'
-  );
-
-  tree = tree.map((i) => Buffer.from(i, 'hex'));
-
-  var auditor = new AuditStream(challenges.length);
-
-  auditor._challenges = challenges;
-  auditor._tree = new MerkleTree(tree, utils.rmd160sha256b);
-  auditor._finished = true;
-
-  return auditor;
-};
-
-module.exports = AuditStream;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_audit-tools_proof-stream.js.html b/Storj/core/docs/lib_audit-tools_proof-stream.js.html deleted file mode 100644 index 288c665..0000000 --- a/Storj/core/docs/lib_audit-tools_proof-stream.js.html +++ /dev/null @@ -1,189 +0,0 @@ - - - - - JSDoc: Source: lib/audit-tools/proof-stream.js - - - - - - - - - - -
- -

Source: lib/audit-tools/proof-stream.js

- - - - - - -
-
-
'use strict';
-
-var assert = require('assert');
-var MerkleTree = require('mtree');
-var utils = require('../utils');
-var inherits = require('util').inherits;
-var stream = require('readable-stream');
-var crypto = require('crypto');
-
-/**
- * Provides interface for proving possession of a file for an
- * {@link AuditStream}
- * @constructor
- * @license LGPL-3.0
- * @param {Array} merkleLeaves - Bottom leaves of the audit merkle tree
- * @param {String} hexChallenge - The challenge data in hex to prepend to shard
- */
-function ProofStream(leaves, challenge) {
-  if (!(this instanceof ProofStream)) {
-    return new ProofStream(leaves, challenge);
-  }
-
-  assert(Array.isArray(leaves), 'Merkle leaves must be an array');
-  assert.ok(challenge, 'Invalid challenge supplied');
-
-  this._tree = new MerkleTree(this._generateLeaves(leaves),
-                              utils.rmd160sha256b);
-  if (!Buffer.isBuffer(challenge)) {
-    this._challenge = Buffer.from(challenge, 'hex');
-  } else {
-    this._challenge = challenge;
-  }
-  this._hasher = crypto.createHash('sha256').update(this._challenge);
-  this._proof = null;
-
-  stream.Transform.call(this, { objectMode: true });
-}
-
-inherits(ProofStream, stream.Transform);
-
-/**
- * Returns the generated proof structure
- * @return {Array}
- */
-ProofStream.prototype.getProofResult = function() {
-  assert(Array.isArray(this._proof), 'Proof generation is not complete');
-
-  return this._proof;
-};
-
-/**
- * Handles writing the shard data to the proof stream
- * @private
- */
-ProofStream.prototype._transform = function(chunk, encoding, next) {
-  this._hasher.update(chunk, encoding);
-  next();
-};
-
-/**
- * Generates the proof from the read data
- * @private
- */
-ProofStream.prototype._flush = function(done) {
-  try {
-    this._generateProof();
-  } catch (err) {
-    return done(err);
-  }
-
-  this.push(this.getProofResult());
-  done();
-};
-
-ProofStream.prototype._findMatchIndex = function(leaves, leaf) {
-  var challengenum = -1;
-  for (let i = 0; i < leaves.length; i++) {
-    if (Buffer.compare(leaves[i], leaf) === 0) {
-      challengenum = i;
-      break;
-    }
-  }
-  return challengenum;
-}
-
-/**
- * Calculate audit response
- * @private
- * @param {String} challenge - Challenge string sent by auditor
- * @returns {Array} result - Challenge response
- */
-ProofStream.prototype._generateProof = function() {
-
-  var response = utils.rmd160b(this._hasher.digest());
-  var leaves = this._tree.level(this._tree.levels() - 1);
-
-  const leaf = utils.rmd160sha256b(response);
-
-  var challengenum = this._findMatchIndex(leaves, leaf);
-
-  assert(challengenum !== -1, 'Failed to generate proof');
-
-  var branches = [response];
-
-  for (var i = (this._tree.levels() - 1); i > 0; i--) {
-    var level = this._tree.level(i);
-
-    if (challengenum % 2 === 0) {
-      branches = [branches, level[challengenum + 1]];
-    } else {
-      branches = [level[challengenum - 1], branches];
-    }
-
-    challengenum = Math.floor(challengenum / 2);
-  }
-
-  this._proof = branches;
-};
-
-/**
- * Generates the bottom leaves of the tree to the next power of two
- * @private
- * @param {Array} leaves
- */
-ProofStream.prototype._generateLeaves = function(leaves) {
-  var numEmpty = utils.getNextPowerOfTwo(leaves.length) - leaves.length;
-  var emptyLeaves = [];
-
-  for (var i = 0; i < numEmpty; i++) {
-    emptyLeaves.push(utils.rmd160sha256b(''));
-  }
-
-  leaves = leaves.map((i) => Buffer.from(i, 'hex'))
-
-  return leaves.concat(emptyLeaves);
-};
-
-module.exports = ProofStream;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_audit-tools_verification.js.html b/Storj/core/docs/lib_audit-tools_verification.js.html deleted file mode 100644 index 79feea2..0000000 --- a/Storj/core/docs/lib_audit-tools_verification.js.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - JSDoc: Source: lib/audit-tools/verification.js - - - - - - - - - - -
- -

Source: lib/audit-tools/verification.js

- - - - - - -
-
-
'use strict';
-
-var assert = require('assert');
-var utils = require('../utils');
-
-/**
- * Interface for verifying the result of an audit proof
- * @constructor
- * @license LGPL-3.0
- * @param {Array} proof - The result of {@link ProofStream#getProofResult}
- */
-function Verification(proof) {
-  if (!(this instanceof Verification)) {
-    return new Verification(proof);
-  }
-
-  assert(Array.isArray(proof), 'Proof must be an array');
-
-  this._proof = proof;
-}
-
-/**
- * Extracts the challenge response from the proof
- * @private
- * @param {Array} response - Challenge response received from farmer
- * @returns {String} leaf
- */
-Verification.prototype._getChallengeResponse = function(tuple) {
-  var data = tuple || this._proof;
-
-  if (data.length === 1) {
-    return utils.rmd160sha256b(data[0]);
-  }
-
-  if (Array.isArray(data[0])) {
-    return this._getChallengeResponse(data[0]);
-  } else {
-    return this._getChallengeResponse(data[1]);
-  }
-};
-
-/**
- * Verifies the proof given the merkle root and tree depth
- * @param {String} merkleRoot - Merkle root
- * @param {Number} totalDepth - Depth of merkle tree
- * @returns {Array} result - Array with expected result and verified result
- */
-Verification.prototype.verify = function(root, totaldepth) {
-  function _collapse(proof, leaf, depth) {
-    if (depth === 0) {
-      assert(proof.length === 1, 'Invalid proof structure');
-      const proofhash = utils.rmd160sha256b(proof[0]);
-      assert(Buffer.compare(proofhash, leaf) === 0, 'Invalid proof value');
-      return leaf;
-    }
-
-    var hashL, hashR;
-
-    if (Array.isArray(proof[0])) {
-      hashL = _collapse(proof[0], leaf, depth - 1);
-    } else {
-      hashL = proof[0];
-    }
-
-    if (Array.isArray(proof[1])) {
-      hashR = _collapse(proof[1], leaf, depth - 1);
-    } else {
-      hashR = proof[1];
-    }
-
-    return utils.rmd160sha256b(Buffer.concat([hashL, hashR]));
-  }
-
-  return [
-    _collapse(this._proof, this._getChallengeResponse(), totaldepth - 1),
-    root
-  ];
-};
-
-module.exports = Verification;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_bridge-client_blacklist.js.html b/Storj/core/docs/lib_bridge-client_blacklist.js.html deleted file mode 100644 index f362f15..0000000 --- a/Storj/core/docs/lib_bridge-client_blacklist.js.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - - JSDoc: Source: lib/bridge-client/blacklist.js - - - - - - - - - - -
- -

Source: lib/bridge-client/blacklist.js

- - - - - - -
-
-
'use strict';
-
-var concat = require('concat-stream');
-var once = require('once');
-
-/**
- * Manage a blacklist file containing an object with key value pairs of
- * nodeids: timestamp
- * @constructor
- * @license LGPL-3.0
- * @see https://github.com/storj/bridge
- * @param {Object} options.logger - Logger instance
- * @param {Object} options.store - The store that blacklist enteries will be
- * persisted to. This object must be compatible with the API of
- * {@link https://github.com/maxogden/abstract-blob-store|abstract-blob-store}
- */
-function Blacklist(options) {
-  if (!(this instanceof Blacklist)) {
-    return new Blacklist(options);
-  }
-
-  this.blacklistKey = '.blacklist';
-  this._store = options.store;
-  this._logger = options.logger;
-  // creating queue to prevent race conditions;
-  // only write one json object at a time
-  this._next = [];
-  this._writing = [];
-}
-
-Blacklist.TTL = 86400000;
-
-Blacklist.prototype._queueForWriting = function(cb) {
-  cb = cb || function() {};
-
-  if (this._writing.length > 0) {
-    return this._next.push(cb);
-  }
-  this._writing.push(cb);
-  this._saveToStore(this._doneWriting.bind(this));
-};
-
-Blacklist.prototype._doneWriting = function(e) {
-  this._writing.forEach(function(cb) {
-    cb(e);
-  });
-
-  this._writing = this._next;
-  this._next = [];
-  if (this._writing.length > 0) {
-    this._saveToStore(this._doneWriting.bind(this));
-  }
-};
-
-/**
- * Push node to blacklist
- * @param {String} nodeid - Node id to be added to blacklist
- */
-Blacklist.prototype.push = function(nodeid, cb) {
-  var self = this;
-  self._logger.info('Adding NodeID %s to blacklist', nodeid);
-  self._getBlacklist(function() {
-    self.blacklist[nodeid] = Date.now();
-    self._queueForWriting(cb);
-  });
-};
-
-/**
- * Lazy load blacklist
- * @private
- */
-Blacklist.prototype._getBlacklist = function(cb) {
-  var self = this;
-
-  // If we already have a blacklist, return it
-  if (self.blacklist !== undefined) {
-    return cb(null, self.blacklist);
-  }
-
-  // Otherwise load it from the store
-  return self._loadFromStore(function() {
-    return cb(null, self.blacklist);
-  });
-};
-
-/**
- * Save blacklist to Store
- * @private
- */
-Blacklist.prototype._saveToStore = function(cb) {
-  cb = once(cb);
-  var ws = this._store.createWriteStream(this.blacklistKey);
-  ws.on('error', cb)
-  ws.end(JSON.stringify(this.blacklist), cb);
-};
-
-/**
- * Read blacklist from Store and Reap old nodeids
- * @private
- */
-Blacklist.prototype._loadFromStore = function(cb) {
-  var self = this;
-  cb = once(cb);
-  var rs = self._store.createReadStream(self.blacklistKey);
-  // If the file doesn't exist, return an empty object.
-  rs.on('error', function() {
-    self.blacklist = {};
-    cb(null, self.blacklist);
-  });
-
-  // Get the stream as a string
-  var cs = concat({encoding: 'string'}, function(data) {
-    // default to an empty object
-    self.blacklist = {};
-    // If the file was empty, return our default. This prevents an error from
-    // being displayed to the user.
-    if (data === '') {
-      return cb(null, self.blacklist);
-    }
-
-    try {
-      self.blacklist = JSON.parse(data);
-    } catch (e) {
-      self._logger.warn('Corrupt blacklist data, using a fresh object.');
-    }
-
-    // Cleanup stale references and return the file
-    return cb(null, self._reap(self.blacklist));
-  });
-  cs.on('error', cb);
-  rs.pipe(cs);
-};
-
-/**
-  * Reap old nodeids from blacklist
-  * @private
-  */
-Blacklist.prototype._reap = function(blacklist) {
-  var now = Date.now();
-
-  for (var nodeid in blacklist) {
-    if ((now - blacklist[nodeid]) > Blacklist.TTL) {
-      delete blacklist[nodeid];
-    }
-  }
-
-  this.blacklist = blacklist;
-
-  return blacklist;
-};
-
-/**
- * Return list of blacklisted nodeids
- */
-Blacklist.prototype.toObject = function(cb) {
-  var self = this;
-  self._getBlacklist(function() {
-    return cb(null, Object.keys(self._reap(self.blacklist)));
-  });
-};
-
-module.exports = Blacklist;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_bridge-client_exchange-report.js.html b/Storj/core/docs/lib_bridge-client_exchange-report.js.html deleted file mode 100644 index a2d9eaf..0000000 --- a/Storj/core/docs/lib_bridge-client_exchange-report.js.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - JSDoc: Source: lib/bridge-client/exchange-report.js - - - - - - - - - - -
- -

Source: lib/bridge-client/exchange-report.js

- - - - - - -
-
-
'use strict';
-
-var assert = require('assert');
-
-/**
- * Represents a report to a bridge regarding the result of a shard exchange
- * @constructor
- * @param {Object} options
- * @param {String} options.reporterId
- * @param {String} [options.farmerId]
- * @param {String} [options.clientId]
- */
-function ExchangeReport(options = {}) {
-  /* eslint complexity: [2, 7] */
-  if (!(this instanceof ExchangeReport)) {
-    return new ExchangeReport(options);
-  }
-
-  assert(options.reporterId, 'Invalid reporterId');
-
-  this._r = {
-    dataHash: options.dataHash || null,
-    reporterId: options.reporterId,
-    farmerId: options.farmerId,
-    clientId: options.clientId,
-    exchangeStart: options.exchangeStart || null,
-    exchangeEnd: options.exchangeEnd || null,
-    exchangeResultCode: options.exchangeResultCode || null,
-    exchangeResultMessage: options.exchangeResultMessage || null
-  };
-}
-
-ExchangeReport.SUCCESS = 1000;
-ExchangeReport.FAILURE = 1100;
-
-/**
- * Starts recording duration of exchange
- * @param {String} dataHash - The shard hash as reference
- */
-ExchangeReport.prototype.begin = function(dataHash) {
-  assert(dataHash, 'You must supply a dataHash to begin an exchange report');
-  this._r.dataHash = dataHash;
-  this._r.exchangeStart = Date.now();
-};
-
-/**
- * Ends the recording time a set result code and message
- * @param {Number} resultCode - Exchange result code
- * @param {String} resultMessage - Exchange result message
- */
-ExchangeReport.prototype.end = function(resultCode, resultMessage) {
-  assert(resultCode, 'You must supply a result code');
-  assert(resultMessage, 'You must supply a result message');
-  this._r.exchangeEnd = Date.now();
-  this._r.exchangeResultCode = resultCode;
-  this._r.exchangeResultMessage = resultMessage;
-};
-
-/**
- * Returns a plain report object
- * @returns {Object}
- */
-ExchangeReport.prototype.toObject = function() {
-  return JSON.parse(JSON.stringify(this._r));
-};
-
-module.exports = ExchangeReport;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_bridge-client_index.js.html b/Storj/core/docs/lib_bridge-client_index.js.html deleted file mode 100644 index 85a8d80..0000000 --- a/Storj/core/docs/lib_bridge-client_index.js.html +++ /dev/null @@ -1,1396 +0,0 @@ - - - - - JSDoc: Source: lib/bridge-client/index.js - - - - - - - - - - -
- -

Source: lib/bridge-client/index.js

- - - - - - -
-
-
'use strict';
-
-var assert = require('assert');
-var fs = require('fs');
-var querystring = require('querystring');
-var request = require('request');
-var utils = require('../utils');
-var FileDemuxer = require('../file-handling/file-demuxer');
-var FileMuxer = require('../file-handling/file-muxer');
-var AuditStream = require('../audit-tools/audit-stream');
-var Contact = require('../network/contact');
-var crypto = require('crypto');
-var path = require('path');
-var mime = require('mime');
-var uuid = require('node-uuid');
-var merge = require('merge');
-var Logger = require('kad-logger-json');
-var EventEmitter = require('events').EventEmitter;
-var UploadState = require('./upload-state');
-var Blacklist = require('./blacklist');
-var stream = require('readable-stream');
-var async = require('async');
-var ExchangeReport = require('./exchange-report');
-var FsBlobStore = require('fs-blob-store');
-var once = require('once');
-
-/**
- * Represents a client interface to a given bridge server
- * @constructor
- * @license LGPL-3.0
- * @see https://github.com/storj/bridge
- * @see https://storj.io/api.html
- * @param {String} [uri=https://api.storj.io] - API base URI
- * @param {Object} options
- * @param {KeyPair} options.keyPair - KeyPair instance for request signing
- * @param {Object} options.logger - Logger instance
- * @param {Object} options.requestTimeout - Timeout when making requests to the
- * bridge
- * @param {Number} options.transferConcurrency - Upload concurrency limit
- * @param {Number} options.transferRetries - Limit number of shard transfer
- * retries before getting a new contract
- * @param {Object} options.basicAuth
- * @param {String} options.basicAuth.email - Email address for HTTP basic auth
- * @param {String} options.basicAuth.password - Password for HTTP basic auth
- * @param {String} [options.blacklistFolder] - The folder that blacklist
- * entries will be persisted to if using the default fs-store
- * @param {Object} [options.store] - The store that blacklist enteries will be
- * persisted to. This object must be compatible with the API of
- * {@link https://github.com/maxogden/abstract-blob-store|abstract-blob-store}
- */
-function BridgeClient(uri, options) {
-  if (!(this instanceof BridgeClient)) {
-    return new BridgeClient(uri, options);
-  }
-
-  this._options = this._checkOptions(uri, options);
-  this._blacklist = new Blacklist(this._options);
-  this._logger = this._options.logger;
-  this._transferConcurrency = this._options.transferConcurrency;
-  this._store = this._options.store;
-}
-
-BridgeClient.DEFAULTS = {
-  baseURI: 'https://api.storj.io',
-  logger: new Logger(0),
-  transferConcurrency: 3,
-  transferRetries: 0,
-  requestTimeout: 30000,
-  retryThrottle: 500
-};
-
-/**
- * Check the options supplied to the constructor
- * @private
- */
-BridgeClient.prototype._checkOptions = function(uri, options) {
-  options = options || {
-    baseURI: uri || process.env.STORJ_BRIDGE || BridgeClient.DEFAULTS.baseURI
-  };
-  options.baseURI = options.baseURI || uri;
-  options = merge(Object.create(BridgeClient.DEFAULTS), options);
-  assert.ok(utils.validateLogger(options.logger), 'Invalid logger supplied');
-
-  return this._configureBlacklist(options);
-};
-
-/**
- * Setup the store for our blacklist
- * @private
- */
-BridgeClient.prototype._configureBlacklist = function(options) {
-  // If we were not given a store, STORJ_TEMP or os.tmpdir. This is
-  // intentionally left out of BridgeClient.DEFAULTS since utils.tmpdir()
-  // accesses the filesystem, breaking storj-lib's compatibility with browsers
-  if (options.store === undefined) {
-    if (options.blacklistFolder === undefined) {
-      options.blacklistFolder = utils.tmpdir();
-    }
-    options.store = new FsBlobStore(options.blacklistFolder);
-  }
-
-  // Only test for the parts of abstract-blob-store that we need
-  assert.ok(typeof options.store.createWriteStream === 'function',
-    'Supplied store must implement abstract-blob-store');
-
-  assert.ok(typeof options.store.createReadStream === 'function',
-    'Supplied store must implement abstract-blob-store');
-
-  assert.ok(typeof options.store.exists === 'function',
-    'Supplied store must implement abstract-blob-store');
-
-  return options;
-};
-
-/**
- * Get the remote Storj Bridge API documentation and version as JSON
- * @param {Function} callback
- */
-BridgeClient.prototype.getInfo = function(callback) {
-  return this._request('GET', '/', {}, callback);
-};
-
-/**
- * Fetches the list of known contacts filtered according to the options
- * @param {Object} options
- * @param {Number} options.page - The page number of the contact list to fetch
- * @param {Boolean} options.connected - Filter results by connection status
- * @param {Function} callback
- */
-BridgeClient.prototype.getContactList = function(options, callback) {
-  return this._request('GET', '/contacts', options, callback);
-};
-
-/**
- * Get the contact information for the given nodeID
- * @param {String} nodeId - The nodeID of the contact
- * @param {Function} callback
- */
-BridgeClient.prototype.getContactByNodeId = function(nodeId, callback) {
-  return this._request('GET', '/contacts/' + nodeId, {}, callback);
-};
-
-/**
- * Registers a user account
- * @param {Object} options
- * @param {String} options.email - Email address for verification email
- * @param {String} options.password - Password to register (auto hashed)
- * @param {String} options.redirect - URL to redirect to after verification
- * @param {String} options.pubkey - Optional ECDSA public key to register
- * @param {Function} callback
- */
-BridgeClient.prototype.createUser = function(options, callback) {
-  return this._request('POST', '/users', {
-    email: options.email,
-    password: utils.sha256(options.password, 'utf8'),
-    redirect: options.redirect,
-    pubkey: options.pubkey
-  }, callback);
-};
-
-/**
- * Deactivates a user account
- * @param {Object} options
- * @param {String} options.email - Email address of user to deactivate
- * @param {String} options.redirect - URL to redirect after verification
- * @param {Function} callback
- */
-BridgeClient.prototype.destroyUser = function(options, callback) {
-  return this._request('DELETE', '/users/' + options.email, {
-    redirect: options.redirect
-  }, callback);
-};
-
-/**
- * Requests a password reset
- * @param {Object} options
- * @param {String} options.email - Email address of user to reset password
- * @param {String} options.password - The cleartext password to reset to
- * @param {String} options.redirect - URL to redirect adter confirmation
- * @param {Function} callback
- */
-BridgeClient.prototype.resetPassword = function(options, callback) {
-  return this._request('PATCH', '/users/' + options.email, {
-    password: utils.sha256(options.password, 'utf8'),
-    redirect: options.redirect
-  }, callback);
-};
-
-/**
- * Returns list of associated public keys
- * @param {Function} callback
- */
-BridgeClient.prototype.getPublicKeys = function(callback) {
-  return this._request('GET', '/keys', {}, callback);
-};
-
-/**
- * Registers a public key for the caller
- * @param {String} pubkey - Hex encoded ECDSA (secp256k1) public key
- * @param {Function} callback
- */
-BridgeClient.prototype.addPublicKey = function(pubkey, callback) {
-  return this._request('POST', '/keys', { key: pubkey }, callback);
-};
-
-/**
- * Disassociates the public key from the caller
- * @param {String} pubkey - Hex encoded ECDSA (secp256k1) public key
- * @param {Function} callback
- */
-BridgeClient.prototype.destroyPublicKey = function(pubkey, callback) {
-  return this._request('DELETE', '/keys/' + pubkey, {}, callback);
-};
-
-/**
- * Lists the caller's file buckets
- * @param {Function} callback
- */
-BridgeClient.prototype.getBuckets = function(callback) {
-  return this._request('GET', '/buckets', {}, callback);
-};
-
-/**
- * Returns the bucket information by ID
- * @param {String} id - Unique bucket ID
- * @param {Function} callback
- */
-BridgeClient.prototype.getBucketById = function(id, callback) {
-  return this._request('GET', '/buckets/' + id, {}, callback);
-};
-
-/**
- * Creates a new file bucket
- * @param {Object} data - Bucket parameters for creation
- * @param {Function} callback
- */
-BridgeClient.prototype.createBucket = function(data, callback) {
-  return this._request('POST', '/buckets', data, callback);
-};
-
-/**
- * Removes the bucket
- * @param {String} id - Unique bucket ID
- * @param {Function} callback
- */
-BridgeClient.prototype.destroyBucketById = function(id, callback) {
-  return this._request('DELETE', '/buckets/' + id, {}, callback);
-};
-
-/**
- * Updates the bucket
- * @param {String} id - Unique bucket ID
- * @param {Object} updates - Bucket update parameters
- * @param {Function} callback
- */
-BridgeClient.prototype.updateBucketById = function(id, updates, callback) {
-  return this._request('PATCH', '/buckets/' + id, updates, callback);
-};
-
-/**
- * Lists the files stored in a bucket
- * @param {String} id - Unique bucket ID
- * @param {Function} callback
- */
-BridgeClient.prototype.listFilesInBucket = function(id, callback) {
-  return this._request('GET', '/buckets/' + id + '/files', {}, callback);
-};
-
-/**
- * Create bucket token
- * @param {String} id - Unique bucket ID
- * @param {String} operation - PUSH or PULL (file operation)
- * @param {Function} callback
- */
-BridgeClient.prototype.createToken = function(id, operation, callback) {
-  return this._request('POST', '/buckets/' + id + '/tokens', {
-    operation: operation
-  }, callback);
-};
-
-/**
- * Removes a file from a bucket
- * @param {String} id - Unique bucket ID
- * @param {String} file - ID of the file to remove from bucket
- * @param {Function} callback
- */
-BridgeClient.prototype.removeFileFromBucket = function(id, file, callback) {
-  return this._request(
-    'DELETE',
-    '/buckets/' + id + '/files/' + file,
-    {},
-    callback
-  );
-};
-
-/**
- * Creates a file staging frame
- * @param {Function} callback
- */
-BridgeClient.prototype.createFileStagingFrame = function(callback) {
-  return this._request('POST', '/frames', {}, callback);
-};
-
-/**
- * List all of the file staging frames
- * @param {Function} callback
- */
-BridgeClient.prototype.getFileStagingFrames = function(callback) {
-  return this._request('GET', '/frames', {}, callback);
-};
-
-/**
- * Get info about a file (bucket, mimetype, filename, frame, size, id)
- * @param {String} bucket - bucket id
- * @param {String} file - file id
- * @param {Function} callback
- */
-BridgeClient.prototype.getFileInfo = function(bucket, file, callback) {
-  var path = '/buckets/' + bucket + '/files/' + file + '/info';
-  return this._request('GET', path, {}, callback);
-};
-
-/**
- * Gets the frame by it's ID
- * @param {String} bucket - Unique bucket ID
-  * @param {String} file - Unique file ID
- * @param {Function} callback
- */
-BridgeClient.prototype.getFrameFromFile = function(bucket, file, callback) {
-  var self = this;
-
-  self.getFileInfo(bucket, file, function(err, file) {
-    if (err) {
-      return callback(err);
-    }
-
-    function _extractFrame(err, frame) {
-      if (err) {
-        return callback(err);
-      }
-
-      callback(null, frame);
-    }
-
-    return self.getFileStagingFrameById(file.frame, _extractFrame);
-  });
-};
-
-/**
- * Fetch an existing file staging frame by it's ID
- * @param {String} id - Unique frame ID
- * @param {Function} callback
- */
-BridgeClient.prototype.getFileStagingFrameById = function(id, callback) {
-  return this._request('GET', '/frames/' + id, {}, callback);
-};
-
-/**
- * Destroy an existing file staging frame
- * @param {String} id - Unique frame ID
- * @param {Function} callback
- */
-BridgeClient.prototype.destroyFileStagingFrameById = function(id, callback) {
-  return this._request('DELETE', '/frames/' + id, {}, callback);
-};
-
-/**
- * Adds the given shard metadata to the file staging frame
- * @param {String} id - Unique frame ID
- * @param {Object} shard - The shard metadata
- * @param {Object} options
- * @param {Number} options.retry - Retry the request this many times if failed
- * @param {Function} callback
- */
-BridgeClient.prototype.addShardToFileStagingFrame = function(f, s, opt, cb) {
-  var self = this;
-  var retries = 0;
-  var pendingReq = null;
-
-  if (typeof arguments[2] === 'function') {
-    cb = opt;
-    opt = { retry: 24 };
-  }
-
-  function _addShard() {
-    self._logger.info(
-      'Querying bridge for contract for %s (retry: %s)',
-      s.hash,
-      retries
-    );
-
-    pendingReq = self._request('PUT', '/frames/' + f, s, function(err, result) {
-      if (err) {
-        if (opt.retry > retries) {
-          retries++;
-          return _addShard();
-        }
-
-        return cb(err);
-      }
-
-      cb(null, result);
-    });
-  }
-
-  _addShard();
-
-  return {
-    cancel: function() {
-      opt.retry = 0;
-      pendingReq.abort();
-    }
-  };
-};
-
-/**
- * Instructs the bridge to find N mirroring farmers for redundancy
- * @param {String} id - Unique bucket ID
- * @param {String} token - Token from {@link BridgeClient#createToken}
- * @param {String} file - Path to file to store
- * @param {Number} concurrency - Upload concurrency
- * @param {Function} callback
- */
-BridgeClient.prototype.replicateFileFromBucket = function(id, file, n, cb) {
-  if (typeof n === 'function') {
-    cb = n;
-    n = undefined;
-  }
-
-  return this._request('POST', '/buckets/' + id + '/mirrors', {
-    file: file,
-    redundancy: n
-  }, cb);
-};
-
-/**
- * Returns the established and available mirrors for a given file
- * @param {String} id - Unique bucket ID
- * @param {String} file - Unique file ID
- * @param {Function} callback
- */
-BridgeClient.prototype.listMirrorsForFile = function(id, file, cb) {
-  return this._request(
-    'GET',
-    '/buckets/' + id + '/files/' + file + '/mirrors',
-    {},
-    cb
-  );
-};
-
-/**
- * Stores a file in the bucket
- * @param {String} id - Unique bucket ID
- * @param {String} token - Token from {@link BridgeClient#createToken}
- * @param {String} file - Path to file to store
- * @param {Function} callback
- */
-// eslint-disable-next-line max-params
-BridgeClient.prototype.storeFileInBucket = function(id, token, file, opts, cb) {
-  assert(typeof file === 'string' || file.readable,
-    'File name must be a string or readable stream.'
-  );
-  var self = this;
-  if (typeof opts === 'function') {
-    cb = opts;
-    opts = {};
-  }
-  cb = once(cb);
-
-  var fileName = opts.fileName;
-  var fileSize = opts.fileSize || 0;
-
-  if (file.constructor === String) {
-    fileName = path.basename(file).split('.crypt')[0];
-    fileSize = fs.statSync(file).size;
-    file = fs.createReadStream(file);
-  }
-
-  self._startDemuxing({
-    file: file,
-    fileName: fileName,
-    fileSize: fileSize,
-    id: id,
-    token: token
-  }, cb);
-};
-
-BridgeClient.prototype._startDemuxing = function(options, cb) {
-  var self = this;
-  const {file, fileSize, fileName, id} = options;
-
-  if (fileSize <= 0) {
-    return cb(new Error(fileSize +' bytes is not a supported file size.'));
-  }
-
-  var shardSize = FileDemuxer.getOptimalShardSize(
-    {
-      fileSize: fileSize,
-      shardConcurrency: this._transferConcurrency
-    }
-  );
-
-  var uploadState = new UploadState({
-    id: id,
-    file: file,
-    fileName: fileName,
-    onComplete: cb,
-    worker: this._shardUploadWorker.bind(this),
-    numShards: Math.ceil(fileSize / shardSize),
-    concurrency: this._transferConcurrency
-  });
-
-  function _createFileStagingFrame() {
-    self._logger.info('Creating file staging frame');
-    self.createFileStagingFrame(function(err, frame) {
-      if (err) {
-        self._logger.error(err.message);
-        return cb(err);
-      }
-
-      var demuxer = new FileDemuxer(uploadState.file, {
-        shardSize: shardSize,
-        fileSize: fileSize
-      });
-
-      demuxer.on('shard', function(shardStream, index) {
-        self._handleShardStream({
-          shardStream: shardStream,
-          index: index,
-          frame: frame,
-          uploadState: uploadState
-        });
-      }).on('error', cb);
-    });
-  }
-  return _createFileStagingFrame();
-};
-
-/**
- * BridgeClient.prototype._shardUploadWorker - description
- *
- * @param  {type} task description
- * @param  {type} done description
- */
-BridgeClient.prototype._shardUploadWorker = function(task, done) {
-  var self = this;
-
-  self._logger.info(
-    'Trying to upload shard %s index %s',
-    task.meta.tmpName,
-    task.meta.index
-  );
-
-  task.state.cleanQueue.push({store: self._store, key: task.meta.tmpName});
-
-  task.shard.on('data', function(data) {
-    task.meta.size += data.length;
-    task.meta.hasher.update(data);
-    task.tmpFile.write(data);
-  }).resume();
-
-  task.shard.on('end', function() {
-    task.tmpFile.end()
-  });
-
-  task.tmpFile.on('finish', function() {
-    task.meta.hash = task.meta.hasher.digest();
-    self._handleShardTmpFileFinish(task.state, task.meta, done);
-  });
-};
-
-/**
- * Handles a demuxed shard and writes it to tmp and updates the state
- * @private
- * @param {Object} options - Pass in configuration vars to this function
- * @param {stream.Readable} options.shardStream - Shard stream
- * @param {Number} options.index  - Index of the demuxed shard
- * @param {Object} options.frame - Frame object returned from bridge
- * @param {UploadState} options.uploadState - The upload state machine
- */
-BridgeClient.prototype._handleShardStream = function(options) {
-  var self = this;
-  const {shardStream, index, frame, uploadState} = options;
-
-  var tmpName = crypto.randomBytes(6).toString('hex')
-  var tmpFile = self._store.createWriteStream(tmpName)
-
-  this._blacklist.toObject(function(err, blacklist){
-    var meta = {
-      frame: frame,
-      tmpName: tmpName,
-      size: 0,
-      index: index,
-      hasher: crypto.createHash('sha256'),
-      hash: null,
-      excludeFarmers: blacklist,
-      transferRetries: 0
-    };
-
-    var passthrough = new stream.PassThrough();
-
-    passthrough.pause();
-
-    uploadState.queue.push({
-      state: uploadState,
-      tmpFile: tmpFile,
-      meta: meta,
-      shard: shardStream.pipe(passthrough)
-    });
-  })
-};
-
-/**
- * Generate audits for shard and add to frame
- * @private
- * @param {UploadState} state - The shard upload state machine
- * @param {Object} meta - Shard metadata reference
- * @param {Function} done - To be called on task complete
- */
-BridgeClient.prototype._handleShardTmpFileFinish = function(state, meta, done) {
-  var self = this;
-  var hash = utils.rmd160(meta.hash);
-  var auditGenerator = new AuditStream(3);
-
-  var rs = self._store.createReadStream(meta.tmpName);
-
-  self._logger.info('Hash for this shard is: %s', hash);
-
-  function _handleError(err) {
-    self._logger.warn('Failed to upload shard...');
-    state.cleanup(function(err2){
-      // If there was an error, and we failed to cleanup temporary files, we
-      // propogate the collection of files that failed back to the caller. The
-      // logic is that the upload error isn't as immediately important as
-      // loosing track of files in the user's blobstore (s3, filesystem, etc)
-      return state.callback(err2 || err);
-    });
-  }
-
-  function _teardownAuditListeners() {
-    auditGenerator.removeAllListeners();
-  }
-
-  rs.on('error', _handleError);
-  state.on('killed', _teardownAuditListeners);
-
-  function _getContract(blacklist) {
-    if (state.killed) {
-      return done();
-    }
-
-    if (!meta.challenges && !meta.tree) {
-      meta.challenges = auditGenerator.getPrivateRecord().challenges;
-      meta.tree = auditGenerator.getPublicRecord();
-      self._logger.info('Audit generation for shard done.');
-    }
-
-    self._logger.info('Waiting on a storage offer from the network...');
-
-    var addShardToFrame = self.addShardToFileStagingFrame(meta.frame.id, {
-      hash: hash,
-      size: meta.size,
-      index: meta.index,
-      challenges: meta.challenges,
-      tree: meta.tree,
-      exclude: blacklist,
-    }, function(err, pointer) {
-      if (state.killed) {
-        return done();
-      }
-
-      if (err) {
-        return _handleError(err);
-      }
-
-      self._startTransfer(pointer, state, meta, done);
-    });
-
-    // Only register listener if addShardToFrame succeeds
-    if (addShardToFrame) {
-      state.removeListener('killed', _teardownAuditListeners);
-      state.on('killed', addShardToFrame.cancel);
-    }
-  }
-
-  self._blacklist.toObject(function(e, blacklist) {
-    if (meta.challenges && meta.tree) {
-      _getContract(blacklist);
-    } else {
-      rs.pipe(auditGenerator).on('finish', _getContract, blacklist);
-    }
-  });
-};
-
-/**
- * Starts a retryable shard transfer operation
- * @private
- * @param {Object} pointer - Pointer object returned from bridge
- * @param {UploadState} state - Upload state machine
- * @param {Object} meta - Shard metadata reference
- * @param {Function} done - Task complete callback
- */
-BridgeClient.prototype._startTransfer = function(pointer, state, meta, done) {
-  var self = this;
-  var rs = self._store.createReadStream(meta.tmpName);
-
-  var transferStatus = self._transferShard(
-    new EventEmitter(),
-    rs,
-    pointer,
-    state
-  );
-
-  if (!meta.exchangeReport) {
-    meta.exchangeReport = new ExchangeReport({
-      reporterId: this._getReporterId(),
-      clientId: this._getReporterId(),
-      farmerId: pointer.farmer.nodeID
-    });
-
-    meta.exchangeReport.begin(pointer.hash);
-  }
-
-  state.on('killed', transferStatus.removeAllListeners.bind(transferStatus));
-
-  self._logger.info('Contract negotiated with: %j', pointer.farmer);
-
-  transferStatus.on('retry', function() {
-    if (meta.transferRetries < self._options.transferRetries) {
-      meta.transferRetries++;
-      self._logger.info('Retrying shard transfer, pointer: %j', pointer);
-      setTimeout(function() {
-        self._transferShard(transferStatus, meta.tmpName, pointer, state);
-      }, self._options.retryThrottle);
-    } else {
-      self._logger.info(
-        'Shard transfer failed %s times, getting another contract...',
-        meta.transferRetries
-      );
-      transferStatus.removeAllListeners();
-      meta.exchangeReport.end(ExchangeReport.FAILURE, 'TRANSFER_FAILED');
-      self.createExchangeReport(meta.exchangeReport);
-      meta.exchangeReport = null;
-      meta.transferRetries = 0;
-      self._blacklist.push(pointer.farmer.nodeID, function() {
-        self._handleShardTmpFileFinish(state, meta, done);
-      });
-    }
-  });
-
-  transferStatus.removeAllListeners('finish');
-  transferStatus.once('finish', function() {
-    self._shardTransferComplete(state, meta.frame, done);
-    meta.exchangeReport.end(ExchangeReport.SUCCESS, 'SHARD_UPLOADED');
-    self._logger.info('sending exchange report');
-    self.createExchangeReport(meta.exchangeReport);
-  });
-};
-
-/**
- * Finalizes shard transfer and if all complete adds entry to bucket
- * @private
- * @param {UploadState} state - Shard upload state machine
- * @param {Object} frame - Frame object returned from bridge
- * @param {Function} done - Task completion callback
- */
-BridgeClient.prototype._shardTransferComplete = function(state, frame, done) {
-  var self = this;
-  var retry = 0;
-
-  state.completed++;
-  this._logger.info(
-    'Shard transfer completed! %s remaining...',
-    state.numShards - state.completed
-  );
-
-  if (state.completed !== state.numShards) {
-    return done();
-  }
-
-  function _shardTransferComplete() {
-    self._logger.info('Transfer finished, creating entry.. (retry: %s)', retry);
-    self._request('POST', '/buckets/' + state.bucketId + '/files', {
-      frame: frame.id,
-      mimetype: mime.lookup(state.fileName),
-      filename: state.fileName
-    }, function(err, file) {
-      if (err) {
-
-        if (retry < 6) {
-          retry++;
-          return _shardTransferComplete();
-        }
-
-        self._logger.error(err.message);
-      }
-      state.callback(err, file);
-      return done();
-    });
-  };
-
-  state.cleanup(function(err) {
-    if (err) {
-      return done(err);
-    }
-    return _shardTransferComplete();
-  });
-};
-
-/**
- * Transfers a shard to a specified farmer
- * @private
- * @param {events.EventEmitter} evt - For getting status events
- * @param {String} shardStream - readable stream of the shard
- * @param {Object} p - Short for pointer, farmer Contact information
- * @param {UploadState} state - The upload state machine
- */
-BridgeClient.prototype._transferShard = function(evt, shardStream, p, state) {
-  var self = this;
-
-  var uploader = utils.createShardUploader(
-    new Contact(p.farmer),
-    p.hash,
-    p.token
-  );
-
-  function _handleUploadError(err) {
-    self._logger.warn('Failed to transfer shard, reason: %s', err.message);
-    uploader.removeAllListeners();
-    evt.emit('retry', shardStream, p);
-  }
-
-  function _handleStateKilled() {
-    shardStream.unpipe(uploader);
-    uploader.end();
-    evt.emit('finish');
-    evt.removeAllListeners('finish');
-  }
-
-  function _handleResponse(res) {
-    /* istanbul ignore if */
-    if (res.statusCode === 200) {
-      return;
-    }
-
-    let body = '';
-
-    res.on('data', (data) => body += data.toString());
-    res.on('end', () => {
-      let errMessage = '';
-
-      try {
-        errMessage = JSON.parse(body).result;
-      } catch (err) {
-        errMessage = '¯\_(ツ)_/¯';
-      }
-
-      uploader.emit('error', new Error(errMessage));
-    });
-  }
-
-  state.on('killed', _handleStateKilled);
-  state.uploaders.push(uploader);
-  uploader.on('response', _handleResponse);
-  uploader.on('error', (err) => _handleUploadError(err));
-
-  shardStream.pipe(uploader).on('finish', function() {
-    state.removeListener('killed', _handleStateKilled);
-    evt.emit('finish');
-    evt.removeAllListeners('finish');
-  });
-
-  return evt;
-};
-
-/**
- * Retrieves a series of file pointers from the bucket
- * @param {Object} options
- * @param {String} options.bucket - Unique bucket ID
- * @param {String} options.token - Token from {@link BridgeClient#createToken}
- * @param {String} options.file - The unique file pointer ID
- * @param {Number} options.skip - The starting index of pointers to resolve
- * @param {Number} options.limit - The number of pointers to resolve
- * @param {Function} callback
- */
-BridgeClient.prototype.getFilePointers = function(options, cb) {
-  var self = this;
-
-  function _request(done) {
-    request({
-      method: 'GET',
-      baseUrl: self._options.baseURI,
-      uri: '/buckets/' + options.bucket + '/files/' + options.file,
-      timeout: self._options.requestTimeout,
-      headers: {
-        'x-token': options.token
-      },
-      qs: {
-        skip: options.skip,
-        limit: options.limit,
-        exclude: Array.isArray(options.exclude) ? options.exclude.join() : null
-      },
-      json: true
-    }, function(err, res, body) {
-      self._logger.debug('Response Body: %s', JSON.stringify(body));
-
-      if (err) {
-        return done(err);
-      }
-
-      if (res.statusCode !== 200 && res.statusCode !== 304) {
-        return done(new Error(body.error || body));
-      }
-
-      done(null, body);
-    });
-  }
-
-  async.retry({
-    times: 3,
-    interval: self._options.retryThrottle,
-    errorFilter: (e) => {
-      const shouldRetry = ['ETIMEDOUT'].includes(e.message);
-      self._logger.debug('Request failed, reason: %s - retrying (%s)...',
-                        e.message, shouldRetry);
-      return shouldRetry;
-    }
-  }, _request, cb);
-};
-
-/**
- * Create a readable stream from the supplied file pointer
- * @private
- * @param {Object} pointer
- */
-BridgeClient.prototype._createInputFromPointer = function(pointer) {
-  return utils.createShardDownloader(
-    new Contact(pointer.farmer),
-    pointer.hash,
-    pointer.token
-  );
-};
-
-/**
- * Open a series of shard transfers based on the returned value of
- * {@link BridgeClient#getFilePointers} to resolve all the shards and
- * reassemble them together as a binary stream
- * @param {Array} pointers - Result of {@link BridgeClient#getFilePointers}
- * @param {Object} [muxerOptions] - Optional overrides for the file muxer
- * @param {Function} callback
- */
-BridgeClient.prototype.resolveFileFromPointers = function(pointers, mOpts, cb) {
-  const self = this;
-
-  if (typeof mOpts === 'function') {
-    cb = mOpts;
-    mOpts = {};
-  }
-
-  const muxer = new FileMuxer({
-    shards: mOpts.shards || pointers.length,
-    length: mOpts.length || pointers.reduce(function(a, b) {
-      return { size: a.size + b.size };
-    }, { size: 0 }).size
-  });
-
-  function _addInputToMultiplexer(pointer, onInputAdded) {
-    const inputStream = self._createInputFromPointer(pointer);
-    const exchangeReport = new ExchangeReport({
-      reporterId: self._getReporterId(),
-      clientId: self._getReporterId(),
-      farmerId: pointer.farmer.nodeID
-    });
-
-    inputStream.on('error', muxer.emit.bind(muxer, 'error'));
-    muxer._shards++;
-    muxer.addInputSource(
-      inputStream,
-      pointer.hash,
-      exchangeReport,
-      self
-    );
-    onInputAdded();
-  }
-
-  const queue = async.queue(_addInputToMultiplexer, 1);
-
-  function _addPointerToInputQueue(done) {
-    queue.push(pointers.shift(), done);
-  }
-
-  async.times(
-    pointers.length,
-    function addInputSource(n, next) {
-      _addPointerToInputQueue(next);
-    },
-    function onInputsAdded() {
-      cb(null, muxer, queue);
-    }
-  );
-};
-
-/**
- * Create a readable stream from the given bucket and file id
- * @param {String} bucket - The unique bucket ID
- * @param {String} file - The unique file ID
- * @param {Object} [options]
- * @param {Array} [options.exlude] - Exclude these nodeID's from pointers
- * @param {Function} callback - Receives (err, stream)
- */
-BridgeClient.prototype.createFileStream = function(bucket, file, opt, cb) {
-  var self = this;
-  var skip = -6;
-  var limit = 6;
-  var resolved = false;
-  var bytesExpected = 0;
-
-  if (typeof opt === 'function') {
-    cb = opt;
-    opt = {};
-  }
-
-  function _getFileMetadata(done) {
-    self.getFileInfo(bucket, file, function(err, fileInfo) {
-      if (err) {
-        return done(err);
-      }
-
-      bytesExpected = fileInfo.size;
-      done();
-    });
-  }
-
-  function _getPullToken(done) {
-    self._logger.info('Creating retrieval token...');
-    self.createToken(bucket, 'PULL', function(err, token) {
-      if (err) {
-        return done(err);
-      }
-      opt.encryptionKey = token.encryptionKey;
-      done(null, token.token);
-    });
-  }
-
-  function _getPointerSlice(token, done) {
-    self._logger.info('Resolving %s file pointers...', limit);
-    self.getFilePointers({
-      bucket: bucket,
-      token: token,
-      file: file,
-      skip: skip + limit,
-      limit: limit,
-      exclude: opt.exclude
-    }, function(err, pointers) {
-      if (err) {
-        return done(err);
-      }
-
-      // When erasure encoding is implemented, this can just
-      // become a missing shard that is recovered.
-      for (var i = 0; i < pointers.length; i++) {
-        if (!pointers[i].farmer) {
-          return done(new Error('Missing shard'));
-        }
-      }
-
-      skip += limit;
-      done(null, pointers);
-    });
-  }
-
-  function _createStreamAndQueue(pointers, done) {
-    self.resolveFileFromPointers(pointers, {
-      length: bytesExpected
-    }, function(err, stream, queue) {
-      if (err) {
-        return done(err);
-      }
-
-      done(null, stream, queue);
-    });
-  }
-
-  function _resolveNextSlice(queue, done) {
-    _getPullToken(function(err, token) {
-      if (err) {
-        return done(err);
-      }
-
-      _getPointerSlice(token, function(err, pointers) {
-        if (err) {
-          return done(err);
-        }
-
-        if (pointers.length === 0) {
-          resolved = true;
-          return done();
-        }
-
-        self._logger.info(
-          'Downloading file slice from %s channels.',
-          pointers.length
-        );
-        async.eachSeries(pointers, queue.push.bind(queue), done);
-      });
-    });
-  }
-
-  async.waterfall([
-    _getFileMetadata,
-    _getPullToken,
-    _getPointerSlice,
-    _createStreamAndQueue
-  ], function(err, stream, queue) {
-    if (err) {
-      return cb(err);
-    }
-
-    stream.encryptionKey = opt.encryptionKey;
-    cb(null, stream); // NB: Provide the stream as soon as it is ready
-    async.until(function _pointersAreExhausted() {
-      return resolved;
-    }, _resolveNextSlice.bind(null, queue), function(err) {
-      if (err) {
-        stream.emit('error', err);
-      }
-    });
-  });
-};
-
-/**
- * Create a stream for a given slice of a file
- * @param {Object} options
- * @param {String} options.bucket - The bucket ID
- * @param {String} options.file - The file ID
- * @param {Number} options.start - The byte position to start slice
- * @param {Number} options.end - The byte position to end slice
- */
-BridgeClient.prototype.createFileSliceStream = function(options, callback) {
-  var self = this;
-
-  self.getFrameFromFile(options.bucket, options.file, function(err, frame) {
-    if (err) {
-      return callback(err);
-    }
-
-    var sliceOpts = self._getSliceParams(frame, options.start, options.end);
-
-    self.createToken(options.bucket, 'PULL', function(err, token) {
-      if (err) {
-        return callback(err);
-      }
-
-      self.getFilePointers({
-        bucket: options.bucket,
-        token: token.token,
-        file: options.file,
-        skip: sliceOpts.skip,
-        limit: sliceOpts.limit
-      }, function(err, pointers) {
-        if (err) {
-          return callback(err);
-        }
-
-        self.resolveFileFromPointers(pointers, function(err, stream) {
-          if (err) {
-            return callback(err);
-          }
-
-          callback(null, stream.pipe(utils.createStreamTrimmer(
-            sliceOpts.trimFront,
-            options.end - options.start
-          )));
-        });
-      });
-    });
-  });
-};
-
-/**
- * Sends an exchange report
- * @param {ExchangeReport} exchangeReport - The result of a transfer operation
- */
-BridgeClient.prototype.createExchangeReport = function(report) {
-  assert(report instanceof ExchangeReport, 'Invalid exchangeReport');
-  this._request('POST', '/reports/exchanges', report.toObject(), utils.noop);
-};
-
-/**
- * Sends a request to the storj bridge
- * @private
- * @param {String} method - HTTP verb
- * @param {String} path - Endpoint path
- * @param {Object} params - Request parameters
- * @param {Function} callback - Return the raw response stream?
- */
-BridgeClient.prototype._request = function(method, path, params, callback) {
-  var self = this;
-  var currentRequest = null;
-
-  function _request(done) {
-    var opts = {
-      baseUrl: self._options.baseURI,
-      uri: path,
-      method: method,
-      timeout: self._options.requestTimeout
-    };
-
-    params.__nonce = uuid.v4();
-
-    if (['GET', 'DELETE'].indexOf(method) !== -1) {
-      opts.qs = params;
-      opts.json = true;
-    } else {
-      opts.json = params;
-    }
-
-    self._authenticate(opts);
-    self._logger.debug('Request Options: %s', JSON.stringify(opts));
-
-    currentRequest = request(opts, function(err, res, body) {
-      self._logger.debug('Response Body: %s', JSON.stringify(body));
-
-      if (err) {
-        return done(err);
-      }
-
-      if (res.statusCode >= 400) {
-        return done(new Error(body.error || body));
-      }
-
-      done(null, body);
-    });
-  }
-
-  async.retry({
-    times: 3,
-    interval: self._options.retryThrottle,
-    errorFilter: (e) => {
-      const shouldRetry = ['ETIMEDOUT', 'ESOCKETTIMEDOUT'].includes(e.message);
-      self._logger.warn('Request failed, reason: %s - retrying(%s)...',
-                        e.message, shouldRetry);
-      return shouldRetry;
-    }
-  }, _request, callback);
-
-  return {
-    abort: () => currentRequest.abort()
-  };
-};
-
-/**
- * Returns a "reporter id"
- * @private
- */
-BridgeClient.prototype._getReporterId = function() {
-  if (this._options.keyPair) {
-    return this._options.keyPair.getPublicKey();
-  } else if (this._options.basicAuth) {
-    return this._options.basicAuth.email;
-  } else {
-    return 'anonymous';
-  }
-};
-
-/**
- * Adds authentication headers to request object
- * @private
- * @param {Object} opts - Options parameter passed to request
- * @return {Object}
- */
-BridgeClient.prototype._authenticate = function(opts) {
-  var self = this;
-
-  if (this._options.keyPair) {
-    var payload = ['GET', 'DELETE'].indexOf(opts.method) !== -1 ?
-                  querystring.stringify(opts.qs) :
-                  JSON.stringify(opts.json);
-    var contract = [opts.method, opts.uri, payload].join('\n');
-
-    self._logger.debug(
-      'Parameter for ECDSA signature: %s\\n%s\\n%s',
-      opts.method,
-      opts.uri,
-      payload
-    );
-
-    opts.headers = opts.headers || {};
-    opts.headers['x-pubkey'] = this._options.keyPair.getPublicKey();
-    opts.headers['x-signature'] = this._options.keyPair.sign(contract, {
-      compact: false
-    });
-  } else if (this._options.basicAuth) {
-    opts.auth = {
-      user: this._options.basicAuth.email,
-      pass: utils.sha256(this._options.basicAuth.password, 'utf8')
-    };
-  }
-
-  return opts;
-};
-
-/**
- * Returns the skip/limit params for downloading a file slice
- * @private
- * @param {Object} frame - The frame object from the bridge
- * @param {Number} bytesStart - The starting byte for slice
- * @param {Number} bytesEnd - The ending byte for slice
- */
-BridgeClient.prototype._getSliceParams = function(frame, bytesStart, bytesEnd) {
-  var skip = 0;
-  var limit = 0;
-  var count = 0;
-  var trimFront = 0;
-  var trimBack = 0;
-  var trimFrontSet = false;
-  var trimBackSet = false;
-
-  frame.shards.forEach(function(shard) {
-    count += shard.size;
-
-    if (bytesStart > count) {
-      skip++;
-    } else if (!trimFrontSet) {
-      trimFront = count - bytesStart;
-      trimFrontSet = true;
-    }
-
-    if (bytesEnd > count) {
-      limit++;
-    } else if (!trimBackSet){
-      trimBack = count - bytesEnd;
-      trimBackSet = true;
-    }
-  });
-
-  return {
-    skip: skip,
-    limit: limit,
-    trimFront: trimFront,
-    trimBack: trimBack
-  };
-};
-
-module.exports = BridgeClient;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_bridge-client_upload-state.js.html b/Storj/core/docs/lib_bridge-client_upload-state.js.html deleted file mode 100644 index aaee0d0..0000000 --- a/Storj/core/docs/lib_bridge-client_upload-state.js.html +++ /dev/null @@ -1,130 +0,0 @@ - - - - - JSDoc: Source: lib/bridge-client/upload-state.js - - - - - - - - - - -
- -

Source: lib/bridge-client/upload-state.js

- - - - - - -
-
-
'use strict';
-
-var merge = require('merge');
-var inherits = require('util').inherits;
-var EventEmitter = require('events').EventEmitter;
-var async = require('async');
-
-/**
- * Internal state machine used by {@link BridgeClient}
- * @constructor
- * @license LGPL-3.0
- * @param {Object} options
- * @param {String} options.id - Bucket ID for the upload state
- * @param {String} options.file - Path to the file to track
- * @param {Number} options.numShards - The number of shards to transfer
- * @param {Number} options.concurrency - The number shards to transfer at once
- * @param {Function} options.worker - The queue task processor function
- * @param {Function} options.onComplete - Reference to callback after complete
- */
-function UploadState(options) {
-  /* eslint max-statements: [2, 16] */
-  if (!(this instanceof UploadState)) {
-    return new UploadState(options);
-  }
-
-  options = merge(Object.create(UploadState.DEFAULTS), options);
-
-  this.bucketId = options.id;
-  this.file = options.file;
-  this.fileName = options.fileName;
-  this.cleanQueue = [];
-  this.numShards = options.numShards;
-  this.completed = 0;
-  this.callback = options.onComplete;
-  this.concurrency = options.concurrency;
-  this.queue = async.queue(options.worker, this.concurrency);
-  this.killed = false;
-  this.uploaders = [];
-
-  EventEmitter.call(this);
-  this.setMaxListeners(0);
-}
-
-inherits(UploadState, EventEmitter);
-
-/**
- * Triggered when the upload queue has been killed
- * @event UploadState#killed
- */
-
-UploadState.DEFAULTS = {
-  concurrency: 6
-};
-
-/**
- * Unlinks the referenced tmp files
- */
-UploadState.prototype.cleanup = function(cb) {
-  this.killed = true;
-
-  async.each(this.cleanQueue, function(options, cb) {
-    options.store.exists(options.key, function(err, exists) {
-      if (!exists) {
-        return cb();
-      }
-      return options.store.remove(options.key, cb);
-    })
-  }, cb);
-
-  this.uploaders.forEach(function(channel) {
-    channel.end();
-  });
-
-  this.queue.kill();
-  this.emit('killed');
-  this.removeAllListeners();
-};
-
-module.exports = UploadState;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_constants.js.html b/Storj/core/docs/lib_constants.js.html deleted file mode 100644 index eb6c292..0000000 --- a/Storj/core/docs/lib_constants.js.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - JSDoc: Source: lib/constants.js - - - - - - - - - - -
- -

Source: lib/constants.js

- - - - - - -
-
-
/**
- * @module storj/constants
- * @license LGPL-3.0
- */
-
-'use strict';
-
-module.exports = {
-  /** @constant {String} CIPHER_ALG - Cipher/Decipher algorithm */
-  CIPHER_ALG: 'aes-256-ctr',
-  /** @constant {Number} PREFIX - NodeID prefix (same as bitcoin) */
-  PREFIX: 0x00,
-  /** @constant {Number} NONCE_EXPIRE - Time to honor a signed message */
-  NONCE_EXPIRE: 15000,
-  /** @constant {Number} RPC_TIMEOUT - Max wait time for a RPC response */
-  RPC_TIMEOUT: 15000,
-  /** @constant {Number} PUBLISH_TTL - Max time for publication relay */
-  PUBLISH_TTL: 6,
-  /** @constant {Number} NET_REENTRY - Max wait time before re-entering net */
-  NET_REENTRY: 600000,
-  /** @constant {Number} AUDIT_BYTES - Number of bytes for audit challenge */
-  AUDIT_BYTES: 32,
-  /** @constant {Number} CLEAN_INTERVAL - Interval for reaping stale shards */
-  CLEAN_INTERVAL: 86400000,
-  /** @constant {Number} CONSIGN_THRESHOLD - Threshold for consign time */
-  CONSIGN_THRESHOLD: 86400000,
-  /** @constant {Number} TOKEN_EXPIRE - Reject datachannl token after time */
-  TOKEN_EXPIRE: 1800000,
-  /** @constant {Number} TUNNEL_ANNOUNCE_INTERVAL - Announce tunnel state */
-  TUNNEL_ANNOUNCE_INTERVAL: 900000,
-  /** @constant {Number} OFFER_TIMEOUT - Max wait time for storage offer */
-  OFFER_TIMEOUT: 15000,
-  /** @constant {Number} ROUTER_CLEAN_INTERVAL - Drop bad contacts */
-  ROUTER_CLEAN_INTERVAL: 60000,
-  /** @constant {Number} OPCODE_TUNRPC_PREFIX - Opcode for tunnel rpc message */
-  OPCODE_TUNRPC_PREFIX: 0x0c,
-  /** @constant {Number} OPCODE_TUNDCX_PREFIX - Opcode for tunnel datachannel */
-  OPCODE_TUNDCX_PREFIX: 0x0d,
-  /** @constant {Number} OPCODE_TUNNELER_PREFIX - Prefix opcode for tunneler */
-  OPCODE_TUNNELER_PREFIX: 0x0e,
-  /** @constant {Number} OPCODE_CONTRACT_PREFIX - Prefix opcode for contracts */
-  OPCODE_CONTRACT_PREFIX: 0x0f,
-  /** @constant {Number} OPCODE_DEG_NULL - Opcode for null criteria degree */
-  OPCODE_DEG_NULL: 0x00,
-  /** @constant {Number} OPCODE_DEG_LOW - Opcode for low criteria degree */
-  OPCODE_DEG_LOW: 0x01,
-  /** @constant {Number} OPCODE_DEG_MED - Opcode for medium criteria degree */
-  OPCODE_DEG_MED: 0x02,
-  /** @constant {Number} OPCODE_DEG_HIGH - Opcode for medium criteria degree */
-  OPCODE_DEG_HIGH: 0x03,
-  /** @constant {Number} MAX_CONCURRENT_OFFERS - Number of concurrent offers */
-  MAX_CONCURRENT_OFFERS: 3,
-  /** @constant {Number} MAX_CONCURRENT_AUDITS - Number of concurrent audits */
-  MAX_CONCURRENT_AUDITS: 3,
-  /** @constant MAX_FIND_TUNNEL_RELAYS - Max times to relay FIND_TUNNEL */
-  MAX_FIND_TUNNEL_RELAYS: 2,
-  /** @constant MAX_NODE_INDEX - Maximum node index */
-  MAX_NODE_INDEX: 0x7fffffff,
-  /** @constant HD_KEY_DERIVATION_PATH - Key derivation path for HD keys */
-  HD_KEY_DERIVATION_PATH: 'm/3000\'/0\''
-};
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_contract_index.js.html b/Storj/core/docs/lib_contract_index.js.html deleted file mode 100644 index 9ed381f..0000000 --- a/Storj/core/docs/lib_contract_index.js.html +++ /dev/null @@ -1,514 +0,0 @@ - - - - - JSDoc: Source: lib/contract/index.js - - - - - - - - - - -
- -

Source: lib/contract/index.js

- - - - - - -
-
-
'use strict';
-
-var assert = require('assert');
-var crypto = require('crypto');
-var merge = require('merge');
-var JSONSchema = require('jsen');
-var stringify = require('json-stable-stringify');
-var bitcore = require('bitcore-lib');
-var constants = require('../constants');
-var Message = require('bitcore-message');
-var ms = require('ms');
-
-/**
- * Represents a storage contract between a renter and a farmer
- * @constructor
- * @license AGPL-3.0
- * @version 0
- * @param {Object} contract
- * @param {String} contract.type - Unique identifier for the contract
- * @param {String} [contract.renter_hd_key] - Node extended public key in base58
- * @param {Number} [contract.renter_hd_index] - Derivation index for signature
- * @param {String} contract.renter_id - Node ID of the renter
- * @param {String} contract.renter_signature - Renter's cryptographic signature
- * @param {String} contract.farmer_id - Node ID of the farmer
- * @param {String} contract.farmer_signature - Farmer's cryptographic signature
- * @param {Number} contract.data_size - Number of bytes to store
- * @param {String} contract.data_hash - RIPEMD-160 SHA-256 hash of the data
- * @param {Number} contract.store_begin - UNIX timestamp to start contract
- * @param {Number} contract.store_end - UNIX timestamp to end the contract
- * @param {Number} contract.audit_count - Number of audits renter will perform
- * @param {Number} contract.payment_storage_price - Total price for storage
- * @param {Number} contract.payment_download_price - Price per download
- * @param {String} contract.payment_destination - Bitcoin address to send funds
- * @param {Object} criteria
- * @param {Number} criteria.size - Criteria degree OPCODE
- * @param {Number} criteria.duration - Criteria degree OPCODE
- * @param {Number} criteria.availability - Criteria degree OPCODE
- * @param {Number} criteria.speed - Criteria degree OPCODE
- */
-
-function Contract(contract, criteria) {
-  if (!(this instanceof Contract)) {
-    return new Contract(contract, criteria);
-  }
-
-  this._properties = merge(Object.create(Contract.DEFAULTS), contract);
-  this._criteria = this._inferCriteria(criteria);
-
-  this._clean();
-  assert.ok(this._validate(), 'Invalid contract specification was supplied');
-}
-
-/**
- * Defines the JSON Schema of a {@link Contract}
- * @static
- */
-Contract.Schema = require('./schema.json');
-Contract.validate = JSONSchema(Contract.Schema);
-
-/**
- * Defines some default properties of a {@link Contract}
- * @static
- */
-Contract.DEFAULTS = {
-  version: 0,
-  renter_hd_key: false,
-  renter_hd_index: false,
-  renter_id: null,
-  renter_signature: null,
-  farmer_id: null,
-  farmer_signature: null,
-  data_size: 1234,
-  data_hash: null,
-  store_begin: 2000000000,
-  store_end: 3000000000,
-  audit_count: 10,
-  payment_storage_price: 0,
-  payment_download_price: 0,
-  payment_destination: null
-};
-
-/**
- * Defines some default criteria of a {@link Contract}
- * @static
- */
-Contract.CRITERIA = {
-  size: constants.OPCODE_DEG_MED,
-  duration: constants.OPCODE_DEG_MED,
-  availability: constants.OPCODE_DEG_MED,
-  speed: constants.OPCODE_DEG_MED
-};
-
-/**
- * Defines the criteria matrix for a {@link Contract}
- * @static
- */
-Contract.MATRIX = {
-  size: function(size) {
-    if (size > 0 && size <= (32 * 1024 * 1024)) {
-      return constants.OPCODE_DEG_LOW;
-    }
-
-    if (size > (32 * 1024 * 1024) && size <= (512 * 1024 * 1024)) {
-      return constants.OPCODE_DEG_MED;
-    }
-
-    if (size > (512 * 1024 * 1024) && size <= (4096 * 1024 * 1024)) {
-      return constants.OPCODE_DEG_HIGH;
-    }
-
-    return constants.OPCODE_DEG_HIGH;
-  },
-  duration: function(duration) {
-    if (duration > 0 && duration <= ms('30d')) {
-      return constants.OPCODE_DEG_LOW;
-    }
-
-    if (duration > ms('30d') && duration <= ms('90d')) {
-      return constants.OPCODE_DEG_MED;
-    }
-
-    if (duration > ms('90d') && duration <= ms('320d')) {
-      return constants.OPCODE_DEG_HIGH;
-    }
-
-    return constants.OPCODE_DEG_HIGH;
-  },
-  availability: function(availability) {
-    if (availability >= 0.5 && availability <= 0.7) {
-      return constants.OPCODE_DEG_LOW;
-    }
-
-    if (availability > 0.7 && availability <= 0.9) {
-      return constants.OPCODE_DEG_MED;
-    }
-
-    if (availability > 0.9 && availability <= 1) {
-      return constants.OPCODE_DEG_HIGH;
-    }
-
-    return constants.OPCODE_DEG_HIGH;
-  },
-  speed: function(speed) {
-    if (speed > 0 && speed <= 6) {
-      return constants.OPCODE_DEG_LOW;
-    }
-
-    if (speed > 6 && speed <= 12) {
-      return constants.OPCODE_DEG_MED;
-    }
-
-    if (speed > 12 && speed <= 32) {
-      return constants.OPCODE_DEG_HIGH;
-    }
-
-    return constants.OPCODE_DEG_HIGH;
-  }
-};
-
-/**
- * Removes all properties not in the schema from contract
- * @private
- * @param {Object} criteria - Criteria degree opcodes
- * @returns {Object}
- */
-Contract.prototype._inferCriteria = function(criteria) {
-  var opcodes = Object.create(Contract.CRITERIA);
-
-  opcodes.size = Contract.MATRIX.size(this.get('data_size'));
-  opcodes.duration = Contract.MATRIX.duration(
-    this.get('store_end') - this.get('store_begin')
-  );
-  // NB: Do not try to infer availability or speed, should be explicit
-
-  return merge(opcodes, criteria);
-};
-
-/**
- * Removes all properties not in the schema from contract
- * @private
- * @returns {Contract} self
- */
-Contract.prototype._clean = function() {
-  var keys = Object.keys(Contract.Schema.properties);
-
-  for (var field in this._properties) {
-    if (keys.indexOf(field) === -1) {
-      delete this._properties[field];
-    }
-  }
-
-  return this;
-};
-
-/**
- * Validates the contract specification
- * @private
- * @returns {Boolean} validity
- */
-Contract.prototype._validate = function() {
-  return Contract.validate(this._properties);
-};
-
-/**
- * Checks if the contract is complete
- * @returns {Boolean} completed
- */
-Contract.prototype.isComplete = function() {
-  for (var prop in this._properties) {
-    if (this._properties[prop] === null) {
-      return false;
-    }
-  }
-
-  return true;
-};
-
-/**
- * Returns the string representation of the contract, minus the signature
- * fields, sorted alphanumerically for signing and verifying
- * @returns {String}
- */
-Contract.prototype.getSigningData = function() {
-  var sorted = this.toObject();
-
-  delete sorted.renter_signature;
-  delete sorted.farmer_signature;
-
-  return stringify(sorted);
-};
-
-/**
- * Signs the contract as the given actor
- * @param {String} actor - One of 'farmer' or 'renter'
- * @param {Buffer} secret - ECDSA private key
- * @returns {String} signature
- */
-Contract.prototype.sign = function(actor, secret) {
-  return this.set(actor + '_signature', this.signExternal(secret));
-};
-
-/**
- * Verify the contract signature for the given actor
- * @param {String} actor - One of 'farmer' or 'renter'
- * @param {Buffer} pubkeyhash - ECDSA nodeID
- * @returns {Boolean} isValidSignature
- */
-Contract.prototype.verify = function(actor, pubkeyhash) {
-  return this.verifyExternal(
-    this.get(actor + '_signature'),
-    pubkeyhash
-  );
-};
-
-/**
- * Signs the contract with the proved key and returns the signature
- * @param {String} secret - ECDSA private key
- * @returns {String} externalSignature
- */
-Contract.prototype.signExternal = function(secret) {
-  var message = Message(this.getSigningData());
-  return message.sign(bitcore.PrivateKey.fromString(secret));
-};
-
-/**
- * Verify the provided signature for the contract
- * @param {String} signature - The contract signature to verify
- * @param {String} pubkeyhash - ECDSA nodeID
- * @returns {Boolean} isValidSignature
- */
-Contract.prototype.verifyExternal = function(signature, pubkeyhash) {
-  if (!pubkeyhash) {
-    return false;
-  }
-
-  var message = Message(this.getSigningData());
-  var address = bitcore.Address.fromPublicKeyHash(Buffer(pubkeyhash, 'hex'));
-
-  try {
-    return message.verify(address, signature);
-  } catch (err) {
-    return false;
-  }
-};
-
-/**
- * Applies the provided fields to the contract and validates it
- * @param {Object} fields - Contract properties to update
- * @returns {Contract} self
- */
-Contract.prototype.update = function(fields) {
-  for (var prop in fields) {
-    this.set(prop, fields[prop]);
-  }
-
-  return this;
-};
-
-/**
- * Returns the value for the given contract property
- * @param {String} field_name - Contract property to get
- * @returns {String|Number|null} value
- */
-Contract.prototype.get = function(field_name) {
-  return this._properties[field_name];
-};
-
-/**
- * Sets the contract property to the given value
- * @param {String} field_name - Contract property to get
- * @returns {String|Number|null} value
- */
-Contract.prototype.set = function(field_name, field_value) {
-  this._properties[field_name] = field_value;
-
-  this._clean();
-  assert.ok(this._validate(), 'Invalid contract property supplied');
-
-  return this._properties[field_name];
-};
-
-/**
- * Calculates the SHA-256 hash of the serialized contract
- * @returns {Buffer}
- */
-Contract.prototype.getHash = function() {
-  return crypto.createHash('sha256').update(this.toBuffer()).digest();
-};
-
-/**
- * Return OPCODE byte sequence for contract publication topic
- * @returns {Buffer}
- */
-Contract.prototype.getTopicBuffer = function() {
-  return Contract.createTopic(this._criteria);
-};
-
-/**
- * Return OPCODE byte sequence for contract publication topic as hex string
- * @returns {String}
- */
-Contract.prototype.getTopicString = function() {
-  return this.getTopicBuffer().toString('hex');
-};
-
-/**
- * Converts the contract to a plain object
- * @returns {Object}
- */
-Contract.prototype.toObject = function() {
-  return JSON.parse(this.toJSON());
-};
-
-/**
- * Converts the contract to JSON string
- * @returns {String}
- */
-Contract.prototype.toJSON = function() {
-  return stringify(this._properties);
-};
-
-/**
- * Converts the contract to Buffer
- * @returns {Buffer}
- */
-Contract.prototype.toBuffer = function() {
-  return new Buffer(this.toJSON(), 'utf8');
-};
-
-/**
- * Creates a contract from a plain object
- * @param {Object} object - Dictionary of contract data
- * @returns {Contract}
- */
-Contract.fromObject = function(object) {
-  return new Contract(object);
-};
-
-/**
- * Creates a contract from a JSON string
- * @param {String} json - JSON encoded contract
- * @returns {Contract}
- */
-Contract.fromJSON = function(json) {
-  return new Contract(JSON.parse(json));
-};
-
-/**
- * Creates a contract from a Buffer
- * @param {Buffer} buffer - Raw binary blob of contract data
- * @returns {Contract}
- */
-Contract.fromBuffer = function(buffer) {
-  return new Contract(JSON.parse(buffer.toString('utf8')));
-};
-
-/**
- * Create a topical OPCODE byte sequence from the provided criteria
- * @param {Object} criteria
- * @param {Number} criteria.size - Criteria degree OPCODE
- * @param {Number} criteria.duration - Criteria degree OPCODE
- * @param {Number} criteria.availability - Criteria degree OPCODE
- * @param {Number} criteria.speed - Criteria degree OPCODE
- * @returns {Buffer}
- */
-Contract.createTopic = function(criteria) {
-  criteria = merge(Object.create(Contract.CRITERIA), criteria);
-
-  return new Buffer([
-    constants.OPCODE_CONTRACT_PREFIX,
-    criteria.size,
-    criteria.duration,
-    criteria.availability,
-    criteria.speed
-  ]);
-};
-
-/**
- * Compares two contracts against each other
- * @param {Contract} c1 - Contract to compare
- * @param {Contract} c2 - Contract to compare
- * @returns {Boolean}
- */
-Contract.compare = function(c1, c2) {
-  var contract1 = c1.toObject();
-  var contract2 = c2.toObject();
-  var ignored = [
-    'renter_id',
-    'renter_signature',
-    'farmer_id',
-    'farmer_signature',
-    'payment_destination'
-  ];
-
-  ignored.forEach(function(prop) {
-    delete contract1[prop];
-    delete contract2[prop];
-  });
-
-  return JSON.stringify(contract1) === JSON.stringify(contract2);
-};
-
-/**
- * Returns the property names between two contracts that differ
- * @param {Contract} c1 - Contract to compare
- * @param {contract} c2 - Contract to compare
- * @returns {String[]} changedProperties
- */
-Contract.diff = function(c1, c2) {
-  var differs = [];
-  var contract1 = c1.toObject();
-  var contract2 = c2.toObject();
-
-  for (var prop in contract1) {
-    if (contract1[prop] !== contract2[prop]) {
-      differs.push(prop);
-    }
-  }
-
-  return differs;
-};
-
-module.exports = Contract;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_contract_offer-manager.js.html b/Storj/core/docs/lib_contract_offer-manager.js.html deleted file mode 100644 index 548c960..0000000 --- a/Storj/core/docs/lib_contract_offer-manager.js.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - - JSDoc: Source: lib/contract/offer-manager.js - - - - - - - - - - -
- -

Source: lib/contract/offer-manager.js

- - - - - - -
-
-
'use strict';
-
-var OfferStream = require('./offer-stream');
-var assert = require('assert');
-
-/**
- * Simple management of a collection of {@link OfferStream}s that are keyable
- * by their associated {@link Contract}'s data hash
- * @constructor
- */
-function OfferManager() {
-  if (!(this instanceof OfferManager)) {
-    return new OfferManager();
-  }
-
-  this._offerStreams = {};
-}
-
-/**
- * Returns the stream at the given key
- * @param {String} dataHash - The hash of the contract's data
- * @returns {OfferStream|null}
- */
-OfferManager.prototype.getStream = function(dataHash) {
-  return this._offerStreams[dataHash] || null;
-};
-
-/**
- * Removes the stream at the given key
- * @param {String} dataHash - The hash of the contract's data
- */
-OfferManager.prototype.removeStream = function(dataHash) {
-  delete this._offerStreams[dataHash];
-};
-
-/**
- * Adds the offer stream to the manager
- * @param {OfferStream} offerStream - The {@link OfferStream} to manage
- */
-OfferManager.prototype.addStream = function(offerStream) {
-  assert(offerStream instanceof OfferStream, 'Invalid offer stream supplied');
-
-  var key = offerStream._contract.get('data_hash');
-  this._offerStreams[key] = offerStream;
-
-  offerStream.on('end', this.removeStream.bind(this, key));
-  offerStream.on('error', this.removeStream.bind(this, key));
-  offerStream.on('destroy', this.removeStream.bind(this, key));
-};
-
-module.exports = OfferManager;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_contract_offer-stream.js.html b/Storj/core/docs/lib_contract_offer-stream.js.html deleted file mode 100644 index 9e25035..0000000 --- a/Storj/core/docs/lib_contract_offer-stream.js.html +++ /dev/null @@ -1,176 +0,0 @@ - - - - - JSDoc: Source: lib/contract/offer-stream.js - - - - - - - - - - -
- -

Source: lib/contract/offer-stream.js

- - - - - - -
-
-
'use strict';
-
-var Contact = require('../network/contact');
-var Contract = require('./index');
-var ReadableStream = require('readable-stream');
-var inherits = require('util').inherits;
-var assert = require('assert');
-var merge = require('merge');
-
-/**
- * Manages a stream of offers for a given storage contract publication
- * @constructor
- * @param {Contract} contract - Storage contract published to network
- * @param {Object} [options]
- * @param {Number} [options.maxOffers] - Maximum number of offers to process
- * @param {Array.<String>} [options.farmerBlacklist] - Reject offers from nodeID
- */
-function OfferStream(contract, options) {
-  if (!(this instanceof OfferStream)) {
-    return new OfferStream(contract, options);
-  }
-
-  ReadableStream.call(this, { objectMode: true });
-  assert(contract instanceof Contract, 'Invalid contract supplied');
-
-  this.options = merge(Object.create(OfferStream.DEFAULTS), options);
-
-  this._contract = contract;
-  this._queue = [];
-  this._offersQueued = 0;
-  this._offersProccessed = 0;
-  this._farmersDidOffer = [];
-  this._isDestroyed = false;
-}
-
-inherits(OfferStream, ReadableStream);
-
-OfferStream.DEFAULTS = {
-  maxOffers: 12,
-  farmerBlacklist: [],
-};
-
-/**
- * Triggered when an offer is received
- * @event OfferStream#data
- * @param {Object} data
- * @param {Contact} data.contact - The sending farmer for the offer
- * @param {Contract} data.contract - The received offer contract
- */
-
-/**
- * Triggered when the maximum number of offers are received and processed
- * @event OfferStream#end
- */
-
-/**
- * Triggered if an error occurs
- * @event OfferStream#error
- * @param {Error} error - The error object with message
- */
-
-/**
- * Implements the underlying stream
- * @private
- */
-OfferStream.prototype._read = function() {
-  var self = this;
-
-  if (this._offersProccessed === this.options.maxOffers) {
-    return this.push(null);
-  }
-
-  function _push() {
-    self._offersProccessed++;
-    self.push(self._queue.shift());
-  }
-
-  if (this._queue.length > 0) {
-    return setImmediate(_push);
-  }
-
-  this.once('_offerAddedToQueue', _push);
-};
-
-/**
- * Adds the offer to the internal queue if there is room
- * @param {Contact} contact - The sending farmer for the offer
- * @param {Contract} contract - The received offer contract
- * @returns {Boolean} didAddOfferToQueue
- */
-OfferStream.prototype.addOfferToQueue = function(contact, contract) {
-  assert(contact instanceof Contact, 'Invalid contact supplied');
-  assert(contract instanceof Contract, 'Invalid contract supplied');
-
-  var isDestroyed = this._isDestroyed;
-  var farmerSentOffer = this._farmersDidOffer.indexOf(
-    contact.nodeID
-  ) !== -1;
-  var contractIncomplete = !contract.isComplete();
-  var maxReached = this._offersQueued === this.options.maxOffers;
-
-  if (isDestroyed || farmerSentOffer || contractIncomplete || maxReached) {
-    return false;
-  }
-
-  this._farmersDidOffer.push(contact.nodeID);
-  this._queue.push({ contact: contact, contract: contract });
-  this._offersQueued++;
-  this.emit('_offerAddedToQueue');
-
-  return true;
-};
-
-/**
- * Tears down listeners and ends the stream
- */
-OfferStream.prototype.destroy = function() {
-  this._queue = [];
-  this._isDestroyed = true;
-
-  setImmediate(this.removeAllListeners.bind(this));
-  this.emit('destroy');
-};
-
-module.exports = OfferStream;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_crypto-tools_cipher-key-iv.js.html b/Storj/core/docs/lib_crypto-tools_cipher-key-iv.js.html deleted file mode 100644 index f0b4f31..0000000 --- a/Storj/core/docs/lib_crypto-tools_cipher-key-iv.js.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - JSDoc: Source: lib/crypto-tools/cipher-key-iv.js - - - - - - - - - - -
- -

Source: lib/crypto-tools/cipher-key-iv.js

- - - - - - -
-
-
'use strict';
-
-var crypto = require('crypto');
-var utils = require('../utils');
-
-/**
- * Create a new random cipher key and initialization vector
- * @constructor
- * @license LGPL-3.0
- * @param {String|Buffer} [password] - The unique cipher password
- * @param {String|Buffer} [salt] - The unique salt
- */
-function DataCipherKeyIv(pass, salt) {
-  if (!(this instanceof DataCipherKeyIv)) {
-    return new DataCipherKeyIv(pass, salt);
-  }
-
-  if (!pass && !salt) {
-    pass = crypto.randomBytes(DataCipherKeyIv.PASS_BYTES);
-    salt = crypto.randomBytes(DataCipherKeyIv.SALT_BYTES);
-  }
-
-  this._pass = Buffer.isBuffer(pass) ? pass : Buffer(pass, 'hex');
-  this._salt = Buffer.isBuffer(salt) ? salt : Buffer(salt, 'hex');
-  this._pbkdf2 = crypto.pbkdf2Sync(
-    this._pass,
-    this._salt,
-    25000,
-    512,
-    'sha512'
-  );
-}
-
-DataCipherKeyIv.PASS_BYTES = 512;
-DataCipherKeyIv.SALT_BYTES = 32;
-
-/**
- * Returns the cipher key and iv in an array
- * @returns {Array}
- */
-DataCipherKeyIv.prototype.getCipherKeyIv = function() {
-  return [
-    Buffer(utils.sha256(this._pbkdf2), 'hex'),
-    Buffer(utils.rmd160(this._salt), 'hex').slice(0, 16)
-  ];
-};
-
-/**
- * Returns the key and iv as an array
- * @returns {Array}
- */
-DataCipherKeyIv.prototype.toObject = function() {
-  return {
-    pass: this._pass.toString('hex'),
-    salt: this._salt.toString('hex')
-  };
-};
-
-/**
- * Returns the a {@link DataCipherKeyIv} from an object
- * @param {Object} object
- * @param {Buffer|String} object.pass - The unique password
- * @param {Buffer|String} object.salt - The unique salt
- * @returns {DataCipherKeyIv}
- */
-DataCipherKeyIv.fromObject = function(object) {
-  return new DataCipherKeyIv(object.pass, object.salt);
-};
-
-module.exports = DataCipherKeyIv;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_crypto-tools_decrypt-stream.js.html b/Storj/core/docs/lib_crypto-tools_decrypt-stream.js.html deleted file mode 100644 index 3d96ce9..0000000 --- a/Storj/core/docs/lib_crypto-tools_decrypt-stream.js.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - JSDoc: Source: lib/crypto-tools/decrypt-stream.js - - - - - - - - - - -
- -

Source: lib/crypto-tools/decrypt-stream.js

- - - - - - -
-
-
'use strict';
-
-var constants = require('../constants');
-var inherits = require('util').inherits;
-var assert = require('assert');
-var crypto = require('crypto');
-var stream = require('readable-stream');
-var DataCipherKeyIv = require('../crypto-tools/cipher-key-iv');
-var DeterministicKeyIv = require('../crypto-tools/deterministic-key-iv');
-
-/**
- * Represents a duplex stream capable of taking encrypted data as input and
- * producing output decrypted by a {@link DataCipherKeyIv}
- * @constructor
- * @license LGPL-3.0
- * @param {DataCipherKeyIv|DeterministicKeyIv} keyiv - Object to use
- * for derivation function
- * @emits DecryptStream#data
- * @emits DecryptStream#end
- */
-function DecryptStream(keyiv) {
-  if (!(this instanceof DecryptStream)) {
-    return new DecryptStream(keyiv);
-  }
-
-  assert(
-    keyiv instanceof DataCipherKeyIv || keyiv instanceof DeterministicKeyIv,
-    'Invalid cipher object supplied'
-  );
-
-  this._decipher = crypto.createDecipheriv.apply(
-    this,
-    [constants.CIPHER_ALG].concat(keyiv.getCipherKeyIv())
-  );
-
-  stream.Transform.call(this);
-}
-
-inherits(DecryptStream, stream.Transform);
-
-/**
- * Writes to the underlying decipher
- * @private
- */
-DecryptStream.prototype._transform = function(chunk, enc, callback) {
-  this._decipher.write(chunk);
-  callback(null, this._decipher.read());
-};
-
-/**
- * Ensures there is no more data to be read from decipher
- * @private
- */
-DecryptStream.prototype._flush = function(callback) {
-  callback(null, this._decipher.read());
-};
-
-/**
- * Triggered when some input bytes have become decrypted output bytes
- * @event DecryptStream#data
- * @type {Buffer}
- */
-
-/**
- * Triggered when the stream has ended
- * @event DecryptStream#end
- */
-
-module.exports = DecryptStream;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_crypto-tools_deterministic-key-iv.js.html b/Storj/core/docs/lib_crypto-tools_deterministic-key-iv.js.html deleted file mode 100644 index 38b215f..0000000 --- a/Storj/core/docs/lib_crypto-tools_deterministic-key-iv.js.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - JSDoc: Source: lib/crypto-tools/deterministic-key-iv.js - - - - - - - - - - -
- -

Source: lib/crypto-tools/deterministic-key-iv.js

- - - - - - -
-
-
'use strict';
-
-var assert = require('assert');
-var utils = require('../utils');
-
-/**
- * Create a new deterministic cipher key
- * @constructor
- * @license LGPL-3.0
- * @param {String} fileKey - file key
- * @param {String} fileId - file id
- */
-function DeterministicKeyIv(fileKey, fileId) {
-  if (!(this instanceof DeterministicKeyIv)) {
-    return new DeterministicKeyIv(fileKey, fileId);
-  }
-
-  this._pass = fileKey;
-  this._salt = fileId;
-}
-
-/**
- * Calculates a deterministic key
- * @param {Buffer|String} seed - Deterministic seed or bucket key
- * @param {Buffer|String} id - Unique bucket or file id
- * @returns {String}
- */
-DeterministicKeyIv.getDeterministicKey = function(key, id){
-  if (!Buffer.isBuffer(key)) {
-    assert(utils.isHexaString(key),
-           'key is expected to be a buffer or hex string');
-    key = Buffer.from(key, 'hex');
-  }
-  if (!Buffer.isBuffer(id)) {
-    assert(utils.isHexaString(id),
-           'id is expected to be a buffer or hex string');
-    id = Buffer.from(id, 'hex');
-  }
-  var buffer = utils.sha512(Buffer.concat([key, id]));
-  return buffer.toString('hex').substring(0, 64);
-};
-
-/**
- * Returns the cipher key and iv in an array
- * @returns {Array}
- */
-DeterministicKeyIv.prototype.getCipherKeyIv = function() {
-  return [
-    Buffer(utils.sha256(this._pass), 'hex'),
-    Buffer(utils.rmd160(this._salt), 'hex').slice(0, 16)
-  ];
-};
-
-/**
- * Returns the key and iv as an array
- * @returns {Array}
- */
-DeterministicKeyIv.prototype.toObject = function() {
-  return {
-    type: 'DeterministicKeyIv',
-    pass: this._pass,
-    salt: this._salt
-  };
-};
-
-/**
- * Returns the a {@link DeterministicKeyIv} from an object
- * @param {Object} object
- * @param {Buffer|String} object.pass - The unique password
- * @param {Buffer|String} object.salt - The unique salt
- * @returns {DeterministicKeyIv}
- */
-DeterministicKeyIv.fromObject = function(object) {
-  return new DeterministicKeyIv(object.pass, object.salt);
-};
-
-module.exports = DeterministicKeyIv;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_crypto-tools_encrypt-stream.js.html b/Storj/core/docs/lib_crypto-tools_encrypt-stream.js.html deleted file mode 100644 index 0228ce7..0000000 --- a/Storj/core/docs/lib_crypto-tools_encrypt-stream.js.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - JSDoc: Source: lib/crypto-tools/encrypt-stream.js - - - - - - - - - - -
- -

Source: lib/crypto-tools/encrypt-stream.js

- - - - - - -
-
-
'use strict';
-
-var constants = require('../constants');
-var assert = require('assert');
-var crypto = require('crypto');
-var stream = require('readable-stream');
-var inherits = require('util').inherits;
-var DataCipherKeyIv = require('../crypto-tools/cipher-key-iv');
-var DeterministicKeyIv = require('../crypto-tools/deterministic-key-iv');
-
-/**
- * Represents a duplex stream capable of taking cleartext data as input and
- * producing output encrypted with {@link DataCipherKeyIv}
- * @constructor
- * @license LGPL-3.0
- * @param {DataCipherKeyIv|DeterministicKeyIv} keyiv - Object to use
- * for derivation function
- * @emits EncryptStream#data
- * @emits EncryptStream#end
- */
-function EncryptStream(keyiv) {
-  if (!(this instanceof EncryptStream)) {
-    return new EncryptStream(keyiv);
-  }
-
-  assert(
-    keyiv instanceof DataCipherKeyIv || keyiv instanceof DeterministicKeyIv,
-    'Invalid cipher object supplied'
-  );
-
-  this._cipher = crypto.createCipheriv.apply(
-    this,
-    [constants.CIPHER_ALG].concat(keyiv.getCipherKeyIv())
-  );
-
-  stream.Transform.call(this);
-}
-
-inherits(EncryptStream, stream.Transform);
-
-/**
- * Writes to the internal cipheriv
- * @private
- */
-EncryptStream.prototype._transform = function(chunk, enc, callback) {
-  this._cipher.write(chunk);
-  callback(null, this._cipher.read());
-};
-
-/**
- * Ensures that there is no remaining bytes to be read from cipher
- * @private
- */
-EncryptStream.prototype._flush = function(callback) {
-  callback(null, this._cipher.read());
-};
-
-/**
- * Triggered when some input bytes have become encrypted output bytes
- * @event EncryptStream#data
- * @type {Buffer}
- */
-
-/**
- * Triggered when the stream has ended
- * @event EncryptStream#end
- */
-
-module.exports = EncryptStream;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_crypto-tools_keypair.js.html b/Storj/core/docs/lib_crypto-tools_keypair.js.html deleted file mode 100644 index fa66c8c..0000000 --- a/Storj/core/docs/lib_crypto-tools_keypair.js.html +++ /dev/null @@ -1,144 +0,0 @@ - - - - - JSDoc: Source: lib/crypto-tools/keypair.js - - - - - - - - - - -
- -

Source: lib/crypto-tools/keypair.js

- - - - - - -
-
-
'use strict';
-
-var bitcore = require('bitcore-lib');
-var crypto = require('crypto');
-var merge = require('merge');
-var Message = require('bitcore-message');
-var curve = bitcore.deps.elliptic.curves.secp256k1;
-var ecdsa = new bitcore.deps.elliptic.ec(curve);
-
-/**
- * Represents a ECDSA key pair
- * @constructor
- * @license LGPL-3.0
- * @param {String|Buffer|undefined} privateKey - WIF encoded ECDSA private key
- */
-function KeyPair(privkey) {
-  if (!(this instanceof KeyPair)) {
-    return new KeyPair(privkey);
-  }
-
-  if (privkey) {
-    this._privkey = bitcore.PrivateKey.fromString(privkey);
-  } else {
-    this._privkey = bitcore.PrivateKey.fromRandom();
-  }
-
-  this._pubkey = this._privkey.toPublicKey();
-}
-
-/**
- * Returns the private key
- * @returns {String} key
- */
-KeyPair.prototype.getPrivateKey = function() {
-  return this._privkey.toString();
-};
-
-/**
- * Returns the public key
- * @returns {String} key
- */
-KeyPair.prototype.getPublicKey = function() {
-  return this._pubkey.toString();
-};
-
-/**
- * Returns the NodeID derived from the public key
- * @returns {String} nodeID - RIPEMD160 hash of public key
- */
-KeyPair.prototype.getNodeID = function() {
-  return bitcore.crypto.Hash.sha256ripemd160(
-    this._pubkey.toBuffer()
-  ).toString('hex');
-};
-
-/**
- * Returns the bitcoin address version of the nodeID
- * @returns {String} address - Base58 encoded address
- */
-KeyPair.prototype.getAddress = function() {
-  return bitcore.Address.fromPublicKeyHash(
-    new Buffer(this.getNodeID(), 'hex')
-  ).toString();
-};
-
-/**
- * Signs the supplied message with the private key
- * @param {String|Buffer} message - The message to sign
- * @param {Object} options
- * @param {Boolean} [options.compact=true] - Compact signature format
- * @returns {String} signature
- */
-KeyPair.prototype.sign = function(message, options) {
-  var sign = null;
-  var opts = merge({ compact: true }, options);
-
-  if (opts.compact) {
-    sign = Message(message).sign(this._privkey);
-  } else {
-    if (!Buffer.isBuffer(message)) {
-      message = new Buffer(message, 'utf8');
-    }
-
-    sign = ecdsa.sign(
-      crypto.createHash('sha256').update(message).digest('hex'),
-      this.getPrivateKey()
-    ).toDER('hex');
-  }
-
-  return sign;
-};
-
-module.exports = KeyPair;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_crypto-tools_keyring.js.html b/Storj/core/docs/lib_crypto-tools_keyring.js.html deleted file mode 100644 index 0cfd9ac..0000000 --- a/Storj/core/docs/lib_crypto-tools_keyring.js.html +++ /dev/null @@ -1,439 +0,0 @@ - - - - - JSDoc: Source: lib/crypto-tools/keyring.js - - - - - - - - - - -
- -

Source: lib/crypto-tools/keyring.js

- - - - - - -
-
-
'use strict';
-
-var assert = require('assert');
-var fs = require('fs');
-var DataCipherKeyIv = require('../crypto-tools/cipher-key-iv');
-var DeterministicKeyIv = require('../crypto-tools/deterministic-key-iv');
-var crypto = require('crypto');
-var path = require('path');
-var targz = require('node-tar.gz');
-var os = require('os');
-var utils = require('../utils');
-var constants = require('../constants');
-var Mnemonic = require('bitcore-mnemonic');
-
-/**
- * A {@link DataCipherKeyIv} factory with file system persistence
- * @constructor
- * @license LGPL-3.0
- * @param {String} keyRingDir - Path to store keyring directory
- * @param {String} [passPhrase=''] - Passphrase to encrypt/decrypt keyring
- */
-function KeyRing(filePath, passPhrase) {
-  if (!(this instanceof KeyRing)) {
-    return new KeyRing(filePath, passPhrase);
-  }
-
-  assert(typeof filePath === 'string', 'Invalid path supplied to keyring');
-
-  this._keyFolder = path.join(filePath, 'key.ring');
-  this._pass = passPhrase || '';
-  this._deterministicKeyFile = path.join(this._keyFolder, '.deterministic_key');
-  this._mnemonic = null;
-
-  if (!utils.existsSync(this._keyFolder)) {
-    fs.mkdirSync(this._keyFolder);
-  }
-
-  this._verify();
-  this._migrateOld(path.join(filePath, 'keyring'));
-  this._readDeterministicKey();
-}
-
-KeyRing.DEFAULTS = {
-  algorithm: constants.CIPHER_ALG
-};
-
-/**
-  * Verify the password supplied is correct for the previously created keys.
-  * @private
-  */
-KeyRing.prototype._verify = function() {
-  if (!utils.existsSync(path.join(this._keyFolder, '.verify'))) {
-    this.generate('.verify');
-  }
-
-  try {
-    this.get('.verify');
-  } catch (err) {
-    throw new Error('Invalid passphrase was supplied to KeyRing');
-  }
-};
-
-/**
-  * Migrate the old keyring to new key.ring folder
-  * @private
-  * @param {String} oldPath - path to the old keyring
-  */
-KeyRing.prototype._migrateOld = function(oldPath) {
-  if (utils.existsSync(oldPath)) {
-    var oldKeyRing;
-
-    try {
-      oldKeyRing = JSON.parse(
-        this._decrypt(fs.readFileSync(oldPath).toString())
-      );
-    } catch (err) {
-      return fs.unlinkSync(oldPath);
-    }
-
-    for (var key in oldKeyRing) {
-      var file = path.join(this._keyFolder, key);
-
-      if (!utils.existsSync(file)) {
-        fs.writeFileSync(
-          file,
-          this._encrypt(JSON.stringify(oldKeyRing[key]))
-        );
-      }
-    }
-
-    fs.unlinkSync(oldPath);
-  }
-};
-
-/**
- * Export Keyring to compressed tarball
- * @param {String} outPath - Path to keyring to be compressed
- * @param {Function} callback - Called when tarball has been written
- */
-KeyRing.prototype.export = function(tar, callback) {
-  var read = targz().createReadStream(this._keyFolder);
-  var write = fs.createWriteStream(tar);
-
-  read.pipe(write).on('finish', callback).on('error', callback);
-};
-
-/**
- * Import to Keyring from compressed tarball
- * @param {String} inPath - Path to tarball to be imported
- * @param {String} passPhrase - Passphrase used to decrypt the imported tar
- * @param {Boolean} [overwriteConflictingIds=false] - Overwrite conflicting key
- * @param {Function} callback - Called on import finish
- */
-KeyRing.prototype.import = function(tar, passphrase, writeflag, callback) {
-  var self = this;
-  var read = fs.createReadStream(tar);
-  var parse = targz().createParseStream();
-
-  if (typeof writeflag === 'function') {
-    callback = writeflag;
-    writeflag = false;
-  }
-
-  function worker(entry, done) {
-    var key = path.basename(entry.path);
-    var keyPath = path.join(self._keyFolder, key);
-
-    if (!utils.existsSync(keyPath) || writeflag === true) {
-      var buf = '';
-
-      entry.on('data', function(data) {
-        buf += data;
-      });
-
-      entry.resume();
-
-      entry.on('end', function() {
-        var decrypted;
-
-        if (key === 'key.ring' || key === '.DS_Store') {
-          return entry.abort();
-        }
-
-        try {
-          decrypted = self._encrypt(
-            KeyRing.prototype._decrypt.call({ _pass: passphrase }, buf)
-          );
-        } catch (err) {
-          parse.removeAllListeners('end');
-          return callback(new Error('Failed to decrypt keyring'));
-        }
-
-        fs.writeFileSync(keyPath, decrypted, done);
-      });
-    }
-  }
-
-  parse.on('entry', worker).on('end', callback);
-  read.pipe(parse);
-};
-
-/**
- * Returns the stored {@link KeyPair} for the given id
- * @param {String} keyId - Arbitrary key ID to load
- * @returns {DataCipherKeyIv|DeterministicKeyIv|null}
- */
-KeyRing.prototype.get = function(id, bucket) {
-  var file = path.join(this._keyFolder, id);
-
-  if (!utils.existsSync(file)) {
-    if (!this._mnemonic) {
-      return null;
-    }
-    return this.generateFileKey(bucket, id);
-  }
-
-  var fileData = this._decrypt(fs.readFileSync(file).toString());
-  var keyObject = JSON.parse(fileData);
-  if (keyObject.type === 'DeterministicKeyIv') {
-    return DeterministicKeyIv.fromObject(keyObject);
-  }
-  return DataCipherKeyIv.fromObject(keyObject);
-};
-
-/**
- * Returns the stored {@link KeyPair} for the given id
- * @param {String} keyId - Generate a key for use with the given ID
- * @returns {KeyPair}
- */
-KeyRing.prototype.generate = function(id) {
-  return this.set(id, DataCipherKeyIv());
-};
-
-/**
- * Returns the stored {@link KeyPair} for the given id
- * @param {String} keyId - Arbitrary key ID to load
- * @param {DataCipherKeyIv|DeterministicKeyIv} dataCipherKey
- */
-KeyRing.prototype.set = function(id, cipherKeyIv) {
-  this._saveKeyToDisk(id, cipherKeyIv.toObject());
-
-  return cipherKeyIv;
-};
-
-/**
- * Saves the keyring file to disk
- * @private
- */
-KeyRing.prototype._saveKeyToDisk = function(id, cipherKeyIv) {
-  return fs.writeFileSync(
-    path.join(this._keyFolder, id),
-    this._encrypt(JSON.stringify(cipherKeyIv))
-  );
-};
-
-/**
- * Delete the keyring file from disk
- * @param {String} keyId - Arbitrary key ID to delete
- */
-KeyRing.prototype.del = function(id) {
-  var key = path.join(this._keyFolder, id);
-
-  if (utils.existsSync(key)) {
-    return fs.unlinkSync(key);
-  }
-};
-
-/**
- * Resets the keyring password
- * @param {String} passPhrase - New passphrase for keyring
- * @param {Function} callback - Called on keyring password reset
- */
-KeyRing.prototype.reset = function(newpass, callback) {
-  var self = this;
-  var tmp = os.tmpdir();
-  var tarball = path.join(tmp, 'keyring.bak.' + Date.now() + '.tgz');
-  var oldpass = this._pass;
-
-  if (!newpass || !newpass.length) {
-    return callback(new Error('Your Password cannot be blank!'));
-  }
-
-  this.export(tarball, function(err) {
-    if (err) {
-      return callback(err);
-    }
-
-    self._pass = newpass;
-    self.del('.verify');
-
-    self.import(tarball, oldpass, true, function(err) {
-      callback(err);
-      fs.unlinkSync(tarball);
-    });
-  });
-};
-
-
-/**
- * Encrypts the data with the passphrase
- * @private
- * @param {String} data - Data to encrypt
- */
-KeyRing.prototype._encrypt = function(data) {
-  var cipher = crypto.createCipher(KeyRing.DEFAULTS.algorithm, this._pass);
-  var enc = cipher.update(data, 'utf8', 'hex');
-
-  enc += cipher.final('hex');
-
-  return enc;
-};
-
-/**
- * Decrypts the data with the passphrase
- * @private
- * @param {String|Buffer} data - Data to encrypt
- */
-KeyRing.prototype._decrypt = function(data) {
-  var decipher = crypto.createDecipher(KeyRing.DEFAULTS.algorithm, this._pass);
-  var dec = decipher.update(data, 'hex', 'utf8');
-
-  dec += decipher.final('utf8');
-
-  return JSON.parse(dec) && dec;
-};
-
-/**
- * Retrieve the bucketKey
- * @param {String} bucketId - bucket id
- * @returns {String|null}
- */
-KeyRing.prototype.generateBucketKey = function(bucketId) {
-  if (!this._mnemonic || !bucketId) {
-    return null;
-  }
-  return DeterministicKeyIv.getDeterministicKey(
-    this._mnemonic.toSeed(),
-    Buffer.from(bucketId, 'hex')
-  );
-};
-
-/**
- * Retrieve the fileKey
- * @param {String} bucketId - bucket id
- * @param {String} fileId - file id
- * @returns {DataCipherKeyIv}
- */
-KeyRing.prototype.generateFileKey = function(bucketId, fileId) {
-  var self = this;
-
-  var bucketKey = self.generateBucketKey(bucketId);
-  if (!bucketKey) {
-    return DataCipherKeyIv();
-  }
-
-  var fileKey = DeterministicKeyIv.getDeterministicKey(
-    Buffer.from(bucketKey, 'hex'),
-    Buffer.from(fileId, 'hex')
-  );
-  return new DeterministicKeyIv(fileKey, fileId);
-};
-
-/**
- * Read a deterministic key from disk
- * @private
- */
-KeyRing.prototype._readDeterministicKey = function() {
-  if (!utils.existsSync(this._deterministicKeyFile)) {
-    return;
-  }
-  var enc = fs.readFileSync(this._deterministicKeyFile).toString();
-  this._mnemonic = new Mnemonic(JSON.parse(this._decrypt(enc)).mnemonic);
-};
-
-/**
- * Generate and save deterministic key to disk
- */
-KeyRing.prototype.generateDeterministicKey = function() {
-
-  assert(
-    !utils.existsSync(this._deterministicKeyFile),
-    'Deterministic key already exists'
-  );
-
-  this._mnemonic = new Mnemonic(Mnemonic.Words.ENGLISH);
-  this._saveKeyToDisk('.deterministic_key', {
-    mnemonic: this._mnemonic.toString()
-  });
-};
-
-/**
- * Import mnemonic into KeyRing
- * @param {String} mnemonic - Mnemonic to transfer
- */
-KeyRing.prototype.importMnemonic = function(mnemonic) {
-
-  assert(
-    !utils.existsSync(this._deterministicKeyFile),
-    'Deterministic key already exists'
-  );
-
-  assert(Mnemonic.isValid(mnemonic), 'Mnemonic is invalid');
-
-  this._mnemonic = new Mnemonic(mnemonic);
-  this._saveKeyToDisk('.deterministic_key', {
-    mnemonic: this._mnemonic.toString()
-  });
-};
-
-/**
- * Export mnemonic from KeyRing
- * @returns {String|null}
- */
-KeyRing.prototype.exportMnemonic = function() {
-  if (!this._mnemonic) {
-    return null;
-  }
-  return this._mnemonic.toString();
-};
-
-/**
- * Delete deterministic key from disk
- */
-KeyRing.prototype.deleteDeterministicKey = function() {
-  this.del('.deterministic_key');
-};
-
-module.exports = KeyRing;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_deps.js.html b/Storj/core/docs/lib_deps.js.html deleted file mode 100644 index 55f140e..0000000 --- a/Storj/core/docs/lib_deps.js.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - JSDoc: Source: lib/deps.js - - - - - - - - - - -
- -

Source: lib/deps.js

- - - - - - -
-
-
/**
- * @module storj/deps
- */
-
-'use strict';
-
-/**
- * Kademlia inspired local file store based on LevelDB
- * @see http://bookch.in/kfs
- */
-exports.kfs = require('kfs');
-
-/**
- * Implementation of the Kademlia distributed hash table
- * @see http://kadtools.github.io/
- */
-exports.kad = require('kad');
-exports.kad.Quasar = require('kad-quasar');
-
-/**
- * A modular node for Bitcoin and blockchain-based apps
- * @see https://bitcore.io/
- */
-exports.bitcore = require('bitcore-lib');
-exports.bitcore.ECIES = require('bitcore-ecies');
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_file-handling_file-demuxer.js.html b/Storj/core/docs/lib_file-handling_file-demuxer.js.html deleted file mode 100644 index 12f4e81..0000000 --- a/Storj/core/docs/lib_file-handling_file-demuxer.js.html +++ /dev/null @@ -1,238 +0,0 @@ - - - - - JSDoc: Source: lib/file-handling/file-demuxer.js - - - - - - - - - - -
- -

Source: lib/file-handling/file-demuxer.js

- - - - - - -
-
-
'use strict';
-
-var inherits = require('util').inherits;
-var assert = require('assert');
-var stream = require('readable-stream');
-var fs = require('fs');
-var EventEmitter = require('events').EventEmitter;
-var merge = require('merge');
-var utils = require('../utils');
-var os = require('os');
-var timers = require('timers');
-
-/**
- * Takes a single file read stream and outputs several output streams, used for
- * "shredding" a file and creating muliple out destination interfaces
- * @constructor
- * @license LGPL-3.0
- * @param {String} filePath - Path the file to demultiplex
- * @param {Object} options
- * @param {Number} options.shardSize - Size of each shard
- * @fires FileDemuxer#shard
- */
-function FileDemuxer(filePath, options) {
-  if (!(this instanceof FileDemuxer)) {
-    return new FileDemuxer(filePath, options);
-  }
-
-  options = merge(Object.create(FileDemuxer.DEFAULTS), options);
-
-  //turn filePath into a readable Stream
-  if (typeof filePath === 'string') {
-    assert(
-      utils.existsSync(filePath),
-      'File does not exist at the supplied path'
-    );
-    options.fileSize = fs.statSync(filePath).size;
-    filePath = fs.createReadStream(filePath).on('error',
-      this.emit.bind(this, 'error'));
-  }
-
-  this._fileSize = options.fileSize;
-  this._filePosition = 0;
-  this._shardSize = options.shardSize;
-
-  // at this point node and browser converge to a readable stream _source
-  this._source = filePath;
-  this._currentShardIndex = 0;
-
-  EventEmitter.call(this);
-  timers.setImmediate(this._openStream.bind(this));
-}
-
-FileDemuxer.SHARD_MULTIPLES_BACK = 4;
-FileDemuxer.DEFAULTS = {
-  shardSize: 1024 * 1024 * 8
-};
-
-/**
- * Triggered when the demuxer has a shard ready to stream
- * @event FileDemuxer#shard
- * @param {ReadableStream} shard - The file shard as a readable stream
- */
-
-/**
- * Triggered when the demuxer has finished writing to all shards
- * @event FileDemuxer#finish
- */
-
-inherits(FileDemuxer, EventEmitter);
-
-/**
- * Opens the underyling readable stream
- * @private
- */
-FileDemuxer.prototype._openStream = function() {
-  if (this._fileSize === 0) {
-    this._currentOutput = new stream.Readable({ read: utils.noop });
-    return this.emit('error', new Error('File size cannot be 0 Bytes.'));
-  }
-  
-  this._source.on('data', this._handleSourceBytes.bind(this));
-  this._source.on('end', this._handleSourceEnded.bind(this));
-};
-
-/**
- * Handles incoming data from the source stream
- * @private
- */
-FileDemuxer.prototype._handleSourceBytes = function(chunk) {
-  if (!this._currentOutput) {
-    this._currentOutput = new stream.Readable({ read: utils.noop });
-
-    this.emit('shard', this._currentOutput, this._currentShardIndex);
-  }
-
-  if (this._needsNewOutputStream()) {
-    this._closeCurrentOutput();
-
-    this._currentOutput = new stream.Readable({ read: utils.noop });
-
-    this.emit('shard', this._currentOutput, ++this._currentShardIndex);
-  }
-
-  this._pushBytesToOutput(chunk);
-};
-
-/**
- * Closes the current output source and emits a finish event
- * @private
- */
-FileDemuxer.prototype._handleSourceEnded = function() {
-  timers.setImmediate(this._closeCurrentOutput.bind(this));
-  this.emit('finish');
-};
-
-/**
- * Simply pushes the given bytes to the current output
- * @private
- */
-FileDemuxer.prototype._pushBytesToOutput = function(bytes) {
-  if (bytes) {
-    this._filePosition += bytes.length;
-  }
-
-  this._currentOutput.push(bytes);
-};
-
-/**
- * Simply closes the output stream
- * @private
- */
-FileDemuxer.prototype._closeCurrentOutput = function() {
-  this._pushBytesToOutput(null);
-};
-
-/**
- * Returns a boolean indicating if we should create a new shard stream
- * @private
- */
-FileDemuxer.prototype._needsNewOutputStream = function() {
-  var expectedIndex = Math.floor(this._filePosition / this._shardSize);
-
-  return this._currentShardIndex < expectedIndex;
-};
-
-/**
- * Determine the optimal shard size given an arbitrary file size in bytes
- * @param {Object} fileInfo
- * @param {Number} fileInfo.fileSize - The number of bytes in the given file
- * @param {Number} fileInfo.shardConcurrency - Num of shards uploaded at once
- * @param {Number} [acc=1] - Accumulator (number of recursions)
- * @returns {Number} shardSize
- */
-FileDemuxer.getOptimalShardSize = function(fileInfo, acc) {
-  var accumulator = typeof acc === 'undefined' ? 0 : acc;
-
-  // Determine hops back by accumulator
-  var hops = (accumulator - FileDemuxer.SHARD_MULTIPLES_BACK) < 0 ?
-                 0 :
-                 accumulator - FileDemuxer.SHARD_MULTIPLES_BACK;
-
-  // Calculate bytemultiple shard size by hops back
-  var shardSize = function(hops) {
-    return (8 * (1024 * 1024)) * Math.pow(2, hops);
-  };
-
-  var byteMultiple = shardSize(accumulator);
-  var check = fileInfo.fileSize / byteMultiple;
-
-  // Determine if bytemultiple is highest bytemultiple that is still <= fileSize
-  if (check > 0 && check <= 1) {
-
-    // Certify the number of concurrency * shardSize doesn't exceed freemem
-    while (
-      hops > 0 &&
-      (os.freemem() / shardSize(hops) <= fileInfo.shardConcurrency)
-    ) {
-      hops = hops - 1 <= 0 ? 0 : hops - 1;
-    }
-
-    return shardSize(hops);
-  }
-
-  return this.getOptimalShardSize(fileInfo, ++accumulator);
-};
-
-module.exports = FileDemuxer;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_file-handling_file-muxer.js.html b/Storj/core/docs/lib_file-handling_file-muxer.js.html deleted file mode 100644 index 882afdc..0000000 --- a/Storj/core/docs/lib_file-handling_file-muxer.js.html +++ /dev/null @@ -1,230 +0,0 @@ - - - - - JSDoc: Source: lib/file-handling/file-muxer.js - - - - - - - - - - -
- -

Source: lib/file-handling/file-muxer.js

- - - - - - -
-
-
'use strict';
-
-var crypto = require('crypto');
-var assert = require('assert');
-var stream = require('readable-stream');
-var inherits = require('util').inherits;
-var merge = require('merge');
-var utils = require('../utils');
-var ExchangeReport = require('../bridge-client/exchange-report');
-
-/**
- * Accepts multiple ordered input sources and exposes them as a single
- * contiguous readable stream. Used for re-assembly of shards.
- * @constructor
- * @license LGPL-3.0
- * @param {Object} options
- * @param {Number} options.shards - Number of total shards to be multiplexed
- * @param {Number} options.length - Number of total bytes of input
- * @param {Number} options.sourceDrainWait - Time to wait for a new input after
- * all inputs are drained before entire stream is consumed
- * @param {Number} options.sourceIdleWait - Time to wait for source to make
- * more data available between next read
- * @fires FileMuxer#drain
- */
-function FileMuxer(options) {
-  if (!(this instanceof FileMuxer)) {
-    return new FileMuxer(options);
-  }
-
-  this._checkOptions(options);
-
-  this._hasher = crypto.createHash('sha256');
-  this._shards = options.shards;
-  this._length = options.length;
-  this._inputs = [];
-  this._bytesRead = 0;
-  this._added = 0;
-  this._options = merge(Object.create(FileMuxer.DEFAULTS), options);
-
-  stream.Readable.call(this);
-}
-
-FileMuxer.DEFAULTS = {
-  sourceDrainWait: 8000,
-  sourceIdleWait: 50
-};
-
-/**
- * Triggered when the muxer has drained one of the supplied inputs
- * @event FileMuxer#drain
- * @param {ReadableStream} input - The drained input stream
- */
-
-inherits(FileMuxer, stream.Readable);
-
-/**
- * Checks the options supplied to the constructor
- * @private
- */
-FileMuxer.prototype._checkOptions = function(options) {
-  var shards = options.shards;
-  var length = options.length;
-
-  assert(typeof shards === 'number', 'You must supply a shards parameter');
-  assert(shards > 0, 'Cannot multiplex a 0 shard stream');
-  assert(typeof length === 'number', 'You must supply a length parameter');
-  assert(length > 0, 'Cannot multiplex a 0 length stream');
-};
-
-/**
- * Implements the underlying read method
- * @private
- */
-FileMuxer.prototype._read = function() {
-  var self = this;
-
-  function _waitForSourceAvailable() {
-    self.once('sourceAdded', self._read.bind(self));
-
-    self._sourceDrainTimeout = setTimeout(function() {
-      self.removeAllListeners('sourceAdded');
-      self.emit('error', new Error('Unexpected end of source stream'));
-    }, self._options.sourceDrainWait);
-  }
-
-  function _mux(bytes) {
-    self._bytesRead += bytes.length;
-
-    if (self._length < self._bytesRead) {
-      return self.emit('error', new Error('Input exceeds expected length'));
-    }
-
-    self._hasher.update(bytes);
-    self.push(bytes);
-  }
-
-  function _readFromSource() {
-    var bytes = self._inputs[0] ? self._inputs[0].read() : null;
-
-    if (bytes !== null) {
-      return _mux(bytes);
-    }
-
-    setTimeout(_readFromSource, self._options.sourceIdleWait);
-  }
-
-  if (this._sourceDrainTimeout) {
-    clearTimeout(this._sourceDrainTimeout);
-  }
-
-  if (this._bytesRead === this._length) {
-    return this.push(null);
-  }
-
-  if (!this._inputs[0]) {
-    return _waitForSourceAvailable();
-  }
-
-  _readFromSource();
-};
-
-/**
- * Adds an additional input stream to the multiplexer
- * @param {ReadableStream} readable - Readable input stream from file shard
- * @param {String} hash - Hash of the shard
- * @param {ExchangeReport} - Instance of exchange report
- * @param {BridgeClient} - An instance of bridge client for reporting
- */
-FileMuxer.prototype.addInputSource = function(readable,
-                                              hash,
-                                              exchangeReport,
-                                              bridgeClient) {
-
-  assert(typeof readable.pipe === 'function', 'Invalid input stream supplied');
-  assert(this._added < this._shards, 'Inputs exceed defined number of shards');
-
-  var self = this;
-  var input = readable.pipe(stream.PassThrough()).pause();
-
-  input.once('readable', function() {
-    exchangeReport.begin(hash);
-  });
-
-  input.on('end', function() {
-    var inputHash = utils.rmd160(self._hasher.digest());
-    self._hasher = crypto.createHash('sha256');
-
-    self._inputs.splice(self._inputs.indexOf(input), 1);
-
-    if (inputHash !== hash) {
-      // Send the bridge a failure report
-      exchangeReport.end(ExchangeReport.FAILURE, 'FAILED_INTEGRITY');
-      bridgeClient.createExchangeReport(exchangeReport);
-
-      self.emit('error', new Error('Shard failed integrity check'));
-    } else {
-      // Send the bridge a success report
-      exchangeReport.end(ExchangeReport.SUCCESS, 'SHARD_DOWNLOADED');
-      bridgeClient.createExchangeReport(exchangeReport);
-    }
-
-    self.emit('drain', input);
-  });
-
-  readable.on('error', function(err) {
-    // Send the bridge a failure report
-    exchangeReport.end(ExchangeReport.FAILURE, 'DOWNLOAD_ERROR');
-    bridgeClient.createExchangeReport(exchangeReport);
-    self.emit('error', err);
-  });
-
-  this._added++;
-  this._inputs.push(input);
-  this.emit('sourceAdded');
-
-  return this;
-};
-
-module.exports = FileMuxer;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_network_contact.js.html b/Storj/core/docs/lib_network_contact.js.html deleted file mode 100644 index 6925840..0000000 --- a/Storj/core/docs/lib_network_contact.js.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - JSDoc: Source: lib/network/contact.js - - - - - - - - - - -
- -

Source: lib/network/contact.js

- - - - - - -
-
-
'use strict';
-
-var assert = require('assert');
-var kad = require('kad');
-var inherits = require('util').inherits;
-var version = require('../version');
-var utils = require('../utils');
-var url = require('url');
-
-/**
-* Represents a Storj contact (or peer)
-* @constructor
-* @license LGPL-3.0
-* @param {Object} contact
-* @param {String} contact.address - Hostname of IP address
-* @param {Number} contact.port - RPC port number
-* @param {String} contact.nodeID - 160 bit node ID (hex)
-* @param {String} [contact.hdKey] - extended hd public key
-* @param {String} [contact.hdIndex] - derivation index for node
-* @param {String} [contact.userAgent] - User agent identifier
-* @param {String} contact.protocol - Semver tag for compatibility
-*/
-function Contact(options) {
-  if (!(this instanceof Contact)) {
-    return new Contact(options);
-  }
-
-  this.userAgent = options.userAgent || version.software;
-  this.protocol = options.protocol || version.protocol;
-
-  if (options.hdKey) {
-    assert(utils.isValidHDNodeKey(options.hdKey),
-           'hdKey is expected to be extended public key');
-    assert(utils.isValidNodeIndex(options.hdIndex),
-           'hdIndex is expected to be a non-hardened index');
-    this.hdKey = options.hdKey;
-    this.hdIndex = options.hdIndex;
-  } else {
-    this.hdKey = undefined;
-    this.hdIndex = undefined;
-  }
-
-  kad.contacts.AddressPortContact.call(this, options);
-}
-
-inherits(Contact, kad.contacts.AddressPortContact);
-
-/**
- * Indicates if URL is valid contact
- * @param {String}
- * @returns {Boolean}
- */
-Contact.isValidUrl = function(uri) {
-  let contact = null;
-
-  try {
-    contact = url.parse(uri);
-    assert(contact.protocol === 'storj:', 'Invalid protocol');
-    assert(
-      Buffer.from(contact.path.substr(1), 'hex').length * 8 === 160,
-      'Invalid node ID'
-    );
-    assert(
-      utils.isValidContact(Contact.fromUrl(uri),
-                           process.env.STORJ_ALLOW_LOOPBACK),
-      'Invalid contact data'
-    );
-  } catch (err) {
-    return false;
-  }
-
-  return true;
-};
-
-/**
- * Returns a Storj contact from the URI
- * @private
- * @param {String} uri
- */
-Contact.fromUrl = function(uri) {
-  var parsed = url.parse(uri);
-
-  return new Contact({
-    address: parsed.hostname,
-    port: Number(parsed.port),
-    nodeID: parsed.path.substr(1)
-  });
-};
-
-module.exports = Contact;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_network_farmer.js.html b/Storj/core/docs/lib_network_farmer.js.html deleted file mode 100644 index 4692416..0000000 --- a/Storj/core/docs/lib_network_farmer.js.html +++ /dev/null @@ -1,439 +0,0 @@ - - - - - JSDoc: Source: lib/network/farmer.js - - - - - - - - - - -
- -

Source: lib/network/farmer.js

- - - - - - -
-
-
'use strict';
-
-var kfs = require('kfs');
-var fs = require('fs');
-var path = require('path');
-var kad = require('kad');
-var Network = require('./');
-var inherits = require('util').inherits;
-var StorageItem = require('../storage/item');
-var Contract = require('../contract');
-var merge = require('merge');
-var constants = require('../constants');
-var utils = require('../utils');
-
-/**
- * Creates and a new farmer interface
- * @constructor
- * @license AGPL-3.0
- * @extends {Network}
- * @param {Object} options
- * @param {String} options.paymentAddress - Optional payment address
- * @param {Array} options.opcodeSubscriptions - Contract opcodes to farm
- * @param {Number} options.maxOfferConcurrency - Max offers to have pending
- * @param {FarmerInterface~negotiator} options.contractNegotiator
- * @param {KeyPair} options.keyPair - Node's cryptographic identity
- * @param {StorageManager} options.storageManager - Storage manager backend
- * @param {String} options.bridgeUri - URL for bridge server seed lookup
- * @param {Object} options.logger - Logger instance
- * @param {Array} options.seedList - List of seed URIs to join
- * @param {String} options.rpcAddress - Public node IP or hostname
- * @param {Number} options.rpcPort - Listening port for RPC
- * @param {Boolean} options.doNotTraverseNat - Skip NAT traversal strategies
- * @param {Number} options.maxTunnels - Max number of tunnels to provide
- * @param {Number} options.tunnelServerPort - Port for tunnel server to use
- * @param {Object} options.tunnelGatewayRange
- * @param {Number} options.tunnelGatewayRange.min - Min port for gateway binding
- * @param {Number} options.tunnelGatewayRange.max - Max port for gateway binding
- * @param {Number} [options.offerBackoffLimit=4] - Do not send offers if more
- * than N transfers are active
- * @param {String[]} [options.renterWhitelist] - Node IDs to offer storage to
- * @param {Object} [options.joinRetry]
- * @param {Number} [options.joinRetry.times] - Times to retry joining net
- * @param {Number} [options.joinRetry.interval] - MS to wait before retrying
- * @emits Network#ready
- * @property {KeyPair} keyPair
- * @property {StorageManager} storageManager
- * @property {kad.Node} node - The underlying DHT node
- * @property {TriggerManager} triggerManager
- * @property {BridgeClient} bridgeClient
- * @property {Contact} contact
- * @property {Transport} transportAdapter
- * @property {kad.Router} router - The underlying DHT router
- * @property {DataChannelServer} dataChannelServer
- */
-function FarmerInterface(options) {
-  if (!(this instanceof FarmerInterface)) {
-    return new FarmerInterface(options);
-  }
-
-  options = merge.recursive(Object.create(FarmerInterface.DEFAULTS), options);
-
-  this._negotiator = options.contractNegotiator;
-  this._pendingOffers = [];
-  this._offerBackoffLimit = options.offerBackoffLimit;
-  this._renterWhitelist = Array.isArray(options.renterWhitelist) ?
-                          options.renterWhitelist :
-                          null;
-
-  Network.call(this, options);
-}
-
-inherits(FarmerInterface, Network);
-
-/**
- * Called when a contract is found that meets subscription criteria and allows
- * us to modify the contract terms if we desire and then uses the return value
- * to determine if we should send the renter an offer
- * @callback FarmerInterface~negotiator
- * @param {Contract} contract - The contract object to negotiate
- * @returns {Boolean}
- */
-
-FarmerInterface.Negotiator = function(contract, callback) {
-  var self = this;
-
-  if (this._renterWhitelist) {
-    var allowed =  {
-      renterNodeId: this._renterWhitelist.indexOf(
-        contract.get('renter_id')
-      ) !== -1,
-      renterExtendedPubKey: this._renterWhitelist.indexOf(
-        contract.get('renter_hd_key')
-      ) !== -1
-    };
-    var isWhitelisted = allowed.renterNodeId || allowed.renterExtendedPubKey;
-
-    self._logger.debug('renter is whitelisted: %s', isWhitelisted);
-
-    if (!isWhitelisted) {
-      return callback(false);
-    }
-  }
-
-  if (!contract.get('data_hash')) {
-    self._logger.warn('contract received with invalid data_hash, ignoring');
-    return callback(false);
-  }
-
-  // NB: Backoff on sending offers if we are already have high active transfer
-  var concurrentTransfer = (
-    self.transport.shardServer.activeTransfers >= self._offerBackoffLimit
-  );
-  self._logger.debug(
-    'active transfers %s is less than offerBackoffLimit %s: %s',
-    self.transport.shardServer.activeTransfers,
-    self._offerBackoffLimit,
-    !concurrentTransfer
-  );
-  if (concurrentTransfer) {
-    self._logger.warn('too many active transfers, not sending offer');
-    return callback(false);
-  }
-
-  // NB: Only bid on contracts for data we don't have
-  this.storageManager.load(contract.get('data_hash'), function(err, item) {
-    if (err) {
-      self._logger.debug('no storage item available for this shard');
-      return callback(true);
-    }
-
-    var renters = Object.keys(item.contracts);
-
-    if (renters.indexOf(contract.get('renter_id')) === -1) {
-      self._logger.debug('no contract currently staged for this shard');
-      return callback(true);
-    }
-
-    if (typeof item.shard.write === 'function') {
-      self._logger.debug('no data currently stored for this shard');
-      return callback(true);
-    }
-
-    self._logger.debug('shard already stored, not sending offer');
-    callback(false);
-  });
-};
-
-FarmerInterface.DEFAULTS = {
-  renterWhitelist: fs.readFileSync(
-    path.join(__dirname, '../../TRUSTED_KEYS')
-  ).toString().split('\n').filter((k) => !!k),
-  paymentAddress: '',
-  opcodeSubscriptions: ['0f01020202', '0f02020202', '0f03020202'],
-  contractNegotiator: FarmerInterface.Negotiator,
-  maxOfferConcurrency: constants.MAX_CONCURRENT_OFFERS,
-  offerBackoffLimit: 4
-};
-
-/**
- * Wraps the super call to {@link Network#join} to listen for contract after
- * successfully establishing a connection to the network
- * @param {Function} callback - Called on successful join
- */
-FarmerInterface.prototype.join = function(callback) {
-  var self = this;
-
-  Network.prototype.join.call(this, function(err) {
-    if (err) {
-      return callback(err);
-    }
-
-    self._listenForContracts(self._options.opcodeSubscriptions);
-    self.on(
-      'connected',
-      self._listenForContracts.bind(self, self._options.opcodeSubscriptions)
-    );
-    callback();
-  });
-};
-
-/**
- * Sends the given contract as an offer to the specified renter
- * @private
- * @param {Contract} contract - The contract to include in offer
- * @param {Contact} renter - The renter who originally published the contract
- */
-FarmerInterface.prototype._sendOfferForContract = function(contract, contact) {
-  var self = this;
-  var message = new kad.Message({
-    method: 'OFFER',
-    params: {
-      contract: contract.toObject(),
-      contact: self.contact
-    }
-  });
-
-  self._logger.debug('Sending offer for contract hash %s',
-    contract.get('data_hash'));
-  self._removeContractFromPendingList(contract);
-  self.transport.send(contact, message, function(err, response) {
-    if (err) {
-      return self._logger.warn(err.message);
-    }
-
-    if (response.error || !response.result.contract) {
-      return self._logger.warn(
-        response.error ? response.error.message : 'Renter refused to sign'
-      );
-    }
-
-    self._handleOfferRes(response, contract, contact);
-  });
-};
-
-/**
- * Returns the payment address supplied or the derived one from keypair
- * @returns {String}
- */
-FarmerInterface.prototype.getPaymentAddress = function() {
-  return this._options.paymentAddress || this.keyPair.getAddress();
-};
-
-/**
- * Handles a received contract and negotiates storage
- * @private
- * @param {Contract} contract
- */
-FarmerInterface.prototype._negotiateContract = function(contract, contact) {
-  var self = this;
-
-  contract.set('farmer_id', self.keyPair.getNodeID());
-  contract.set('payment_destination', self.getPaymentAddress());
-  contract.sign('farmer', self.keyPair.getPrivateKey());
-
-  var item = new StorageItem({ hash: contract.get('data_hash') });
-  var renterId = contract.get('renter_id');
-
-  if (typeof renterId !== 'string') {
-    self._removeContractFromPendingList(contract);
-    return self._logger.warn('dropping invalid contract with no renter id');
-  }
-
-  item.addContract({ nodeID: renterId }, contract);
-  item.addMetaData({ nodeID: renterId }, {});
-
-  self.storageManager.save(item, function(err) {
-    if (err) {
-      self._removeContractFromPendingList(contract);
-      return self._logger.error(err.message);
-    }
-
-    self._sendOfferForContract(contract, contact);
-  });
-};
-
-/**
- * Checks if we should send an offer by checking the pending offers and running
- * the optional custom negotiator function
- * @private
- * @param {Contract} contract
- * @param {Function} callback
- */
-FarmerInterface.prototype._shouldSendOffer = function(contract, callback) {
-  var self = this;
-
-  this._negotiator.call(this, contract, function(shouldNegotiate) {
-    /* eslint max-statements: [2, 16] */
-    self._logger.debug('negotiator returned: %s', shouldNegotiate);
-    self.storageManager._storage.size(
-      contract.get('data_hash'),
-      function(err, usedSpace) {
-        if (err) {
-          self._logger.error('Could not get usedSpace: %s',err.message);
-          return callback(false);
-        }
-
-        var maxCapacity = self.storageManager._options.maxCapacity;
-        var estimatedMaxBucketSize = Math.floor(maxCapacity / kfs.constants.B);
-        var freeSpace = estimatedMaxBucketSize - usedSpace;
-        var enoughFreeSpace = contract.get('data_size') <= freeSpace;
-        self._logger.debug('we have enough free space: %s', enoughFreeSpace);
-
-        callback(shouldNegotiate && enoughFreeSpace);
-      }
-    );
-  });
-};
-
-/**
- * Adds the contract data hash to the pending offers list
- * @private
- * @param {Contract} contract - The contract being negotiated
- */
-FarmerInterface.prototype._addContractToPendingList = function(contract) {
-  var id = contract.get('data_hash') + contract.get('renter_id');
-
-  if (this._pendingOffers.indexOf(id) !== -1) {
-    return 0;
-  }
-
-  return this._pendingOffers.push(id);
-};
-
-/**
- * Removes the contract data hash to the pending offers list
- * @param {Contract} contract - The contract being negotiated
- * @private
- */
-FarmerInterface.prototype._removeContractFromPendingList = function(contract) {
-  var index = this._pendingOffers.indexOf(
-    contract.get('data_hash') + contract.get('renter_id')
-  );
-
-  if (index === -1) {
-    return;
-  }
-
-  this._pendingOffers.splice(index, 1);
-};
-
-/**
- * Handles an offer response from a renter
- * @private
- */
-FarmerInterface.prototype._handleOfferRes = function(res, contract, renter) {
-  var self = this;
-  var final = null;
-
-  try {
-    final = Contract.fromObject(res.result.contract);
-  } catch (err) {
-    return self._logger.warn('renter responded with invalid contract');
-  }
-
-  if (!final.verify('renter', contract.get('renter_id'))) {
-    return self._logger.warn('renter signature is invalid');
-  }
-
-  self.storageManager.load(contract.get('data_hash'), function(err, item) {
-    if (err) {
-      item = new StorageItem({ hash: contract.get('data_hash') });
-    }
-
-    item.addContract(renter, contract);
-    item.addMetaData(renter, {});
-    self.storageManager.save(item, utils.noop);
-    self._logger.info('Offer accepted');
-  });
-};
-
-/**
- * Subscribes to a contract identifier on the network
- * @private
- * @param {Array} opcodes
- */
-FarmerInterface.prototype._listenForContracts = function(opcodes) {
-  this.subscribe(opcodes, this._handleContractPublication.bind(this));
-};
-
-/**
- * Handles received contract publications
- * @private
- * @param {Object} contract - The raw contract object
- */
-FarmerInterface.prototype._handleContractPublication = function(contract) {
-  var self = this;
-  var contractObj;
-  var contact = contract.contact;
-
-  this._logger.debug('received contract offer...');
-
-  try {
-    contractObj = Contract.fromObject(contract);
-  } catch (err) {
-    return; // If the contract is invalid just drop it
-  }
-
-  this._shouldSendOffer(contractObj, function(shouldSendOffer) {
-    if (!shouldSendOffer) {
-      return self._logger.debug('not sending an offer for the contract');
-    }
-
-    self._addContractToPendingList(contractObj);
-    self._negotiateContract(contractObj, contact);
-  });
-};
-
-module.exports = FarmerInterface;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_network_index.js.html b/Storj/core/docs/lib_network_index.js.html deleted file mode 100644 index cd895ab..0000000 --- a/Storj/core/docs/lib_network_index.js.html +++ /dev/null @@ -1,1005 +0,0 @@ - - - - - JSDoc: Source: lib/network/index.js - - - - - - - - - - -
- -

Source: lib/network/index.js

- - - - - - -
-
-
'use strict';
-
-var assert = require('assert');
-var merge = require('merge');
-var async = require('async');
-var kad = require('kad');
-var HDKey = require('hdkey');
-var bitcore = require('bitcore-lib');
-var secp256k1 = require('secp256k1');
-var constants = require('../constants');
-var Message = require('bitcore-message');
-var Quasar = require('kad-quasar').Protocol;
-var utils = require('../utils');
-var KeyPair = require('../crypto-tools/keypair');
-var StorageManager = require('../storage/manager');
-var Protocol = require('./protocol');
-var Contact = require('./contact');
-var Transport = require('./transport');
-var EventEmitter = require('events').EventEmitter;
-var inherits = require('util').inherits;
-var diglet = require('diglet');
-var shuffle = require('knuth-shuffle').knuthShuffle;
-var BridgeClient = require('../bridge-client');
-var TriggerManager = require('../sips').SIP0003.TriggerManager;
-var OfferManager = require('../contract/offer-manager');
-
-/**
- * Storj network interface
- * @constructor
- * @license AGPL-3.0
- * @param {Object}  options
- * @param {String} [options.hdKey] - Extended SIP32 private key at 'group index'
- * @param {Number} [options.hdIndex] - Derivation index for hdKey
- * @param {KeyPair} [options.keyPair] - Node's cryptographic identity
- * @param {StorageManager} options.storageManager - Storage manager backend
- * @param {String} options.bridgeUri - URL for bridge server seed lookup
- * @param {Object} options.logger - Logger instance
- * @param {Array} options.seedList - List of seed URIs to join
- * @param {String} options.rpcAddress - Public node IP or hostname
- * @param {Number} options.rpcPort - Listening port for RPC
- * @param {Number} options.listenPort - Optional different listening port for RPC to bind to
- * @param {Boolean} options.doNotTraverseNat - Skip NAT traversal strategies
- * @param {Number} options.maxTunnels - Max number of tunnels to provide
- * @param {Number} options.maxConnections - Max concurrent connections
- * @param {Object} options.tunnelGatewayRange
- * @param {Number} options.tunnelGatewayRange.min - Min port for gateway bind
- * @param {Number} options.tunnelGatewayRange.max - Max port for gateway bind
- * @param {Object} [options.joinRetry]
- * @param {Number} [options.joinRetry.times] - Times to retry joining net
- * @param {Number} [options.joinRetry.interval] - MS to wait before retrying
- * @emits Network#ready
- * @property {KeyPair} keyPair
- * @property {StorageManager} storageManager
- * @property {kad.Node} node - The underlying DHT node
- * @property {TriggerManager} triggerManager
- * @property {BridgeClient} bridgeClient
- * @property {Contact} contact
- * @property {Transport} transportAdapter
- * @property {kad.Router} router - The underlying DHT router
- * @property {ShardServer} shardServer
- * @property {OfferManager} offerManager
- */
-function Network(options) {
-  if (!(this instanceof Network)) {
-    return new Network(options);
-  }
-
-  this._initKeyPair(options);
-  this.storageManager = options.storageManager;
-  this.offerManager = new OfferManager();
-
-  this._tunnelers = kad.Bucket();
-  this._options = this._checkOptions(options);
-  this._logger = options.logger;
-  this._storage = new kad.storage.MemStore();
-  this._pubkeys = {};
-  this._hdcache = {};
-  this._open = false;
-
-  this._initNetworkInterface();
-}
-
-inherits(Network, EventEmitter);
-
-Network.prototype._initKeyPair = function(options) {
-  if (options.hdKey) {
-    assert(!options.keyPair, '"keyPair" is not expected with "hdKey"');
-    assert(options.hdIndex, '"hdIndex" is expected with "hdKey"');
-    this.hdKey = HDKey.fromExtendedKey(options.hdKey);
-    this.hdIndex = options.hdIndex;
-    var key = this.hdKey.deriveChild(this.hdIndex);
-    this.keyPair = new KeyPair(key.privateKey.toString('hex'));
-  } else {
-    this.hdKey = null;
-    this.hdIndex = null;
-    this.keyPair = options.keyPair;
-  }
-};
-
-/**
- * Triggered when the transport's network interface is ready
- * @event Network#ready
- */
-
-/**
- * Triggered when the node has entered the overlay network
- * @event Network#connected
- */
-
-/**
- * Triggered when the node has exited the overlay network
- * @event Network#disconnected
- */
-
-/**
- * Triggered when an error occurs
- * @event Network#error
- */
-
-/**
- * Triggered when a valid offer is received, but we are not waiting for one
- * @event Network#unhandledOffer
- * @param {Contact} contact - The farmer contact the offer is from
- * @param {Contract} contract - The complete contract, signed by us and farmer
- * @param {Protocol~unhandledOfferResolver}
- */
-
-/**
- * Triggered when an unhandled offer is handled by the
- * {@link Network#unhandledOffer} listener by calling the event's supplied
- * {@link Network~unhandledOfferResolver}
- * @event Network#unhandledOfferResolved
- * @param {Contact} contact - The farmer contact the offer is from
- * @param {Contract} contract - The complete contract, signed by us and farmer
- */
-
-Network.DEFAULTS = {
-  bridgeUri: process.env.STORJ_BRIDGE || 'https://api.storj.io',
-  seedList: [],
-  joinRetry: { times: 1, interval: 5000 },
-  rpcAddress: '127.0.0.1',
-  rpcPort: 4000,
-  doNotTraverseNat: false,
-  maxTunnels: 3,
-  maxConnections: 150,
-  tunnelServerPort: 4001,
-  tunnelGatewayRange: { min: 4002, max: 4004 }
-};
-
-Network.RPC_VALIDATION_EXEMPT = [
-  'PROBE',
-  'FIND_TUNNEL',
-  'OPEN_TUNNEL'
-];
-
-/**
- * Check the options supplied to the constructor
- * @private
- */
-Network.prototype._checkOptions = function(options) {
-  assert(
-    options.keyPair instanceof KeyPair || typeof options.hdKey === 'string',
-    'Invalid keypair supplied'
-  );
-  assert(
-    options.storageManager instanceof StorageManager,
-    'Invalid manager supplied'
-  );
-  assert.ok(this._validateLogger(options.logger), 'Invalid logger supplied');
-
-  return merge(JSON.parse(JSON.stringify(Network.DEFAULTS)), options);
-};
-
-/**
- * Validates the logger object supplied
- * @private
- */
-Network.prototype._validateLogger = function(logger) {
-  return logger && logger.debug && logger.warn && logger.info && logger.error;
-};
-
-/**
- * Binds the transport adapter's hooks and events
- * @private
- */
-Network.prototype._bindTransportHooks = function() {
-  this.transport.on('error', this._handleTransportError.bind(this));
-  this.transport.before('serialize', this._signMessage.bind(this));
-  this.transport.before('receive', this._verifyMessage.bind(this));
-  this.transport.before('receive', kad.hooks.protocol(
-    this._protocol.getRouteMap()
-  ));
-  // NB: After receiving a message, reset the net re-entry timeout
-  this.transport.after('receive', () => {
-    clearTimeout(this._reEntryTimeout);
-    this._reEntryTimeout = setTimeout(
-      () => this._enterOverlay(utils.noop),
-      constants.NET_REENTRY
-    );
-  });
-};
-
-/**
- * Opens the connection to the network
- * @param {Function} callback - Called on successful network join
- */
-Network.prototype.join = function(callback) {
-  var self = this;
-
-  if (!this._ready) {
-    return this.once('ready', this.join.bind(this, callback));
-  }
-
-  this.node = new kad.Node({
-    transport: this.transport,
-    router: this.router,
-    storage: this._storage,
-    logger: this._logger
-  });
-
-  if (typeof callback === 'function') {
-    self.once('error', callback);
-    self.once('connected', function() {
-      if (self.transport._isPublic) {
-        self._listenForTunnelers();
-      }
-
-      self.removeListener('error', callback);
-      callback(null, self);
-    });
-  }
-
-  function onJoinComplete(err) {
-    if (err) {
-      return self.emit('error', err);
-    }
-
-    self.emit('connected');
-  }
-
-  async.series(
-    [
-      this._warnIfClockNotSynced.bind(this), // TODO: Make this not fail hard
-      this.storageManager.open.bind(this.storageManager),
-      this._setupTunnelClient.bind(this),
-    ],
-    function(err) {
-      if (err) {
-        return self.emit('error', err);
-      }
-
-      // enter overlay network and retry if failed
-      async.retry(
-        {
-          times: self._options.joinRetry.times,
-          interval: self._options.joinRetry.interval
-        },
-        self._enterOverlay.bind(self),
-        onJoinComplete
-      );
-    }
-  );
-};
-
-/**
- * Iteratively attempt connection to network via supplied seeds
- * @private
- */
-Network.prototype._enterOverlay = function(onConnected) {
-  var self = this;
-
-  function _trySeeds() {
-    async.detectSeries(self._options.seedList, function(uri, next) {
-      self._logger.info('attempting to join network via %s', uri);
-      self.connect(uri, function(err) {
-        if (err) {
-          self._logger.warn('failed to connect to seed %s', uri);
-          next(null, false);
-        } else {
-          self._logger.info('connected to the storj network via %s', uri);
-          next(null, true);
-        }
-      });
-    }, function(err, result) {
-      if (err || !result) {
-        // NB: If we fail to join log a warning and retry in 10 mins
-        self._logger.warn('failed to join the network, queuing re-entry');
-      }
-
-      // NB: Force re-entry into network to refresh routes every 10 minutes
-      clearTimeout(self._reEntryTimeout);
-      self._reEntryTimeout = setTimeout(_trySeeds, constants.NET_REENTRY);
-      onConnected(null);
-    });
-  }
-
-  if (this._options.seedList.length) {
-    return _trySeeds();
-  }
-
-  if (this._options.bridgeUri === null) {
-    self._logger.warn('no bridge uri or seeds provided, not connected');
-    return onConnected(null);
-  }
-
-  this._logger.info('resolving seeds from %s', this._options.bridgeUri);
-  this.bridgeClient.getContactList({ connected: true }, function(err, seeds) {
-    if (err) {
-      return onConnected(
-        new Error('Failed to discover seeds from bridge: ' + err.message)
-      );
-    }
-
-    self._options.seedList = shuffle(seeds)
-      .filter((c) => c.nodeID !== self.contact.nodeID)
-      .filter((c) => utils.isCompatibleVersion(
-        c.protocol,
-        process.env.STORJ_ALLOW_LOOPBACK
-      ))
-      .filter((c) => utils.isValidContact(c))
-      .map(utils.getContactURL);
-
-    _trySeeds();
-  });
-};
-
-/**
- * Disconnects from the network
- * @param {Function} callback - Called when successful disconnect
- */
-Network.prototype.leave = function(callback) {
-  var self = this;
-
-  if (typeof callback === 'function') {
-    this.once('error', callback);
-    this.once('disconnected', function() {
-      this.removeListener('error', callback);
-      callback(null);
-    });
-  }
-
-  this.storageManager.close(function(err) {
-    if (err) {
-      return self.emit('error', err);
-    }
-
-    self.node.disconnect(function(err) {
-      if (err) {
-        return self.emit('error', err);
-      }
-
-      self.emit('disconnected');
-    });
-  });
-};
-
-/**
- * Publishes a topic with content to the network
- * @param {String} topic - The serialized opcode topic
- * @param {Object} contents - Arbitrary publication contents
- * @param {Object} options - Options to pass to kad-quasar
- */
-Network.prototype.publish = function(topic, contents, options) {
-  return this._pubsub.publish(topic, contents, options);
-};
-
-/**
- * Subscribes to a topic on the network
- * @param {String} topic - The serialized opcode topic
- * @param {Object} handler - Function to handle received publications
- */
-Network.prototype.subscribe = function(topic, handler) {
-  return this._pubsub.subscribe(topic, handler);
-};
-
-/**
- * Connects to the node at the given URI
- * @param {String} uri - The storj protocol URI to connect
- * @param {Function} callback - Called on connection or error
- */
-Network.prototype.connect = function(uri, callback) {
-  const self = this;
-
-  callback = typeof callback === 'function' ? callback : function(err) {
-    if (err) {
-      self._logger.warn('failed to connect to %s, reason: %s',
-                        uri, err.message);
-    } else {
-      self._logger.info('connection established with %s', uri);
-    }
-  };
-
-  if (!Contact.isValidUrl(uri)) {
-    return callback(new Error('Invalid contact URI supplied'));
-  }
-
-  return this.node.connect(Contact.fromUrl(uri), callback);
-};
-
-/**
- * Will ping a neighbor
- * @param {String} neighbor - A contact
- * @param {Function} callback - Called on connection or error
- */
-Network.prototype.ping = function(neighbor, callback) {
-  var message = new kad.Message({
-    method: 'PING',
-    params: { contact: this.contact }
-  });
-
-  this.transport.send(neighbor, message, callback);
-};
-
-/**
- * Initilizes the network interface
- * @private
- */
-Network.prototype._initNetworkInterface = function() {
-  EventEmitter.call(this);
-
-  this.triggerManager = new TriggerManager();
-  this.bridgeClient = new BridgeClient(this._options.bridgeUri, {
-    logger: this._logger
-  });
-  this.contact = new Contact({
-    address: this._options.rpcAddress,
-    port: this._options.rpcPort,
-    nodeID: this.keyPair.getNodeID(),
-    hdKey: this.hdKey ? this.hdKey.publicExtendedKey : undefined,
-    hdIndex: this.hdIndex ? this.hdIndex : undefined
-  });
-  this.transport = new Transport(this.contact, {
-    logger: this._logger,
-    maxTunnels: this._options.maxTunnels,
-    maxConnections: this._options.maxConnections,
-    tunnelGatewayRange: this._options.tunnelGatewayRange,
-    doNotTraverseNat: this._options.doNotTraverseNat,
-    storageManager: this.storageManager,
-    bridgeClient: this._bridgeClient,
-    listenPort: this._options.listenPort
-  });
-  this.router = new kad.Router({
-    transport: this.transport,
-    logger: this._logger
-  });
-
-  this._protocol = new Protocol({ network: this });
-  this.transport.after('open', this._onTransportOpen.bind(this));
-  this._startRouterCleaner();
-};
-
-/**
- * Set up {@link ShardServer} after transport is ready
- * @private
- */
-Network.prototype._onTransportOpen = function() {
-  this._bindTransportHooks();
-
-  this._ready = true;
-  this._pubsub = new Quasar(this.router, {
-    logger: this._logger,
-    randomRelay: true,
-    maxRelayHops: constants.PUBLISH_TTL
-  });
-
-  this.emit('ready');
-};
-
-/**
- * Signs an outgoing message
- * @private
- * @param {kad.Message} message
- * @param {Function} callback
- */
-Network.prototype._signMessage = function(message, callback) {
-  var nonce = Date.now();
-  var target = message.id + nonce;
-  var signature = null;
-
-  try {
-    signature = this.keyPair.sign(target);
-  } catch (err) {
-    return callback(err);
-  }
-
-  if (kad.Message.isRequest(message)) {
-    message.params.nonce = nonce;
-    message.params.signature = signature;
-  } else {
-    message.result.nonce = nonce;
-    message.result.signature = signature;
-  }
-
-  callback();
-};
-
-/**
- * Verifies that the supplied contact is valid and compatible
- * @private
- * @param {Contact} contact
- */
-Network.prototype._validateContact = function(contact, callback) {
-  if (!utils.isCompatibleVersion(contact.protocol)) {
-    this.router.removeContact(contact);
-    return callback(new Error('Protocol version is incompatible'));
-  }
-
-  if (!utils.isValidContact(contact, process.env.STORJ_ALLOW_LOOPBACK)) {
-    this.router.removeContact(contact);
-    return callback(new Error('Invalid contact data supplied'));
-  }
-
-  callback(null);
-};
-
-/**
- * Verifies an incoming message
- * @private
- * @param {kad.Message} message
- * @param {Contact} contact
- * @param {Function} callback
- */
-Network.prototype._verifyMessage = function(message, contact, callback) {
-  var self = this;
-
-  this._validateContact(contact, function(err) {
-    if (err && Network.RPC_VALIDATION_EXEMPT.indexOf(message.method) === -1) {
-      return callback(err);
-    }
-
-    var messagekey = kad.Message.isRequest(message) ? 'params' : 'result';
-    var nonce = message[messagekey].nonce;
-    var signature = message[messagekey].signature;
-
-    if (Date.now() > (constants.NONCE_EXPIRE + nonce)) {
-      return callback(new Error('Message signature expired'));
-    }
-
-    var addr = bitcore.Address.fromPublicKeyHash(Buffer(contact.nodeID, 'hex'));
-    var signobj = self._createSignatureObject(signature);
-
-    self._verifySignature({
-      message: message,
-      nonce: nonce,
-      signobj: signobj,
-      address: addr,
-      contact: contact,
-      signature: signature
-    }, callback);
-  });
-};
-
-/**
- * Verifies the validity of the supplied signature
- * @private
- */
-Network.prototype._verifySignature = function(options, callback) {
-  /* eslint max-statements: [2, 20] */
-  if (!options.signobj) {
-    return callback(new Error('Invalid signature supplied'));
-  }
-
-  var signedmsg = Message(options.message.id + options.nonce);
-  var magic = signedmsg.magicHash();
-  var recovery = options.signobj.i;
-  var sig = secp256k1.signatureImport(options.signobj.toBuffer());
-  var pubKey = this._pubkeys[options.contact.nodeID];
-
-  if (!pubKey) {
-    try {
-      pubKey = secp256k1.recover(magic, sig, recovery, true);
-      this._pubkeys[options.contact.nodeID] = pubKey;
-    } catch (e) {
-      return callback(e);
-    }
-  }
-
-  if (!secp256k1.verify(magic, sig, pubKey)) {
-    return callback(new Error('Signature verification failed'));
-  }
-
-  if (!this._verifyHDKeyContact(options.contact, pubKey)) {
-    return callback(new Error('Invalid derived public key'));
-  }
-
-  callback(null);
-};
-
-Network.prototype._verifyHDKeyContact = function(contact, publicKeyBuffer) {
-  if (contact.hdKey) {
-    var contactPub = this._hdcache[contact.hdKey + contact.hdIndex];
-    if (!contactPub) {
-      var hdKey = HDKey.fromExtendedKey(contact.hdKey);
-      var nodeKey = hdKey.deriveChild(contact.hdIndex);
-      contactPub = nodeKey.publicKey;
-      this._hdcache[contact.hdKey + contact.hdIndex] = contactPub;
-    }
-    if (contactPub.compare(publicKeyBuffer) === 0) {
-      return true;
-    }
-    return false;
-  }
-  return true;
-};
-
-/**
- * Creates a signature object from signature string
- * @private
- */
-Network.prototype._createSignatureObject = function(signature) {
-  var compactSig;
-  var signobj;
-
-  try {
-    compactSig = new Buffer(signature, 'base64');
-    signobj = bitcore.crypto.Signature.fromCompact(compactSig);
-  } catch (err) {
-    return null;
-  }
-
-  return signobj;
-};
-
-/**
- * Proxies error events from the underlying transport adapter
- * @private
- * @param {Error} error
- */
-Network.prototype._handleTransportError = function(error) {
-  this._logger.warn(error.message);
-};
-
-/**
- * Subscribe to tunneler opcodes to manage known tunnelers
- * @private
- */
-Network.prototype._listenForTunnelers = function() {
-  var self = this;
-  var tunserver = self.transport.tunnelServer;
-  var prefix = Buffer([constants.OPCODE_TUNNELER_PREFIX], 'hex');
-  var available = Buffer([constants.OPCODE_DEG_LOW], 'hex');
-  var unavailable = Buffer([constants.OPCODE_DEG_NULL], 'hex');
-
-  function announce() {
-    let hasTunnelAvailable = Object.keys(
-      tunserver._proxies
-    ).length < tunserver._opts.maxProxiesAllowed;
-    self._pubsub.publish(
-      Buffer.concat([
-        prefix,
-        hasTunnelAvailable ? available : unavailable
-      ]).toString('hex'),
-      self.contact
-    );
-    setTimeout(announce, constants.TUNNEL_ANNOUNCE_INTERVAL);
-  }
-
-  if (this._options.maxTunnels) {
-    announce();
-  }
-
-  var tunUp = Buffer.concat([prefix, available]).toString('hex');
-  var tunDown = Buffer.concat([prefix, unavailable]).toString('hex');
-
-  this._pubsub.subscribe([tunUp, tunDown], function(contact, topic) {
-    if (topic === tunUp) {
-      if (!self._tunnelers.addContact(Contact(contact))) {
-        self._tunnelers.removeContact(self._tunnelers.getContact(0));
-        self._tunnelers.addContact(Contact(contact));
-      }
-    } else {
-      self._tunnelers.removeContact(Contact(contact));
-    }
-  });
-};
-
-/**
- * Determines if tunnel is needed
- * @private
- * @param {Function} callback
- */
-Network.prototype._setupTunnelClient = function(callback) {
-  var self = this;
-
-  if (this.transport._isPublic) {
-    return callback(null);
-  }
-
-  var neighbors = this._options.seedList
-    .filter(Contact.isValidUrl)
-    .map(Contact.fromUrl)
-    .filter((c) => c.nodeID !== self.contact.nodeID);
-
-  function _discoverIfReachable() {
-    self._logger.info('requesting probe from nearest neighbor');
-    self._requestProbe(neighbors[0], function(err, result) {
-      if (err || result.error) {
-        return self._findTunnel(neighbors, callback);
-      }
-
-      self._logger.info(
-        'you are publicly reachable, skipping tunnel establishment'
-      );
-      callback(null);
-    });
-  }
-
-  if (!neighbors.length) {
-    if (this._options.bridgeUri === null) {
-      return callback(
-        new Error('Could not find a neighbor to query for probe')
-      );
-    }
-
-    return this.bridgeClient.getContactList({}, function(err, result) {
-      if (err) {
-        return callback(new Error('Failed to get seeds for probe'));
-      }
-
-      neighbors = result.map(function(c) {
-        return new Contact(c);
-      });
-
-      _discoverIfReachable();
-    });
-  }
-
-  _discoverIfReachable();
-};
-
-/**
- * Requests a probe from the nearest neighbor
- * @private
- */
-Network.prototype._requestProbe = function(neighbor, callback) {
-  var message = new kad.Message({
-    method: 'PROBE',
-    params: { contact: this.contact }
-  });
-
-  this.transport.send(neighbor, message, callback);
-};
-
-/**
- * Finds a potential tunneler
- * @private
- * @param {Array} neighbors
- * @param {Function} callback
- */
-Network.prototype._findTunnel = function(neighbors, callback) {
-  var self = this;
-  var tunnelers = [];
-  var message = new kad.Message({
-    method: 'FIND_TUNNEL',
-    params: {
-      contact: this.contact,
-      relayers: []
-    }
-  });
-
-  // NB: If we are going to be tunneled, we better not accept any tunnel
-  // NB: connections from other nodes, so let's override our maxTunnels.
-  this._options.maxTunnels = 0;
-  this.transport.tunnelServer._opts.maxProxiesAllowed = 0;
-
-  if (!neighbors.length) {
-    return callback(
-      new Error('Could not find a neighbor to query for tunnels')
-    );
-  }
-
-  async.detectSeries(neighbors, function(neighbor, callback) {
-    self._logger.info('requesting tunnelers from neighbor');
-    self.transport.send(neighbor, message, function(err, resp) {
-      if (err) {
-        return callback(null, false);
-      }
-
-      if (!resp.result.tunnels.length) {
-        return callback(null, false);
-      }
-
-      tunnelers = tunnelers.concat(resp.result.tunnels).filter(
-        t => t.nodeID !== self.contact.nodeID
-      );
-
-      callback(null, true);
-    });
-  }, function() {
-    if (!tunnelers.length) {
-      return callback(
-        new Error('Failed to find tunnels from neighbors')
-      );
-    }
-
-    self._establishTunnel(tunnelers, callback);
-  });
-};
-
-/**
- * Creates a tunnel to a public node
- * @private
- * @param {Function} callback
- */
-Network.prototype._establishTunnel = function(tunnels, callback) {
-  var self = this;
-  var remoteAddress, remotePort, proxyPort;
-
-  function established() {
-    return proxyPort && remotePort && remoteAddress;
-  }
-
-  function openTunnel(done) {
-    if (!tunnels.length) {
-      return done(new Error('No tunnelers were returned'));
-    }
-
-    var tun = new Contact(tunnels[0]);
-    var msg = kad.Message({
-      method: 'OPEN_TUNNEL',
-      params: { contact: self.contact }
-    });
-
-    tunnels.shift();
-    self.transport.send(tun, msg, function(err, resp) {
-      if (err) {
-        return done();
-      }
-
-      remoteAddress = tun.address;
-      remotePort = tun.port;
-      proxyPort = resp.result.proxyPort;
-      done();
-    });
-  }
-
-  async.until(established, openTunnel, function(err) {
-    if (err) {
-      return callback(
-        new Error('Failed to establish tunnel, reason: ' + err.message)
-      );
-    }
-
-    var tunnelWasOpened = false;
-    var tunnelDidError = false;
-    var localAddress = self.transport._server.address();
-
-    if (!localAddress) {
-      return callback(new Error(
-        'Local transport not initialized, refusing to establish new tunnel'
-      ));
-    }
-
-    self._tunnelClient = new diglet.Tunnel({
-      localAddress: 'localhost',
-      localPort: localAddress.port,
-      remoteAddress: remoteAddress,
-      remotePort: proxyPort,
-      logger: self._logger
-    });
-
-    self._tunnelClient.once('established', () => {
-      self._logger.info('tunnel successfully established');
-
-      tunnelWasOpened = true;
-      self.contact.address = remoteAddress;
-      self.contact.port = remotePort;
-
-      callback();
-    });
-
-    self._tunnelClient.on('error', function onTunnelError(err) {
-      /* istanbul ignore else */
-      if (!tunnelDidError) {
-        tunnelDidError = true;
-
-        self._logger.warn(
-          'tunnel connection lost, reason: %s',
-          err.message
-        );
-        self._establishTunnel(tunnels, tunnelWasOpened ? utils.noop : callback);
-      } else {
-        self._logger.debug(
-          'stale tunnel client encountered an error: %s, ignoring',
-          err.message
-        );
-      }
-    });
-
-    self._tunnelClient.open();
-  });
-};
-
-/**
- * Cleans invalid contacts from routing table
- * @private
- */
-Network.prototype._cleanRoutingTable = function() {
-  var dropped = [];
-
-  for (var k in this.router._buckets) {
-    var bucket = this.router._buckets[k];
-    var bucketList = bucket.getContactList();
-
-    for (var i = 0; i < bucketList.length; i++) {
-      var isValidContact = utils.isValidContact(
-        bucketList[i],
-        process.env.STORJ_ALLOW_LOOPBACK
-      );
-      var isValidProtocol = utils.isCompatibleVersion(bucketList[i].protocol);
-
-      if (!isValidContact || !isValidProtocol) {
-        dropped.push(bucketList[i]);
-        bucket.removeContact(bucketList[i]);
-      }
-    }
-  }
-
-  return dropped;
-};
-
-/**
- * Cleans the routing table on an interval
- * @private
- */
-Network.prototype._startRouterCleaner = function() {
-  var self = this;
-
-  setInterval(function() {
-    self._logger.debug('cleaning bad contacts from routing table');
-    var dropped = self._cleanRoutingTable();
-    self._logger.debug('dropping %s bad contacts from router', dropped.length);
-  }, constants.ROUTER_CLEAN_INTERVAL);
-};
-
-/**
- * Warns the user if their clock is not synchronized with NTP server
- * @private
- */
-Network.prototype._warnIfClockNotSynced = function(callback) {
-  var self = this;
-
-  utils.ensureNtpClockIsSynchronized(function(err, delta) {
-    if (err) {
-      self._logger.warn(err.message);
-    } else {
-      self._logger.info('clock is synchronized with ntp, delta: %s ms', delta);
-    }
-
-    callback(null);
-  });
-};
-
-module.exports = Network;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_network_monitor.js.html b/Storj/core/docs/lib_network_monitor.js.html deleted file mode 100644 index 926d469..0000000 --- a/Storj/core/docs/lib_network_monitor.js.html +++ /dev/null @@ -1,285 +0,0 @@ - - - - - JSDoc: Source: lib/network/monitor.js - - - - - - - - - - -
- -

Source: lib/network/monitor.js

- - - - - - -
-
-
'use strict';
-
-var Network = require('./index');
-var EventEmitter = require('events').EventEmitter;
-var inherits = require('util').inherits;
-var assert = require('assert');
-var merge = require('merge');
-var async = require('async');
-var request = require('request');
-
-/**
- * Wraps a {@link Network} instance and provides events for gathering
- * statistics about node operation
- * @constructor
- * @license AGPL-3.0
- * @param {Network} network - The network interface to monitor
- * @param {Object} options
- */
-function Monitor(network, options) {
-  if (!(this instanceof Monitor)) {
-    return new Monitor(network, options);
-  }
-
-  assert(network instanceof Network, 'Invalid network instance supplied');
-
-  this._source = network;
-  this._options = merge(Object.create(Monitor.DEFAULTS), options);
-  this._statistics = {};
-  this._collectors = {
-    soft: [
-      Monitor.getConnectedPeers,
-      Monitor.getDiskUtilization
-    ],
-    hard: [
-      Monitor.getPaymentAddressBalances
-    ]
-  };
-
-  EventEmitter.call(this);
-}
-
-inherits(Monitor, EventEmitter);
-
-/**
- * Triggered when a valid offer is received, but we are not waiting for one
- * @event Monitor#update
- * @param {Object} stats
- */
-
-Monitor.DEFAULTS = {
-  softInterval: 10000, // NB: Interval for simple jobs
-  hardInterval: 3 * 60 * 1000 // NB: Interval for resource heavy jobs
-};
-
-/**
- * Starts the network monitor
- * @returns {Monitor}
- */
-Monitor.prototype.start = function() {
-  if (this._softInterval && this._hardInterval) {
-    return false;
-  }
-
-  this._softInterval = setInterval(
-    this._collectSoftStats.bind(this),
-    this._options.softInterval
-  );
-
-  this._hardInterval = setInterval(
-    this._collectHardStats.bind(this),
-    this._options.hardInterval
-  );
-
-  return true;
-};
-
-/**
- * Stops the network monitor
- * @returns {Monitor}
- */
-Monitor.prototype.stop = function() {
-  if (!this._softInterval && !this._hardInterval) {
-    return false;
-  }
-
-  clearInterval(this._softInterval);
-  clearInterval(this._hardInterval);
-
-  delete this._softInterval;
-  delete this._hardInterval;
-
-  return true;
-};
-
-/**
- * Returns the current snapshot
- * @returns {Object} snapshot
- */
-Monitor.prototype.getSnapshot = function() {
-  return merge(Object.create(this._statistics), {
-    timestamp: new Date()
-  });
-};
-
-/**
- * Collects the soft stats
- * @private
- */
-Monitor.prototype._collectStats = function(collectors) {
-  var self = this;
-
-  async.parallel(collectors.map(function(collector) {
-    return collector.bind(null, self._source);
-  }), function(err, results) {
-    results.forEach(function(result) {
-      self._statistics = merge(self._statistics, result);
-    });
-    self.emit('update', self.getSnapshot());
-  });
-};
-
-/**
- * Collects the soft stats
- * @private
- */
-Monitor.prototype._collectSoftStats = function() {
-  this._collectStats(this._collectors.soft);
-};
-
-/**
- * Collects the hard stats
- * @private
- */
-Monitor.prototype._collectHardStats = function() {
-  this._collectStats(this._collectors.hard);
-};
-
-/**
- * Gets the list of currently known {@link Contact}s
- * @static
- * @param {Network} source - The network instance to use
- * @param {Function} callback
- */
-Monitor.getConnectedPeers = function(source, callback) {
-  var stats = { connected: 0 };
-  var buckets = source.router._buckets;
-
-  for (var k in buckets) {
-    stats.connected += buckets[k].getSize();
-  }
-
-  callback(null, { peers: stats });
-};
-
-/**
- * Gets the amount of used space compared to amount shared
- * @static
- * @param {Network} source - The network instance to use
- * @param {Function} callback
- */
-Monitor.getDiskUtilization = function(source, callback) {
-  var stats = { free: source.storageManager._options.maxCapacity };
-
-  source.storageManager._storage.size(function(err, bytes) {
-    if (err) {
-      return callback(null, {
-        disk: merge(stats, { used: 0, free: stats.free })
-      });
-    }
-
-    callback(null, {
-      disk: merge(stats, { used: bytes, free: stats.free - bytes })
-    });
-  });
-};
-
-/**
- * Gets the balance of SJCX/SJCT from a {@link FarmerInterface}
- * @static
- * @param {Network} source - The network instance to use
- * @param {Function} callback
- */
-Monitor.getPaymentAddressBalances = function(source, callback) {
-  var stats = { balances: { sjcx: 0, sjct: 0 } };
-  var address = source.keyPair.getAddress();
-
-  if (source._options.paymentAddress) {
-    address = source._options.paymentAddress.trim();
-  }
-
-  var url = 'https://counterpartychain.io/api/balances/' + address;
-
-  request({ url: url, json: true }, function(err, res, body) {
-    if (err || res.statusCode !== 200) {
-      return callback(null, { payments: stats });
-    }
-
-    if (body && body.data) {
-      for (var balance = 0; balance < body.data.length; balance++) {
-        stats.balances[body.data[balance].asset.toLowerCase()] = Number(
-          body.data[balance].amount
-        );
-      }
-    }
-
-    callback(null, { payments: stats });
-  });
-};
-
-/**
- * Gets the total contracts stored
- * @static
- * @param {Network} source - The network instance to use
- * @param {Function} callback
- */
-Monitor.getContractsDetails = function(source, callback) {
-  var stats = { total: 0 };
-  var stream = source.storageManager._storage.createReadStream();
-
-  stream.on('data', function(item) {
-    stats.total += Object.keys(item.contracts).length;
-  });
-
-  stream.on('end', function() {
-    callback(null, { contracts: stats });
-  });
-
-  stream.on('error', function() {
-    stream.removeAllListeners();
-    callback(null, { contracts: stats });
-  });
-};
-
-module.exports = Monitor;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_network_protocol.js.html b/Storj/core/docs/lib_network_protocol.js.html deleted file mode 100644 index 82d4696..0000000 --- a/Storj/core/docs/lib_network_protocol.js.html +++ /dev/null @@ -1,758 +0,0 @@ - - - - - JSDoc: Source: lib/network/protocol.js - - - - - - - - - - -
- -

Source: lib/network/protocol.js

- - - - - - -
-
-
'use strict';
-
-var through = require('through');
-var crypto = require('crypto');
-var assert = require('assert');
-var utils = require('../utils');
-var ProofStream = require('../audit-tools/proof-stream');
-var Contract = require('../contract');
-var stream = require('readable-stream');
-var kad = require('kad');
-var async = require('async');
-var Contact =  require('./contact');
-var constants = require('../constants');
-var ExchangeReport = require('../bridge-client/exchange-report');
-
-/**
- * Defines the Storj protocol methods and mounts on a {@link Network} instance
- * to handle Storj protocol messages
- * @constructor
- * @license AGPL-3.0
- * @param {Object} options
- * @param {Network} options.network - Network instance to bind to
- */
-function Protocol(opts) {
-  if (!(this instanceof Protocol)) {
-    return new Protocol(opts);
-  }
-
-  assert(typeof opts === 'object' , 'Invalid options supplied');
-
-  this._network = opts.network;
-  this._logger = this._network._logger;
-}
-
-Protocol.RENEW_PROPS_ALLOWED = [
-  'renter_id',
-  'renter_hd_key',
-  'renter_hd_index',
-  'renter_signature',
-  'store_begin',
-  'store_end'
-];
-
-/**
- * Handles OFFER messages
- * @param {Object} params
- * @param {Contact} params.contact - Sender contact information
- * @param {Contract} params.contract - Serialized contract data
- * @param {Protocol~handleOfferCallback} callback
- * @fires Network#unhandledOffer
- * @fires Network#unhandledOfferResolved
- */
-Protocol.prototype.handleOffer = function(params, callback) {
-  var self = this;
-  var contract = null;
-
-  try {
-    contract = Contract.fromObject(params.contract);
-  } catch (err) {
-    return callback(new Error('Invalid contract format'));
-  }
-
-  self._logger.info(
-    'handling storage contract offer from %s hash %s',
-    params.contact.nodeID,
-    contract.get('data_hash')
-  );
-
-  var key = contract.get('data_hash');
-  var offerStream = self._network.offerManager.getStream(key);
-
-  this._verifyContract(contract, params.contact, function(err) {
-    if (err) {
-      return callback(err);
-    }
-
-    if (offerStream) {
-      // NB: We are waiting on/accepting offers for this contract,
-      // NB: so add it to the offer queue
-      offerStream.addOfferToQueue(Contact(params.contact), contract);
-    } else {
-      // NB: We are not waiting on/accepting offers for this contract,
-      // NB: so notify implementors
-      self._network.emit(
-        'unhandledOfferResolved',
-        Contact(params.contact),
-        contract
-      );
-    }
-
-    callback(null, { contract: contract.toObject() });
-  });
-};
-/**
- * @callback Protocol~handleOfferCallback
- * @param {Error|null} err
- * @param {Object} result
- * @param {Contract} result.contract - Signed contract
- */
-
-/**
- * Verifies that the contract is valid
- * @private
- */
-Protocol.prototype._verifyContract = function(contract, contact, callback) {
-  contract.sign('renter', this._network.keyPair.getPrivateKey());
-
-  if (!contract.isComplete()) {
-    return callback(new Error('Contract is not complete'));
-  }
-
-  if (!contract.verify('farmer', contact.nodeID)) {
-    return callback(new Error('Invalid signature from farmer'));
-  }
-
-  var offerStream = this._network.offerManager.getStream(
-    contract.get('data_hash')
-  );
-
-  if (!offerStream) {
-    if (!this._network.listenerCount('unhandledOffer')) {
-      return callback(new Error('Contract no longer open to offers'));
-    }
-
-    return this._network.emit('unhandledOffer', contact, contract, callback);
-  }
-
-  var blacklist = offerStream.options.farmerBlacklist;
-
-  if (blacklist.indexOf(contact.nodeID) !== -1) {
-    return callback(new Error('Contract no longer open to offers'));
-  }
-
-  callback(null);
-};
-/**
- * @callback Protocol~unhandledOfferResolver
- * @param {Error} [error] - An error if the offer cannot be resolved
- */
-
-/**
- * Handles AUDIT messages
- * @param {Object} params
- * @param {Contact} params.contact - Sender contact information
- * @param {Object[]} params.audits
- * @param {String} params.audits.data_hash - Shard data hash to audit
- * @param {String} params.audits.challenge - Challenge string for audit
- * @param {Protocol~handleAuditCallback} callback
- */
-Protocol.prototype.handleAudit = function(params, callback) {
-  var self = this;
-  var limit = constants.MAX_CONCURRENT_AUDITS;
-
-  if (!Array.isArray(params.audits)) {
-    return callback(new Error('Invalid audit list supplied'));
-  }
-
-  this._logger.info(
-    'handling storage audit from %s', params.contact.nodeID
-  );
-
-  async.mapLimit(params.audits, limit, function(audit, done) {
-    self._proveShardExistence(
-      audit.data_hash,
-      audit.challenge,
-      params.contact.nodeID,
-      done
-    );
-  }, function onComplete(err, proofs) {
-    if (err) {
-      return callback(err);
-    }
-
-    callback(null, { proofs: proofs });
-  });
-};
-/**
- * @callback Protocol~handleAuditCallback
- * @param {Error|null} err
- * @param {Object} result
- * @param {Array[]} result.proofs - Mapped list of proof responses
- */
-
-/**
- * Performs a single audit proof generation
- * @private
- * @param {String} hash - The hash of the shard to prove
- * @param {String} challenge - The challenge input for proof generation
- * @param {String} nodeID - The nodeID of the auditor
- * @param {Function} callback - Called on completion of the proof generation
- */
-Protocol.prototype._proveShardExistence = function(hash, chall, nid, cb) {
-  if (!hash || !chall) {
-    return cb(new Error('Invalid data hash or challenge provided'));
-  }
-
-  this._network.storageManager.load(hash, function(err, item) {
-    if (err) {
-      return cb(err);
-    }
-
-    if (item.shard instanceof stream.Writable) {
-      return cb(new Error('Shard not found'));
-    }
-
-    var proof = new ProofStream(item.trees[nid], chall);
-
-    proof.on('error', function(err) {
-      proof.removeAllListeners('finish');
-      cb(err);
-    });
-
-    proof.on('finish', function() {
-      proof.removeAllListeners('error');
-      cb(null, proof.getProofResult());
-    });
-
-    item.shard.pipe(proof);
-  });
-};
-
-/**
- * Handles CONSIGN messages
- * @param {Object} params
- * @param {Contact} params.contact - Sender contact information
- * @param {String} params.data_hash - Shard data hash (contract key)
- * @param {String[]} params.audit_tree - Bottom leaves of audit merkle tree
- * @param {Protocol~handleConsignCallback} callback
- */
-Protocol.prototype.handleConsign = function(params, callback) {
-  var self = this;
-  var token = utils.generateToken();
-
-  self._logger.info(
-    'handling storage consignment request from %s hash %s',
-    params.contact.nodeID,
-    params.data_hash
-  );
-
-  self._network.storageManager.load(params.data_hash, function(err, item) {
-    if (err) {
-      return callback(err);
-    }
-
-    var contract = item.getContract(params.contact);
-    var t = Date.now();
-
-    if (!contract) {
-      return callback(new Error('Consignment is not authorized'));
-    }
-
-    item.trees[contract.get('renter_id')] = params.audit_tree;
-
-    try {
-      assert(
-        t < contract.get('store_end') &&
-        t + constants.CONSIGN_THRESHOLD > contract.get('store_begin'),
-        'Consignment violates contract store time'
-      );
-    } catch (err) {
-      return callback(err);
-    }
-
-    self._network.storageManager.save(item, function(err) {
-      if (err) {
-        return callback(err);
-      }
-
-      self._logger.info(
-        'authorizing upload data channel for %s', params.contact.nodeID
-      );
-
-      self._network.transport.shardServer.accept(
-        token,
-         params.data_hash,
-         params.contact
-       );
-      callback(null, { token: token });
-    });
-  });
-};
-/**
- * @callback Protocol~handleConsignCallback
- * @param {Error|null} err
- * @param {Object} result
- * @param {String} result.token - Data channel authorization token
- */
-
-/**
- * Handles MIRROR messages
- * @param {Object} params
- * @param {Contact} params.contact - Sender contact information
- * @param {String} params.data_hash - Shard hash to mirror
- * @param {String} params.token - Data channel authorization token
- * @param {Contact} params.farmer - The farmer to transfer data from
- * @param {Protocol~handleMirrorCallback} callback
- */
-Protocol.prototype.handleMirror = function(params, callback) {
-  /* eslint max-statements: [2, 16] */
-  const self = this;
-  const {data_hash: hash, token} = params;
-  const bridgeClient = this._network.bridgeClient;
-
-  self._logger.info(
-    'handling mirror request from %s hash %s', params.contact.nodeID, hash
-  );
-
-  self._network.storageManager.load(hash, function(err, item) {
-    if (err) {
-      return callback(err);
-    }
-
-    // NB: Don't mirror data we are not contracted for
-    if (!item.getContract(params.contact)) {
-      return callback(new Error('No contract found for shard'));
-    }
-
-    // NB: Don't mirror if we already have the shard
-    if (typeof item.shard.write !== 'function') {
-      return callback(null, {});
-    }
-
-    self._logger.info(
-      'opening data transfer with %j to mirror %s',
-      params.farmer,
-      hash
-    );
-
-    const hasher256 = crypto.createHash('sha256');
-    const report = new ExchangeReport({
-      reporterId: self._network.contact.nodeID,
-      farmerId: params.farmer.nodeID
-    });
-    const downloader = utils.createShardDownloader(
-      new Contact(params.farmer),
-      hash,
-      token
-    );
-    const hash256updater = through(function(data) {
-      hasher256.update(data);
-      this.queue(data);
-    });
-
-    function _onFinish() {
-      if (item.hash !== utils.rmd160(hasher256.digest())) {
-        self._logger.warn('mirror read integrity check failed, destroying');
-        report.end(ExchangeReport.FAILURE, 'FAILED_INTEGRITY');
-        item.shard.destroy(utils.warnOnError(self._logger));
-      } else {
-        self._logger.info('successfully mirrored shard hash %s', item.hash);
-        report.end(ExchangeReport.SUCCESS, 'MIRROR_SUCCESS');
-      }
-      bridgeClient.createExchangeReport(report);
-    }
-
-    report.begin(hash);
-    downloader.on('error', function _onStreamError(err) {
-      self._logger.error('failed to read from mirror node: %s', err.message);
-      item.shard.destroy(utils.warnOnError(self._logger));
-      report.end(ExchangeReport.FAILURE, 'MIRROR_FAILED');
-      bridgeClient.createExchangeReport(report);
-    }).pipe(hash256updater).pipe(item.shard).on('finish', _onFinish);
-    callback(null, {});
-  });
-};
-/**
- * @callback Protocol~handleMirrorCallback
- * @param {Error|null} err
- * @param {Object} result - Empty acknowledgement
- */
-
-/**
- * Handles RETRIEVE messages
- * @param {Object} params
- * @param {Contact} params.contact - Sender contact information
- * @param {String} params.data_hash - RMD160(SHA256(shard_data))
- * @param {Protocol~handleRetrieveCallback} callback
- */
-Protocol.prototype.handleRetrieve = function(params, callback) {
-  var self = this;
-  var hash = params.data_hash;
-  var token = utils.generateToken();
-
-  if (!kad.utils.isValidKey(hash)) {
-    return callback(new Error('Invalid data hash provided: ' + hash));
-  }
-
-  self._logger.info(
-    'handling storage retrieve request from %s hash %s',
-    params.contact.nodeID,
-    hash
-  );
-
-  self._network.storageManager.load(hash, function(err, item) {
-    if (err) {
-      return callback(err);
-    }
-
-    if (!item.getContract(params.contact)) {
-      return callback(new Error('Retrieval is not authorized'));
-    }
-
-    if (typeof item.shard.write === 'function') {
-      return callback(new Error('Shard data not found'));
-    }
-
-    // TODO: We will need to increment the download count to track payments
-
-    self._logger.info(
-      'authorizing download data channel for %s', params.contact.nodeID
-    );
-
-    self._network.transport.shardServer.accept(
-      token,
-      item.hash,
-      params.contact
-    );
-    callback(null, { token: token });
-  });
-};
-/**
- * @callback Protocol~handleRetrieveCallback
- * @param {Error|null} err
- * @param {Object} result
- * @param {String} result.token - Authorization token for data channel
- */
-
-/**
- * Handles PROBE messages
- * @param {Object} params
- * @param {Contact} params.contact - Sender contact information
- * @param {Protocol~handleProbeCallback} callback
- */
-Protocol.prototype.handleProbe = function(params, callback) {
-  var message = new kad.Message({
-    method: 'PING',
-    params: { contact: this._network.contact }
-  });
-
-  this._logger.info('performing probe for %s', params.contact.nodeID);
-  this._network.transport.send(params.contact, message, function(err) {
-    if (err) {
-      return callback(new Error('Probe failed, you are not addressable'));
-    }
-
-    callback(null, {});
-  });
-};
-/**
- * @callback Protocol~handleProbeCallback
- * @param {Error|null} err
- * @param {Object} result - Empty acknowledgement
- */
-
-/**
- * Handles FIND_TUNNEL messages
- * @param {Object} params
- * @param {Contact} params.contact - Sender contact information
- * @param {Contact[]} params.relayers - List of contacts who have already
- * relayed the FIND_TUNNEL request
- * @param {Protocol~handleFindTunnelCallback} callback
- */
-Protocol.prototype.handleFindTunnel = function(params, callback) {
-  var tunServer = this._network.transport.tunnelServer;
-  var numProxies = Object.keys(tunServer._proxies).length;
-  var available = numProxies < tunServer._opts.maxProxiesAllowed;
-  var knownTunnelers = this._network._tunnelers.getContactList();
-  var tunnels = available ?
-                [this._network.contact].concat(knownTunnelers) :
-                knownTunnelers;
-
-  this._logger.info('finding tunnels for %s', params.contact.nodeID);
-
-  if (tunnels.length) {
-    this._logger.info(
-      'sending %s tunnels to %s', tunnels.length, params.contact.nodeID
-    );
-    return callback(null, { tunnels: tunnels });
-  }
-
-  if (params.relayers.length < constants.MAX_FIND_TUNNEL_RELAYS) {
-    return this._askNeighborsForTunnels(params.relayers, callback);
-  }
-
-  callback(null, { tunnels: tunnels });
-};
-/**
- * @callback Protocol~handleFindTunnelCallback
- * @param {Error|null} err
- * @param {Object} result
- * @param {Contact[]} result.tunnels - List of known tunnelers
- */
-
-/**
- * Sends a FIND_TUNNEL to our seed on behalf of requester
- * @private
- */
-Protocol.prototype._askNeighborsForTunnels = function(relayers, callback) {
-  var self = this;
-  var nearestNeighbors = this._network.router.getNearestContacts(
-    this._network.contact.nodeID,
-    3,
-    this._network.contact.nodeID
-  ).filter(function(contact) {
-    return relayers.indexOf(contact.nodeID) === -1;
-  });
-
-  this._logger.info('asking nearest neighbors for known tunnels');
-
-  function askNeighbor(neighbor, done) {
-    self._network.transport.send(neighbor, kad.Message({
-      method: 'FIND_TUNNEL',
-      params: {
-        contact: self._network.contact,
-        relayers: [self._network.contact].concat(relayers)
-      }
-    }), function(err, response) {
-      if (err || !Array.isArray(response.result.tunnels)) {
-        return done(null, false);
-      }
-
-      if (response.result.tunnels && response.result.tunnels.length) {
-        response.result.tunnels.forEach(function(tun) {
-          if (self._network._tunnelers.getSize() < kad.constants.K) {
-            self._network._tunnelers.addContact(new Contact(tun));
-          }
-        });
-        return done(null, true);
-      }
-
-      done(null, false);
-    });
-  }
-
-  async.detectSeries(nearestNeighbors, askNeighbor, function() {
-    callback(null, { tunnels: self._network._tunnelers.getContactList() });
-  });
-};
-
-/**
- * Handles OPEN_TUNNEL messages
- * @param {Object} params
- * @param {Contact} params.contact - Sender contact information
- * @param {Protocol~handleOpenTunnelCallback} callback
- */
-Protocol.prototype.handleOpenTunnel = function(params, callback) {
-  var self = this;
-  var tunnelServer = this._network.transport.tunnelServer;
-
-  this._logger.info('opening gateway for %s', params.contact.nodeID);
-  tunnelServer.addProxy(params.contact.nodeID, function(err, proxy) {
-    if (err) {
-      return callback(err);
-    }
-
-    if (!self._network.transport._requiresTraversal) {
-      return callback(null, {
-        proxyPort: proxy.getProxyPort()
-      });
-    }
-
-    self._network.transport.createPortMapping(proxy.getProxyPort(), (err) => {
-      if (err) {
-        return callback(err);
-      }
-
-      callback(null, { proxyPort: proxy.getProxyPort() });
-    });
-  });
-};
-/**
- * @callback Protocol~handleOpenTunnelCallback
- * @param {Error|null} err
- * @param {Object} result
- * @param {String} result.tunnel - WebSocket URI including auth token
- * @param {Object} result.alias
- * @param {String} result.alias.address - Gateway address on the tunneler
- * @param {Number} result.alias.port - Gateway port on the tunneler
- */
-
-/**
- * Handles TRIGGER messages
- * @see https://github.com/Storj/sips/blob/master/sip-0003.md
- * @param {Object} params
- * @param {String} params.behavior - Trigger behavior name to process
- * @param {Object} params.contents - Trigger content payload
- * @param {Contact} params.contact - Sender contact information
- * @param {Protocol~handleTriggerCallback} callback
- */
-Protocol.prototype.handleTrigger = function(params, callback) {
-  this._network.triggers.process(params, callback);
-};
-/**
- * @callback Protocol~handleTriggerCallback
- * @param {Error|null} err
- * @param {Object} result - Arbitrary key-value pairs
- */
-
-/**
- * Handles RENEW messages
- * @see https://github.com/Storj/sips/blob/master/sip-0004.md
- * @param {Object} params
- * @param {Contact} params.contact - Sender contact information
- * @param {String} params.renter_id - Renter nodeID of the original contract
- * @param {String} params.renter_signature - Contract signature from original
- * node ID
- * @param {Object} params.contract - Updated contract data
- * @param {Protocol~handleRenewCallback} callback
- */
-Protocol.prototype.handleRenew = function(params, callback) {
-  var self = this;
-  var updatedContract = null;
-  var dataHash = null;
-
-  try {
-    assert.ok(params.renter_id, 'No original renter_id was supplied');
-    assert.ok(params.renter_signature, 'No original renter signature supplied');
-
-    updatedContract = Contract.fromObject(params.contract);
-    dataHash = updatedContract.get('data_hash');
-
-    self._logger.info('handling contract renew request from %s hash %s',
-      params.contact.nodeID,
-      dataHash
-    );
-
-    assert.ok(
-      updatedContract.verifyExternal(
-        params.renter_signature,
-        params.renter_id
-      ),
-      'Invalid original renter signature on updated contract'
-    );
-    assert.ok(
-      updatedContract.verify('renter', updatedContract.get('renter_id')),
-      'Invalid new renter signature on updated contract'
-    );
-  } catch (err) {
-    return callback(err);
-  }
-
-  this._network.storageManager.load(dataHash, function(err, item) {
-    if (err) {
-      return callback(err);
-    }
-
-    var originalContract = item.getContract(params.contact);
-
-    if (!originalContract) {
-      return callback(new Error('No contract found for renter_id'));
-    }
-
-    var changedProperties = Contract.diff(originalContract, updatedContract);
-
-    // TODO: Come back and consider how to handle attacks on store time
-    for (var i = 0; i < changedProperties.length; i++) {
-      if (Protocol.RENEW_PROPS_ALLOWED.indexOf(changedProperties[i]) === -1) {
-        self._logger.error('Renew contract failed: %s cannot be changed',
-          changedProperties[i]);
-        return callback(new Error(changedProperties[i] + ' cannot be changed'));
-      }
-    }
-
-    updatedContract.sign('farmer', self._network.keyPair.getPrivateKey());
-    item.removeContract(params.contact);
-    item.addContract({
-      nodeID: updatedContract.get('renter_id'),
-      hdKey: updatedContract.get('renter_hd_key'),
-      hdIndex: updatedContract.get('renter_hd_index')
-    }, updatedContract);
-
-    self._network.storageManager.save(item, function(err) {
-      if (err) {
-        return callback(new Error('Failed to save updated contract'));
-      }
-
-      callback(null, { contract: updatedContract.toObject() });
-    });
-  });
-};
-/**
- * @callback Protocol~handleRenewCallback
- * @param {Error|null} err
- * @param {Object} result
- * @param {Object} result.contract - Signed updated contract
- */
-
-/**
- * Returns bound references to the protocol handlers
- * @returns {Object} handlers
- */
-Protocol.prototype.getRouteMap = function() {
-  return {
-    OFFER: this.handleOffer.bind(this),
-    AUDIT: this.handleAudit.bind(this),
-    CONSIGN: this.handleConsign.bind(this),
-    MIRROR: this.handleMirror.bind(this),
-    RETRIEVE: this.handleRetrieve.bind(this),
-    PROBE: this.handleProbe.bind(this),
-    FIND_TUNNEL: this.handleFindTunnel.bind(this),
-    OPEN_TUNNEL: this.handleOpenTunnel.bind(this),
-    TRIGGER: this.handleTrigger.bind(this),
-    RENEW: this.handleRenew.bind(this)
-  };
-};
-
-module.exports = Protocol;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_network_renter.js.html b/Storj/core/docs/lib_network_renter.js.html deleted file mode 100644 index 687141a..0000000 --- a/Storj/core/docs/lib_network_renter.js.html +++ /dev/null @@ -1,356 +0,0 @@ - - - - - JSDoc: Source: lib/network/renter.js - - - - - - - - - - -
- -

Source: lib/network/renter.js

- - - - - - -
-
-
'use strict';
-
-var merge = require('merge');
-var assert = require('assert');
-var Contract = require('../contract');
-var Contact = require('./contact');
-var AuditStream = require('../audit-tools/audit-stream');
-var kad = require('kad');
-var Network = require('./');
-var inherits = require('util').inherits;
-var StorageItem = require('../storage/item');
-var async = require('async');
-var OfferStream = require('../contract/offer-stream');
-
-/**
- * Creates and a new renter interface
- * @constructor
- * @license AGPL-3.0
- * @extends {Network}
- * @param {Object}  options
- * @param {String} [options.hdKey] - Extended key at 'group index' as per SIP32
- * @param {Number} [options.hdIndex] - Derivation index for hdKey
- * @param {KeyPair}[options.keyPair] - Node's cryptographic identity
- * @param {StorageManager} options.storageManager - Storage manager backend
- * @param {String}  options.bridgeUri - URL for bridge server seed lookup
- * @param {Object}  options.logger - Logger instance
- * @param {Array}   options.seedList - List of seed URIs to join
- * @param {String}  options.rpcAddress - Public node IP or hostname
- * @param {Number}  options.rpcPort - Listening port for RPC
- * @param {Boolean} options.doNotTraverseNat - Skip NAT traversal strategies
- * @param {Number}  options.maxTunnels - Max number of tunnels to provide
- * @param {Number}  options.tunnelServerPort - Port for tunnel server to use
- * @param {Object}  options.tunnelGatewayRange
- * @param {Number}  options.tunnelGatewayRange.min - Min port for gateway bind
- * @param {Number}  options.tunnelGatewayRange.max - Max port for gateway bind
- * @param {Object}  options.rateLimiterOpts - Options for {@link RateLimiter}
- * @param {Object} [options.joinRetry]
- * @param {Number} [options.joinRetry.times] - Times to retry joining net
- * @param {Number} [options.joinRetry.interval] - MS to wait before retrying
- * @emits Network#ready
- * @property {KeyPair} keyPair
- * @property {StorageManager} storageManager
- * @property {kad.Node} node - The underlying DHT node
- * @property {TriggerManager} triggerManager
- * @property {BridgeClient} bridgeClient
- * @property {Contact} contact
- * @property {Transport} transportAdapter
- * @property {kad.Router} router - The underlying DHT router
- * @property {DataChannelServer} dataChannelServer
- */
-function RenterInterface(options) {
-  if (!(this instanceof RenterInterface)) {
-    return new RenterInterface(options);
-  }
-
-  Network.call(this, options);
-}
-
-inherits(RenterInterface, Network);
-
-/**
- * Creates a readable stream of offers for the storage contract
- * @param {Contract} contract - The storage contract to publish
- * @param {Object} [offerStreamOptions] - Options passed to {@link OfferStream}
- * @returns {OfferStream} offerStream
- */
-RenterInterface.prototype.getOfferStream = function(contract, options) {
-  assert(contract instanceof Contract, 'Invalid contract supplied');
-
-  var hash = contract.get('data_hash');
-  var offerStream = new OfferStream(contract, options);
-  var content = merge(contract.toObject(), { contact: this.contact });
-
-  this.offerManager.addStream(offerStream);
-  this.publish(contract.getTopicString(), content, { key: hash });
-
-  return offerStream;
-};
-
-/**
- * Issues an audit request to the given farmer for the data and returns the
- * {@link ProofStream#getProofResult} structure for verification.
- * @param {Contact} farmer - Farmer contact from which proof is needed
- * @param {StorageItem} item - The storage item on which to perform the audit
- * @param {RenterInterface~getStorageProofCallback} callback - Proof handler
- */
-RenterInterface.prototype.getStorageProof = function(farmer, item, callback) {
-  assert(farmer instanceof Contact, 'Invalid contact supplied');
-  assert(item instanceof StorageItem, 'Invalid storage item supplied');
-
-  if (!item.challenges[farmer.nodeID]) {
-    return callback(new Error('Item has no contracts with supplied farmer'));
-  }
-
-  if (!item.challenges[farmer.nodeID].challenges.length) {
-    return callback(new Error('There are no remaining challenges to send'));
-  }
-
-  var message = new kad.Message({
-    method: 'AUDIT',
-    params: {
-      audits: [
-        {
-          data_hash: item.hash,
-          challenge: item.challenges[farmer.nodeID].challenges.shift()
-        }
-      ],
-      contact: this.contact
-    }
-  });
-
-  this.transport.send(farmer, message, function(err, response) {
-    if (err) {
-      return callback(err);
-    }
-
-    if (response.error) {
-      return callback(new Error(response.error.message));
-    }
-
-    if (!Array.isArray(response.result.proofs)) {
-      return callback(new Error('Invalid proof returned'));
-    }
-
-    callback(null, response.result.proofs[0]);
-  });
-};
-/**
- * This callback is called upon receipt of an audit proof from
- * {@link RenterInterface#getStorageProof}
- * @callback RenterInterface~getStorageProofCallback
- * @param {Error|null} err - If requesting the proof failed, an error object
- * @param {Array} proof - Result from {@link ProofStream#getProofResult}
- */
-
-/**
- * Requests a consignment pointer from the given farmer for opening a
- * {@link DataChannelClient} for transferring the the data shard to the farmer
- * @param {Contact} farmer - The farmer contact object for requesting token
- * @param {Contract} contract - The storage contract for this consignment
- * @param {AuditStream} audit - The audit object for merkle leaves
- * @param {RenterInterface~getConsignmentPointerCallback} callback
- */
-RenterInterface.prototype.getConsignmentPointer = function(f, c, a, callback) {
-  var farmer = f;
-  var contract = c;
-  var audit = a;
-
-  assert(farmer instanceof Contact, 'Invalid farmer contact supplied');
-  assert(contract instanceof Contract, 'Invalid contract supplied');
-  assert(audit instanceof AuditStream, 'Invalid audit object supplied');
-
-  var message = new kad.Message({
-    method: 'CONSIGN',
-    params: {
-      data_hash: contract.get('data_hash'),
-      audit_tree: audit.getPublicRecord(),
-      contact: this.contact
-    }
-  });
-
-  this.transport.send(farmer, message, function(err, response) {
-    if (err) {
-      return callback(err);
-    }
-
-    if (response.error) {
-      return callback(new Error(response.error.message));
-    }
-
-    callback(null, {
-      farmer: f,
-      hash: contract.get('data_hash'),
-      token: response.result.token,
-      operation: 'PUSH'
-    });
-  });
-};
-/**
- * This callback is called upon receipt of a consignment token from
- * {@link RenterInterface#getConsignmentPointer}
- * @callback RenterInterface~getConsignmentPointerCallback
- * @param {Error|null} err - If requesting the token failed, an error object
- * @param {Object} pointer
- * @param {Contact} pointer.farmer
- * @param {String} pointer.hash
- * @param {String} pointer.token
- * @param {String} pointer.operation
- */
-
-/**
- * Requests a retrieval token from the given farmer for opening a
- * {@link DataChannelClient} for transferring the data shard from the farmer
- * @param {Contact} farmer - The farmer contact object for requesting token
- * @param {Contract} contract - The storage contract for this consignment
- * @param {RenterInterface~getRetrievalPointerCallback} callback - Token handler
- */
-RenterInterface.prototype.getRetrievalPointer = function(f, c, callback) {
-  var farmer = f;
-  var contract = c;
-
-  assert(farmer instanceof Contact, 'Invalid farmer contact supplied');
-  assert(contract instanceof Contract, 'Invalid contract supplied');
-
-  var message = new kad.Message({
-    method: 'RETRIEVE',
-    params: {
-      data_hash: contract.get('data_hash'),
-      contact: this.contact
-    }
-  });
-
-  this.transport.send(farmer, message, function(err, response) {
-    if (err) {
-      return callback(err);
-    }
-
-    if (response.error) {
-      return callback(new Error(response.error.message));
-    }
-
-    callback(null, {
-      farmer: f,
-      hash: contract.get('data_hash'),
-      token: response.result.token,
-      operation: 'PULL'
-    });
-  });
-};
-/**
- * This callback is called upon receipt of a retrieval token from
- * {@link RenterInterface#getRetrieveToken}
- * @callback RenterInterface~getRetrievalPointerCallback
- * @param {Error|null} err - If requesting the token failed, an error object
- * @param {Object} pointer
- * @param {Contact} pointer.farmer
- * @param {String} pointer.hash
- * @param {String} pointer.token
- * @param {String} pointer.operation
- */
-
-/**
- * Requests that the given destination farmers mirror the data from the sources
- * @param {Array.<Object>} sources - Pointers for each destination
- * @param {Array.<Contact>} destinations - The farmers to replicate to
- * @param {RenterInterface~getMirrorNodesCallback} callback - Results handler
- */
-RenterInterface.prototype.getMirrorNodes = function(sources, dests, callback) {
-  var self = this;
-
-  assert(Array.isArray(sources), 'Invalid sources list supplied');
-  assert(Array.isArray(dests), 'Invalid destination list supplied');
-  assert(
-    sources.length === dests.length,
-    'Sources and destinations must have equal length'
-  );
-
-  dests.forEach(function(dest) {
-    assert(dest instanceof Contact, 'Invalid destination supplied');
-  });
-
-  function _sendMirrorRequest(destination, next) {
-    var source = sources.shift();
-    var message = new kad.Message({
-      method: 'MIRROR',
-      params: {
-        data_hash: source.hash,
-        token: source.token,
-        farmer: source.farmer,
-        contact: self.contact
-      }
-    });
-
-    self.transport.send(destination, message, function(err, response) {
-      if (err || !response || response.error) {
-        return next(null, false);
-      }
-      next(null, true);
-    });
-  }
-
-  function _onMirrorRequestsComplete(err, results) {
-    // Error is never passed in the filter, as the test is for an error
-    // we can keep the error check here anyways, if the code changes.
-    /* istanbul ignore next */
-    if (err) {
-      return callback(err);
-    }
-    if (results.length === 0) {
-      return callback(new Error('All mirror requests failed'));
-    }
-
-    callback(null, results);
-  }
-
-  async.filter(dests, _sendMirrorRequest, _onMirrorRequestsComplete);
-};
-/**
- * This callback is called upon acknowledgement of a mirror request
- * @callback RenterInterface~getMirrorNodesCallback
- * @param {Error|null} err - If requesting all mirrors failed, an error object
- * @param {Array.<Contact>} results - The farmers who successfully mirrored
- */
-
-module.exports = RenterInterface;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_network_shard-server.js.html b/Storj/core/docs/lib_network_shard-server.js.html deleted file mode 100644 index 9cb70e6..0000000 --- a/Storj/core/docs/lib_network_shard-server.js.html +++ /dev/null @@ -1,346 +0,0 @@ - - - - - JSDoc: Source: lib/network/shard-server.js - - - - - - - - - - -
- -

Source: lib/network/shard-server.js

- - - - - - -
-
-
'use strict';
-
-var assert = require('assert');
-var StorageManager = require('../storage/manager');
-var events = require('events');
-var inherits = require('util').inherits;
-var crypto = require('crypto');
-var utils = require('../utils');
-var constants = require('../constants');
-var BridgeClient = require('../bridge-client');
-var ExchangeReport = require('../bridge-client/exchange-report');
-
-/**
- * Creates a shard server for sending and receiving consigned file shards
- * @constructor
- * @license AGPL-3.0
- * @param {Object} options
- * @param {String} options.nodeID - The farmer nodeID
- * @param {StorageManager} options.storageManager - Storage manager backend
- * @param {kad.Logger} options.logger - Logger to use from {@link Network}
- * @param {Number} [options.tokenTtl=1800000] - Close after idle
- */
-function ShardServer(options) {
-  if (!(this instanceof ShardServer)) {
-    return new ShardServer(options);
-  }
-
-  this._checkOptions(options);
-  events.EventEmitter.call(this);
-
-  this.activeTransfers = 0;
-  this._nodeID = options.nodeID;
-  this._bridgeClient = options.bridgeClient || new BridgeClient();
-  this._manager = options.storageManager;
-  this._log = options.logger;
-  this._ttl = options.tokenTtl || constants.TOKEN_EXPIRE;
-  this._allowed = {};
-
-  setInterval(this._reapDeadTokens.bind(this), this._ttl);
-}
-
-/**
- * Triggered when a shard has finished uploading to this instance
- * @event ShardServer#shardUploaded
- * @param {StorageItem} item - The item associated with the upload
- */
-
-/**
- * Triggered when a shard has finished downloading from this instance
- * @event ShardServer#shardDownloaded
- * @param {StorageItem} item - The item associated with the download
- */
-
-/**
- * Triggered when a error occurs
- * @event ShardServer#error
- * @param {Error} error - The error object
- */
-
-inherits(ShardServer, events.EventEmitter);
-
-/**
- * Begin accepting data for the given file hash and token
- * @param {String} token - The authorization token created for transfer
- * @param {String} filehash - The shard hash to allow for the token
- * @param {Contact} contact - contact that negotiated the token
- */
-ShardServer.prototype.accept = function(token, filehash, contact) {
-  assert(typeof token === 'string', 'Invalid token supplied');
-  assert(typeof filehash === 'string', 'Invalid filehash supplied');
-
-  this._allowed[token] = {
-    hash: filehash,
-    contact: contact,
-    expires: Date.now() + this._ttl,
-    report: new ExchangeReport({
-      reporterId: this._nodeID,
-      farmerId: this._nodeID
-    })
-  };
-};
-
-/**
- * Stop accepting data for the given token
- * @param {String} token - The authorization token created for transfer
- */
-ShardServer.prototype.reject = function(token) {
-  assert(typeof token === 'string', 'Invalid token supplied');
-  delete this._allowed[token];
-};
-
-/**
- * Checks the options supplied to constructor
- * @private
- */
-ShardServer.prototype._checkOptions = function(options) {
-  assert.ok(options, 'No options were supplied to constructor');
-  assert(
-    options.storageManager instanceof StorageManager,
-    'Invalid manager supplied'
-  );
-  assert.ok(options.logger, 'Invalid logger supplied');
-  assert.ok(options.nodeID, 'Invalid nodeID supplied');
-};
-
-/**
- * Validates the given token
- * @param {String} token
- * @param {String} hash
- */
-ShardServer.prototype.isAuthorized = function(token, hash) {
-  var self = this;
-
-  try {
-    assert.ok(token, 'You did not supply a token');
-    assert.ok(self._allowed[token], 'The supplied token is not accepted');
-    assert.ok(hash, 'You did not supply the data hash');
-    assert(self._allowed[token].expires > Date.now(), 'Token has expired');
-    assert(self._allowed[token].hash === hash, 'Token not valid for hash');
-  } catch (err) {
-    return [false, err];
-  }
-
-  return [true, null];
-};
-
-/**
- * Decrements the active transfer count on early socket close
- * @private
- */
-ShardServer.prototype._handleEarlySocketClose = function() {
-  this._log.warn('channel terminated early (possibly by client)');
-  this.activeTransfers--;
-};
-
-/**
- * Decrements the active transfer count on request error
- * @private
- */
-ShardServer.prototype._handleRequestError = function(err) {
-  this._log.warn('channel encountered an error: %s', err.message);
-  this.activeTransfers--;
-};
-
-/**
- * Receives the data stream and writes it to storage
- * @param {http.IncomingMessage} req
- * @param {http.ServerResponse} req
- */
-ShardServer.prototype.routeConsignment = function(req, res) {
-  const self = this;
-  const hasher = crypto.createHash('sha256');
-  const [isAuthed, authError] = this.isAuthorized(
-    req.query.token,
-    req.params.hash
-  );
-
-  if (!isAuthed) {
-    return res.send(401, { result: authError.message });
-  }
-
-  const {report, contact, hash} = this._allowed[req.query.token];
-
-  report.begin(hash);
-
-  this._manager.load(hash, function(err, item) {
-    if (err) {
-      return res.send(404, { result: err.message });
-    }
-
-    const nodeID = Object.keys(item.contracts)[0];
-    const shardsize = item.getContract({ nodeID: nodeID }).get('data_size');
-
-    // If the shard is not writable, it means we already have it, so let's
-    // just respond with a success message
-    if (typeof item.shard.write !== 'function') {
-      report.end(ExchangeReport.SUCCESS, 'SHARD_EXISTS');
-      self._bridgeClient.createExchangeReport(report);
-      return res.send(304, { result: 'Consignment completed' });
-    }
-
-    let received = 0;
-
-    self.activeTransfers++;
-    req.on('error', self._handleRequestError.bind(self));
-    res.on('close', self._handleEarlySocketClose.bind(self));
-    req.on('data', function(chunk) {
-      received += chunk.length;
-
-      hasher.update(chunk);
-      item.shard.write(chunk);
-
-      if (received > shardsize) {
-        report.end(ExchangeReport.FAILURE, 'FAILED_INTEGRITY');
-        self._bridgeClient.createExchangeReport(report);
-        item.shard.destroy(utils.warnOnError(self._log));
-        self.activeTransfers--;
-        return res.send(400, {
-          result: 'Shard exceeds the amount defined in the contract'
-        });
-      }
-    });
-
-    req.on('end', function() {
-      /* eslint max-statements: [2, 15] */
-      var calculatedHash = utils.rmd160(hasher.digest());
-      self.activeTransfers--;
-
-      if (calculatedHash !== hash) {
-        report.end(ExchangeReport.FAILURE, 'FAILED_INTEGRITY');
-        self._bridgeClient.createExchangeReport(report);
-        self._log.warn('calculated hash does not match the expected result');
-        item.shard.destroy(utils.warnOnError(self._log));
-        return res.send(400, {
-          result: 'Calculated hash does not match the expected result'
-        });
-      }
-
-      self._log.debug('Shard upload completed hash %s', hash);
-      item.shard.end();
-      report.end(ExchangeReport.SUCCESS, 'SHARD_UPLOADED');
-      self._bridgeClient.createExchangeReport(report);
-      self.reject(req.query.token);
-      res.send(200, { result: 'Consignment completed' });
-      self.emit('shardUploaded', item, contact);
-    });
-  });
-};
-
-/**
- * Pumps the data through to the client
- * @param {http.IncomingMessage} req
- * @param {http.ServerResponse} res
- */
-ShardServer.prototype.routeRetrieval = function(req, res) {
-  const self = this;
-  const [isAuthed, authError] = this.isAuthorized(
-    req.query.token,
-    req.params.hash
-  );
-
-  if (!isAuthed) {
-    return res.send(401, { result: authError.message });
-  }
-
-  const {report, contact, hash} = this._allowed[req.query.token];
-
-  this._manager.load(hash, function(err, item) {
-    if (err) {
-      return res.send(404, { result: err.message });
-    }
-
-    function _handleReadFailure(err) {
-      self.activeTransfers--;
-      report.end(ExchangeReport.FAILURE, 'READ_FAILED');
-      self._bridgeClient.createExchangeReport(report);
-      res.send(500, { result: err.message });
-    }
-
-    function _handleTransferFinish() {
-      self.activeTransfers--;
-      self._log.debug('Shard download completed hash %s', item.hash);
-      report.end(ExchangeReport.SUCCESS, 'SHARD_DOWNLOADED');
-      self._bridgeClient.createExchangeReport(report);
-      self.emit('shardDownloaded', item, contact);
-      self.reject(req.query.token);
-    }
-
-    self.activeTransfers++;
-    req.on('error', self._handleRequestError.bind(self));
-    res.on('close', self._handleEarlySocketClose.bind(self));
-    res.header('content-type', 'application/octet-stream');
-    report.begin(hash);
-    item.shard
-      .on('error', _handleReadFailure)
-      .on('end', _handleTransferFinish)
-      .pipe(res);
-  });
-};
-
-/**
- * Enumerates the authorized list and rejects expired
- * @private
- */
-ShardServer.prototype._reapDeadTokens = function() {
-  let now = Date.now();
-
-  for (let token in this._allowed) {
-    if (this._allowed[token].expires < now) {
-      this.reject(token);
-    }
-  }
-};
-
-module.exports = ShardServer;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_network_transport.js.html b/Storj/core/docs/lib_network_transport.js.html deleted file mode 100644 index 36c0959..0000000 --- a/Storj/core/docs/lib_network_transport.js.html +++ /dev/null @@ -1,478 +0,0 @@ - - - - - JSDoc: Source: lib/network/transport.js - - - - - - - - - - -
- -

Source: lib/network/transport.js

- - - - - - -
-
-
'use strict';
-
-const inherits = require('util').inherits;
-const kad = require('kad');
-const portfinder = require('portfinder');
-const natupnp = require('nat-upnp');
-const ip = require('ip');
-const merge = require('merge');
-const utils = require('../utils');
-const http = require('http');
-const restify = require('restify');
-const diglet = require('diglet');
-const net = require('net');
-const url = require('url');
-const ShardServer = require('./shard-server');
-
-/**
- * Custom HTTP transport adapter
- * @constructor
- * @license AGPL-3.0
- * @param {kad.Contact} contact - Contact object to binding to port
- * @param {Object}  options
- * @param {Logger}  options.logger - Logger for diagnositcs
- * @param {Number}  options.maxTunnels - Number of tunnels to provide to network
- * @param {Boolean} options.doNotTraverseNat - Do not try to punch out of NAT
- * @param {Object}  options.tunnelGatewayRange
- * @param {Number}  options.tunnelGatewayRange.min - Min port for gateway bind
- * @param {Number}  options.tunnelGatewayRange.max - Max port for gateway bind
- * @param {Number}  options.listenPort - Different port for the server to listen on (optional)
- * @param {StorageManager} options.storageManager
- * @param {BridgeClient} options.bridgeClient
- */
-function Transport(contact, options) {
-  if (!(this instanceof Transport)) {
-    return new Transport(contact, options);
-  }
-
-  this._opts = merge(Object.create(Transport.DEFAULTS), options);
-  this._queuedResponses = {};
-  this._maxTunnels = this._opts.maxTunnels;
-  this._doNotTraverseNat = this._opts.doNotTraverseNat;
-  this._tunnelGatewayRange = this._opts.tunnelGatewayRange;
-  this._server = restify.createServer({
-    name: 'storj',
-    handleUpgrades: true
-  });
-
-  kad.RPC.call(this, contact, options);
-  this.on(
-    'MESSAGE_DROP',
-    kad.transports.HTTP.prototype._handleDroppedMessage.bind(this)
-  );
-}
-
-Transport.DEFAULTS = {
-  maxTunnels: 3,
-  doNotTraverseNat: false,
-  tunnelGatewayRange: { min: 0, max: 0 }
-};
-
-/**
- * Triggered when the max connections limit is reached
- * @event Transport#connectionLimitReached
- */
-
-inherits(Transport, kad.RPC);
-
-/**
- * Opens the transport, trying UPnP to become publicly addressable and falling
- * back to using a Tunnel
- * @private
- * @param {Function} callback
- */
-Transport.prototype._open = function(callback) {
-  const self = this;
-
-  this.tunnelServer = new diglet.Server({
-    logger: this._log,
-    proxyPortRange: this._opts.tunnelGatewayRange,
-    proxyMaxConnections: 12,
-    maxProxiesAllowed: this._opts.maxTunnels
-  });
-  this.shardServer = new ShardServer({
-    bridgeClient: this._opts.bridgeClient,
-    storageManager: this._opts.storageManager,
-    logger: this._log,
-    nodeID: this._contact.nodeID
-  });
-
-  if (self._doNotTraverseNat) {
-    self._isPublic = true;
-
-    /* istanbul ignore next */
-    self._log.warn(
-      'your address is %s and traversal strategies are disabled',
-      ip.isPublic(self._contact.address) ? 'public' : 'private'
-    );
-
-    return self._bindServer(callback);
-  }
-
-  self._requiresTraversal = true;
-
-  function _traverseNat() {
-    self._log.warn(
-      'you are not publicly reachable, trying traversal strategies...'
-    );
-    self._forwardPort(function(err, wanip, port) {
-      self._isPublic = !err;
-
-      if (self._isPublic) {
-        self._contact.port = port || self._contact.port;
-        self._log.info('node bound and port mapped: %s', self._contact.port);
-      }
-
-      self._bindServer(callback);
-      self._contact.address = wanip || self._contact.address;
-    });
-  }
-
-  self._bindServer(function() {
-    self._checkIfReachable(function(isReachable) {
-      if (isReachable) {
-        return callback(null);
-      }
-
-      self._close();
-      _traverseNat();
-    });
-  });
-};
-
-/**
- * Sets up server routes
- * @private
- */
-Transport.prototype._bindServer = function(callback) {
-  const self = this;
-
-  // Disable TCP Nagle algorithm
-  self._server.on('connection', (sock) => sock.setNoDelay(true));
-
-  // Middleware
-  self._server.use(self._routeTunnelProxies.bind(self));
-  self._server.use(restify.CORS());
-
-  self._server.opts(/.*/, self._handleOpts.bind(self));
-
-  // Routes
-  self._server.post(
-    '/',
-    restify.bodyParser(),
-    self._handleRPC.bind(self)
-  );
-  self._server.post(
-    '/shards/:hash',
-    restify.queryParser(),
-    self.shardServer.routeConsignment.bind(self.shardServer)
-  );
-  self._server.get(
-    '/shards/:hash',
-    restify.queryParser(),
-    self.shardServer.routeRetrieval.bind(self.shardServer)
-  );
-
-  const port = self._opts.listenPort ?
-    self._opts.listenPort : self._contact.port;
-  self._server.listen(port, callback);
-};
-
-/**
- * _handleOpts handles incomming OPTIONS requests. These requests are preflight
- * requests for Cross-Origin requests enforced by browser security. This
- * function essentially allows all methods and headers for any origin, allowing
- * any domain to make a request to a farmer.
- * @private
- */
-Transport.prototype._handleOpts = function(req, res, next) {
-  res.header('Access-Control-Allow-Origin', '*');
-  res.header('Access-Control-Allow-Methods',
-    req.header('Access-Control-Request-Method'));
-  res.header('Access-Control-Allow-Headers',
-    req.header('Access-Control-Request-Headers'));
-  res.send(200);
-  return next();
-};
-
-/**
- * Handles incoming RPC messages
- * @private
- */
-Transport.prototype._handleRPC = function(req, res) {
-  const self = this;
-  let message;
-
-  try {
-    message = new kad.Message(req.body);
-  } catch (err) {
-    res.send(400, new Error('Invalid RPC message'));
-    self.receive(null);
-    return;
-  }
-
-  if (kad.Message.isRequest(message)) {
-    self._queuedResponses[message.id] = res;
-  }
-
-  self.receive(message.serialize(), {});
-};
-
-/**
- * Routes incoming requests to tunnels if any
- * @private
- */
-Transport.prototype._routeTunnelProxies = function(req, res, next) {
-  var self = this;
-  var targetNodeId = req.header('x-storj-node-id');
-  var upgradeReq = res.claimUpgrade ? res.claimUpgrade() : null;
-
-  if (!targetNodeId || targetNodeId === self._contact.nodeID) {
-    return next();
-  }
-
-  if (upgradeReq) {
-    self.tunnelServer.routeWebSocketConnection(
-      targetNodeId,
-      req,
-      upgradeReq.socket,
-      () => null
-    );
-  } else {
-    self.tunnelServer.routeHttpRequest(
-      targetNodeId,
-      req,
-      res,
-      () => null
-    );
-  }
-};
-
-/**
- * Implement the message dispatcher for RPC
- * @private
- */
-Transport.prototype._send = function(data, contact) {
-  var self = this;
-  var parsedMessage = JSON.parse(data.toString());
-
-  if (self._queuedResponses[parsedMessage.id]) {
-    self._queuedResponses[parsedMessage.id].send(200, parsedMessage);
-    delete self._queuedResponses[parsedMessage.id];
-    return;
-  }
-
-  if (!contact.valid()) {
-    return self.receive(null);
-  }
-
-  var client = restify.createJsonClient({
-    version: '*',
-    url: url.format({
-      hostname: contact.address,
-      port: contact.port,
-      protocol: 'http:'
-    }),
-    headers: {
-      'content-type': 'application/json',
-      'x-storj-node-id': contact.nodeID
-    },
-    agent: new http.Agent({ keepAlive: true, keepAliveMsecs: 25000 }),
-    // NB: Disable TCP Nagle algorithm - use `signRequest` options to
-    // NB: manipulate the request object before sending
-    signRequest: function(req) {
-      /* istanbul ignore next */
-      req.setNoDelay(true);
-    }
-  });
-
-  client.post('/', parsedMessage, (err, req, res, data) => {
-    if (err) {
-      self._log.warn('error returned from remote host: %s', err.message);
-      return self.receive(null);
-    }
-
-    let message;
-
-    try {
-      message = kad.Message(data);
-    } catch (err) {
-      return self.receive(null);
-    }
-
-    self.receive(message.serialize(), {});
-  });
-};
-
-/**
- * Closes the transport
- * @private
- */
-Transport.prototype._close = function() {
-  this._server.close();
-};
-
-/**
- * Checks if we are publicly reachable
- * @private
- * @param {Function}
- */
-Transport.prototype._checkIfReachable = function(callback) {
-  if (ip.isPrivate(this._contact.address)) {
-    return callback(false);
-  }
-
-  var sock = net.connect({
-    host: this._contact.address,
-    port: this._contact.port
-  });
-
-  sock.once('error', () => {
-    callback(false);
-    sock.removeAllListeners();
-    sock.destroy();
-  });
-  sock.once('connect', () => {
-    callback(true);
-    sock.removeAllListeners();
-    sock.end();
-  });
-};
-
-/**
- * Creates a port mapping with UPnP
- * @param {Number} port - The port to forward
- * @param {Function} callback - Callback function
- */
-Transport.prototype.createPortMapping = function(port, callback) {
-  var self = this;
-  var natupnpClient = natupnp.createClient();
-
-  natupnpClient.portMapping({
-    public: port,
-    private: port,
-    ttl: 0
-  }, function(err) {
-    if (err) {
-      self._log.warn('could not connect to NAT device via UPnP: %s', port);
-      return callback(err);
-    }
-
-    natupnpClient.externalIp(function(err, wanip) {
-      if (err) {
-        self._log.warn('could not obtain public IP address');
-        return callback(err);
-      }
-
-      if (!net.isIP(wanip)) {
-        self._log.warn('UPnP device has no valid IP address: %s',
-                        JSON.stringify(wanip));
-        return callback(new Error('UPnP device has no valid IP address'));
-      }
-
-      if (ip.isPrivate(wanip)) {
-        self._log.warn('UPnP device has no public IP address: %s', wanip);
-        return callback(new Error('UPnP device has no public IP address'));
-      }
-
-      self._log.info('successfully traversed NAT via UPnP: %s:%s', wanip, port);
-      callback(null, wanip, port);
-    });
-  });
-};
-
-/**
- * Resolve random port to use for opening a gateway
- * @private
- * @param {Number}  port
- * @param {Function} callback
- */
-Transport.prototype._getPort = function(callback) {
-  var self = this;
-
-  if (self._contact.port) {
-    return callback(null, self._contact.port);
-  }
-
-  portfinder.basePort = Math.floor(Math.random() * (65535 - 1024) + 1024);
-  portfinder.getPort(callback);
-};
-
-/**
- * Forwards a port and resolves the public IP
- * @private
- * @param {Function} callback
- */
-Transport.prototype._forwardPort = function(callback) {
-  var self = this;
-
-  self._getPort(function(err, port) {
-    if (err) {
-      self._log.warn('could not obtain port');
-      return callback(err);
-    }
-
-    self.createPortMapping(port, callback);
-  });
-};
-
-/**
- * Sends the RPC message to the given contact
- * @param {Contact} contact
- * @param {kad.Message} message
- * @param {Function} callback
- */
-Transport.prototype.send = function(contact, message, callback) {
-  if (kad.Message.isResponse(message)) {
-    return kad.RPC.prototype.send.apply(this, arguments);
-  }
-
-  if (!utils.isValidContact(contact, !!process.env.STORJ_ALLOW_LOOPBACK)) {
-    return callback(new Error('Invalid or forbidden contact address'));
-  }
-
-  kad.RPC.prototype.send.apply(this, arguments);
-};
-
-module.exports = Transport;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_patches.js.html b/Storj/core/docs/lib_patches.js.html deleted file mode 100644 index d5eda12..0000000 --- a/Storj/core/docs/lib_patches.js.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - JSDoc: Source: lib/patches.js - - - - - - - - - - -
- -

Source: lib/patches.js

- - - - - - -
-
-
/**
- * @module storj/patches
- * @license AGPL-3.0
- */
-
-'use strict';
-
-var kad = require('kad');
-var constants = require('./constants');
-
-module.exports = function() {
-
-  // NB: Increase response timeout for RPC calls
-  kad.constants.T_RESPONSETIMEOUT = constants.RPC_TIMEOUT;
-
-};
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_sips_0003_index.js.html b/Storj/core/docs/lib_sips_0003_index.js.html deleted file mode 100644 index 9aafad1..0000000 --- a/Storj/core/docs/lib_sips_0003_index.js.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - JSDoc: Source: lib/sips/0003/index.js - - - - - - - - - - -
- -

Source: lib/sips/0003/index.js

- - - - - - -
-
-
/**
- * @module storj/sips/0003
- */
-
-'use strict';
-
-/** {@link TriggerManager} */
-exports.TriggerManager = require('./trigger-manager');
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_sips_0003_trigger-manager.js.html b/Storj/core/docs/lib_sips_0003_trigger-manager.js.html deleted file mode 100644 index 5eb16a9..0000000 --- a/Storj/core/docs/lib_sips_0003_trigger-manager.js.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - JSDoc: Source: lib/sips/0003/trigger-manager.js - - - - - - - - - - -
- -

Source: lib/sips/0003/trigger-manager.js

- - - - - - -
-
-
'use strict';
-
-var assert = require('assert');
-
-/**
- * Implements behavior triggers as described in SIP-0003
- * @constructor
- * @license AGPL-3.0
- * @see https://github.com/storj/sips/blob/master/sip-0003.md
- */
-function TriggerManager(options) {
-  if (!(this instanceof TriggerManager)) {
-    return new TriggerManager(options);
-  }
-
-  this._options = options;
-  this._authorized = {};
-  this._behaviors = {};
-}
-
-/**
- * Adds a trigger handler for the given nodeID and behavior
- * @param {String|Array} nodeID - The nodeID(s) to authorize for the trigger
- * (supports `*` wildcard)
- * @param {Object} behaviors - Behavior name to {TriggerManager~triggerHandler}s
- */
-TriggerManager.prototype.add = function(nodeID, behaviors) {
-  var self = this;
-
-  if (Array.isArray(nodeID)) {
-    return nodeID.forEach(function(nodeID) {
-      self.add(nodeID, behaviors);
-    });
-  }
-
-  for (var behavior in behaviors) {
-    assert(
-      typeof behaviors[behavior] === 'function',
-      'Trigger handler must be a function'
-    );
-
-    if (!this._authorized[behavior]) {
-      this._authorized[behavior] = [];
-    }
-
-    if (this._authorized[behavior].indexOf(nodeID) === -1) {
-      this._authorized[behavior].push(nodeID);
-    }
-
-    this._behaviors[nodeID + ':' + behavior] = behaviors[behavior];
-  }
-};
-
-/**
- * Removes a trigger handler for the given nodeID and behavior
- * @param {String|Array} nodeID - The nodeID(s) to deauthorize for the trigger
- * @param {String|Array} behaviors - Behavior name to unregister
- */
-TriggerManager.prototype.remove = function(nodeID, behavior) {
-  var self = this;
-
-  if (Array.isArray(nodeID)) {
-    return nodeID.forEach(function(nodeID) {
-      if (Array.isArray(behavior)) {
-        return behavior.forEach(function(behavior) {
-          self.remove(nodeID, behavior);
-        });
-      }
-
-      self.remove(nodeID, behavior);
-    });
-  }
-
-  if (this._authorized[behavior]) {
-    var index = this._authorized[behavior].indexOf(nodeID);
-
-    if (index !== -1) {
-      this._authorized[behavior].splice(index, 1);
-    }
-  }
-
-  delete this._behaviors[nodeID + ':' + behavior];
-};
-
-/**
- * Process a received trigger message
- * @param {Object} messageParams - The received message params
- * @param {TriggerManager~processCallback} callback - Result of trigger process
- */
-TriggerManager.prototype.process = function(messageParams, callback) {
-  var authorized = this._authorized[messageParams.behavior];
-  var allowAnySource = authorized ? authorized.indexOf('*') !== -1 : false;
-  var sourceNodeId = allowAnySource || messageParams.contact.nodeID;
-
-  if (!authorized) {
-    return callback(new Error('No trigger handler defined for behavior'));
-  }
-
-  if (!allowAnySource && authorized.indexOf(sourceNodeId) === -1) {
-    return callback(new Error('Not authorized to process trigger'));
-  }
-
-  this._behaviors[sourceNodeId + ':' + messageParams.behavior](
-    messageParams,
-    callback,
-    this.remove.bind(this, sourceNodeId, messageParams.behavior)
-  );
-};
-
-/**
- * Called when a trigger is received from authorized source
- * @callback TriggerManager~triggerHandler
- * @param {Object} messageParams - The RPC message parameters
- * @param {TriggerManager~replyToSender} replyToSender - Respond to the trigger
- * @param {TriggerManager~destroyTrigger} destroyTrigger - Unregisters trigger
- */
-
-/**
- * Passed to the trigger handler for replying to the message
- * @callback TriggerManager~replyToSender
- * @param {Error|null} err - Optional error to respond with
- * @param {Object} params - Response parameters to return
- */
-
-/**
- * Optionally called from trigger handler to unregister the trigger handler
- * @callback TriggerManager~destroyTrigger
- */
-
-/**
- * Called upon the processing of a trigger message
- * @callback TriggerManager~processCallback
- * @param {Error|null} err - Optional error resulting from processing
- * @param {Object} params - Response parameters to send back
- */
-
-module.exports = TriggerManager;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_sips_index.js.html b/Storj/core/docs/lib_sips_index.js.html deleted file mode 100644 index 003f4e6..0000000 --- a/Storj/core/docs/lib_sips_index.js.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - JSDoc: Source: lib/sips/index.js - - - - - - - - - - -
- -

Source: lib/sips/index.js

- - - - - - -
-
-
/**
- * @module storj/sips
- * @license AGPL-3.0
- */
-
-'use strict';
-
-/** {@link module:storj/sips/0003} */
-module.exports.SIP0003 = require('./0003');
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_storage_adapter.js.html b/Storj/core/docs/lib_storage_adapter.js.html deleted file mode 100644 index 504771c..0000000 --- a/Storj/core/docs/lib_storage_adapter.js.html +++ /dev/null @@ -1,318 +0,0 @@ - - - - - JSDoc: Source: lib/storage/adapter.js - - - - - - - - - - -
- -

Source: lib/storage/adapter.js

- - - - - - -
-
-
'use strict';
-
-var stream = require('readable-stream');
-var assert = require('assert');
-var Item = require('./item');
-var EventEmitter = require('events').EventEmitter;
-var inherits = require('util').inherits;
-var StorageItem = require('./item');
-
-/**
- * Abstract base class for storage adapter
- * @constructor
- * @license AGPL-3.0
- */
-function StorageAdapter() {
-  if (!(this instanceof StorageAdapter)) {
-    return new StorageAdapter();
-  }
-
-  EventEmitter.call(this);
-}
-
-/**
- * Triggered when the adapter is ready
- * @event StorageAdapter#ready
- */
-
-/**
- * Triggered when a new item is added
- * @event StorageAdapter#add
- * @param {StorageItem} item
- */
-
-/**
- * Triggered when an item is deleted
- * @event StorageAdapter#delete
- * @param {StorageItem} item
- */
-
-/**
- * Triggered when an existing item is updated
- * @event StorageAdapter#update
- * @param {StorageItem} itemBeforeUpdate
- * @param {StorageItem} itemAfterUpdate
- */
-
-inherits(StorageAdapter, EventEmitter);
-
-/**
- * Calls the implemented {@link StorageAdapter#_get} and validates the result
- * @param {String} key - Shard hash to get metadata for
- * @param {Function} callback - Called with error or {@link StorageItem}
- */
-StorageAdapter.prototype.get = function(key, callback) {
-  assert(typeof key === 'string', 'Invalid key supplied');
-  assert(key.length === 40, 'Key must be 160 bit hex string');
-  assert(typeof callback === 'function', 'Callback function must be supplied');
-
-  return this._get(key, function(err, result) {
-    if (err) {
-      return callback(err);
-    }
-
-    callback(null, new StorageItem(result));
-  });
-};
-
-/**
- * Calls the implemented {@link StorageAdapter#_peek} and validates the result
- * @param {String} key - Shard hash to get metadata for
- * @param {Function} callback - Called with error or {@link StorageItem}
- */
-StorageAdapter.prototype.peek = function(key, callback) {
-  assert(typeof key === 'string', 'Invalid key supplied');
-  assert(key.length === 40, 'Key must be 160 bit hex string');
-  assert(typeof callback === 'function', 'Callback function must be supplied');
-
-  return this._peek(key, function(err, result) {
-    if (err) {
-      return callback(err);
-    }
-
-    callback(null, new StorageItem(result));
-  });
-};
-
-/**
- * Calls the implemented {@link StorageAdapter#_put} and validates the input
- * @param {StorageItem} item - Item to write to storage
- * @param {Function} callback - Called on complete write
- */
-StorageAdapter.prototype.put = function(item, callback) {
-  var self = this;
-
-  assert(item instanceof Item, 'Invalid storage item supplied');
-  assert(typeof callback === 'function', 'Callback function must be supplied');
-
-  item.updateTimestamp();
-
-  return this.peek(item.hash, function(doesNotExist, existingItem) {
-    self._put(item.hash, item.toObject(), function(err) {
-      if (err) {
-        return callback(err);
-      }
-
-      if (doesNotExist) {
-        self.emit('add', item);
-      } else {
-        self.emit('update', existingItem, item);
-      }
-
-      callback(null);
-    });
-  });
-};
-
-/**
- * Calls the implemented {@link StorageAdapter#_del}
- * @param {String} key - Shard hash to delete the data for
- * @param {Function} callback - Called with error or {@link StorageItem}
- */
-StorageAdapter.prototype.del = function(key, callback) {
-  var self = this;
-
-  assert(typeof key === 'string', 'Invalid key supplied');
-  assert(key.length === 40, 'Key must be 160 bit hex string');
-  assert(typeof callback === 'function', 'Callback function must be supplied');
-
-  this.peek(key, function(err, item) {
-    if (err) {
-      return callback(err);
-    }
-
-    return self._del(key, function(err) {
-      if (err) {
-        return callback(err);
-      }
-
-      self.emit('delete', item);
-      callback(null);
-    });
-  });
-};
-
-/**
- * Calls the implemented {@link StorageAdapter#_size}
- * @param {String} [key] - Optional file key
- * @param {Function} callback - Called with error or number of bytes stored
- */
-StorageAdapter.prototype.size = function(/* [,key] callback */) {
-  return this._size.apply(this, arguments);
-};
-
-/**
- * Calls the implemented {@link StorageAdapter#_flush}
- * @param {Function} callback - Called with error or null
- */
-StorageAdapter.prototype.flush = function(callback) {
-  assert(typeof callback === 'function', 'Callback function must be supplied');
-
-  return this._flush(callback);
-};
-
-/**
- * Calls the implemented {@link StorageAdapter#_keys} and returns a readable
- * stream containing each stored item
- * @return {ReadableStream}
- */
-StorageAdapter.prototype.createReadStream = function() {
-  return this._keys().pipe(new stream.Transform({
-    objectMode: true,
-    transform: (key, enc, next) => {
-      this.peek(key.toString(), next);
-    },
-    flush: (done) => done()
-  }));
-};
-
-/**
- * Performs lookup and provides an {@link StorageItem} to the callback
- * @abstract
- * @param {String} key - Shard hash
- * @param {Function} callback - Called on complete
- */
-StorageAdapter.prototype._flush = function(/* callback */) {
-  throw new Error('Method not implemented');
-};
-
-/**
- * Performs lookup and provides an {@link StorageItem} to the callback
- * @abstract
- * @param {String} key - Shard hash
- * @param {Function} callback - Called on complete
- */
-StorageAdapter.prototype._get = function(/* key, callback */) {
-  throw new Error('Method not implemented');
-};
-
-/**
- * Performs lookup and provides an {@link StorageItem} to the callback but does
- * not initialize any shard read/write stream
- * @abstract
- * @param {String} key - Shard hash
- * @param {Function} callback - Called on complete
- */
-StorageAdapter.prototype._peek = function(/* key, callback */) {
-  throw new Error('Method not implemented');
-};
-
-/**
- * Delete the shard data at the given key
- * @abstract
- * @param {String} key - Shard hash
- * @param {Function} callback - Called on complete
- */
-StorageAdapter.prototype._del = function(/* key, callback */) {
-  throw new Error('Method not implemented');
-};
-
-/**
- * Stores the {@link StorageItem}
- * @abstract
- * @param {String} key - Shard hash
- * @param {Item} item - Item to store
- * @param {Function} callback - Called on complete
- */
-StorageAdapter.prototype._put = function(/* item, callback */) {
-  throw new Error('Method not implemented');
-};
-
-/**
- * Returns the hashes of all shards stored
- * @abstract
- * @returns {ReadableStream}
- */
-StorageAdapter.prototype._keys = function() {
-  throw new Error('Method not implemented');
-};
-
-/**
- * Returns the number of bytes stored
- * @abstract
- * @param {Function} callback - Called on complete
- */
-StorageAdapter.prototype._size = function(/* callback */) {
-  throw new Error('Method not implemented');
-};
-
-/**
- * Opens the storage adapter
- * @abstract
- * @param {Function} callback - Called on complete
- */
-StorageAdapter.prototype._open = function(callback) {
-  callback(null);
-};
-
-/**
- * Closes the storage adapter
- * @abstract
- * @param {Function} callback - Called on complete
- */
-StorageAdapter.prototype._close = function(callback) {
-  callback(null);
-};
-
-module.exports = StorageAdapter;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_storage_adapters_embedded.js.html b/Storj/core/docs/lib_storage_adapters_embedded.js.html deleted file mode 100644 index 4f3618d..0000000 --- a/Storj/core/docs/lib_storage_adapters_embedded.js.html +++ /dev/null @@ -1,333 +0,0 @@ - - - - - JSDoc: Source: lib/storage/adapters/embedded.js - - - - - - - - - - -
- -

Source: lib/storage/adapters/embedded.js

- - - - - - -
-
-
'use strict';
-
-var inherits = require('util').inherits;
-var StorageAdapter = require('../adapter');
-var levelup = require('levelup');
-var kfs = require('kfs');
-var path = require('path');
-var assert = require('assert');
-var utils = require('../../utils');
-var mkdirp = require('mkdirp');
-
-/**
- * Implements an LevelDB/KFS storage adapter interface
- * @extends {StorageAdapter}
- * @param {String} storageDirPath - Path to store the level db
- * @constructor
- * @license AGPL-3.0
- */
-function EmbeddedStorageAdapter(storageDirPath) {
-  if (!(this instanceof EmbeddedStorageAdapter)) {
-    return new EmbeddedStorageAdapter(storageDirPath);
-  }
-
-  this._validatePath(storageDirPath);
-
-  this._path = storageDirPath;
-  this._db = levelup(path.join(this._path, 'contracts.db'), {
-    maxOpenFiles: EmbeddedStorageAdapter.MAX_OPEN_FILES
-  });
-  this._fs = kfs(path.join(this._path, 'sharddata.kfs'));
-  this._isOpen = true;
-}
-
-EmbeddedStorageAdapter.SIZE_START_KEY = '0';
-EmbeddedStorageAdapter.SIZE_END_KEY = 'z';
-EmbeddedStorageAdapter.MAX_OPEN_FILES = 1000;
-
-inherits(EmbeddedStorageAdapter, StorageAdapter);
-
-/**
- * Validates the storage path supplied
- * @private
- */
-EmbeddedStorageAdapter.prototype._validatePath = function(storageDirPath) {
-  if (!utils.existsSync(storageDirPath)) {
-    mkdirp.sync(storageDirPath);
-  }
-
-  assert(utils.isDirectory(storageDirPath), 'Invalid directory path supplied');
-};
-
-/**
- * Implements the abstract {@link StorageAdapter#_get}
- * @private
- * @param {String} key
- * @param {Function} callback
- */
-EmbeddedStorageAdapter.prototype._get = function(key, callback) {
-  var self = this;
-
-  this._db.get(key, { fillCache: false }, function(err, value) {
-    if (err) {
-      return callback(err);
-    }
-
-    var result = JSON.parse(value);
-    var fskey = result.fskey || key;
-
-    self._fs.exists(fskey, function(err, exists) {
-      if (err) {
-        return callback(err);
-      }
-
-      function _getShardStreamPointer(callback) {
-        var getStream = exists ?
-                        self._fs.createReadStream.bind(self._fs) :
-                        self._fs.createWriteStream.bind(self._fs);
-        if (!exists) {
-          fskey = utils.rmd160(key, 'hex');
-          result.fskey = fskey;
-        }
-        getStream(fskey, function(err, stream) {
-          if (err) {
-            return callback(err);
-          }
-
-          result.shard = stream;
-
-          callback(null, result);
-        });
-      }
-
-      _getShardStreamPointer(callback);
-    });
-  });
-};
-
-/**
- * Implements the abstract {@link StorageAdapter#_peek}
- * @private
- * @param {String} key
- * @param {Function} callback
- */
-EmbeddedStorageAdapter.prototype._peek = function(key, callback) {
-  this._db.get(key, { fillCache: false }, function(err, value) {
-    if (err) {
-      return callback(err);
-    }
-
-    callback(null, JSON.parse(value));
-  });
-};
-
-/**
- * Implements the abstract {@link StorageAdapter#_put}
- * @private
- * @param {String} key
- * @param {Object} item
- * @param {Function} callback
- */
-EmbeddedStorageAdapter.prototype._put = function(key, item, callback) {
-  var self = this;
-
-  item.shard = null; // NB: Don't store any shard data here
-
-  item.fskey = utils.rmd160(key, 'hex');
-
-  self._db.put(key, JSON.stringify(item), {
-    sync: true
-  }, function(err) {
-    if (err) {
-      return callback(err);
-    }
-
-    callback(null);
-  });
-};
-
-/**
- * Implements the abstract {@link StorageAdapter#_del}
- * @private
- * @param {String} key
- * @param {Function} callback
- */
-EmbeddedStorageAdapter.prototype._del = function(key, callback) {
-  var self = this;
-  var fskey = key;
-
-  self._peek(key, function(err, item) {
-    if (!err && item.fskey) {
-      fskey = item.fskey;
-    }
-
-    self._db.del(key, function(err) {
-      if (err) {
-        return callback(err);
-      }
-
-      self._fs.unlink(fskey, function(err) {
-        if (err) {
-          return callback(err);
-        }
-
-        callback(null);
-      });
-    });
-  });
-};
-
-/**
- * Implements the abstract {@link StorageAdapter#_flush}
- * @private
- * @param {Function} callback
- */
-EmbeddedStorageAdapter.prototype._flush = function(callback) {
-  this._fs.flush(callback);
-};
-
-/**
- * Implements the abstract {@link StorageAdapter#_size}
- * @private
- * @param {String} [key]
- * @param {Function} callback
- */
-EmbeddedStorageAdapter.prototype._size = function(key, callback) {
-  var self = this;
-
-  if (typeof key === 'function') {
-    callback = key;
-    key = null;
-  }
-
-  this._db.db.approximateSize(
-    EmbeddedStorageAdapter.SIZE_START_KEY,
-    EmbeddedStorageAdapter.SIZE_END_KEY,
-    function(err, contractDbSize) {
-      if (err) {
-        return callback(err);
-      }
-
-      function handleStatResults(err, stats) {
-        if (err) {
-          return callback(err);
-        }
-
-        var kfsUsedSpace = stats.reduce(function(stat1, stat2) {
-          return {
-            sBucketStats: {
-              size: stat1.sBucketStats.size + stat2.sBucketStats.size
-            }
-          };
-        }, {
-          sBucketStats: { size: 0 }
-        }).sBucketStats.size;
-
-        callback(null, kfsUsedSpace + contractDbSize);
-      }
-
-      /* istanbul ignore if */
-      if (key) {
-        self._fs.stat(utils.rmd160(key, 'hex'), handleStatResults);
-      } else {
-        self._fs.stat(handleStatResults);
-      }
-    }
-  );
-};
-
-/**
- * Implements the abstract {@link StorageAdapter#_keys}
- * @private
- * @returns {ReadableStream}
- */
-EmbeddedStorageAdapter.prototype._keys = function() {
-  return this._db.createKeyStream();
-};
-
-/**
- * Implements the abstract {@link StorageAdapter#_open}
- * @private
- * @param {Function} callback
- */
-EmbeddedStorageAdapter.prototype._open = function(callback) {
-  var self = this;
-
-  if (!this._isOpen) {
-    return this._db.open(function(err) {
-      if (err) {
-        return callback(err);
-      }
-
-      self._isOpen = true;
-      callback(null);
-    });
-  }
-
-  callback(null);
-};
-
-/**
- * Implements the abstract {@link StorageAdapter#_close}
- * @private
- * @param {Function} callback
- */
-EmbeddedStorageAdapter.prototype._close = function(callback) {
-  var self = this;
-
-  if (this._isOpen) {
-    return this._db.close(function(err) {
-      if (err) {
-        return callback(err);
-      }
-
-      self._isOpen = false;
-      callback(null);
-    });
-  }
-
-  callback(null);
-};
-
-module.exports = EmbeddedStorageAdapter;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_storage_adapters_ram.js.html b/Storj/core/docs/lib_storage_adapters_ram.js.html deleted file mode 100644 index cdc99af..0000000 --- a/Storj/core/docs/lib_storage_adapters_ram.js.html +++ /dev/null @@ -1,216 +0,0 @@ - - - - - JSDoc: Source: lib/storage/adapters/ram.js - - - - - - - - - - -
- -

Source: lib/storage/adapters/ram.js

- - - - - - -
-
-
'use strict';
-
-var inherits = require('util').inherits;
-var stream = require('readable-stream');
-var StorageAdapter = require('../adapter');
-
-/**
- * Implements an in-memory storage adapter
- * @extends {StorageAdapter}
- * @constructor
- * @license AGPL-3.0
- */
-function RAMStorageAdapter() {
-  if (!(this instanceof RAMStorageAdapter)) {
-    return new RAMStorageAdapter();
-  }
-
-  this._items = {};
-  this._shards = {};
-}
-
-inherits(RAMStorageAdapter, StorageAdapter);
-
-/**
- * Implements the abstract {@link StorageAdapter#_get}
- * @private
- * @param {String} key
- * @param {Function} callback
- */
-RAMStorageAdapter.prototype._get = function(key, callback) {
-  var self = this;
-  var result = this._items[key];
-
-  if (!result) {
-    return callback(new Error('Shard data not found'));
-  }
-
-  if (this._shards[key]) {
-    result.shard = this._decorateStreamWithDestroy(key, new stream.Readable({
-      read: function() {
-        if (this._finished) {
-          this.push(null);
-        } else {
-          this.push(self._shards[key]);
-          this._finished = true;
-        }
-      }
-    }));
-  } else {
-    result.shard = this._decorateStreamWithDestroy(key, new stream.Writable({
-      write: function(data, encoding, next) {
-        self._shards[key] = data;
-        next();
-      }
-    }));
-  }
-
-  callback(null, result);
-};
-
-/**
- * Implements the abstract {@link StorageAdapter#_peek}
- * @private
- * @param {String} key
- * @param {Function} callback
- */
-RAMStorageAdapter.prototype._peek = function(key, callback) {
-  if (!this._items[key]) {
-    return callback(new Error('Shard data not found'));
-  }
-
-  callback(null, this._items[key]);
-};
-
-/**
- * Implements the abstract {@link StorageAdapter#_put}
- * @private
- * @param {String} key
- * @param {StorageItem} item
- * @param {Function} callback
- */
-RAMStorageAdapter.prototype._put = function(key, item, callback) {
-  this._items[key] = item;
-
-  callback();
-};
-
-/**
- * Implements the abstract {@link StorageAdapter#_flush}
- * @private
- * @param {Function} callback
- */
-RAMStorageAdapter.prototype._flush = function(callback) {
-  callback();
-};
-
-/**
- * Implements the abstract {@link StorageAdapter#_del}
- * @private
- * @param {String} key
- * @param {Function} callback
- */
-RAMStorageAdapter.prototype._del = function(key, callback) {
-  delete this._shards[key];
-
-  callback();
-};
-
-/**
- * Implements the abstract {@link StorageAdapter#_size}
- * @private
- * @param {String} [key]
- * @param {Function} callback
- */
-/* istanbul ignore next */
-RAMStorageAdapter.prototype._size = function(key, callback) {
-  /* istanbul ignore if */
-  if (typeof key === 'function') {
-    callback = key;
-  }
-
-  var shardBytes = 0;
-
-  for (var _key in this._shards) {
-    shardBytes += this._shards[_key].length;
-  }
-
-  callback(
-    null,
-    Buffer(JSON.stringify(this._items)).length + shardBytes
-  );
-};
-
-/**
- * Implements the abstract {@link StorageAdapter#_keys}
- * @private
- * @returns {ReadableStream}
- */
-RAMStorageAdapter.prototype._keys = function() {
-  var keys = Object.keys(this._items);
-
-  return new stream.Readable({
-    read: function() {
-      this.push(keys.length ? keys.shift() : null);
-    }
-  });
-};
-
-/**
- * Decorates a stream with a destroy method to remove any data written
- * @private
- * @param {String} key
- * @param {Stream} stream
- */
-RAMStorageAdapter.prototype._decorateStreamWithDestroy = function(key, stream) {
-  var self = this;
-
-  stream.destroy = function() {
-    delete self._shards[key];
-  };
-
-  return stream;
-};
-
-module.exports = RAMStorageAdapter;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_storage_item.js.html b/Storj/core/docs/lib_storage_item.js.html deleted file mode 100644 index b8db4c9..0000000 --- a/Storj/core/docs/lib_storage_item.js.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - - JSDoc: Source: lib/storage/item.js - - - - - - - - - - -
- -

Source: lib/storage/item.js

- - - - - - -
-
-
'use strict';
-
-var assert = require('assert');
-var Contract = require('../contract');
-var merge = require('merge');
-
-/**
- * Represents a storage item, including contracts, challenges, the shard itself
- * along with metadata describing download count, payments, etc
- * @constructor
- * @license AGPL-3.0
- * @param {Object} data
- * @param {String|null} data.hash - Shard hash to use as storage key
- * @param {Stream|null} data.shard - Raw binary blob of shard
- * @param {Object} data.contracts - Dictionary of nodeID:{@link Contract}
- * @param {Object} data.trees - Dictionary of nodeID:merkleLeaves
- * @param {Object} data.challenges - Dictionary of nodeID:privateAuditData
- * @param {Object} data.meta - Dictionary of arbitrary nodeID:metadata
- */
-function StorageItem(data) {
-  if (!(this instanceof StorageItem)) {
-    return new StorageItem(data);
-  }
-
-  data = merge({}, data);
-
-  this.hash = null;
-  this.fskey = null;
-  this.shard = null;
-  this.contracts = {};
-  this.contractsHDMap = {};
-  this.trees = data.trees || {};
-  this.challenges = data.challenges || {};
-  this.meta = data.meta || {};
-  this.modified = data.modified || Date.now();
-
-  this._init(data);
-}
-
-/**
- * Adds the trees and challenges to the item keyed by nodeID
- * @param {Contact} contact - The contact associated with the trees
- * @param {Audit|AuditStream} audit - The audit or challenge generator
- */
-StorageItem.prototype.addAuditRecords = function(contact, audit) {
-  this.trees[contact.nodeID] = audit.getPublicRecord();
-  this.challenges[contact.nodeID] = audit.getPrivateRecord();
-
-  return this;
-};
-
-/**
- * Adds the contract data keyed by nodeID and hdKey
- * @param {Contact} contact - The contact associated with the trees
- * @param {Contract} contract - The storage contract instance
- */
-StorageItem.prototype.addContract = function(contact, contract) {
-  assert(contract instanceof Contract, 'Invalid contract supplied');
-  assert(contact && contact.nodeID, 'contact.nodeID is expected');
-
-  this.contracts[contact.nodeID] = contract;
-  var hdKey = contact.hdKey;
-
-  if (hdKey) {
-    this.contractsHDMap[hdKey] = contract;
-  }
-
-  return this;
-};
-
-/**
- * Gets a contract data by a contact based on the hdKey or the nodeID
- * of the contact. It will return false if the contract is not found for the
- * contact, which will indicate that the contact is not authorized for
- * that specific contract.
- * @param {Contact} contact - The contact associated with the trees
- * @param {Contract} contract - The storage contract instance
- * @returns {Contract|Boolean}
- */
-StorageItem.prototype.getContract = function(contact) {
-  if (contact.hdKey) {
-    return this.contractsHDMap[contact.hdKey] || false;
-  } else {
-    return this.contracts[contact.nodeID] || false;
-  }
-};
-
-/**
- * Deletes the contract for the given contact
- * @param {Contact} contact
- * @returns {Boolean} didRemoveContract
- */
-StorageItem.prototype.removeContract = function(contact) {
-  if (this.getContract(contact)) {
-    if (contact.hdKey) {
-      delete this.contractsHDMap[contact.hdKey];
-    } else {
-      delete this.contracts[contact.nodeID];
-    }
-    return true;
-  }
-  return false;
-};
-
-/**
- * Adds the meta data keyed by nodeID
- * @param {Contact} contact - The contact associated with the trees
- * @param {Object} meta - Arbitrary metadata about the shard
- */
-StorageItem.prototype.addMetaData = function(contact, meta) {
-  this.meta[contact.nodeID] = meta;
-
-  return this;
-};
-
-/**
- * Updates the timestamp for the item
- */
-StorageItem.prototype.updateTimestamp = function() {
-  this.modified = Date.now();
-
-  return this;
-};
-
-/**
- * Returns a plain object representation of the item
- */
-StorageItem.prototype.toObject = function() {
-  var contracts = {};
-
-  for (var c in this.contracts) {
-    contracts[c] = this.contracts[c].toObject();
-  }
-
-  return {
-    hash: this.hash,
-    fskey: this.fskey,
-    shard: null,
-    contracts: contracts,
-    challenges: this.challenges,
-    trees: this.trees,
-    meta: this.meta,
-    modified: this.modified
-  };
-};
-
-/**
- * Initializes the item values with the given data
- * @private
- * @param {Object} data
- * @returns {StorageItem}
- */
-StorageItem.prototype._init = function(data) {
-  assert(typeof data === 'object', 'Invalid item data supplied');
-
-  this.shard = data.shard || null;
-  this.hash = data.hash || null;
-  this.fskey = data.fskey || null;
-
-  for (var nodeID in data.contracts) {
-    var contract = new Contract(data.contracts[nodeID]);
-    this.addContract({
-      nodeID: nodeID,
-      hdKey: contract.get('renter_hd_key')
-    }, contract);
-  }
-
-  return this;
-};
-
-module.exports = StorageItem;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_storage_manager.js.html b/Storj/core/docs/lib_storage_manager.js.html deleted file mode 100644 index 09e240c..0000000 --- a/Storj/core/docs/lib_storage_manager.js.html +++ /dev/null @@ -1,245 +0,0 @@ - - - - - JSDoc: Source: lib/storage/manager.js - - - - - - - - - - -
- -

Source: lib/storage/manager.js

- - - - - - -
-
-
'use strict';
-
-var constants = require('../constants');
-var assert = require('assert');
-var StorageAdapter = require('./adapter');
-var StorageItem = require('./item');
-var merge = require('merge');
-var EventEmitter = require('events').EventEmitter;
-var inherits = require('util').inherits;
-var Logger = require('kad-logger-json');
-
-/**
- * Interface for managing contracts, shards, and audits
- * @constructor
- * @license AGPL-3.0
- * @extends {EventEmitter}
- * @param {StorageAdapter} storage - Storage adapter to use
- * @param {Object} options
- * @param {Boolean} options.disableReaper - Don't perform periodic reaping of
- * stale contracts
- * @param {Object} [options.logger] - Logger to use for debugging
- * @param {Number} options.maxCapacity - Max number of bytes to allow in storage
- */
-function StorageManager(storage, options) {
-  if (!(this instanceof StorageManager)) {
-    return new StorageManager(storage, options);
-  }
-
-  assert(storage instanceof StorageAdapter, 'Invalid storage adapter');
-
-  this._options = merge(Object.create(StorageManager.DEFAULTS), options);
-  this._storage = storage;
-  this._logger = this._options.logger || new Logger(0);
-
-  this._initShardReaper();
-}
-
-inherits(StorageManager, EventEmitter);
-
-StorageManager.DEFAULTS = {
-  disableReaper: false,
-  maxCapacity: Infinity
-};
-
-/**
- * Loads the storage {@link Item} at the given key
- * @param {String} hash - Shard hash to load data for
- * @param {Function} callback - Called with error or {@link StorageItem}
- */
-StorageManager.prototype.load = function(hash, callback) {
-  assert(typeof hash === 'string', 'Invalid key supplied');
-  assert(hash.length === 40, 'Key must be 160 bit hex string');
-  assert(typeof callback === 'function', 'Callback function must be supplied');
-
-  this._storage.get(hash, function(err, item) {
-    if (err) {
-      return callback(err);
-    }
-
-    if (!(item instanceof StorageItem)) {
-      return callback(new Error('Storage adapter provided invalid result'));
-    }
-
-    callback(null, item);
-  });
-};
-
-/**
- * Saves the storage {@link StorageItem} at the given key
- * @param {StorageItem} item - The {@link StorageItem} to store
- * @param {Function} callback - Called on complete
- */
-StorageManager.prototype.save = function(item, callback) {
-  var self = this;
-
-  assert(item instanceof StorageItem, 'Invalid storage item supplied');
-  assert(typeof callback === 'function', 'Callback function must be supplied');
-
-  self._storage.get(item.hash, function(err, existingItem) {
-    self._storage.put(
-      self._merge(existingItem, item),
-      function(err) {
-        if (err) {
-          return callback(err);
-        }
-
-        callback(null);
-      }
-    );
-  });
-};
-
-/**
- * Merges two storage items together
- * @private
- */
-StorageManager.prototype._merge = function(item1, item2) {
-  return new StorageItem(
-    merge.recursive(
-      true,
-      item1 ?
-        ((item1 instanceof StorageItem) ?
-          item1.toObject() :
-          StorageItem(item1).toObject()) :
-        {},
-      item2 ?
-        ((item2 instanceof StorageItem) ?
-          item2.toObject() :
-          StorageItem(item2).toObject()) :
-        {}
-    )
-  );
-};
-
-/**
- * Opens the underlying storage adapter
- * @param {Function} callback - Called on complete
- */
-StorageManager.prototype.open = function(callback) {
-  this._storage._open(callback);
-};
-
-/**
- * Closes the underlying storage adapter
- * @param {Function} callback - Called on complete
- */
-StorageManager.prototype.close = function(callback) {
-  this._storage._close(callback);
-};
-
-/**
- * Enumerates all storage contracts and reaps stale data
- * @param {Function} callback - Called on complete
- */
-StorageManager.prototype.clean = function(callback) {
-  var self = this;
-  var rstream = this._storage.createReadStream();
-  var timestamp = Date.now();
-
-  this._logger.info('starting shard reaper, checking for expired contracts');
-
-  rstream.on('data', function(item) {
-    rstream.pause();
-
-    var total = Object.keys(item.contracts).length;
-    var endedOrIncomplete = 0;
-
-    for (var nodeID in item.contracts) {
-      var ended = item.contracts[nodeID].get('store_end') < timestamp;
-      var incomplete = !item.contracts[nodeID].isComplete();
-
-      if (ended || incomplete) {
-        endedOrIncomplete++;
-      }
-    }
-
-    if (total === endedOrIncomplete) {
-      self._logger.info('destroying shard/contract for %s', item.hash);
-      self._storage.del(item.hash, function(/* err */) {
-        rstream.resume();
-      });
-    } else {
-      rstream.resume();
-    }
-  });
-
-  rstream.on('end', function() {
-    self._logger.info('flushing shards, some buckets will be inaccessible');
-    self._storage.flush(function(err) {
-      /* istanbul ignore if */
-      if (err) {
-        self._logger.warn('problem while flushing shards, %s', err.message);
-      }
-
-      self._logger.info('flushing shards finished');
-      callback();
-    });
-  });
-};
-
-/**
- * Initialize the shard reaper to check for stale contracts and reap shards
- * @private
- */
-StorageManager.prototype._initShardReaper = function() {
-  if (this._options.disableReaper) {
-    return false;
-  }
-
-  setTimeout(this.clean.bind(this, this._initShardReaper.bind(this)),
-             constants.CLEAN_INTERVAL);
-};
-
-module.exports = StorageManager;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_storage_migration.js.html b/Storj/core/docs/lib_storage_migration.js.html deleted file mode 100644 index a35c0f3..0000000 --- a/Storj/core/docs/lib_storage_migration.js.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - JSDoc: Source: lib/storage/migration.js - - - - - - - - - - -
- -

Source: lib/storage/migration.js

- - - - - - -
-
-
'use strict';
-
-var assert = require('assert');
-var StorageAdapter = require('./adapter');
-var inherits = require('util').inherits;
-var EventEmitter = require('events').EventEmitter;
-var StorageItem = require('./item');
-var WritableStream = require('readable-stream').Writable;
-
-/**
- * Migrates data stored with one {@link StorageAdapter} to another
- * @constructor
- * @license AGPL-3.0
- * @param {StorageAdapter} source - The source adapter
- * @param {StorageAdapter} target - The migration destination
- */
-function StorageMigration(source, target) {
-  if (!(this instanceof StorageMigration)) {
-    return new StorageMigration(source, target);
-  }
-
-  assert(source instanceof StorageAdapter, 'Invalid storage adapter supplied');
-  assert(target instanceof StorageAdapter, 'Invalid storage adapter supplied');
-
-  this.source = source;
-  this.target = target;
-  this.readyState = StorageMigration.STOPPED;
-  this._isReady = false;
-
-  EventEmitter.call(this);
-}
-
-inherits(StorageMigration, EventEmitter);
-
-StorageMigration.STOPPED = 0;
-StorageMigration.STARTED = 1;
-
-/**
- * Starts the migration process
- */
-StorageMigration.prototype.start = function() {
-  var self = this;
-
-  assert(
-    this.readyState === StorageMigration.STOPPED,
-    'Migration has already started'
-  );
-
-  self.readyState = StorageMigration.STARTED;
-  self._sourceStream = self.source.createReadStream();
-  self._targetStream = new WritableStream({
-    write: self._handleSourceObject.bind(self),
-    objectMode: true
-  });
-
-  self._targetStream.on('finish', self._handleSourceFinished.bind(self));
-  self._sourceStream.on('error', self._handleSourceError.bind(self));
-  self._targetStream.on('error', self._handleSourceError.bind(self));
-
-  return self._sourceStream.pipe(self._targetStream);
-};
-
-/**
- * Stops the migration process
- */
-StorageMigration.prototype.stop = function() {
-  assert(
-    this.readyState === StorageMigration.STARTED,
-    'Migration has already stopped'
-  );
-
-  this._sourceStream.removeAllListeners();
-
-  this.readyState = StorageMigration.STOPPED;
-  this._sourceStream = null;
-};
-
-/**
- * Handles a data event from the source read stream and inserts it into the
- * the target adapter
- * @private
- * @param {StorageItem} sourceItem - Storage item from the source read stream
- */
-StorageMigration.prototype._handleSourceObject = function(sourceItem, enc, cb) {
-  var self = this;
-
-  self.target.put(StorageItem(sourceItem), function(err) {
-    if (err) {
-      return cb(err);
-    }
-
-    self.target.get(sourceItem.hash, function(err, targetItem) {
-      if (err) {
-        return cb(err);
-      }
-
-      self.source.get(sourceItem.hash, function(err, fullSourceItem) {
-        if (err) {
-          return cb(err);
-        }
-
-        if (typeof fullSourceItem.shard.read === 'function') {
-          return fullSourceItem.shard.pipe(targetItem.shard)
-            .on('error', cb)
-            .on('finish', cb);
-        }
-
-        cb();
-      });
-    });
-  });
-};
-
-/**
- * Handles the completion of the source stream read
- * @private
- */
-StorageMigration.prototype._handleSourceFinished = function() {
-  this.readyState = StorageMigration.STOPPED;
-  this._sourceStream = null;
-
-  this.emit('finish');
-};
-
-/**
- * Handles errors received from the underyling source stream
- * @private
- * @param {Error} error
- */
-StorageMigration.prototype._handleSourceError = function(err) {
-  this.readyState = StorageMigration.STOPPED;
-  this._sourceStream = null;
-
-  this.emit('error', err);
-};
-
-module.exports = StorageMigration;
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_utils.js.html b/Storj/core/docs/lib_utils.js.html deleted file mode 100644 index 31c93d5..0000000 --- a/Storj/core/docs/lib_utils.js.html +++ /dev/null @@ -1,640 +0,0 @@ - - - - - JSDoc: Source: lib/utils.js - - - - - - - - - - -
- -

Source: lib/utils.js

- - - - - - -
-
-
/**
- * @module storj/utils
- * @license LGPL-3.0
- */
-
-'use strict';
-
-var http = require('http');
-var stream = require('readable-stream');
-var assert = require('assert');
-var HDKey = require('hdkey');
-var constants = require('./constants');
-var KeyPair = require('./crypto-tools/keypair');
-var crypto = require('crypto');
-var semver = require('semver');
-var ip = require('ip');
-var ntp = require('ntp-client');
-var bitcore = require('bitcore-lib');
-var ECIES = require('bitcore-ecies');
-var through = require('through');
-var fs = require('fs');
-var base58 = bitcore.deps.bs58;
-var os = require('os');
-
-/**
- * Returns the SHA-1 hash of the input
- * @param {String|Buffer} input - Data to hash
- * @param {String} encoding - The encoding type of the data
- * @returns {String}
- */
-module.exports.sha1 = function(input, encoding) {
-  return crypto.createHash('sha1').update(input, encoding).digest('hex');
-};
-
-/**
- * Returns the SHA-256 hash of the input
- * @param {String|Buffer} input - Data to hash
- * @param {String} encoding - The encoding type of the data
- * @returns {String}
- */
-module.exports.sha256 = function(input, encoding) {
-  return crypto.createHash('sha256').update(input, encoding).digest('hex');
-};
-
-/**
- * Returns the SHA-256 hash of the input
- * @param {String|Buffer} input - Data to hash
- * @param {String} encoding - The encoding type of the data
- * @returns {Buffer}
- */
-module.exports.sha256b = function(input, encoding) {
-  return crypto.createHash('sha256').update(input, encoding).digest();
-};
-
-/**
- * Returns the SHA-512 hash of the input
- * @param {String|Buffer} input - Data to hash
- * @param {String} encoding - The encoding type of the data
- * @returns {String}
- */
-module.exports.sha512 = function(input, encoding) {
-  return crypto.createHash('sha512').update(input, encoding).digest('hex');
-};
-
-/**
- * Returns the RIPEMD-160 hash of the input
- * @param {String|Buffer} input - Data to hash
- * @param {String} encoding - The encoding type of the data
- * @returns {String}
- */
-module.exports.rmd160 = function(input, encoding) {
-  return crypto.createHash('rmd160').update(input, encoding).digest('hex');
-};
-
-/**
- * Returns the RIPEMD-160 hash of the input
- * @param {String|Buffer} input - Data to hash
- * @param {String} encoding - The encoding type of the data
- * @returns {Buffer}
- */
-module.exports.rmd160b = function(input, encoding) {
-  return crypto.createHash('rmd160').update(input, encoding).digest();
-};
-
-/**
- * Returns the WHIRLPOOL hash of the input
- * @param {String|Buffer} input - Data to hash
- * @param {String} encoding - The encoding type of the data
- * @returns {String}
- */
-module.exports.whirlpool = function(input, encoding) {
-  return crypto.createHash('whirlpool').update(input, encoding).digest('hex');
-};
-
-/**
- * Returns the RIPEMD-160 SHA-256 hash of this input
- * @param {String|Buffer} input - Data to hash
- * @param {String} encoding - The encoding type of the data
- * @returns {String}
- */
-module.exports.rmd160sha256 = function(input, encoding) {
-  return module.exports.rmd160(
-    Buffer(module.exports.sha256(input, encoding), 'hex')
-  );
-};
-
-/**
- * Returns the RIPEMD-160 SHA-256 hash of this input
- * @param {String|Buffer} input - Data to hash
- * @param {String} encoding - The encoding type of the data
- * @returns {Buffer}
- */
-module.exports.rmd160sha256b = function(input, encoding) {
-  return module.exports.rmd160b(module.exports.sha256b(input, encoding))
-};
-
-/**
- * Returns the SHA-1 WHIRLPOOL hash of this input
- * @param {String|Buffer} input - Data to hash
- * @param {String} encoding - The encoding type of the data
- * @returns {String}
- */
-module.exports.sha1whirlpool = function(input, encoding) {
-  return module.exports.sha1(
-    Buffer(module.exports.whirlpool(input, encoding), 'hex')
-  );
-};
-
-/**
- * Returns the next power of two number
- * @param {Number} number
- * @returns {Number}
- */
-module.exports.getNextPowerOfTwo = function(num) {
-  return Math.pow(2, Math.ceil(Math.log(num) / Math.log(2)));
-};
-
-/**
- * Generates a unique token
- * @returns {String}
- */
-module.exports.generateToken = function() {
-  return module.exports.rmd160sha256(crypto.randomBytes(512));
-};
-
-/**
- * Returns a stringified URL from the supplied contact object
- * @param {Object} contact
- * @param {String} contact.address
- * @param {Number} contact.port
- * @param {String} contact.nodeID
- * @returns {String}
- */
-module.exports.getContactURL = function(contact) {
-  return [
-    'storj://', contact.address, ':', contact.port, '/', contact.nodeID
-  ].join('');
-};
-
-/**
- * Returns whether or not the supplied semver tag is compatible
- * @param {String} version - The semver tag from the contact
- * @returns {Boolean} compatible
- */
-module.exports.isCompatibleVersion = function(version) {
-  var local = require('./version').protocol;
-  var remote = version;
-  var sameMajor = semver.major(local) === semver.major(remote);
-  var diffs = ['prerelease', 'prepatch', 'preminor', 'premajor'];
-
-  if (diffs.indexOf(semver.diff(remote, local)) !== -1) {
-    return false;
-  } else {
-    return sameMajor;
-  }
-};
-
-/**
- * Determines if the supplied contact is valid
- * @param {Contact} contact - The contact information for a given peer
- * @param {Boolean} loopback - Allows contacts that are localhost
- * @returns {Boolean}
- */
-module.exports.isValidContact = function(contact, loopback) {
-  if (!contact) {
-    return false;
-  }
-
-  var isValidAddr = ip.isV4Format(contact.address) ||
-                    ip.isV6Format(contact.address) ||
-                    ip.isPublic(contact.address);
-  var isValidPort = contact.port > 0;
-  var isAllowedAddr = ip.isLoopback(contact.address) ? !!loopback : true;
-
-  return isValidPort && isValidAddr && isAllowedAddr;
-};
-
-/**
- * Determines if a value is hexadecimal string
- * @param {*} a - The value to be tested
- * @returns {Boolean}
- */
-module.exports.isHexaString = function(a) {
-  if (typeof a !== 'string') {
-    return false;
-  }
-  return /^[0-9a-fA-F]+$/.test(a);
-};
-
-/**
- * Creates an ECIES ciper object from a private and a public key
- * @param {String} privateKey - The private key of the sender
- * @param {String} publicKey - The public key of the recipient
- * @returns {Object}
- */
-module.exports.createEciesCipher = function(privateKey, publicKey) {
-  var cipher = ECIES();
-
-  cipher.privateKey(KeyPair(privateKey)._privkey);
-  cipher.publicKey(bitcore.PublicKey.fromDER(Buffer(publicKey, 'hex')));
-
-  return cipher;
-};
-
-/**
- * Validates the logger object supplied
- * @private
- */
-module.exports.validateLogger = function(logger) {
-  return logger && logger.debug && logger.warn && logger.info && logger.error;
-};
-
-/**
- * Returns number of bytes from human readable size and unit strings
- * @param {String|Number} size - The size measurement
- * @param {String} unit - The unit of measure (MB|MiB|GB|GiB|TB|TiB)
- * @returns {Number}
- */
-module.exports.toNumberBytes = function(size, unit) {
-  /* eslint complexity: [2, 7] */
-  switch (unit.toUpperCase()) {
-    case 'MB':
-      size = Number(size) * Math.pow(1000, 2);
-      break;
-    case 'GB':
-      size = Number(size) * Math.pow(1000, 3);
-      break;
-    case 'TB':
-      size = Number(size) * Math.pow(1000, 4);
-      break;
-    case 'MIB':
-      size = Number(size) * Math.pow(1024, 2);
-      break;
-    case 'GIB':
-      size = Number(size) * Math.pow(1024, 3);
-      break;
-    case 'TIB':
-      size = Number(size) * Math.pow(1024, 4);
-      break;
-    default:
-      throw new Error('Unit must be one of TB, TiB, GB, GiB, MB or MiB');
-  }
-
-  return Number(size.toFixed());
-};
-
-/**
- * Encrypts the given data with the supplied password and base58 encodes it
- * @param {String} password - The passphrase to use for encryption
- * @param {String} data - The string to encrypt
- * @returns {String}
- */
-module.exports.simpleEncrypt = function(password, str) {
-  var aes256 = crypto.createCipher('aes-256-cbc', password);
-  var a = aes256.update(str, 'utf8');
-  var b = aes256.final();
-  var buf = new Buffer(a.length + b.length);
-
-  a.copy(buf, 0);
-  b.copy(buf, a.length);
-
-  return base58.encode(buf);
-};
-
-/**
- * Decrypts the given data with the supplied password and base58 decodes it
- * @param {String} password - The passphrase to use for decryption
- * @param {String} data - The string to decrypt
- * @returns {String}
- */
-module.exports.simpleDecrypt = function(password, str) {
-  var aes256 = crypto.createDecipher('aes-256-cbc', password);
-  var a = aes256.update(new Buffer(base58.decode(str)));
-  var b = aes256.final();
-  var buf = new Buffer(a.length + b.length);
-
-  a.copy(buf, 0);
-  b.copy(buf, a.length);
-
-  return buf.toString('utf8');
-};
-
-/**
- * Returns the delta between system time and NTP time
- * @param {Function} callback - Called with (err, delta)
- */
-module.exports.getNtpTimeDelta = function(callback) {
-  var timeBeforeRequest = new Date();
-
-  ntp.getNetworkTime(
-    ntp.defaultNtpServer,
-    ntp.defaultNtpPort,
-    function(err, networkTime) {
-      if (err) {
-        return callback(err);
-      }
-
-      var systemTime = Date.now();
-      var latency = parseInt((systemTime - timeBeforeRequest) / 2);
-      var delta = networkTime.getTime() - Math.abs(systemTime - latency);
-
-      callback(null, delta);
-    }
-  );
-};
-
-/**
- * Determines if the system clock is syncronized with network
- * @param {Function} callback - Called with (err, delta)
- */
-module.exports.ensureNtpClockIsSynchronized = function(callback) {
-  module.exports.getNtpTimeDelta(function(err, delta) {
-    if (err) {
-      return callback(err);
-    }
-
-    if (Math.abs(delta) > constants.NONCE_EXPIRE) {
-      return callback(new Error('System clock is not syncronized with NTP'));
-    }
-
-    callback(null, delta);
-  });
-};
-
-/**
- * Returns a through stream that trims the output based on the given range
- * @param {Number} trimFront - Number of bytes to trim off front of stream
- * @param {Number} totalBytes - The total length of the stream in bytes
- */
-module.exports.createStreamTrimmer = function(trimFront, totalBytes) {
-  var bytesTrimmedFront = 0;
-  var bytesRead = 0;
-
-  return through(function(data) {
-    if (trimFront - bytesTrimmedFront > data.length) {
-      bytesTrimmedFront += data.length;
-      bytesRead += 0;
-      this.queue(new Buffer([]));
-    } else if (trimFront > bytesTrimmedFront) {
-      var frontTrimmedSlice = data.slice(trimFront - bytesTrimmedFront);
-      bytesTrimmedFront += data.length;
-      bytesRead += frontTrimmedSlice.length;
-      this.queue(frontTrimmedSlice);
-    } else if (bytesRead < totalBytes) {
-      var backTrimmedSlice = data.slice(0, totalBytes - bytesRead);
-      bytesRead += backTrimmedSlice.length;
-      this.queue(backTrimmedSlice);
-    } else {
-      this.queue(null);
-    }
-  });
-};
-
-/**
- * Check if file exists
- * @param {String} file - Path to file
- * @returns {Boolean}
- */
-module.exports.existsSync = function(file) {
-  try {
-    fs.statSync(file);
-  } catch (err) {
-    return false;
-  }
-
-  return true;
-};
-
-/**
- * Check if a path is a directory
- * @param {String} dirPath - Path to a directory
- * @returns {Boolean}
- */
-module.exports.isDirectory = function(dirPath) {
-  try {
-    return fs.statSync(dirPath).isDirectory();
-  } catch (err) {
-    return false;
-  }
-};
-
-/**
- * Check for env STORJ_TEMP todetermine temp directory
- */
-module.exports.tmpdir = function() {
-  var tmpdir = process.env.STORJ_TEMP;
-
-  if (
-    !tmpdir ||
-    (typeof tmpdir === 'undefined') ||
-    !module.exports.existsSync(tmpdir)
-  ) {
-    tmpdir = os.tmpdir();
-  }
-
-  return tmpdir;
-};
-
-/**
- * Empty function stub
- * @private
- */
-module.exports.noop = function() {};
-
-/**
- * Calculate bucket id from a given user id and bucket name
- * @param {String} user - user id
- * @param {String} bucketName - bucket name
- */
-module.exports.calculateBucketId = function(user, bucketName) {
-  var rmd160sha256 = module.exports.rmd160sha256;
-  var hash = rmd160sha256(user + bucketName, 'utf-8');
-  return hash.substring(0, 24);
-};
-
-/**
- * Calculate file id from a given bucket id and file name
- * @param {String} bucket - bucket id
- * @param {String} fileName - file name
- */
-module.exports.calculateFileId = function(bucket, fileName) {
-  var rmd160sha256 = module.exports.rmd160sha256;
-  var hash = rmd160sha256(bucket + fileName, 'utf-8');
-  return hash.substring(0, 24);
-};
-
-/**
- * Calculate file id from a user id, bucket name, and file name
- * @param {String} user - user id
- * @param {String} bucketName - bucket name
- * @param {String} fileName - file name
- */
-module.exports.calculateFileIdByName = function(user, bucketName, fileName) {
-  var bucket = module.exports.calculateBucketId(user, bucketName);
-  var hash = module.exports.calculateFileId(bucket, fileName);
-  return hash;
-};
-
-/**
- * Checks if the supplied HD key is valid (base58 encoded) and proper length
- * @param {String} hdKey - The HD key in base 58 encoding
- * @returns {Boolean} isValidHDKey
- */
-module.exports.isValidHDNodeKey = function(hdKey) {
-  return typeof hdKey === 'string' &&
-    /^[1-9a-km-zA-HJ-NP-Z]{1,111}$/.test(hdKey);
-};
-
-/**
- * Checks if the input is a non-hardened HD key index
- * @param {Number} hdIndex - The HD key index
- * @returns {Boolean} isValidHDKeyIndex
- */
-module.exports.isValidNodeIndex = function(n) {
-  return !Number.isNaN(n) && (parseInt(n) === n) && n >= 0 &&
-    n <= constants.MAX_NODE_INDEX;
-};
-
-/**
- * Returns a HD key object using corrent key derivation path using the
- * given seed
- * @see https://github.com/Storj/complex
- * @param {Buffer} seed64 - 64 byte seed for generating key
- * @returns {HDKey}
- */
-module.exports.createComplexKeyFromSeed = function(seed64) {
-  assert(Buffer.isBuffer(seed64), 'Seed must be a buffer');
-  assert(seed64.length === 64, 'Seed must be 64 bytes in length');
-
-  var hdKey = HDKey.fromMasterSeed(seed64).derive(
-    constants.HD_KEY_DERIVATION_PATH
-  );
-
-  return hdKey.privateExtendedKey;
-};
-
-/**
- * Returns a request object for uploading a shard to a farmer
- * @param {Contact} farmer - Farmer contact object
- * @param {String} shardHash - The hash of the shard to upload
- * @param {String} transferToken - The authorized transfer token
- * @returns {http.ClientRequest}
- */
-module.exports.createShardUploader = function(farmer, hash, token) {
-  function _createUploadStream() {
-    return http.request({
-      method: 'POST',
-      protocol: 'http:',
-      hostname: farmer.address,
-      port: farmer.port,
-      path: `/shards/${hash}?token=${token}`,
-      headers: {
-        'content-type': 'application/octet-stream',
-        'x-storj-node-id': farmer.nodeID
-      }
-    });
-  }
-
-  return new stream.Transform({
-    transform: function(chunk, encoding, callback) {
-      if (!this._uploader) {
-        this._uploader = _createUploadStream();
-        this._uploader.on('response', this.emit.bind(this, 'response'));
-        this._uploader.on('error', (err) => {
-          this.unpipe();
-          this.emit('error', err);
-        });
-      }
-
-      this._uploader.write(chunk, encoding, callback);
-    },
-    flush: function(callback) {
-      if (this._uploader) {
-        this._uploader.end();
-      }
-      callback();
-    }
-  });
-};
-
-/**
- * Returns a request object for downloading a shard from a farmer
- * @param {Contact} farmer - Farmer contact object
- * @param {String} shardHash - The hash of the shard to upload
- * @param {String} transferToken - The authorized transfer token
- * @returns {http.ClientRequest}
- */
-module.exports.createShardDownloader = function(farmer, hash, token) {
-  function _createDownloadStream() {
-    return http.get({
-      protocol: 'http:',
-      hostname: farmer.address,
-      port: farmer.port,
-      path: `/shards/${hash}?token=${token}`,
-      headers: {
-        'content-type': 'application/octet-stream',
-        'x-storj-node-id': farmer.nodeID
-      }
-    });
-  }
-
-  return new stream.Readable({
-    read: function() {
-      if (!this._downloader) {
-        this._downloader = _createDownloadStream();
-        this._downloader.on('response', (res) => {
-          res
-            .on('data', this.push.bind(this))
-            .on('error', this.emit.bind(this, 'error'))
-            .on('end', this.push.bind(this, null));
-        })
-        .on('error', this.emit.bind(this, 'error'));
-      }
-    }
-  });
-};
-
-/**
- * Helper for passing an error only logger callback
- * @param {Logger} logger - Logger object
- * @returns {Function}
- */
-module.exports.warnOnError = function(logger) {
-  return function(err) {
-    if (err) {
-      logger.warn(err.message);
-    }
-  };
-};
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/lib_version.js.html b/Storj/core/docs/lib_version.js.html deleted file mode 100644 index 0b9aab7..0000000 --- a/Storj/core/docs/lib_version.js.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - JSDoc: Source: lib/version.js - - - - - - - - - - -
- -

Source: lib/version.js

- - - - - - -
-
-
/**
- * @module storj/version
- */
-
-'use strict';
-
-var semver = require('semver');
-var assert = require('assert');
-var postfix = process.env.STORJ_NETWORK ? '-' + process.env.STORJ_NETWORK : '';
-
-module.exports = {
-  /** @constant {String} protocol - The supported protocol version */
-  protocol: '1.1.0' + postfix,
-  /** @constant {String} software - The current software version */
-  software: require('../package').version
-};
-
-assert(
-  semver.valid(module.exports.protocol),
-  'Invalid protocol version specified'
-);
-
-
-
- - - - -
- - - -
- - - - - - - diff --git a/Storj/core/docs/module-storj.html b/Storj/core/docs/module-storj.html deleted file mode 100644 index ec1ac1c..0000000 --- a/Storj/core/docs/module-storj.html +++ /dev/null @@ -1,2197 +0,0 @@ - - - - - JSDoc: Module: storj - - - - - - - - - - -
- -

Module: storj

- - - - - - -
- -
- - - -
- -
-
- - - - - -
- - - - - - - - - - - - - - -

Members

- - - -

(static) AuditStream

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) BridgeClient

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) constants

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) Contact

- - - - -
- Contact -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) Contract

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) DataCipherKeyIv

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) DecryptStream

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) deps

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) DeterministicKeyIv

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) EmbeddedStorageAdapter

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) EncryptStream

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) Farmer

- - - - -
- Farmer -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) FileDemuxer

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) FileMuxer

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) KeyPair

- - - - -
- KeyPair -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) KeyRing

- - - - -
- KeyRing -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) Monitor

- - - - -
- Monitor -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) Network

- - - - -
- Network -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) OfferManager

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) OfferStream

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) ProofStream

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) Protocol

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) RAMStorageAdapter

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) Renter

- - - - -
- Renter -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) ShardServer

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) sips

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) StorageAdapter

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) StorageItem

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) StorageManager

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) StorageMigration

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) Transport

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) utils

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) Verification

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(static) version

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/module-storj_constants.html b/Storj/core/docs/module-storj_constants.html deleted file mode 100644 index 25a2a2a..0000000 --- a/Storj/core/docs/module-storj_constants.html +++ /dev/null @@ -1,1919 +0,0 @@ - - - - - JSDoc: Module: storj/constants - - - - - - - - - - -
- -

Module: storj/constants

- - - - - - -
- -
- - - -
- -
-
- - - - - -
- - - - - - - - - - - - - - -

Members

- - - -

(inner, constant) AUDIT_BYTES :Number

- - - - -
- Number of bytes for audit challenge -
- - - -
Type:
-
    -
  • - -Number - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) CIPHER_ALG :String

- - - - -
- Cipher/Decipher algorithm -
- - - -
Type:
-
    -
  • - -String - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) CLEAN_INTERVAL :Number

- - - - -
- Interval for reaping stale shards -
- - - -
Type:
-
    -
  • - -Number - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) CONSIGN_THRESHOLD :Number

- - - - -
- Threshold for consign time -
- - - -
Type:
-
    -
  • - -Number - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) HD_KEY_DERIVATION_PATH

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) MAX_CONCURRENT_AUDITS :Number

- - - - -
- Number of concurrent audits -
- - - -
Type:
-
    -
  • - -Number - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) MAX_CONCURRENT_OFFERS :Number

- - - - -
- Number of concurrent offers -
- - - -
Type:
-
    -
  • - -Number - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) MAX_FIND_TUNNEL_RELAYS

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) MAX_NODE_INDEX

- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) NET_REENTRY :Number

- - - - -
- Max wait time before re-entering net -
- - - -
Type:
-
    -
  • - -Number - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) NONCE_EXPIRE :Number

- - - - -
- Time to honor a signed message -
- - - -
Type:
-
    -
  • - -Number - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) OFFER_TIMEOUT :Number

- - - - -
- Max wait time for storage offer -
- - - -
Type:
-
    -
  • - -Number - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) OPCODE_CONTRACT_PREFIX :Number

- - - - -
- Prefix opcode for contracts -
- - - -
Type:
-
    -
  • - -Number - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) OPCODE_DEG_HIGH :Number

- - - - -
- Opcode for medium criteria degree -
- - - -
Type:
-
    -
  • - -Number - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) OPCODE_DEG_LOW :Number

- - - - -
- Opcode for low criteria degree -
- - - -
Type:
-
    -
  • - -Number - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) OPCODE_DEG_MED :Number

- - - - -
- Opcode for medium criteria degree -
- - - -
Type:
-
    -
  • - -Number - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) OPCODE_DEG_NULL :Number

- - - - -
- Opcode for null criteria degree -
- - - -
Type:
-
    -
  • - -Number - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) OPCODE_TUNDCX_PREFIX :Number

- - - - -
- Opcode for tunnel datachannel -
- - - -
Type:
-
    -
  • - -Number - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) OPCODE_TUNNELER_PREFIX :Number

- - - - -
- Prefix opcode for tunneler -
- - - -
Type:
-
    -
  • - -Number - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) OPCODE_TUNRPC_PREFIX :Number

- - - - -
- Opcode for tunnel rpc message -
- - - -
Type:
-
    -
  • - -Number - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) PREFIX :Number

- - - - -
- NodeID prefix (same as bitcoin) -
- - - -
Type:
-
    -
  • - -Number - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) PUBLISH_TTL :Number

- - - - -
- Max time for publication relay -
- - - -
Type:
-
    -
  • - -Number - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) ROUTER_CLEAN_INTERVAL :Number

- - - - -
- Drop bad contacts -
- - - -
Type:
-
    -
  • - -Number - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) RPC_TIMEOUT :Number

- - - - -
- Max wait time for a RPC response -
- - - -
Type:
-
    -
  • - -Number - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) TOKEN_EXPIRE :Number

- - - - -
- Reject datachannl token after time -
- - - -
Type:
-
    -
  • - -Number - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) TUNNEL_ANNOUNCE_INTERVAL :Number

- - - - -
- Announce tunnel state -
- - - -
Type:
-
    -
  • - -Number - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/module-storj_deps.html b/Storj/core/docs/module-storj_deps.html deleted file mode 100644 index bf472e6..0000000 --- a/Storj/core/docs/module-storj_deps.html +++ /dev/null @@ -1,296 +0,0 @@ - - - - - JSDoc: Module: storj/deps - - - - - - - - - - -
- -

Module: storj/deps

- - - - - - -
- -
- - - -
- -
-
- - - - - -
- - - - - - - - - - - - - - -

Members

- - - -

(static) bitcore

- - - - -
- A modular node for Bitcoin and blockchain-based apps -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - -
See:
-
- -
- - - -
- - - - - - - - -

(static) kad

- - - - -
- Implementation of the Kademlia distributed hash table -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - -
See:
-
- -
- - - -
- - - - - - - - -

(static) kfs

- - - - -
- Kademlia inspired local file store based on LevelDB -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - -
See:
-
- -
- - - -
- - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/module-storj_patches.html b/Storj/core/docs/module-storj_patches.html deleted file mode 100644 index ba49daf..0000000 --- a/Storj/core/docs/module-storj_patches.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - JSDoc: Module: storj/patches - - - - - - - - - - -
- -

Module: storj/patches

- - - - - - -
- -
- - - -
- -
-
- - - - - -
- - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/module-storj_sips.html b/Storj/core/docs/module-storj_sips.html deleted file mode 100644 index 30b918e..0000000 --- a/Storj/core/docs/module-storj_sips.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - JSDoc: Module: storj/sips - - - - - - - - - - -
- -

Module: storj/sips

- - - - - - -
- -
- - - -
- -
-
- - - - - -
- - - - - - - - - - - - - - -

Members

- - - -

(static) SIP0003

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/module-storj_sips_0003.html b/Storj/core/docs/module-storj_sips_0003.html deleted file mode 100644 index aeac5ba..0000000 --- a/Storj/core/docs/module-storj_sips_0003.html +++ /dev/null @@ -1,151 +0,0 @@ - - - - - JSDoc: Module: storj/sips/0003 - - - - - - - - - - -
- -

Module: storj/sips/0003

- - - - - - -
- -
- - - -
- -
-
- - - - - -
- - - - - - - - - - - - - - -

Members

- - - -

(static) TriggerManager

- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/module-storj_utils.html b/Storj/core/docs/module-storj_utils.html deleted file mode 100644 index 8ee540c..0000000 --- a/Storj/core/docs/module-storj_utils.html +++ /dev/null @@ -1,5990 +0,0 @@ - - - - - JSDoc: Module: storj/utils - - - - - - - - - - -
- -

Module: storj/utils

- - - - - - -
- -
- - - -
- -
-
- - - - - -
- - - - - - - - - - - - - - - - -

Methods

- - - - - - - -

(static) calculateBucketId(user, bucketName)

- - - - - - -
- Calculate bucket id from a given user id and bucket name -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
user - - -String - - - - user id
bucketName - - -String - - - - bucket name
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

(static) calculateFileId(bucket, fileName)

- - - - - - -
- Calculate file id from a given bucket id and file name -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
bucket - - -String - - - - bucket id
fileName - - -String - - - - file name
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

(static) calculateFileIdByName(user, bucketName, fileName)

- - - - - - -
- Calculate file id from a user id, bucket name, and file name -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
user - - -String - - - - user id
bucketName - - -String - - - - bucket name
fileName - - -String - - - - file name
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

(static) createComplexKeyFromSeed(seed64) → {HDKey}

- - - - - - -
- Returns a HD key object using corrent key derivation path using the -given seed -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
seed64 - - -Buffer - - - - 64 byte seed for generating key
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - -
See:
-
- -
- - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -HDKey - - -
-
- - - - - - - - - - - - - -

(static) createEciesCipher(privateKey, publicKey) → {Object}

- - - - - - -
- Creates an ECIES ciper object from a private and a public key -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
privateKey - - -String - - - - The private key of the sender
publicKey - - -String - - - - The public key of the recipient
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Object - - -
-
- - - - - - - - - - - - - -

(static) createShardDownloader(farmer, shardHash, transferToken) → {http.ClientRequest}

- - - - - - -
- Returns a request object for downloading a shard from a farmer -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
farmer - - -Contact - - - - Farmer contact object
shardHash - - -String - - - - The hash of the shard to upload
transferToken - - -String - - - - The authorized transfer token
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -http.ClientRequest - - -
-
- - - - - - - - - - - - - -

(static) createShardUploader(farmer, shardHash, transferToken) → {http.ClientRequest}

- - - - - - -
- Returns a request object for uploading a shard to a farmer -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
farmer - - -Contact - - - - Farmer contact object
shardHash - - -String - - - - The hash of the shard to upload
transferToken - - -String - - - - The authorized transfer token
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -http.ClientRequest - - -
-
- - - - - - - - - - - - - -

(static) createStreamTrimmer(trimFront, totalBytes)

- - - - - - -
- Returns a through stream that trims the output based on the given range -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
trimFront - - -Number - - - - Number of bytes to trim off front of stream
totalBytes - - -Number - - - - The total length of the stream in bytes
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

(static) ensureNtpClockIsSynchronized(callback)

- - - - - - -
- Determines if the system clock is syncronized with network -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - - Called with (err, delta)
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

(static) existsSync(file) → {Boolean}

- - - - - - -
- Check if file exists -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
file - - -String - - - - Path to file
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Boolean - - -
-
- - - - - - - - - - - - - -

(static) generateToken() → {String}

- - - - - - -
- Generates a unique token -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -String - - -
-
- - - - - - - - - - - - - -

(static) getContactURL(contact) → {String}

- - - - - - -
- Returns a stringified URL from the supplied contact object -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Object - - - - -
Properties
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
address - - -String - - - -
port - - -Number - - - -
nodeID - - -String - - - -
- -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -String - - -
-
- - - - - - - - - - - - - -

(static) getNextPowerOfTwo(number) → {Number}

- - - - - - -
- Returns the next power of two number -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
number - - -Number - - - -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Number - - -
-
- - - - - - - - - - - - - -

(static) getNtpTimeDelta(callback)

- - - - - - -
- Returns the delta between system time and NTP time -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
callback - - -function - - - - Called with (err, delta)
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

(static) isCompatibleVersion(version) → {Boolean}

- - - - - - -
- Returns whether or not the supplied semver tag is compatible -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
version - - -String - - - - The semver tag from the contact
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- compatible -
- - - -
-
- Type -
-
- -Boolean - - -
-
- - - - - - - - - - - - - -

(static) isDirectory(dirPath) → {Boolean}

- - - - - - -
- Check if a path is a directory -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
dirPath - - -String - - - - Path to a directory
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Boolean - - -
-
- - - - - - - - - - - - - -

(static) isHexaString(a) → {Boolean}

- - - - - - -
- Determines if a value is hexadecimal string -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
a - - -* - - - - The value to be tested
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Boolean - - -
-
- - - - - - - - - - - - - -

(static) isValidContact(contact, loopback) → {Boolean}

- - - - - - -
- Determines if the supplied contact is valid -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
contact - - -Contact - - - - The contact information for a given peer
loopback - - -Boolean - - - - Allows contacts that are localhost
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Boolean - - -
-
- - - - - - - - - - - - - -

(static) isValidHDNodeKey(hdKey) → {Boolean}

- - - - - - -
- Checks if the supplied HD key is valid (base58 encoded) and proper length -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
hdKey - - -String - - - - The HD key in base 58 encoding
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- isValidHDKey -
- - - -
-
- Type -
-
- -Boolean - - -
-
- - - - - - - - - - - - - -

(static) isValidNodeIndex(hdIndex) → {Boolean}

- - - - - - -
- Checks if the input is a non-hardened HD key index -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
hdIndex - - -Number - - - - The HD key index
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - -
- isValidHDKeyIndex -
- - - -
-
- Type -
-
- -Boolean - - -
-
- - - - - - - - - - - - - -

(static) rmd160(input, encoding) → {String}

- - - - - - -
- Returns the RIPEMD-160 hash of the input -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
input - - -String -| - -Buffer - - - - Data to hash
encoding - - -String - - - - The encoding type of the data
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -String - - -
-
- - - - - - - - - - - - - -

(static) rmd160b(input, encoding) → {Buffer}

- - - - - - -
- Returns the RIPEMD-160 hash of the input -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
input - - -String -| - -Buffer - - - - Data to hash
encoding - - -String - - - - The encoding type of the data
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Buffer - - -
-
- - - - - - - - - - - - - -

(static) rmd160sha256(input, encoding) → {String}

- - - - - - -
- Returns the RIPEMD-160 SHA-256 hash of this input -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
input - - -String -| - -Buffer - - - - Data to hash
encoding - - -String - - - - The encoding type of the data
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -String - - -
-
- - - - - - - - - - - - - -

(static) rmd160sha256b(input, encoding) → {Buffer}

- - - - - - -
- Returns the RIPEMD-160 SHA-256 hash of this input -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
input - - -String -| - -Buffer - - - - Data to hash
encoding - - -String - - - - The encoding type of the data
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Buffer - - -
-
- - - - - - - - - - - - - -

(static) sha1(input, encoding) → {String}

- - - - - - -
- Returns the SHA-1 hash of the input -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
input - - -String -| - -Buffer - - - - Data to hash
encoding - - -String - - - - The encoding type of the data
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -String - - -
-
- - - - - - - - - - - - - -

(static) sha1whirlpool(input, encoding) → {String}

- - - - - - -
- Returns the SHA-1 WHIRLPOOL hash of this input -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
input - - -String -| - -Buffer - - - - Data to hash
encoding - - -String - - - - The encoding type of the data
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -String - - -
-
- - - - - - - - - - - - - -

(static) sha256(input, encoding) → {String}

- - - - - - -
- Returns the SHA-256 hash of the input -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
input - - -String -| - -Buffer - - - - Data to hash
encoding - - -String - - - - The encoding type of the data
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -String - - -
-
- - - - - - - - - - - - - -

(static) sha256b(input, encoding) → {Buffer}

- - - - - - -
- Returns the SHA-256 hash of the input -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
input - - -String -| - -Buffer - - - - Data to hash
encoding - - -String - - - - The encoding type of the data
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Buffer - - -
-
- - - - - - - - - - - - - -

(static) sha512(input, encoding) → {String}

- - - - - - -
- Returns the SHA-512 hash of the input -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
input - - -String -| - -Buffer - - - - Data to hash
encoding - - -String - - - - The encoding type of the data
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -String - - -
-
- - - - - - - - - - - - - -

(static) simpleDecrypt(password, data) → {String}

- - - - - - -
- Decrypts the given data with the supplied password and base58 decodes it -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
password - - -String - - - - The passphrase to use for decryption
data - - -String - - - - The string to decrypt
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -String - - -
-
- - - - - - - - - - - - - -

(static) simpleEncrypt(password, data) → {String}

- - - - - - -
- Encrypts the given data with the supplied password and base58 encodes it -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
password - - -String - - - - The passphrase to use for encryption
data - - -String - - - - The string to encrypt
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -String - - -
-
- - - - - - - - - - - - - -

(static) tmpdir()

- - - - - - -
- Check for env STORJ_TEMP todetermine temp directory -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

(static) toNumberBytes(size, unit) → {Number}

- - - - - - -
- Returns number of bytes from human readable size and unit strings -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
size - - -String -| - -Number - - - - The size measurement
unit - - -String - - - - The unit of measure (MB|MiB|GB|GiB|TB|TiB)
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -Number - - -
-
- - - - - - - - - - - - - -

(static) warnOnError(logger) → {function}

- - - - - - -
- Helper for passing an error only logger callback -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
logger - - -Logger - - - - Logger object
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -function - - -
-
- - - - - - - - - - - - - -

(static) whirlpool(input, encoding) → {String}

- - - - - - -
- Returns the WHIRLPOOL hash of the input -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
input - - -String -| - -Buffer - - - - Data to hash
encoding - - -String - - - - The encoding type of the data
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -
Returns:
- - - - -
-
- Type -
-
- -String - - -
-
- - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/module-storj_version.html b/Storj/core/docs/module-storj_version.html deleted file mode 100644 index 7bb39ff..0000000 --- a/Storj/core/docs/module-storj_version.html +++ /dev/null @@ -1,233 +0,0 @@ - - - - - JSDoc: Module: storj/version - - - - - - - - - - -
- -

Module: storj/version

- - - - - - -
- -
- - - -
- -
-
- - - - - -
- - - - - - - - - - - - - - -

Members

- - - -

(inner, constant) protocol :String

- - - - -
- The supported protocol version -
- - - -
Type:
-
    -
  • - -String - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - -

(inner, constant) software :String

- - - - -
- The current software version -
- - - -
Type:
-
    -
  • - -String - - -
  • -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- - - - - - - \ No newline at end of file diff --git a/Storj/core/docs/scripts/linenumber.js b/Storj/core/docs/scripts/linenumber.js deleted file mode 100644 index 4354785..0000000 --- a/Storj/core/docs/scripts/linenumber.js +++ /dev/null @@ -1,25 +0,0 @@ -/*global document */ -(() => { - const source = document.getElementsByClassName('prettyprint source linenums'); - let i = 0; - let lineNumber = 0; - let lineId; - let lines; - let totalLines; - let anchorHash; - - if (source && source[0]) { - anchorHash = document.location.hash.substring(1); - lines = source[0].getElementsByTagName('li'); - totalLines = lines.length; - - for (; i < totalLines; i++) { - lineNumber++; - lineId = `line${lineNumber}`; - lines[i].id = lineId; - if (lineId === anchorHash) { - lines[i].className += ' selected'; - } - } - } -})(); diff --git a/Storj/core/docs/scripts/prettify/Apache-License-2.0.txt b/Storj/core/docs/scripts/prettify/Apache-License-2.0.txt deleted file mode 100644 index d645695..0000000 --- a/Storj/core/docs/scripts/prettify/Apache-License-2.0.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/Storj/core/docs/scripts/prettify/lang-css.js b/Storj/core/docs/scripts/prettify/lang-css.js deleted file mode 100644 index 041e1f5..0000000 --- a/Storj/core/docs/scripts/prettify/lang-css.js +++ /dev/null @@ -1,2 +0,0 @@ -PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", -/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); diff --git a/Storj/core/docs/scripts/prettify/prettify.js b/Storj/core/docs/scripts/prettify/prettify.js deleted file mode 100644 index eef5ad7..0000000 --- a/Storj/core/docs/scripts/prettify/prettify.js +++ /dev/null @@ -1,28 +0,0 @@ -var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; -(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= -[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), -l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, -q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, -q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, -"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), -a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} -for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], -"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], -H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], -J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ -I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), -["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", -/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), -["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", -hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= -!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p th:last-child { border-right: 1px solid #ddd; } - -.ancestors, .attribs { color: #999; } -.ancestors a, .attribs a -{ - color: #999 !important; - text-decoration: none; -} - -.clear -{ - clear: both; -} - -.important -{ - font-weight: bold; - color: #950B02; -} - -.yes-def { - text-indent: -1000px; -} - -.type-signature { - color: #aaa; -} - -.name, .signature { - font-family: Consolas, Monaco, 'Andale Mono', monospace; -} - -.details { margin-top: 14px; border-left: 2px solid #DDD; } -.details dt { width: 120px; float: left; padding-left: 10px; padding-top: 6px; } -.details dd { margin-left: 70px; } -.details ul { margin: 0; } -.details ul { list-style-type: none; } -.details li { margin-left: 30px; padding-top: 6px; } -.details pre.prettyprint { margin: 0 } -.details .object-value { padding-top: 0; } - -.description { - margin-bottom: 1em; - margin-top: 1em; -} - -.code-caption -{ - font-style: italic; - font-size: 107%; - margin: 0; -} - -.source -{ - border: 1px solid #ddd; - width: 80%; - overflow: auto; -} - -.prettyprint.source { - width: inherit; -} - -.source code -{ - font-size: 100%; - line-height: 18px; - display: block; - padding: 4px 12px; - margin: 0; - background-color: #fff; - color: #4D4E53; -} - -.prettyprint code span.line -{ - display: inline-block; -} - -.prettyprint.linenums -{ - padding-left: 70px; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -.prettyprint.linenums ol -{ - padding-left: 0; -} - -.prettyprint.linenums li -{ - border-left: 3px #ddd solid; -} - -.prettyprint.linenums li.selected, -.prettyprint.linenums li.selected * -{ - background-color: lightyellow; -} - -.prettyprint.linenums li * -{ - -webkit-user-select: text; - -moz-user-select: text; - -ms-user-select: text; - user-select: text; -} - -.params .name, .props .name, .name code { - color: #4D4E53; - font-family: Consolas, Monaco, 'Andale Mono', monospace; - font-size: 100%; -} - -.params td.description > p:first-child, -.props td.description > p:first-child -{ - margin-top: 0; - padding-top: 0; -} - -.params td.description > p:last-child, -.props td.description > p:last-child -{ - margin-bottom: 0; - padding-bottom: 0; -} - -.disabled { - color: #454545; -} diff --git a/Storj/core/docs/styles/prettify-jsdoc.css b/Storj/core/docs/styles/prettify-jsdoc.css deleted file mode 100644 index 5a2526e..0000000 --- a/Storj/core/docs/styles/prettify-jsdoc.css +++ /dev/null @@ -1,111 +0,0 @@ -/* JSDoc prettify.js theme */ - -/* plain text */ -.pln { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* string content */ -.str { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a keyword */ -.kwd { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a comment */ -.com { - font-weight: normal; - font-style: italic; -} - -/* a type name */ -.typ { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* a literal value */ -.lit { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* punctuation */ -.pun { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* lisp open bracket */ -.opn { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* lisp close bracket */ -.clo { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a markup tag name */ -.tag { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a markup attribute name */ -.atn { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a markup attribute value */ -.atv { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a declaration */ -.dec { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a variable name */ -.var { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* a function name */ -.fun { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* Specify class=linenums on a pre to get line numbering */ -ol.linenums { - margin-top: 0; - margin-bottom: 0; -} diff --git a/Storj/core/docs/styles/prettify-tomorrow.css b/Storj/core/docs/styles/prettify-tomorrow.css deleted file mode 100644 index b6f92a7..0000000 --- a/Storj/core/docs/styles/prettify-tomorrow.css +++ /dev/null @@ -1,132 +0,0 @@ -/* Tomorrow Theme */ -/* Original theme - https://github.com/chriskempson/tomorrow-theme */ -/* Pretty printing styles. Used with prettify.js. */ -/* SPAN elements with the classes below are added by prettyprint. */ -/* plain text */ -.pln { - color: #4d4d4c; } - -@media screen { - /* string content */ - .str { - color: #718c00; } - - /* a keyword */ - .kwd { - color: #8959a8; } - - /* a comment */ - .com { - color: #8e908c; } - - /* a type name */ - .typ { - color: #4271ae; } - - /* a literal value */ - .lit { - color: #f5871f; } - - /* punctuation */ - .pun { - color: #4d4d4c; } - - /* lisp open bracket */ - .opn { - color: #4d4d4c; } - - /* lisp close bracket */ - .clo { - color: #4d4d4c; } - - /* a markup tag name */ - .tag { - color: #c82829; } - - /* a markup attribute name */ - .atn { - color: #f5871f; } - - /* a markup attribute value */ - .atv { - color: #3e999f; } - - /* a declaration */ - .dec { - color: #f5871f; } - - /* a variable name */ - .var { - color: #c82829; } - - /* a function name */ - .fun { - color: #4271ae; } } -/* Use higher contrast and text-weight for printable form. */ -@media print, projection { - .str { - color: #060; } - - .kwd { - color: #006; - font-weight: bold; } - - .com { - color: #600; - font-style: italic; } - - .typ { - color: #404; - font-weight: bold; } - - .lit { - color: #044; } - - .pun, .opn, .clo { - color: #440; } - - .tag { - color: #006; - font-weight: bold; } - - .atn { - color: #404; } - - .atv { - color: #060; } } -/* Style */ -/* -pre.prettyprint { - background: white; - font-family: Consolas, Monaco, 'Andale Mono', monospace; - font-size: 12px; - line-height: 1.5; - border: 1px solid #ccc; - padding: 10px; } -*/ - -/* Specify class=linenums on a pre to get line numbering */ -ol.linenums { - margin-top: 0; - margin-bottom: 0; } - -/* IE indents via margin-left */ -li.L0, -li.L1, -li.L2, -li.L3, -li.L4, -li.L5, -li.L6, -li.L7, -li.L8, -li.L9 { - /* */ } - -/* Alternate shading for lines */ -li.L1, -li.L3, -li.L5, -li.L7, -li.L9 { - /* */ } diff --git a/Storj/core/docs/tutorial-command-line-interface.html b/Storj/core/docs/tutorial-command-line-interface.html deleted file mode 100644 index d8a5f33..0000000 --- a/Storj/core/docs/tutorial-command-line-interface.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - JSDoc: Tutorial: Using the Command Line Tools - - - - - - - - - - -
- -

Tutorial: Using the Command Line Tools

- -
- -
- - -

Using the Command Line Tools

-
- -
-

This package comes equipped with a command line interface for performing a -number of useful operations on the Storj network. The CLI program is generally -focused on interacting with a remote Bridge -service and makes use of the library's BridgeClient class to do so. In -addition to interacting with a bridge node, the tool also exposes some general -purpose utilities.

-

To use the CLI, follow the instructions in the README to install the module -globally or if you are working from within the git repository, you can use:

-
npm link
-
-

Communicating with a Bridge

-

Once you have access to the storj command, register and authenticate with the -bridge:

-
> $ storj register
- [...]  > Enter your email address  >  gordon@storj.io
- [...]  > Enter your password  >  *************
-
- [info]   Registered! Check your email to activate your account.
-
-

Follow the activation link you receive via email and come back to the CLI to -pair with your account:

-
> $ storj login
- [...]  > Enter your email address  >  gordon@storj.io
- [...]  > Enter your password  >  *************
-
- [info]   This device has been successfully paired.
-
-

Now you can create buckets, transfer files, and manage your bridge account.

-

Audits, Proofs, and Verifications

-

The CLI also includes some utility commands for generating file possession -audits, proving possession, and verifying proofs. You can generate a challenge -set and merkle tree for a file easily:

-
> $ storj prepare-audits 2 CONTRIBUTING.md
- [info]   Generating challenges and merkle tree...
- [info]
- [info]   Merkle Root
- [info]   -----------
- [info]   9c8c37935f58d46e3301efe4f44724b8785a81a5
- [info]
- [info]   Challenges
- [info]   ----------
- [info]   c8573773616e072230d40131e7ce8537d384825e337e5903ff7367ddea798c52
- [info]   7c4d4f57f40d5c95f962e7cd72347e4077e1885aaffd8c1ccbbd02c8d7c48dce
- [info]
- [info]   Merkle Leaves
- [info]   -------------
- [info]   aaf42766d87a37e6dffbae7172fd0073006bf5f3
- [info]   ccee086dbc8a16b93b79912cb37f3b037bbf8269
-
-

A farmer can use parts of this data to prove possession of a file shard:

-
> $ storj prove-file aaf42766d87a37e6dffbae7172fd0073006bf5f3,ccee086dbc8a16b93b79912cb37f3b037bbf8269 c8573773616e072230d40131e7ce8537d384825e337e5903ff7367ddea798c52 CONTRIBUTING.md
- [info]   Generating proof of possession...
- [info]
- [info]   Challenge Response
- [info]   ------------------
- [info]   [["153a0d4b1d228043992fec585cadb51974b053f7"],"ccee086dbc8a16b93b79912cb37f3b037bbf8269"]
-
-

The result of this operation can be used by the original renter to verify the -the proof and confirm that the farmer still has possession of the file:

-
> $ storj verify-proof 9c8c37935f58d46e3301efe4f44724b8785a81a5 2 '[["153a0d4b1d228043992fec585cadb51974b053f7"],"ccee086dbc8a16b93b79912cb37f3b037bbf8269"]'
- [info]
- [info]   Expected: 9c8c37935f58d46e3301efe4f44724b8785a81a5
- [info]   Actual:   9c8c37935f58d46e3301efe4f44724b8785a81a5
- [info]
- [info]   The proof response is valid
-
-

For more detailed usage information of the command line interface, run -storj --help.

-

Temporary Files

-

On Windows temporary files are stored:

-
C:\Users\<user>\AppData\Local\Temp
-
-
- -
- -
- - - -
- -
- Documentation generated by JSDoc 3.6.11 on Sat Nov 09 2024 22:26:40 GMT-0800 (Pacific Standard Time) -
- - - - - \ No newline at end of file diff --git a/Storj/core/docs/tutorial-contract-topics.html b/Storj/core/docs/tutorial-contract-topics.html deleted file mode 100644 index a82d84b..0000000 --- a/Storj/core/docs/tutorial-contract-topics.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - JSDoc: Tutorial: Publishing Storage Contracts - - - - - - - - - - -
- -

Tutorial: Publishing Storage Contracts

- -
- -
- - -

Publishing Storage Contracts

-
- -
-

Nodes solicit storage contracts with the network by publishing information -about their storage requirements as outlined in Protocol Specification. -Storj implements a distributed publish/subscribe system based on an algorithm -called Quasar.

-

Quasar works by allowing nodes to advertise topics of interest to their -neighbors and keeping a record of these topics in their neighborhood by storing -them in an attenuated bloom filter. Each node has a view of the topics in which -their neighbors are interested up to 3 hops away. By the nature of this -design, the network forms gravity wells wherein messages of interest are -efficiently relayed to nodes that are subscribed to the topic without flooding -the network.

-

This approach works well when there is a diverse number of topics. The Storj -protocol leverages this by defining a matrix of criteria and descriptors -in the form of opcodes representing the degree of which the criteria must be -met.

-

Criteria

-

At the time of writing, there are 4 criteria column in the topic matrix:

-
    -
  • Size
  • -
  • Duration
  • -
  • Availability
  • -
  • Speed
  • -
-

Size

-

Refers to the size of the data to be stored.

-

Duration

-

Refers to the length of time for which the data should be stored.

-

Availability

-

Refers to the relative uptime of required by the contract for retrieval of the -stored data.

-

Speed

-

Refers to the throughput desired for retrieval of the stored data.

-

Descriptors

-

At the time of writing, there are 3 descriptor opcodes representing low, -medium, and high degrees of the criteria.

-
    -
  • Low: 0x01
  • -
  • Medium: 0x02
  • -
  • High: 0x03
  • -
-

The ranges represented by these descriptors are advisory and may change based -on network performance and improvements to hardware over time.

-
-------------------------------------------------------------------------------
-| Descriptor      | Size        | Duration   | Availability | Speed           |
-|-----------------|-------------|------------|--------------|-----------------|
-| Low    (`0x01`) | 0mb - 8mb   | 0d - 30d   | 0% - 50%     | 0mbps - 6mbps   |
-|-----------------|-------------|------------|--------------|-----------------|
-| Medium (`0x02`) | 8mb - 16mb  | 30d - 90d  | 50% - 80%    | 6mbps - 12mbps  |
-|-----------------|-------------|------------|--------------|-----------------|
-| High   (`0x03`) | 16mb - 32mb | 90d - 270d | 80% - 99%    | 12mbps - 32mbps |
--------------------------------------------------------------------------------
-
-

Topic Format

-

When publishing or subscribing to a given topic representing the degrees of -these criteria, nodes must serialize the opcodes as the hex representation of -the bytes in proper sequence. This sequence is defined as:

-
prefix|size|duration|availability|speed
-
-

The first byte, "prefix", is the static identifier for a contract -publication. Contracts are not the only type of publication shared in the -network, so the prefix acts as a namespace for a type of publication topic.

-

The prefix for a contract publication is: 0x0f.

-

To illustrate by example, we can determine the proper topic by analyzing the -use case for a given file shard. For instance, if we want to store an asset -that is displayed on a web page we can infer the following:

-
    -
  • The file is small
  • -
  • The file may change often, so we should only store it for medium duration
  • -
  • The file needs to always be available
  • -
  • The file should be transferred quickly
  • -
-

Using the matrix, we can determine the proper opcode sequence:

-
[0x0f, 0x01, 0x02, 0x03, 0x03]
-
-

Serialized as hex, our topic string becomes:

-
0f01020303
-
-

Another example, by contrast, is data backup. Data backup is quite different -than the previous example:

-
    -
  • The file is large (perhaps part of a hard drive backup)
  • -
  • The file will not change and should be stored long term
  • -
  • The file will not be accessed often, if ever
  • -
  • The file does not need to be transferred at high speed
  • -
-

Using the matrix, we can determine the proper opcode sequence:

-
[0x0f, 0x03, 0x03, 0x01, 0x01]
-
-

Serialized as hex, our topic string becomes:

-
0f03030101
-
-

The resulting hex string from the serialized opcode byte sequence should be -used as the topic parameter of a PUBLISH RPC as defined in the -Protocol Specification. Nodes that are subscribed to the topic will receive -the proposed storage contract and may begin contract negotiation with you -directly.

-
- -
- -
- - - -
- -
- Documentation generated by JSDoc 3.6.11 on Sat Nov 09 2024 22:26:40 GMT-0800 (Pacific Standard Time) -
- - - - - \ No newline at end of file diff --git a/Storj/core/docs/tutorial-data-transfer.html b/Storj/core/docs/tutorial-data-transfer.html deleted file mode 100644 index 1156973..0000000 --- a/Storj/core/docs/tutorial-data-transfer.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - - JSDoc: Tutorial: Transferring File Shards - - - - - - - - - - -
- -

Tutorial: Transferring File Shards

- -
- -
- - -

Transferring File Shards

-
- -
-

Transfering file shards to farmers is a simple process. After a successful -CONSIGN or RETRIEVE RPC yields a token, the renter may construct an HTTP -request to the farmer, to push or pull the data.

-

Uploading Shards

-

To upload a shard to a given farmer, construct an HTTP request:

-
    -
  • Method: POST
  • -
  • Path: /shards/{hash}?token={token}
  • -
  • Headers: -
      -
    • content-type: application/octet-stream
    • -
    • x-storj-node-id: {farmer node id}
    • -
    -
  • -
-

Then simply write the encrypted shard to the request. Farmers will respond with -appropriate status codes and messages to indicate the result.

-

Downloading Shards

-

To download a shard from a given farmer, construct an HTTP request:

-
    -
  • Method: GET
  • -
  • Path: /shards/{hash}?token={token}
  • -
  • Headers: -
      -
    • content-type: application/octet-stream
    • -
    • x-storj-node-id: {farmer node id}
    • -
    -
  • -
-

You will receive the shard as a response of type application/octet-stream if -you are authorized.

-
- -
- -
- - - -
- -
- Documentation generated by JSDoc 3.6.11 on Sat Nov 09 2024 22:26:40 GMT-0800 (Pacific Standard Time) -
- - - - - \ No newline at end of file diff --git a/Storj/core/docs/tutorial-environment-variables.html b/Storj/core/docs/tutorial-environment-variables.html deleted file mode 100644 index 2fffa6f..0000000 --- a/Storj/core/docs/tutorial-environment-variables.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - JSDoc: Tutorial: Environment Variables - - - - - - - - - - -
- -

Tutorial: Environment Variables

- -
- -
- - -

Environment Variables

-
- -
-

Below is a list of environment variables that can be used to alter the -behavior of the core library and associated tooling.

-

STORJ_NETWORK

-

This value will be postfixed to your announced protocol version in the network. -A value of testnet would advertise to the network you are running -0.7.0-testnet, which will isolate you to other nodes running the same exact -version. See Running a Test Network for more information.

-

STORJ_ALLOW_LOOPBACK

-

By default, the Network class will drop and ignore message from nodes -who identify themeselves as a loopback interface like localhost, 127.0.0.1, -etc. This is a security precaution to prevent others from causing you to send -messages to yourself as well as prevent invalid contacts in your routing table.

-

To disable this feature (primarily for local testing), set this variable to 1.

-

STORJ_BRIDGE

-

This variable will change the default URI for the BridgeClient class. -The default value is https://api.storj.io. If you run your own bridge, -testing one locally, or otherwise would like to default to a different host, -set this variable.

-

This works well with the CLI (see Using the Command Line Tools) when -testing against other bridges.

-

STORJ_KEYPASS

-

This variable will set the --keypass used to unlock the keyring.

-

Setting your password will make it so other users can't grep it with ps -a.

-

STORJ_TEMP

-

This variable will set the folder to which the encrypted file will be placed -when uploading a file. Shards will also be placed in this folder during upload.

-
- -
- -
- - - -
- -
- Documentation generated by JSDoc 3.6.11 on Sat Nov 09 2024 22:26:40 GMT-0800 (Pacific Standard Time) -
- - - - - \ No newline at end of file diff --git a/Storj/core/docs/tutorial-file-encryption.html b/Storj/core/docs/tutorial-file-encryption.html deleted file mode 100644 index f449208..0000000 --- a/Storj/core/docs/tutorial-file-encryption.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - JSDoc: Tutorial: File Encryption Standards - - - - - - - - - - -
- -

Tutorial: File Encryption Standards

- -
- -
- - -

File Encryption Standards

-
- -
-

This document serves to provide a detailed account of how files are encrypted -by default by Storj Core to promote interoperability between different -implementations of clients.

-

Sharding and Encryption Scheme

-

Before data is stored in the network, the Storj Core library automatically -handles file encryption, sharding, and key management for you.

-

In order of operations:

-
    -
  1. Complete file is encrypted with a unique key and initialization vector
  2. -
  3. File is demultiplexed (or "sharded") into individual chunks
  4. -
  5. Each shard is offered to the network and transferred
  6. -
  7. Key and IV are encrypted with a passphrase and stored locally
  8. -
-

Key and Initialization Vector Generation

-

Files are encrypted using AES-256-CTR. Use -of CTR allows for random read-access to known indices. File keys are -generated via one of two methods:

-
    -
  • Local PBKDF2 key derivation (default)
  • -
  • Passphrase-based deterministic key derivation (recommended)
  • -
-
PBKDF2 Key Derivation
-

By default, the key for each file is the result of a standard key derivation -function, PBKDF2. PBKDF2 generates a -key from a password and a salt. These two values are randomly generated bytes:

-
    -
  • Password: 512 random bytes
  • -
  • Salt: 32 random bytes
  • -
-

The key length of the PBKDF2 is 512 bytes, should use 25000 iterations, and use -SHA-512 as the digest. To create the cipher/decipher and initialization vector, -derive the SHA-256 hash of the resulting PBKDF2 for the cipher/decipher key -and use the first 16 bytes of the original salt as the iv. The -DataCipherKeyIv class represents these values, and provides methods for -their generation.

-

The KeyRing class stores the original password and salt locally in -an encrypted JSON document keyed by the ObjectId returned from -Storj Bridge for the file object. The -cleartext JSON document has two properties: pass and salt.

-
{
-  "pass": "c7c311ee213d10baefd620a004d76485190d82...",
-  "salt": "6d33490c999e9d613ccf4b146446763df15de2..."
-}
-
-

This JSON string is encrypted with AES-256-CBC using a user-defined passphrase, -and encoded as Base58. Each of those -encrypted JSON documents is stored in a directory called key.ring/, where the -file name is the ObjectId returned from Storj Bridge for the file object.

-
Portable Key Ring Format
-

Because the keys in the key ring are generated and stored locally, files -encrypted with these keys cannot be accessed by other machines without first -duplicating the key files onto that machine. To mitigate this, Storj Core can -create a simple portable key ring archive.

-

A KeyRing created by Storj Core can be exported into a portable format, -which is simply a gzipped tape archive (.tar.gz or .tgz). Importing this -archive simply entails:

-
    -
  1. Decompress and unpack the archive
  2. -
  3. Decrypt each JSON document using the original passphrase
  4. -
  5. Encrypt each document with the passphrase of the target keyring
  6. -
  7. Move the files into the target keyring, optionally overwriting conflicts
  8. -
-
Passphrase-based Key Derivation
-

Rather than relying on locally-generated keys, it is recommended that the user -generate a high-entropy passphrase, and generate keys from it via a -deterministic key derivation process. Using this method, the user may grant -access to all encrypted files by simply transferring the passphrase. Storj Core -offers tools for this based on Bitcoin's BIP39 Mnemonic passphrases.

-

KeyRing provides tools for generating a mnemonic passphrase and -writing it to disk. If a mnemonic is found, Storj Core will prefer -passphrase-based key derivation to PBKDF2 derivation. Storj clients should -create a file key as follows:

-
    -
  1. Prepend the passphrase to the Bucket ID
  2. -
  3. Calculate the sha512 hash of the resulting string
  4. -
  5. Take the first 64 bits of the resulting hash to make the Bucket Key
  6. -
  7. Prepend the Bucket Key to the File ID
  8. -
  9. Calculate the sha512 hash of the resulting string
  10. -
  11. Take the first 64 bits of the resulting hash to make the File Key
  12. -
-

As any client with access to the passphrase can easily generate file keys on -demand, this provides additional portability of files between machines and -applications.

-

It is strongly recommended that users write down the passphrase, and keep it in -a secure place.

-
Public Bucket Key Storage
-

Public Buckets are a feature of Bridge, not a feature of Storj. When a Public -Bucket is created, the Bucket Key is stored with Bridge. It is then provided to -clients requesting PUSH or PULL tokens from that bucket.

-

References

- -
- -
- -
- - - -
- -
- Documentation generated by JSDoc 3.6.11 on Sat Nov 09 2024 22:26:40 GMT-0800 (Pacific Standard Time) -
- - - - - \ No newline at end of file diff --git a/Storj/core/docs/tutorial-private-testnet.html b/Storj/core/docs/tutorial-private-testnet.html deleted file mode 100644 index 7624234..0000000 --- a/Storj/core/docs/tutorial-private-testnet.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - - JSDoc: Tutorial: Running a Test Network - - - - - - - - - - -
- -

Tutorial: Running a Test Network

- -
- -
- - -

Running a Test Network

-
- -
-

Setting up a private or partitioned version of the Storj network is very simple. -The Storj protocol requires the inclusion of a protocol property nested -inside the contact data included in every RPC message. See -Protocol Specification for more information on the RPC message format.

-

Protocol Identifier Format

-

Nodes on the Storj network identify the version of the protocol they are -running with the use of a semantic version tag. When a -node is trying to determine whether or not another node is compatible with her -version of the protocol, she checks the following:

-
    -
  • Is the MAJOR version the same?
  • -
  • Is the MAJOR version 0?
  • -
  • Is the MINOR version the same?
  • -
-

If both nodes are running the same MAJOR version and that version is -not 0, then the nodes are compatible. If the MAJOR version is 0, -then the nodes are compatible only if the MINOR version is the same.

-

For example:

-
    -
  • 0.5.1 is compatible with 0.5.3
  • -
  • 0.5.1 is not compatible with 0.6.0
  • -
  • 1.5.1 is compatible with 1.13.0
  • -
  • 2.1.0 is not compatible with 1.13.0
  • -
-

Special Identifiers

-

The semantic versions specification also allows for special identifiers by -postfixing the version with a hyphen followed by some identifier. This is where -the network partitioning magic happens.

-

Let's say, for example, I work for "Widgets Ltd" and I want to deploy a Storj -network within the Widgets Ltd private network. Every workstation would run a -modified version of storj/farmer or maybe -my own custom interface built atop storj/core.

-

I would simply change my Storj-based software to use the version -1.5.0-widgetsltd. The Storj protocol sees this identifies as a strict match -and therefore any nodes running this version of the software will only -communicate with nodes running the exact protocol identifier.

-

Changing the Version

-

Changing the version in storj/core is easy as pie. In your code, simply -import the module and change the identifier like so:

-
// Import core library
-var storj = require('storj');
-
-// Modify protocol version
-storj.version.protocol = '1.5.0-widgetsltd';
-
-// Get on with your stuff...
-
-

If you are running "vanilla" Storj software, you can change the protocol -version by setting the STORJ_NETWORK environment variable. This will add a -postfix to the protocol version, which will partition the network to nodes -that are running that exact version:

-
STORJ_NETWORK=testnet storjshare --datadir /path/to/shards
-
-

This concept applies broadly to deploying a custom Storj network for any -purpose. This could be used for a public testnet (x.x.x-testnet) or for the -private network example above.

-
- -
- -
- - - -
- -
- Documentation generated by JSDoc 3.6.11 on Sat Nov 09 2024 22:26:40 GMT-0800 (Pacific Standard Time) -
- - - - - \ No newline at end of file diff --git a/Storj/core/docs/tutorial-protocol-spec.html b/Storj/core/docs/tutorial-protocol-spec.html deleted file mode 100644 index 4a4b0a1..0000000 --- a/Storj/core/docs/tutorial-protocol-spec.html +++ /dev/null @@ -1,996 +0,0 @@ - - - - - JSDoc: Tutorial: Protocol Specification - - - - - - - - - - -
- -

Tutorial: Protocol Specification

- -
- -
- - -

Protocol Specification

-
- -
-

Nodes communicate with each other using -JSON-RPC 2.0 over HTTPS. This requires -farmers (nodes who are contracted by renter to store data) to be publicly -addressable and enables access to content from web browsers, mobile phones, and -any other devices that speak HTTP (hint: everything).

-

This document outlines the specification for the RPC interface by defining the -message structure, required methods, and expected response formats that are -needed for a Storj protocol compliant implementation.

-
-

Note that there may be other aspects of the protocol that are implemented as -SIPs (Storj Improvement Proposals). See the end of this document for a list -of implemented SIPs.

-
-

Request Format

-

Requests are formed according to the JSON-RPC 2.0 specification and are issued -via HTTP POST. The Storj protocol requires the use of named parameters - -positional parameters are not supported. Example:

-
{
-  "method": "PING",
-  "params": {
-    "contact": {
-      "address": "10.0.0.2",
-      "port": 1337,
-      "nodeID": "89cc3ddb4209c6e7e301c10c0257adf4fd85f253",
-      "protocol": "0.8.1"
-    },
-    "nonce": 1455216323786,
-    "signature": "3045022100de2e162d017a1e9d0ebfe2a94df3fc847b68281a9882..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

The receiving node for this request would then respond with the result, which -in the case of a PING message, is simply an acknowledgement that includes -the recipient's contact information and required signature and nonce:

-
{
-  "result": {
-    "contact": {
-      "address": "10.0.0.3",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.8.1"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

In the event that an error occurs, an error property must be added to the -response. You still need to include your contact data in the result -property of the response:

-
{
-  "result": {
-    "contact": {
-      "address": "10.0.0.3",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.8.1"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "error": {
-    "code": -32603,
-    "message": "OH GOD THERE'S SO MUCH BLOOD"
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

Joining the Network

-

To join the Storj network, one must only know the contact information for a -single "seed" node. A node's contact information is defined as the following -three properties:

-
    -
  • address - hostname, domain, or IP
  • -
  • port - port number on which the node is listening
  • -
  • nodeID - hash of the node's public key (see below)
  • -
  • protocol - version of the protocol implementation
  • -
-

This information can be expressed as a URI in the following format:

-
storj://10.0.0.2:1337/89cc3ddb4209c6e7e301c10c0257adf4fd85f253
-
-

In addition to knowing this information about the seed, you also will need to -know this information about yourself, so that it can be provided to the nodes -with which you are communicating. Your "contact card" must be provided as the -contact parameter in every message sent (both requests and responses). This -is because messages must be signed with your private key and your nodeID is -used by recipients to verify two things:

-
    -
  1. That you own the private key corresponding to your claimed nodeID
  2. -
  3. That the message was in fact sent by you and not an attacker
  4. -
-

In the Storj network, nodes are identified by the hash of the public portion of -an ECDSA key pair. Key pairs are generated using curve SECP256K1 and a node's -nodeID is the "pubkeyhash", defined as:

-
RIPEMD160(SHA256(public_key))
-
-

This pubkeyhash, combined with a message and signature is enough data to -reconstruct the complete public key and is used in the Storj network to sign -and verify messages. This ensures that nodes are unable to assume the identity -of another node by claiming it has the same nodeID.

-

Special Headers

-
x-storj-node-id
-

Every request sent should include this header. It's value should equal the -expected Node ID of the destination. This allows nodes who are tunneling -other nodes to determine who the message is intended for.

-

PROBE

-

Before a node can join the network, it must determine whether or not it is -reachable (or publicly addressable). This can be determined by sending a -PROBE request to a known seed.

-
{
-  "method": "PROBE",
-  "params": {
-    "contact": {
-      "address": "10.0.0.3",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.6.0"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

The PROBE RPC message triggers the recipient to attempt to reach the -supplied Contact directly by sending a PING RPC message. If the -target Contact reponds to the PING, then the PROBE should yield -a success response, which is indicated by simply responding to the RPC -message with only the required parameters and no error property.

-
{
-  "result": {
-    "contact": {
-      "address": "10.0.0.3",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.6.0"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

If the PING message triggered by the PROBE fails, then the recipient of the -PROBE RPC must respond with an error indicating to the sender that she is not -addressable.

-
{
-  "result": {
-    "contact": {
-      "address": "10.0.0.3",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.6.0"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "error": {
-    "code": -32603,
-    "message": "PROBE FAILED"
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

If the PROBE fails, you cannot successfully join the overlay and need to -establish a tunnel through a node that is addressable on the network.

-

FIND_TUNNEL

-

Finding a node that is willing to tunnel your connection to the overlay begins -with a FIND_TUNNEL RPC message sent to a known seed. Nodes on the network -maintain a record of known nodes that are willing to tunnel, by subscribing to -"tunnel announcements" over the publish/subscribe system.

-
-

For more information on how nodes announce willingness to tunnel, see the -documentation for Tunnelling Connections.

-
-
{
-  "method": "FIND_TUNNEL",
-  "params": {
-    "relayers": [],
-    "contact": {
-      "address": "10.0.0.3",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.8.1"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

When a node receives a FIND_TUNNEL message, it should respond with ALPHA -(3) contacts that are close the the sender's nodeID who have previously -published their willingness to tunnel. If the recipient herself is willing to -tunnel the connection, she may include herself in the response even if her -nodeID is not closer to the sender's nodeID than her known tunnels.

-
{
-  "result": {
-    "tunnels": [
-      {
-        "address": "10.0.0.4",
-        "port": 1337,
-        "nodeID": "58dc026fa01ae26822bfb23f98e725444d6775b0",
-        "protocol": "0.6.0"
-      },
-      {
-        "address": "10.0.0.5",
-        "port": 1337,
-        "nodeID": "68dc026fa01ae26822bfb23f98e725444d6775b0",
-        "protocol": "0.6.0"
-      },
-      {
-        "address": "10.0.0.6",
-        "port": 1337,
-        "nodeID": "78dc026fa01ae26822bfb23f98e725444d6775b0",
-        "protocol": "0.6.0"
-      }
-    ],
-    "contact": {
-      "address": "10.0.0.3",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.6.0"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

The result of a FIND_TUNNEL message looks almost identical to the result of a -FIND_NODE message, with the exception being the name of the result key is -tunnels instead of nodes. Now that the original sender possesses the -contact information for some known tunnels, she should keep them in her record -so that she can later respond to other's FIND_TUNNEL requests appropriately.

-

Before the node can join the overlay (after determining it is not publicly -addressable), it needs to establish a connection tunnel through one of the -Contacts received from the FIND_TUNNEL request.

-

OPEN_TUNNEL

-

Establishing a tunnel is initiated by sending an OPEN_TUNNEL RPC message to a -node who has indicated their willingness to tunnel. Only the minimum required -parameters need to be sent.

-
-

In the future, the protocol may be enhanced to include additional information -in the OPEN_TUNNEL RPC for negotiating payment channels or other conditions.

-
-
{
-  "method": "OPEN_TUNNEL",
-  "params": {
-    "contact": {
-      "address": "10.0.0.3",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "1.0.0"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

The recipient of the OPEN_TUNNEL message must determine whether or not she -can satisfy the request. This decision may be based upon an arbitrary limit -set by the node regarding how many concurrent tunnels she wishes to open, -available bandwidth, etc. If the node is capable of establishing the tunnel, -she must do so, assigning a dedicated address or port to receive messages and -data channel requests (see data-channels).

-

Once the tunnel's dedicated entry point has been established, she responds to -the sender of the OPEN_TUNNEL request with a proxyPort to which the client -may connect to receive messages.

-
{
-  "result": {
-    "proxyPort": 12000,
-    "contact": {
-      "address": "10.0.0.3",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "1.0.0"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

This response indicates that a proxy has been established and the original -sender can receive messages from the overlay by opening a TCP connection -to the proxyPort and contact address in the reply. In addition, the sender -must update it's Contact information to mirror the remote tunneler's -address and port.

-

If the recipient of the OPEN_TUNNEL message is not able to establish a tunnel -for the sender, then she may respond with an error so that the sender can -attempt to open a tunnel with other known contact.

-
{
-  "result": {
-    "contact": {
-      "address": "10.0.0.3",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.6.0"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "error": {
-    "code": -32603,
-    "message": "Failed to establish tunnel, multiplexer full"
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

Once your node has determined that it is publicly addressable on the network -or has successfully established a tunnel, it can join the overlay network by -issuing a FIND_NODE request sent to one or more known seeds. The request must -include a key, contact (you), along with a signature and nonce.

-

FIND_NODE

-

When issuing a FIND_NODE request, you provide a key that represents the -nodeID of the contact of which you would like to know their neighbors. When -joining the network, this value is your own nodeID.

-
{
-  "method": "FIND_NODE",
-  "params": {
-    "key": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-    "contact": {
-      "address": "10.0.0.3",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.8.1"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

When a node receives a FIND_NODE RPC message, it must perform a lookup in -it's routing table and respond with a nodes array containing the known -contacts that are "closest" to the provided key. This is based on the XOR -metric as the Storj network uses a -Kademlia-based overlay. In addition, -if the receiving node is not already aware of the requesting node, it may add -the requester to it's own routing table to later inform other requesters.

-
{
-  "result": {
-    "nodes": [
-      {
-        "address": "10.0.0.4",
-        "port": 1337,
-        "nodeID": "58dc026fa01ae26822bfb23f98e725444d6775b0",
-        "protocol": "0.8.1"
-      },
-      {
-        "address": "10.0.0.5",
-        "port": 1337,
-        "nodeID": "68dc026fa01ae26822bfb23f98e725444d6775b0",
-        "protocol": "0.8.1"
-      },
-      {
-        "address": "10.0.0.6",
-        "port": 1337,
-        "nodeID": "78dc026fa01ae26822bfb23f98e725444d6775b0",
-        "protocol": "0.8.1"
-      }
-    ],
-    "contact": {
-      "address": "10.0.0.3",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.8.1"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

Upon receipt of the FIND_NODE response, the node attempting to join the -network may iteratively send the same FIND_NODE request to contacts that have -been newly added to the routing table to build out a wider view of the network. -Once the joining node is satisfied with the size of the routing table (or there -are no more nodes to discover), this is considered a successful join.

-

Soliciting Storage

-

Once a node has a sufficiently complete routing table and view of the network, -it's time to buddy up with it's neighbors to cooperate in the sharing and relay -of publications. A "publication" is essentially a request for storage. When -a node in the network wishes to store some data, it notifies it's closest -neighbors who, if interested, will respond to negotiate a storage contract.

-

If the neighbors are not offering storage or do not wish to fulfill the terms of -the storage contract, they must check to see if any of their neighbors are and -forward the publication to them. If no known neighbors are interested, then the -publication is sent to a random node in that neighbor's routing table and the -process repeats until an interested node fulfills the contract.

-

SUBSCRIBE

-

In order to know what publications in which your neighbors are interested, we -select the 3 nodes in our routing table that are identified by a nodeID that -is closest to ours and we issue a SUBSCRIBE message to each of them:

-
{
-  "method": "SUBSCRIBE",
-  "params": {
-    "contact": {
-      "address": "10.0.0.2",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.8.1"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

To properly handle a SUBSCRIBE message, the recipient must respond with an -attenuated bloom filter, with a size 160 bits and a depth of 3. This data -structure represents 3 sets of topics to which the recipient's neighbors are -subscribed 3 "hops" away.

-
{
-  "result": {
-    "filters": [
-      "0000000000000000000000000000000000000000",
-      "0000000000000000000000000000000000000000",
-      "0000000000000000000000000000000000000000"
-    ],
-    "contact": {
-      "address": "10.0.0.3",
-      "port": 1337,
-      "nodeID": "58dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.8.1"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

When the original requesting node receives this response, it must update it's -local attenuated bloom filter to reflect this response, starting at it's filter -at index 1 (since index 0 is reserved for topic to which the node itself is -interested).

-

UPDATE

-

After the requester updates it's local view of it's neighbor's publication -subscriptions, it must in turn update it's neighbors with it's own publication -subscriptions by providing it's own attenuated bloom filter:

-
{
-  "method": "UPDATE",
-  "params": {
-    "filters": [
-      "0000000000000000000000000000000000000000",
-      "0000000000000000000000000000000000000000",
-      "0000000000000000000000000000000000000000"
-    ],
-    "contact": {
-      "address": "10.0.0.2",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.8.1"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

This method is essentially the "push" version of the SUBSCRIBE message, where -instead of providing subscription information as a response, we provide it as a -request. Whenever a node subscribes to a new publication topic, it should -initiate another SUBSCRIBE/UPDATE loop with it's neighbors to ensure that -it may cooperate in publication relay effectively.

-

PUBLISH

-

Once a node has a view of the publications to which it's neighbors are -subscribed, it is capable of issuing a PUBLISH message containing a topic -and some content. This message is sent to the node's nearest neighbors, who -then relay it to their neighbors based upon their own view of nearby -subscriptions.

-

The topic property and the corresponding contents data is arbitrary, but -this mechanism is used for publishing "asks" for storage contracts. In this -case, the topic is equal to the Contract type and the contents is -equal to the proposed contract itself. See Publishing Storage Contracts for more -information on how to choose a valid contract type for your storage needs.

-
{
-  "method": "PUBLISH",
-  "params": {
-    "uuid": "7f0c40a2-e465-4f3e-b617-3d53460e34f7",
-    "topic": "0f02010303",
-    "contents": {
-      "type": "56ce3e837f575827cb5a94e2b609756a48fa4a3882f5e762b262af31f432878d",
-      "renter_id": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "renter_signature": null,
-      "farmer_id": null,
-      "farmer_signature": null,
-      "data_size": 4906,
-      "data_hash": "4efc1c36d3349189fb3486d2914f56e05d3e66f8",
-      "store_begin": 1455228907665,
-      "store_end": 2910457830468,
-      "audit_count": 10,
-      "payment_storage_price": 1200,
-      "payment_download_price": 2,
-      "payment_destination": null
-    },
-    "publishers": [
-      "48dc026fa01ae26822bfb23f98e725444d6775b0"
-    ],
-    "ttl": 1455228597837,
-    "contact": {
-      "address": "10.0.0.2",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.8.1"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

Upon receipt of a PUBLISH message, a node must first check to make sure it -has not already received the publication. This is done by caching the uuid of -received publications. If the node has already seen the publication, it should -respond with an error message indicating such. The node should also make sure -that the publication has not expired by checking that the ttl is a positive -integer.

-

If the node has not previously seen the publication and the message has not -expired, then it must check to see if the publication topic is of interest to -itself by testing it's attenuated bloom filter at index 0 for the topic. If -the node is interested in the publication, it may take action accordingly. In -the case of storage contract, the node may begin communicating directly with -the original publisher to finalize the contract.

-

Regardless of whether or not the node is interested in the publication, it -should acknowledge receipt of the publication to the forwarder:

-
{
-  "result": {
-    "contact": {
-      "address": "10.0.0.2",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.8.1"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

Then, it must append negative information to the publication message by -adding it's own nodeID to the publishers property as well as decrementing -the ttl. Once the message has been updated with the negative information, -the node must check it's attenuated bloom filter to see if any of it's -neighbors are also interested and, if so, forward the message along to them. -If no neighbors are interested, the node must select a random contact from the -routing table and forward the message to that contact.

-

Negotiating Storage Contracts

-

When a node receives a contract proposal in the form of a PUBLISH message and -that proposal meets the recipient's criteria, it can send an OFFER message to -the original publisher.

-

OFFER

-

The offer message must contain the original contract, supplemented with the -information that is required of the offering node, which at minimum must -include farmer_id, farmer_signature, and payment_destination.

-
-

The *_signature property value should be the hex-encoded signature of the -JSON string representation of the contract, minus both signature fields and -with keys sorted alphanumerically.

-
-

In addition to these fields, the offering node (or "farmer") may modify the -other fields in the contract to their liking if they wish to counter the -original offer:

-
{
-  "method": "OFFER",
-  "params": {
-    "contract": {
-      "type": "56ce3e837f575827cb5a94e2b609756a48fa4a3882f5e762b262af31f432878d",
-      "renter_id": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "renter_signature": null,
-      "farmer_id": "58dc026fa01ae26822bfb23f98e725444d6775b0",
-      "farmer_signature": "304502203f2be986f4213c45bf2f78c57cbf4001b049c4fd...",
-      "data_size": 4906,
-      "data_hash": "4efc1c36d3349189fb3486d2914f56e05d3e66f8",
-      "store_begin": 1455228907665,
-      "store_end": 2910457830468,
-      "audit_count": 10,
-      "payment_storage_price": 1200,
-      "payment_download_price": 2,
-      "payment_destination": "1JUhMAZj2Mkb4mRaGxbBYPsStryPyDxPuj"
-    },
-    "contact": {
-      "address": "10.0.0.2",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.8.1"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

The receiving node must check the offer and determine whether or not the -modified contract terms are satisfactory. If so, it may finalize the contract -by adding it's signature to the renter_signature field:

-
{
-  "result": {
-    "contract": {
-      "type": "56ce3e837f575827cb5a94e2b609756a48fa4a3882f5e762b262af31f432878d",
-      "renter_id": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "renter_signature": "304402202ccc152ee81fbff7e802c290cabea0c62384bb12...",
-      "farmer_id": "58dc026fa01ae26822bfb23f98e725444d6775b0",
-      "farmer_signature": "304502203f2be986f4213c45bf2f78c57cbf4001b049c4fd...",
-      "data_size": 4906,
-      "data_hash": "4efc1c36d3349189fb3486d2914f56e05d3e66f8",
-      "store_begin": 1455228907665,
-      "store_end": 2910457830468,
-      "audit_count": 10,
-      "payment_storage_price": 1200,
-      "payment_download_price": 2,
-      "payment_destination": "1JUhMAZj2Mkb4mRaGxbBYPsStryPyDxPuj"
-    },
-    "contact": {
-      "address": "10.0.0.2",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.8.1"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

Alternatively, the receiving node may counter the offer by modifying any of the -fields and returning those in the response. The farmer must check the contract -against it's signature to determine if the terms of the contract have been -changed. This counter offer loop can continue until one party abandons the -offer loop or until both parties have signed the same contract.

-
-

Once a contract has been finalized, each node should store a copy locally -that can be keyed by the data_hash.

-
-

Executing a Storage Contract

-

Once a storage contract has been signed by both parties, the renter may execute -the terms of the contract by issuing a CONSIGN message to the farmer. The -purpose of this message is to deliver the data referenced by the contract for -the farmer to store.

-

CONSIGN

-

The consign message must contain the hex-encoded -data_shard itself, the contract_hash, as well as an audit_tree that -contains the bottom leaves of the audit strategy's merkle tree (see Auditing -a Storage Contract below).

-
{
-  "method": "CONSIGN",
-  "params": {
-    "data_hash": "4efc1c36d3349189fb3486d2914f56e05d3e66f8",
-    "audit_tree": [
-      "40a98e19c298631cba19d6c19691360ce08ccf36",
-      "02f0d971096305e797da9165cd50d4d1bb19590b",
-      "a44ad75d8aa118cdd73df77ae2543d3e87f94576",
-      "d84e8bfac28a98df418d0c3029f77a4d9f338e9e",
-      "7408bb5b0a9eefa56f3234fc83d2423f76c4b857",
-      "d1b71886c910d34b31cee9e23316abded9ef3fe0",
-      "0ac89686a12e26aaf952180c0fec5373224c4c1e",
-      "98c304116e7eb89839ff6c96202eb4c3cbdaf8e0",
-      "c7937b8a1be9da426e076eff70c5b4edf8a66270",
-      "c6c2c5cdafb99e4d62185d42e59522d15c33d676",
-      "1f87ca29e75944aa36e676b3ddf27e49a8ca4fe2",
-      "8585e356a517535b8a36ec9222b955c5b61a5227",
-      "ba084d3f143f2896809d3f1d7dffed472b39d8de",
-      "ba084d3f143f2896809d3f1d7dffed472b39d8de",
-      "ba084d3f143f2896809d3f1d7dffed472b39d8de",
-      "ba084d3f143f2896809d3f1d7dffed472b39d8de"
-    ],
-    "contact": {
-      "address": "10.0.0.2",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.8.1"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

Upon receipt of a CONSIGN message, the farmer must lookup the reference -contract by the supplied data_hash and verify that the renter is authorized -to store the data and that the number of items in the audit_tree is equal to -the next power of 2 of the audit_count supplied in the original contract.

-

Once verified, the farmer must respond with a generated token that the renter -or another authorized party can use to open a data channel with the farmer -(via websocket) to deliver the data as a binary stream.

-
-

For more information on the Data Channel specification see the tutorial for -data-channels.

-
-

In addition, the farmer should verify that the current UNIX time is greater -than or equal to the agreed upon store_begin and less than the agreed upon -store_end. If everything checks out, the farmer must store the consigned data -in such a way that it may later be retrieved by it's hash. Once the farmer has -done this, it must acknowledge the renter to confirm:

-
{
-  "result": {
-    "token": "3f62b781e3b5b5288dca587807248261d109bbfb",
-    "contact": {
-      "address": "10.0.0.2",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.8.1"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

Using Mirrors for Redundancy

-

In most cases it is desirable for the renter to store multiple copies of the -shard across a number of farmers in the event that one of the contracted -farmers leaves the network, loses the data, or otherwise breaches the terms of -the storage contract. This can be accomplished by simply performing an -iterative PUBLISH - OFFER - CONSIGN loop for the desired level of redundancy, -followed by the establishment of a data channel as described in -data-channels.

-

However, this method can introduce a significant amount of latency for -completing a full upload that increases linearly with the number of redundant -shards. Additionally, the amount of bandwidth consumed by the renter increases -in the same way as the renter will have to upload the data for each redundant -shard.

-

MIRROR

-

In these scenarios, renters can offload the burden of storing multiple copies -of a shard to the farmers by issuing a MIRROR RPC in lieu of establishing -a data channel. A MIRROR RPC instructs a contracted farmer to retrieve the -data already uploaded to another farmer by providing them with a retrieval -token authorized by another farmer (this is performed by issuing a RETRIEVE -RPC message - see Downloading Consigned Data later in this document). This -allows the renter to incur the bandwidth and latency once and instead pay the -recently contracted farmer to transfer the data to another farmer for -redundancy.

-

To initiate this process, instead of opening a data channel, issue a MIRROR -RPC message to the farmer after contract negotiation is complete:

-
{
-  "method": "MIRROR",
-  "params": {
-    "data_hash": "4efc1c36d3349189fb3486d2914f56e05d3e66f8",
-    "token": "ce898e520cede42fd847ba5176b6d6b6ea47481f",
-    "farmer": {
-      "address": "remote.farmer.host",
-      "port": 4000,
-      "nodeID": "e77e46ceb7f8dbf2904eff254a479f90a4f8ddbd",
-      "protocol": "0.8.1"
-    },
-    "contact": {
-      "address": "10.0.0.2",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.8.1"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-
-

Note that you should wait until data is successfully consigned to the first -farmer before sending a MIRROR RPC for replication.

-
-

Once the mirroring farmer receives the request, it should open a data channel -to the original farmer and pass along the supplied token and data hash in the -initial authorization frame. Once the mirroring farmer begins receiving data -it must respond to the renter's request with a simple acknowledgement to -indicate that the mirror operation was successfully initiated.

-
{
-  "result": {
-    "contact": {
-      "address": "10.0.0.2",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.8.1"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-
-

Note that data transfer may fail after the original acknowledgement. It is -important to regularly issue AUDIT messages to farmers storing your data. -If a mirror farmer later fails an audit, the renter should negotiate a new -contract and attempt to create a new mirror to retain the expected level of -redundancy.

-
-

Auditing a Storage Contract

-

Before a renter issues a CONSIGN RPC, it must pre-calculate a series of -"challenges", the number of which must equal the audit_count defined in the -negotiated contract. A challenge is simply 32 random bytes encoded as hex. The -generated challenges must not be shared until the renter wishes to issue an -AUDIT request.

-

When issuing a CONSIGN request, the renter must include an audit_tree which -contains the bottom leaves of a merkle tree. Each of the bottom leaves of the -tree must be equal to the double RIPEMD160(SHA256(challenge + shard)) encoded -as hex. In order to ensure that the resulting merkle tree is properly -"balanced", the number of bottom leaves must be equal to the next power of 2 of -the audit count. To ensure this, the additional leaves can simply be the double -RIPEMD160(SHA256('')) (the same hash function for an audit, but applied to an -empty buffer).

-

AUDIT

-

To audit a farmer is to request proof that it is still honoring the terms of -the storage contract without the need to have them supply the entire -data_shard. To do this, the renter must supply the farmer with one of the -secret pre-calculated challenges:

-
{
-  "method": "AUDIT",
-  "params": {
-    "audits": [
-      {
-        "data_hash": "4efc1c36d3349189fb3486d2914f56e05d3e66f8",
-        "challenge": "6290bb9e1766bf3fc00eea3bb14146925611026d453e1aa95c32973f8baa5c98"
-      }
-    ],
-    "contact": {
-      "address": "10.0.0.2",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.8.1"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

Upon receipt of an AUDIT request, the farmer must lookup the data_shard by -the supplied data_hash, then calculate the single -RIPEMD160(SHA256(challenge + shard)).

-
-

The result of this operation should hash again to match one of the items -supplied in the audit_tree property of the original CONSIGN request.

-
-

In addition to supplying this single-hashed value as proof that the farmer is still honoring -the terms of the contract, the farmer must also provide the uncles required -to rebuild the merkle tree. This proof response is specified as a series -of nested JSON arrays:

-
{
-  "result": {
-    "proofs": [
-      [[[
-      [["6a2f02144c461e178dc4496c263313e64d7a56ab"
-      ],"efb0dfa48813e3289ba8d16e9e23cf1efa1a99fd"
-      ],"dfb8877b84e7a7496a4b08b2aef6ffd02ccbfccc"
-      ],"82c60f546bcaaabeb908c911b1fadb816e039409"
-      ],"5e265b0256cd471c6af22bd66b59ed9242067654"]
-    ],
-    "contact": {
-      "address": "10.0.0.2",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.8.1"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

For clarification, given a simple merkle tree:

-
+-- Hash_0 (Root)
-|   +-- Hash_1
-|   |   +-- Hash_3
-|   |   +-- Hash_4
-|   +-- Hash_2
-|   |   +-- Hash_5
-|   |   +-- Hash_6 = RIPEMD160(SHA256(RIPEMD160(SHA256(challenge + shard))))
-
-

The resulting format of a proof for an audit matching Hash_6 would appear as:

-
[Hash_1, [Hash_5, [RIPEMD160(SHA256(challenge + shard))]]]
-
-

And, the resulting format of a proof for an audit matching Hash_3 would appear as:

-
[[[RIPEMD160(SHA256(challenge + shard))], Hash_5], Hash_2]
-
-

Upon receipt of the farmer's proof, the renter must verify that the proof is -valid by using it to rebuild the merkle tree. See Verification#verify -for an implementation example. If the proof is verified successfully, then the -renter is expected to issue a payment to the payment_destination defined in -the original contract. The amount of the payment should be equal to:

-
(payment_storage_price / audit_count) + (payment_download_price * downloads_since_last_audit)
-
-

If the verification fails then the contract is null and no payment is required. -Conversely, if the verification succeeds and the renter does not issue the -payment in a timely manner, then the contract is also null and the farmer may -decide to cease storage of the data.

-

RETRIEVE

-

When a renter wishes to retrieve data that is stored under contract, it can -issue a RETRIEVE RPC message that includes the data_hash to the farmer -storing the data:

-
{
-  "method": "RETRIEVE",
-  "params": {
-    "data_hash": "4efc1c36d3349189fb3486d2914f56e05d3e66f8",
-    "contact": {
-      "address": "10.0.0.2",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.8.1"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

After the recipient of the RETRIEVE message verifies the sender's signature -it must lookup the storage contract by the supplied data_hash and verify that -the sender is the party with which the contract was negotiated. If all tests -pass, then the farmer must respond with a generated token to allow the renter -to open a data channel (via websocket) to retrieve the data as a binary stream. -After the data shard is delivered successfully, the farmer must increment -it's record of the downloads_since_last_audit (which must be reset after the -next audit).

-
-

For more information on the Data Channel specification see the tutorial for -data-channels.

-
-
{
-  "result": {
-    "token": "3f62b781e3b5b5288dca587807248261d109bbfb",
-    "contact": {
-      "address": "10.0.0.2",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.8.1"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

In addition, the renter must check the integrity of the returned data_shard -by calculating the hash and checking it against the expected data_hash. If -the test fails, then this effectively a failed audit and the contract is null.

-

Implemented SIPs

- -
- -
- -
- - - -
- -
- Documentation generated by JSDoc 3.6.11 on Sat Nov 09 2024 22:26:40 GMT-0800 (Pacific Standard Time) -
- - - - - \ No newline at end of file diff --git a/Storj/core/docs/tutorial-renting-data.html b/Storj/core/docs/tutorial-renting-data.html deleted file mode 100644 index 5507557..0000000 --- a/Storj/core/docs/tutorial-renting-data.html +++ /dev/null @@ -1,314 +0,0 @@ - - - - - JSDoc: Tutorial: Renting Data to the Network - - - - - - - - - - -
- -

Tutorial: Renting Data to the Network

- -
- -
- - -

Renting Data to the Network

-
- -
-

This tutorial covers the process for using StorjCORE to rent data to farmers on -the network programmatically using a number of tools included in the library. -This walkthrough should also serve as an overview for a number of the tools -included in the library and how they work together.

-

Bootstrapping

-

Before we can join the network, we need to set up a few required components:

-
    -
  • KeyPair - for representing our identity on the network
  • -
  • StorageAdapter - for persisting our contracts and shard metadata
  • -
  • StorageManager - for managing our persistence layer
  • -
-

Start by importing the storj module and instantiating these objects:

-
var storj = require('storj');
-var keypair = new storj.KeyPair();
-var persistence = new storj.EmbeddedStorageAdapter('/path/to/datadir');
-var manager = new storj.StorageManager(persistence);
-
-

Now that we have a way of identifying ourselves to the network and keeping a -record of our contracts, we can use the RenterInterface to join the -network.

-
var renter = new storj.RenterInterface({
-  keyPair: keypair,
-  storageManager: manager,
-  rpcAddress: 'ip.or.hostname',
-  rpcPort: 1337
-});
-
-renter.join(function(err) {
-  if (err) {
-    return console.error('Failed to join the network');
-  }
-
-  // CONTINUED IN NEXT EXAMPLE...
-});
-
-

File Preparation

-

Now that we have a connection to the network, we are ready to store some data. -Before we can actually store the data, we need to get some information about -the shards we need to store. We need to know:

-
    -
  • The hash of each shard that will be stored
  • -
  • The size of each shard that will be stored
  • -
  • The length of time we wish to store the data
  • -
  • The number of audits we intend to issue over the life of the contract
  • -
-

To get this information we need to process the file using a few more of the -core components:

- -

We will start by demultiplexing the file into several shard streams. Let's -break our file into 6 shards. We will start by creating a FileDemuxer:

-
var demuxer = new storj.FileDemuxer('/path/to/file');
-
-

Now that we have prepared to shard a file, we need to set up event listeners on -the demuxer for whenever a new shard stream is available. Once a shard stream -is available, we need to encrypt it and calculate it's hash and size so we can -create an appropriate Contract to offer the network. In addition we -will write the encrypted shard to temporary storage so we don't have to process -the file again when we are ready to transfer the data:

-
var tmpdir = require('os').tmpdir();
-var crypto = require('crypto');
-var path = require('path');
-
-demuxer.on('shard', function(shardStream) {
-  var tmpName = path.join(tmpdir, crypto.randomBytes(6).toString('hex'));
-  var tmpFile = fs.createWriteStream(tmpName);
-  var key = new storj.DataCipherKeyIv('password', 'salt');
-  var encrypter = new storj.EncryptStream(key);
-  var hasher = crypto.createHash('sha256');
-  var size = 0;
-
-  encrypter.on('data', function(bytes) {
-    hasher.update(bytes);
-    size += bytes.length;
-  });
-
-  tmpFile.on('finish', function() {
-    // CONTINUED IN NEXT EXAMPLE...
-  });
-
-  shardStream.pipe(encrypter).pipe(tmpFile);
-});
-
-

Contract Negotiation

-

When each shard is finished being encrypted and we know it's size and hash, it -is time to create a Contract and offer it to the network. The example -below is continued from inside the tmpFile.on('finish', callback) in the -example above:

-
var hash = utils.rmd160sha256(hasher.digest());
-var contract = new storj.Contract({
-  renter_id: keypair.getNodeID(),
-  data_size: size,
-  data_hash: hash,
-  store_begin: Date.now(),
-  store_end: Date.now() + 604800000, // 7 days from now
-  audit_count: 12
-});
-
-renter.getStorageOffer(contract, function(err, farmer, contract) {
-  // CONTINUED IN NEXT EXAMPLE...
-});
-
-

Now we have created a Contract for the shard and we are waiting for an -offer from a farmer on the network. When we receive one, the callback supplied -to RenterInterface#getStorageOffer above will trigger and we can -proceed to transfer the shard to the farmer, but first we need to tell the -farmer we are ready to transfer the shard to them and include the audit -information they will need in the future. We will be using:

-
    -
  • AuditStream - for generating audit challenges and merkle tree
  • -
  • StorageItem - for storing our private record of challenges
  • -
-

Let's continue by reading the encrypted shard temporary file we just created -and generating the challenges and merkle tree and saving a copy of the contract -and associated challenges:

-
var item = new storj.StorageItem({ hash: hash });
-var auditGenerator = new storj.AuditStream(12);
-var encryptedShard = fs.createReadStream(tmpName);
-
-auditGenerator.on('finish', function() {
-  item.addContract(farmer, contract);
-  item.addAuditRecords(farmer, auditGenerator);
-
-  manager.save(item, function(err) {
-    if (err) {
-      return console.error(err);
-    }
-
-    // CONTINUED IN NEXT EXAMPLE...
-  });
-});
-
-encryptedShard.pipe(auditGenerator);
-
-

Transferring Shards

-

Now that we have stored a copy of our contract and challenges, it's time to -authorize a "data channel" (as described in data-channels) and -transfer the shard to the farmer.

-
renter.getConsignToken(farmer, contract, auditGenerator, function(err, token) {
-  if (err) {
-    return console.error(err);
-  }
-
-  var upload = storj.utils.createShardUploader(farmer, hash, token);
-  var encryptedShard = fs.createReadStream(tmpName);
-
-  encryptedShard.pipe(upload).on('end', () => {
-    // CONTINUED IN THE NEXT EXAMPLE
-  });
-});
-
-

Remember that these operations for contract negotiation and shard transfer are -taking place for each shard in the original file. You'll want to keep track -of shards and their associated contracts by grouping references to them -logically as the file that they compose. This is the responsibility of -implementing clients. If you do not wish to manage this yourself, consider -running a Bridge or using the -Storj API.

-

Replicating Shards for Redundancy

-

Once we have successfully consigned our data to a farmer, we can ensure that in -the event that farmer disappears, our data can be recovered from elsewhere. We -use mirrors to accomplish this. Mirroring is a method for passively -replicating our data, meaning that instead of uploading it again, we instruct a -new farmer to retrieve it from the location we already stored it.

-
-

We are also going to use the async module -for managing flow control.

-
-

First we'll need to negotiate a few more contracts, then authorize some -retrieval tokens (outlined later in this document), and finally request some -mirrors.

-
var redundancy = 3;
-var mirrors = [];
-
-function _getMirroringContract(n, next) {
-  renter.getStorageOffer(contract, function(err, mirror, contract) {
-    renter.getRetrieveToken(farmer, contract, function(err, token) {
-      if (err) {
-        return next(err);
-      }
-
-      mirrors.push(mirror);
-      next(null, { farmer: farmer, hash: hash, token: token });
-    });
-  });
-}
-
-async.timesSeries(redundancy, _getMirroringContract, function(err, sources) {
-  if (err) {
-    return console.error(err);
-  }
-
-  renter.getMirrorNodes(sources, mirrors, function(err, completed) {
-    if (err) {
-      return console.error('Failed to replicate to all mirrors');
-    }
-
-    console.info('Replicated to %s mirrors', completed.length);
-  });
-});
-
-

Auditing Farmer Storage

-

Now that we have successfully consigned a shard, we will want to be sure that -the farmer is being honest about storing it. We can verify this by requesting -a proof using the challenges we generated previously. We will be using:

-
    -
  • Verification - for validating the farmer's challenge response
  • -
-
var merkleRoot = auditGenerator.getPrivateRecord().root;
-var treeDepth = auditGenerator.getPrivateRecord().depth;
-
-renter.getStorageProof(farmer, item, function(err, proof) {
-  if (err) {
-    return console.error(err);
-  }
-
-  var verification = new storj.Verification(proof);
-  var verifyResult = verification.verify(merkleRoot, treeDepth);
-
-  if (verifyResult[0] !== verifyResult[1]) {
-    return console.error('The proof is not valid');
-  }
-
-  manager.save(item, function(err) {
-    if (err) {
-      return console.error(err);
-    }
-
-    // CONTINUED IN NEXT EXAMPLE
-  });
-});
-
-

Retrieving Shards

-

Now that we have verified that the farmer is storing the shard, we know that we -can later retrieve it when needed. The process for doing this is very similar -to the process for storing the shard, only this time we'll be asking for a -retrieval token and we will be receiving data over the data channel instead of -sending. We'll also be using:

- -
renter.getRetrieveToken(farmer, contract, function(err, token) {
-  if (err) {
-    return console.error(err);
-  }
-
-  var download = utils.createShardDownloader(farmer, hash, token);
-  var decrypter = new storj.DecryptStream(keypair);
-  var fileDestination = fs.createWriteStream('/path/to/download/shard');
-
-  download.pipe(decrypter).pipe(fileDestination);
-
-  fileDestination.on('finish', function() {
-    console.info('Successfully downloaded shard!');
-  });
-});
-
-

This concludes the tutorial. To dive deeper, follow the reference links -throughout this walkthrough and read the documentation on each of the classes -used here.

-
- -
- -
- - - -
- -
- Documentation generated by JSDoc 3.6.11 on Sat Nov 09 2024 22:26:40 GMT-0800 (Pacific Standard Time) -
- - - - - \ No newline at end of file diff --git a/Storj/core/docs/tutorial-tunnel-connections.html b/Storj/core/docs/tutorial-tunnel-connections.html deleted file mode 100644 index 6a85938..0000000 --- a/Storj/core/docs/tutorial-tunnel-connections.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - JSDoc: Tutorial: Tunnelling Connections - - - - - - - - - - -
- -

Tutorial: Tunnelling Connections

- -
- -
- - -

Tunnelling Connections

-
- -
-

One of the most daunting problems to tackle when designing a stable and -reliable distributed network is the traversal of various constraints such as -NAT and firewalls. In some cases, software can use various strategies to -"punch out" of these constraints and become publicly addressable on the -Internet. The StorjCORE library makes use of these strategies, but when they -fail we must devise more complex tactics for ensuring that network participants -are reachable by their peers.

-

The Storj protocol defines a series of RPC messages that can be exchanged -in order to establish a "tunnel". See the Protocol Specification for more -detail on these RPC messages and their purposes. A tunnel is, in essence, a -proxy that allows a client that is not exposed to the Internet to be -addressable as if it were.

-

This works by a private node opening a long-lived connection to a public node -who establishes a dedicated means for accepting messages on behalf of the -private node and "pipes" any data received via those means directly back to the -private node over the previously established connection.

-

Once a tunnel has been established, the private node can begin identifying -herself to the network using her tunnel's address, instead of her own. Private -nodes do not need to use the tunnel to contact other nodes on the network, but -rather only to be contacted.

-

Announcing Willingness

-

When a node joins the network and is publicly addressable, it has the ability -to announce to the network that it is willing and capable of tunneling -connections on behalf on nodes who are private or unable to punch out to -become addressable on the Internet. The process of doing this uses the same -publish/subscribe system described in the Publishing Storage Contracts -specification which enables nodes to maintain a view of subscriptions in their -neighborhood of the network as described in the Protocol Specification.

-

The difference between a contract publication and a tunnel announcement is in -the opcode used for the topic and in the contents of the publication. Tunnel -announcement publications use the opcode prefix 0x0e followed by a single -criteria degree opcode to indicate their willingness to tunnel (0x00 to -indicate "I am no longer tunneling" and 0x01 to indicate "I am ready to -tunnel").

-

Whenever the condition changes, such as a node's maximum number of tunnels is -reached or when a tunnel becomes available, it should issue a PUBLISH RPC -message to it's nearest neighbors.

-
{
-  "method": "PUBLISH",
-  "params": {
-    "uuid": "7f0c40a2-e465-4f3e-b617-3d53460e34f7",
-    "topic": "0e01",
-    "contents": {
-      "address": "10.0.0.2",
-      "port": 1337
-    },
-    "publishers": [
-      "48dc026fa01ae26822bfb23f98e725444d6775b0"
-    ],
-    "ttl": 1455228597837,
-    "contact": {
-      "address": "10.0.0.2",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.6.0"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

Public nodes should subscribe to these topics so that they can maintain an -up-to-date list of nodes who are capable and willing to tunnel connections, so -they can respond accurately to FIND_TUNNEL messages from private nodes.

-

Establishing a Tunnel

-

After a private node has discovered some willing tunnels using the FIND_TUNNEL -RPC message defined in the Protocol Specification, it can now begin the -handshake to establish the tunnel. This begins by sending the OPEN_TUNNEL RPC -message to the desired tunneler node. The recipient of OPEN_TUNNEL will -check:

-
    -
  • Do I have enough remaining tunnels? (based on arbitrary limit set by node)
  • -
  • Am I already tunneling for this nodeID?
  • -
  • Has a payment channel been opened? (future spec)
  • -
-

If the tunneling node has enough tunnels, is not already tunneling the node, -and (in a future spec) if a payment channel has been opened for bandwidth, then -the tunneling node opens a new dedicated TCP socket on an available port -that will be used by the requester to send/receive HTTP messages.

-
{
-  "result": {
-    "proxyPort": 12000,
-    "contact": {
-      "address": "10.0.0.3",
-      "port": 1337,
-      "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0",
-      "protocol": "0.6.0"
-    },
-    "nonce": 1455216323786,
-    "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..."
-  },
-  "id": "7b6a2ab35da6826995abf3310a4875097df88cdb"
-}
-
-

Now the private node can open a TCP connect to the proxyPort provided and -messages sent to the tunneler that specify your node ID in the -x-storj-node-id header will be written to the connected socket. From there, -you may pipe this socket directly to your locally running node.

-
- -
- -
- - - -
- -
- Documentation generated by JSDoc 3.6.11 on Sat Nov 09 2024 22:26:40 GMT-0800 (Pacific Standard Time) -
- - - - - \ No newline at end of file diff --git a/Storj/core/script/publishdoc.js b/Storj/core/script/publishdoc.js deleted file mode 100644 index f65cfd9..0000000 --- a/Storj/core/script/publishdoc.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -var ghpages = require('gh-pages'); -var path = require('path'); - -ghpages.publish(path.join(__dirname, '../jsdoc'), { - repo: 'git@github.com:Storj/core.git' -}, function(err) { - console.log(err || 'Published to http://storj.github.io/core'); -}); diff --git a/Storj/core/.eslintignore b/Storj/protocol-v2/.eslintignore similarity index 100% rename from Storj/core/.eslintignore rename to Storj/protocol-v2/.eslintignore diff --git a/Storj/core/.eslintrc b/Storj/protocol-v2/.eslintrc similarity index 100% rename from Storj/core/.eslintrc rename to Storj/protocol-v2/.eslintrc diff --git a/Storj/core/.gitignore b/Storj/protocol-v2/.gitignore similarity index 100% rename from Storj/core/.gitignore rename to Storj/protocol-v2/.gitignore diff --git a/Storj/core/.jsdoc.json b/Storj/protocol-v2/.jsdoc.json similarity index 100% rename from Storj/core/.jsdoc.json rename to Storj/protocol-v2/.jsdoc.json diff --git a/Storj/core/.jshintrc b/Storj/protocol-v2/.jshintrc similarity index 100% rename from Storj/core/.jshintrc rename to Storj/protocol-v2/.jshintrc diff --git a/Storj/core/.nvmrc b/Storj/protocol-v2/.nvmrc similarity index 100% rename from Storj/core/.nvmrc rename to Storj/protocol-v2/.nvmrc diff --git a/Storj/core/.travis.yml b/Storj/protocol-v2/.travis.yml similarity index 100% rename from Storj/core/.travis.yml rename to Storj/protocol-v2/.travis.yml diff --git a/Storj/core/LICENSE-AGPL-3.0 b/Storj/protocol-v2/LICENSE-AGPL-3.0 similarity index 100% rename from Storj/core/LICENSE-AGPL-3.0 rename to Storj/protocol-v2/LICENSE-AGPL-3.0 diff --git a/Storj/core/LICENSE-LGPL-3.0 b/Storj/protocol-v2/LICENSE-LGPL-3.0 similarity index 100% rename from Storj/core/LICENSE-LGPL-3.0 rename to Storj/protocol-v2/LICENSE-LGPL-3.0 diff --git a/Storj/core/doc/protocol-spec.md b/Storj/protocol-v2/README.md similarity index 61% rename from Storj/core/doc/protocol-spec.md rename to Storj/protocol-v2/README.md index c76ad66..d852ba3 100644 --- a/Storj/core/doc/protocol-spec.md +++ b/Storj/protocol-v2/README.md @@ -1,3 +1,9 @@ +# Storj Core *protocol specification version 2* + +> Authored by Lily Anne Hall with contributions from Braydon Fuller + +## remote procedure calls + Nodes communicate with each other using [JSON-RPC 2.0](http://www.jsonrpc.org/specification) over HTTPS. This requires farmers (nodes who are contracted by renter to store data) to be publicly @@ -1086,6 +1092,638 @@ the test fails, then this effectively a failed audit and the contract is null. ### Implemented SIPs -* [SIP0003 Remote Notifications and Triggers](https://github.com/Storj/sips/blob/master/sip-0003.md) -* [SIP0004 Contract Transfers and Renewals](https://github.com/Storj/sips/blob/master/sip-0004.md) -* [SIP0032 Hierarchically Deterministic Node IDs](https://github.com/Storj/sips/blob/master/sip-0032.md) +* [SIP0003 Remote Notifications and Triggers](../sip-0003) +* [SIP0004 Contract Transfers and Renewals](../sip-0004) +* [SIP0032 Hierarchically Deterministic Node IDs](../sip-0032) + +## contract topics + +Nodes solicit storage contracts with the network by publishing information +about their storage requirements as outlined in {@tutorial protocol-spec}. +Storj implements a distributed publish/subscribe system based on an algorithm +called [Quasar](https://github.com/kadtools/kad-quasar). + +Quasar works by allowing nodes to advertise topics of interest to their +neighbors and keeping a record of these topics in their neighborhood by storing +them in an attenuated bloom filter. Each node has a view of the topics in which +their neighbors are interested up to 3 hops away. By the nature of this +design, the network forms gravity wells wherein messages of interest are +efficiently relayed to nodes that are subscribed to the topic without flooding +the network. + +This approach works well when there is a diverse number of topics. The Storj +protocol leverages this by defining a matrix of *criteria* and *descriptors* +in the form of opcodes representing the degree of which the criteria must be +met. + +### Criteria + +At the time of writing, there are 4 criteria column in the topic matrix: + +* Size +* Duration +* Availability +* Speed + +#### Size + +Refers to the size of the data to be stored. + +#### Duration + +Refers to the length of time for which the data should be stored. + +#### Availability + +Refers to the relative uptime of required by the contract for retrieval of the +stored data. + +#### Speed + +Refers to the throughput desired for retrieval of the stored data. + +### Descriptors + +At the time of writing, there are 3 descriptor opcodes representing *low*, +*medium*, and *high* degrees of the criteria. + +* Low: `0x01` +* Medium: `0x02` +* High: `0x03` + +The ranges represented by these descriptors are advisory and may change based +on network performance and improvements to hardware over time. + +``` +------------------------------------------------------------------------------- +| Descriptor | Size | Duration | Availability | Speed | +|-----------------|-------------|------------|--------------|-----------------| +| Low (`0x01`) | 0mb - 8mb | 0d - 30d | 0% - 50% | 0mbps - 6mbps | +|-----------------|-------------|------------|--------------|-----------------| +| Medium (`0x02`) | 8mb - 16mb | 30d - 90d | 50% - 80% | 6mbps - 12mbps | +|-----------------|-------------|------------|--------------|-----------------| +| High (`0x03`) | 16mb - 32mb | 90d - 270d | 80% - 99% | 12mbps - 32mbps | +------------------------------------------------------------------------------- +``` + +### Topic Format + +When publishing or subscribing to a given topic representing the degrees of +these criteria, nodes must serialize the opcodes as the hex representation of +the bytes in proper sequence. This sequence is defined as: + +``` +prefix|size|duration|availability|speed +``` + +The first byte, "prefix", is the **static identifier** for a contract +publication. Contracts are not the only type of publication shared in the +network, so the prefix acts as a namespace for a type of publication topic. + +**The prefix for a contract publication is:** `0x0f`. + +To illustrate by example, we can determine the proper topic by analyzing the +*use case* for a given file shard. For instance, if we want to store an asset +that is displayed on a web page we can infer the following: + +* The file is small +* The file may change often, so we should only store it for medium duration +* The file needs to always be available +* The file should be transferred quickly + +Using the matrix, we can determine the proper opcode sequence: + +``` +[0x0f, 0x01, 0x02, 0x03, 0x03] +``` + +Serialized as hex, our topic string becomes: + +``` +0f01020303 +``` + +Another example, by contrast, is data *backup*. Data backup is quite different +than the previous example: + +* The file is large (perhaps part of a hard drive backup) +* The file will not change and should be stored long term +* The file will not be accessed often, if ever +* The file does not need to be transferred at high speed + +Using the matrix, we can determine the proper opcode sequence: + +``` +[0x0f, 0x03, 0x03, 0x01, 0x01] +``` + +Serialized as hex, our topic string becomes: + +``` +0f03030101 +``` + +The resulting hex string from the serialized opcode byte sequence should be +used as the `topic` parameter of a `PUBLISH` RPC as defined in the +{@tutorial protocol-spec}. Nodes that are subscribed to the topic will receive +the proposed storage contract and may begin contract negotiation with you +directly. + +## data transfer + +Transfering file shards to farmers is a simple process. After a successful +`CONSIGN` or `RETRIEVE` RPC yields a token, the renter may construct an HTTP +request to the farmer, to push or pull the data. + +#### Uploading Shards + +To upload a shard to a given farmer, construct an HTTP request: + +* Method: `POST` +* Path: `/shards/{hash}?token={token}` +* Headers: + * `content-type: application/octet-stream` + * `x-storj-node-id: {farmer node id}` + +Then simply write the encrypted shard to the request. Farmers will respond with +appropriate status codes and messages to indicate the result. + +#### Downloading Shards + +To download a shard from a given farmer, construct an HTTP request: + +* Method: `GET` +* Path: `/shards/{hash}?token={token}` +* Headers: + * `content-type: application/octet-stream` + * `x-storj-node-id: {farmer node id}` + +You will receive the shard as a response of type `application/octet-stream` if +you are authorized. + +## file encryption + +This document serves to provide a detailed account of how files are encrypted +by default by Storj Core to promote interoperability between different +implementations of clients. + +### Sharding and Encryption Scheme + +Before data is stored in the network, the Storj Core library automatically +handles file encryption, sharding, and key management for you. + +In order of operations: + +1. Complete file is encrypted with a unique key and initialization vector +2. File is demultiplexed (or "sharded") into individual chunks +3. Each shard is offered to the network and transferred +4. Key and IV are encrypted with a passphrase and stored locally + +### Key and Initialization Vector Generation + +Files are encrypted using [AES-256-CTR](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard). Use +of CTR allows for random read-access to known indices. File `keys` are +generated via one of two methods: + +* Local PBKDF2 key derivation (default) +* Passphrase-based deterministic key derivation (recommended) + +### PBKDF2 Key Derivation + +By default, the `key` for each file is the result of a standard key derivation +function, [PBKDF2](https://en.wikipedia.org/wiki/PBKDF2). PBKDF2 generates a +key from a password and a salt. These two values are randomly generated bytes: + +* Password: 512 random bytes +* Salt: 32 random bytes + +The key length of the PBKDF2 is 512 bytes, should use 25000 iterations, and use +SHA-512 as the digest. To create the cipher/decipher and initialization vector, +derive the SHA-256 hash of the resulting PBKDF2 for the cipher/decipher `key` +and use the first 16 bytes of the original salt as the `iv`. The +{@link DataCipherKeyIv} class represents these values, and provides methods for +their generation. + +The {@link KeyRing} class stores the original `password` and `salt` locally in +an encrypted JSON document keyed by the ObjectId returned from +[Storj Bridge](https://github.com/Storj/bridge) for the file object. The +cleartext JSON document has two properties: `pass` and `salt`. + +``` +{ + "pass": "c7c311ee213d10baefd620a004d76485190d82...", + "salt": "6d33490c999e9d613ccf4b146446763df15de2..." +} +``` + +This JSON string is encrypted with AES-256-CBC using a user-defined passphrase, +and encoded as [Base58](https://en.wikipedia.org/wiki/Base58). Each of those +encrypted JSON documents is stored in a directory called `key.ring/`, where the +file name is the ObjectId returned from [Storj Bridge](https://github.com/Storj/bridge) for the file object. + +### Portable Key Ring Format + +Because the keys in the key ring are generated and stored locally, files +encrypted with these keys cannot be accessed by other machines without first +duplicating the key files onto that machine. To mitigate this, Storj Core can +create a simple portable key ring archive. + +A {@link KeyRing} created by Storj Core can be exported into a portable format, +which is simply a gzipped tape archive (`.tar.gz` or `.tgz`). Importing this +archive simply entails: + +1. Decompress and unpack the archive +2. Decrypt each JSON document using the original passphrase +3. Encrypt each document with the passphrase of the target keyring +4. Move the files into the target keyring, optionally overwriting conflicts + +### Passphrase-based Key Derivation + +Rather than relying on locally-generated keys, it is recommended that the user +generate a high-entropy passphrase, and generate keys from it via a +deterministic key derivation process. Using this method, the user may grant +access to all encrypted files by simply transferring the passphrase. Storj Core +offers tools for this based on Bitcoin's BIP39 Mnemonic passphrases. + +{@link KeyRing} provides tools for generating a mnemonic passphrase and +writing it to disk. If a mnemonic is found, Storj Core will prefer +passphrase-based key derivation to PBKDF2 derivation. Storj clients should +create a file key as follows: + +1. Prepend the passphrase to the Bucket ID +2. Calculate the `sha512` hash of the resulting string +3. Take the first 64 bits of the resulting hash to make the **Bucket Key** +4. Prepend the Bucket Key to the File ID +5. Calculate the `sha512` hash of the resulting string +6. Take the first 64 bits of the resulting hash to make the **File Key** + +As any client with access to the passphrase can easily generate file keys on +demand, this provides additional portability of files between machines and +applications. + +It is strongly recommended that users write down the passphrase, and keep it in +a secure place. + +### Public Bucket Key Storage + +Public Buckets are a feature of Bridge, not a feature of Storj. When a Public +Bucket is created, the Bucket Key is stored with Bridge. It is then provided to +clients requesting PUSH or PULL tokens from that bucket. + +## tunnel connections + +One of the most daunting problems to tackle when designing a stable and +reliable distributed network is the traversal of various constraints such as +NAT and firewalls. In some cases, software can use various strategies to +"punch out" of these constraints and become publicly addressable on the +Internet. The StorjCORE library makes use of these strategies, but when they +fail we must devise more complex tactics for ensuring that network participants +are reachable by their peers. + +The Storj protocol defines a series of RPC messages that can be exchanged +in order to establish a "tunnel". See the {@tutorial protocol-spec} for more +detail on these RPC messages and their purposes. A tunnel is, in essence, a +proxy that allows a client that is not exposed to the Internet to be +addressable as if it were. + +This works by a private node opening a long-lived connection to a public node +who establishes a dedicated means for accepting messages on behalf of the +private node and "pipes" any data received via those means directly back to the +private node over the previously established connection. + +Once a tunnel has been established, the private node can begin identifying +herself to the network using her tunnel's address, instead of her own. Private +nodes do not need to use the tunnel to contact other nodes on the network, but +rather only *to be contacted*. + +### Announcing Willingness + +When a node joins the network and is publicly addressable, it has the ability +to announce to the network that it is willing and capable of tunneling +connections on behalf on nodes who are private or unable to punch out to +become addressable on the Internet. The process of doing this uses the same +publish/subscribe system described in the {@tutorial contract-topics} +specification which enables nodes to maintain a view of subscriptions in their +neighborhood of the network as described in the {@tutorial protocol-spec}. + +The difference between a contract publication and a tunnel announcement is in +the opcode used for the topic and in the contents of the publication. Tunnel +announcement publications use the opcode prefix `0x0e` followed by a single +criteria degree opcode to indicate their willingness to tunnel (`0x00` to +indicate "I am no longer tunneling" and `0x01` to indicate "I am ready to +tunnel"). + +Whenever the condition changes, such as a node's maximum number of tunnels is +reached or when a tunnel becomes available, it should issue a `PUBLISH` RPC +message to it's nearest neighbors. + +``` +{ + "method": "PUBLISH", + "params": { + "uuid": "7f0c40a2-e465-4f3e-b617-3d53460e34f7", + "topic": "0e01", + "contents": { + "address": "10.0.0.2", + "port": 1337 + }, + "publishers": [ + "48dc026fa01ae26822bfb23f98e725444d6775b0" + ], + "ttl": 1455228597837, + "contact": { + "address": "10.0.0.2", + "port": 1337, + "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0", + "protocol": "0.6.0" + }, + "nonce": 1455216323786, + "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..." + }, + "id": "7b6a2ab35da6826995abf3310a4875097df88cdb" +} +``` + +Public nodes should subscribe to these topics so that they can maintain an +up-to-date list of nodes who are capable and willing to tunnel connections, so +they can respond accurately to `FIND_TUNNEL` messages from private nodes. + +### Establishing a Tunnel + +After a private node has discovered some willing tunnels using the `FIND_TUNNEL` +RPC message defined in the {@tutorial protocol-spec}, it can now begin the +handshake to establish the tunnel. This begins by sending the `OPEN_TUNNEL` RPC +message to the desired tunneler node. The recipient of `OPEN_TUNNEL` will +check: + +* Do I have enough remaining tunnels? (based on arbitrary limit set by node) +* Am I already tunneling for this nodeID? +* Has a payment channel been opened? (**future spec**) + +If the tunneling node has enough tunnels, is not already tunneling the node, +and (in a future spec) if a payment channel has been opened for bandwidth, then +the tunneling node opens a new dedicated TCP socket on an available port +that will be used by the requester to send/receive HTTP messages. + +``` +{ + "result": { + "proxyPort": 12000, + "contact": { + "address": "10.0.0.3", + "port": 1337, + "nodeID": "48dc026fa01ae26822bfb23f98e725444d6775b0", + "protocol": "0.6.0" + }, + "nonce": 1455216323786, + "signature": "304502207e8a439f2cb33055e0b2e2d90e775f29d90b3ad85aec0c..." + }, + "id": "7b6a2ab35da6826995abf3310a4875097df88cdb" +} +``` + +Now the private node can open a TCP connect to the `proxyPort` provided and +messages sent to the tunneler that specify your node ID in the +`x-storj-node-id` header will be written to the connected socket. From there, +you may pipe this socket directly to your locally running node. + +![tunnel diagram](assets/images/tunneling.png) + +## private testnet + +Setting up a private or partitioned version of the Storj network is very simple. +The Storj protocol requires the inclusion of a `protocol` property nested +inside the `contact` data included in every RPC message. See +{@tutorial protocol-spec} for more information on the RPC message format. + +### Protocol Identifier Format + +Nodes on the Storj network identify the version of the protocol they are +running with the use of a [semantic version](http://semver.org/) tag. When a +node is trying to determine whether or not another node is compatible with her +version of the protocol, she checks the following: + +* Is the `MAJOR` version the same? +* Is the `MAJOR` version `0`? +* Is the `MINOR` version the same? + +If both nodes are running the *same* `MAJOR` version and that version is +**not** `0`, then the nodes are compatible. If the `MAJOR` version **is** `0`, +then the nodes are compatible *only* if the `MINOR` version is the same. + +For example: + +* `0.5.1` **is** compatible with `0.5.3` +* `0.5.1` **is not** compatible with `0.6.0` +* `1.5.1` **is** compatible with `1.13.0` +* `2.1.0` **is not** compatible with `1.13.0` + +### Special Identifiers + +The semantic versions specification also allows for special identifiers by +postfixing the version with a hyphen followed by some identifier. This is where +the network partitioning magic happens. + +Let's say, for example, I work for "Widgets Ltd" and I want to deploy a Storj +network within the Widgets Ltd private network. Every workstation would run a +modified version of [`storj/farmer`](https://github.com/storj/farmer) or maybe +my own custom interface built atop `storj/core`. + +I would simply change my Storj-based software to use the version +`1.5.0-widgetsltd`. The Storj protocol sees this identifies as a *strict* match +and therefore any nodes running this version of the software will only +communicate with nodes running the **exact** protocol identifier. + +### Changing the Version + +Changing the version in `storj/core` is easy as pie. In your code, simply +import the module and change the identifier like so: + +``` +// Import core library +var storj = require('storj'); + +// Modify protocol version +storj.version.protocol = '1.5.0-widgetsltd'; + +// Get on with your stuff... +``` + +If you are running "vanilla" Storj software, you can change the protocol +version by setting the `STORJ_NETWORK` environment variable. This will add a +postfix to the protocol version, which will partition the network to nodes +that are running that *exact* version: + +``` +STORJ_NETWORK=testnet storjshare --datadir /path/to/shards +``` + +This concept applies broadly to deploying a custom Storj network for any +purpose. This could be used for a public testnet (`x.x.x-testnet`) or for the +private network example above. + +## environment variables + +Below is a list of environment variables that can be used to alter the +behavior of the core library and associated tooling. + +### `STORJ_NETWORK` + +This value will be postfixed to your announced protocol version in the network. +A value of `testnet` would advertise to the network you are running +`0.7.0-testnet`, which will isolate you to other nodes running the same exact +version. See {@tutorial private-testnet} for more information. + +### `STORJ_ALLOW_LOOPBACK` + +By default, the {@link Network} class will drop and ignore message from nodes +who identify themeselves as a loopback interface like `localhost`, `127.0.0.1`, +etc. This is a security precaution to prevent others from causing you to send +messages to yourself as well as prevent invalid contacts in your routing table. + +To disable this feature (primarily for local testing), set this variable to `1`. + +### `STORJ_BRIDGE` + +This variable will change the default URI for the {@link BridgeClient} class. +The default value is `https://api.storj.io`. If you run your own bridge, +testing one locally, or otherwise would like to default to a different host, +set this variable. + +This works well with the CLI (see {@tutorial command-line-interface}) when +testing against other bridges. + +### `STORJ_KEYPASS` + +This variable will set the `--keypass` used to unlock the keyring. + +Setting your password will make it so other users can't grep it with `ps -a`. + +### `STORJ_TEMP` + +This variable will set the folder to which the encrypted file will be placed +when uploading a file. Shards will also be placed in this folder during upload. + +## command line interface + +This package comes equipped with a command line interface for performing a +number of useful operations on the Storj network. The CLI program is generally +focused on interacting with a remote [Bridge](https://github.com/Storj/bridge) +service and makes use of the library's {@link BridgeClient} class to do so. In +addition to interacting with a bridge node, the tool also exposes some general +purpose utilities. + +To use the CLI, follow the instructions in the [README](https://github.com/Storj/core/blob/master/README.md) to install the module +**globally** or if you are working from within the git repository, you can use: + +``` +npm link +``` + +### Communicating with a Bridge + +Once you have access to the `storj` command, register and authenticate with the +bridge: + +``` +> $ storj register + [...] > Enter your email address > user@storj.io + [...] > Enter your password > ************* + + [info] Registered! Check your email to activate your account. +``` + +Follow the activation link you receive via email and come back to the CLI to +pair with your account: + +``` +> $ storj login + [...] > Enter your email address > user@storj.io + [...] > Enter your password > ************* + + [info] This device has been successfully paired. +``` + +Now you can create buckets, transfer files, and manage your bridge account. + +### Audits, Proofs, and Verifications + +The CLI also includes some utility commands for generating file possession +audits, proving possession, and verifying proofs. You can generate a challenge +set and merkle tree for a file easily: + +``` +> $ storj prepare-audits 2 CONTRIBUTING.md + [info] Generating challenges and merkle tree... + [info] + [info] Merkle Root + [info] ----------- + [info] 9c8c37935f58d46e3301efe4f44724b8785a81a5 + [info] + [info] Challenges + [info] ---------- + [info] c8573773616e072230d40131e7ce8537d384825e337e5903ff7367ddea798c52 + [info] 7c4d4f57f40d5c95f962e7cd72347e4077e1885aaffd8c1ccbbd02c8d7c48dce + [info] + [info] Merkle Leaves + [info] ------------- + [info] aaf42766d87a37e6dffbae7172fd0073006bf5f3 + [info] ccee086dbc8a16b93b79912cb37f3b037bbf8269 +``` + +A farmer can use parts of this data to prove possession of a file shard: + +``` +> $ storj prove-file aaf42766d87a37e6dffbae7172fd0073006bf5f3,ccee086dbc8a16b93b79912cb37f3b037bbf8269 c8573773616e072230d40131e7ce8537d384825e337e5903ff7367ddea798c52 CONTRIBUTING.md + [info] Generating proof of possession... + [info] + [info] Challenge Response + [info] ------------------ + [info] [["153a0d4b1d228043992fec585cadb51974b053f7"],"ccee086dbc8a16b93b79912cb37f3b037bbf8269"] +``` + +The result of this operation can be used by the original renter to verify the +the proof and confirm that the farmer still has possession of the file: + +``` +> $ storj verify-proof 9c8c37935f58d46e3301efe4f44724b8785a81a5 2 '[["153a0d4b1d228043992fec585cadb51974b053f7"],"ccee086dbc8a16b93b79912cb37f3b037bbf8269"]' + [info] + [info] Expected: 9c8c37935f58d46e3301efe4f44724b8785a81a5 + [info] Actual: 9c8c37935f58d46e3301efe4f44724b8785a81a5 + [info] + [info] The proof response is valid +``` + +For more detailed usage information of the command line interface, run +`storj --help`. + +### Temporary Files +On Windows temporary files are stored: + +``` +C:\Users\\AppData\Local\Temp +``` + +## license + +> Storj Core - Implementation of the Storj protocol for Node.js +> Copyright (C) 2016 Storj Labs, Inc + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published +by the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +*Certain parts of this program are licensed under the GNU Lesser General +Public License as published by the Free Software Foundation. You can +redistribute it and/or modify it under the terms either version 3 of the +License, or (at your option) any later version.* + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see +[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). diff --git a/Storj/core/doc/assets/tunneling.png b/Storj/protocol-v2/assets/images/tunneling.png similarity index 100% rename from Storj/core/doc/assets/tunneling.png rename to Storj/protocol-v2/assets/images/tunneling.png diff --git a/Storj/core/bench/index.js b/Storj/protocol-v2/bench/index.js similarity index 100% rename from Storj/core/bench/index.js rename to Storj/protocol-v2/bench/index.js diff --git a/Storj/core/example/1-create-user.js b/Storj/protocol-v2/example/1-create-user.js similarity index 100% rename from Storj/core/example/1-create-user.js rename to Storj/protocol-v2/example/1-create-user.js diff --git a/Storj/core/example/2-generate-keypair.js b/Storj/protocol-v2/example/2-generate-keypair.js similarity index 100% rename from Storj/core/example/2-generate-keypair.js rename to Storj/protocol-v2/example/2-generate-keypair.js diff --git a/Storj/core/example/3-authenticate-with-keypair.js b/Storj/protocol-v2/example/3-authenticate-with-keypair.js similarity index 100% rename from Storj/core/example/3-authenticate-with-keypair.js rename to Storj/protocol-v2/example/3-authenticate-with-keypair.js diff --git a/Storj/core/example/4a-list-keys.js b/Storj/protocol-v2/example/4a-list-keys.js similarity index 100% rename from Storj/core/example/4a-list-keys.js rename to Storj/protocol-v2/example/4a-list-keys.js diff --git a/Storj/core/example/4b-add-remove-keys.js b/Storj/protocol-v2/example/4b-add-remove-keys.js similarity index 100% rename from Storj/core/example/4b-add-remove-keys.js rename to Storj/protocol-v2/example/4b-add-remove-keys.js diff --git a/Storj/core/example/5a-list-buckets.js b/Storj/protocol-v2/example/5a-list-buckets.js similarity index 100% rename from Storj/core/example/5a-list-buckets.js rename to Storj/protocol-v2/example/5a-list-buckets.js diff --git a/Storj/core/example/5b-add-remove-bucket.js b/Storj/protocol-v2/example/5b-add-remove-bucket.js similarity index 100% rename from Storj/core/example/5b-add-remove-bucket.js rename to Storj/protocol-v2/example/5b-add-remove-bucket.js diff --git a/Storj/core/example/6a-upload-file.js b/Storj/protocol-v2/example/6a-upload-file.js similarity index 100% rename from Storj/core/example/6a-upload-file.js rename to Storj/protocol-v2/example/6a-upload-file.js diff --git a/Storj/core/example/6b-download-file.js b/Storj/protocol-v2/example/6b-download-file.js similarity index 100% rename from Storj/core/example/6b-download-file.js rename to Storj/protocol-v2/example/6b-download-file.js diff --git a/Storj/core/example/6c-list-bucket-files.js b/Storj/protocol-v2/example/6c-list-bucket-files.js similarity index 100% rename from Storj/core/example/6c-list-bucket-files.js rename to Storj/protocol-v2/example/6c-list-bucket-files.js diff --git a/Storj/core/example/6d-delete-file-from-bucket.js b/Storj/protocol-v2/example/6d-delete-file-from-bucket.js similarity index 100% rename from Storj/core/example/6d-delete-file-from-bucket.js rename to Storj/protocol-v2/example/6d-delete-file-from-bucket.js diff --git a/Storj/core/index.js b/Storj/protocol-v2/index.js similarity index 100% rename from Storj/core/index.js rename to Storj/protocol-v2/index.js diff --git a/Storj/core/lib/audit-tools/audit-stream.js b/Storj/protocol-v2/lib/audit-tools/audit-stream.js similarity index 100% rename from Storj/core/lib/audit-tools/audit-stream.js rename to Storj/protocol-v2/lib/audit-tools/audit-stream.js diff --git a/Storj/core/lib/audit-tools/proof-stream.js b/Storj/protocol-v2/lib/audit-tools/proof-stream.js similarity index 100% rename from Storj/core/lib/audit-tools/proof-stream.js rename to Storj/protocol-v2/lib/audit-tools/proof-stream.js diff --git a/Storj/core/lib/audit-tools/verification.js b/Storj/protocol-v2/lib/audit-tools/verification.js similarity index 100% rename from Storj/core/lib/audit-tools/verification.js rename to Storj/protocol-v2/lib/audit-tools/verification.js diff --git a/Storj/core/lib/bridge-client/blacklist.js b/Storj/protocol-v2/lib/bridge-client/blacklist.js similarity index 100% rename from Storj/core/lib/bridge-client/blacklist.js rename to Storj/protocol-v2/lib/bridge-client/blacklist.js diff --git a/Storj/core/lib/bridge-client/exchange-report.js b/Storj/protocol-v2/lib/bridge-client/exchange-report.js similarity index 100% rename from Storj/core/lib/bridge-client/exchange-report.js rename to Storj/protocol-v2/lib/bridge-client/exchange-report.js diff --git a/Storj/core/lib/bridge-client/index.js b/Storj/protocol-v2/lib/bridge-client/index.js similarity index 100% rename from Storj/core/lib/bridge-client/index.js rename to Storj/protocol-v2/lib/bridge-client/index.js diff --git a/Storj/core/lib/bridge-client/upload-state.js b/Storj/protocol-v2/lib/bridge-client/upload-state.js similarity index 100% rename from Storj/core/lib/bridge-client/upload-state.js rename to Storj/protocol-v2/lib/bridge-client/upload-state.js diff --git a/Storj/core/lib/constants.js b/Storj/protocol-v2/lib/constants.js similarity index 100% rename from Storj/core/lib/constants.js rename to Storj/protocol-v2/lib/constants.js diff --git a/Storj/core/lib/contract/index.js b/Storj/protocol-v2/lib/contract/index.js similarity index 100% rename from Storj/core/lib/contract/index.js rename to Storj/protocol-v2/lib/contract/index.js diff --git a/Storj/core/lib/contract/offer-manager.js b/Storj/protocol-v2/lib/contract/offer-manager.js similarity index 100% rename from Storj/core/lib/contract/offer-manager.js rename to Storj/protocol-v2/lib/contract/offer-manager.js diff --git a/Storj/core/lib/contract/offer-stream.js b/Storj/protocol-v2/lib/contract/offer-stream.js similarity index 100% rename from Storj/core/lib/contract/offer-stream.js rename to Storj/protocol-v2/lib/contract/offer-stream.js diff --git a/Storj/core/lib/contract/schema.json b/Storj/protocol-v2/lib/contract/schema.json similarity index 100% rename from Storj/core/lib/contract/schema.json rename to Storj/protocol-v2/lib/contract/schema.json diff --git a/Storj/core/lib/crypto-tools/cipher-key-iv.js b/Storj/protocol-v2/lib/crypto-tools/cipher-key-iv.js similarity index 100% rename from Storj/core/lib/crypto-tools/cipher-key-iv.js rename to Storj/protocol-v2/lib/crypto-tools/cipher-key-iv.js diff --git a/Storj/core/lib/crypto-tools/decrypt-stream.js b/Storj/protocol-v2/lib/crypto-tools/decrypt-stream.js similarity index 100% rename from Storj/core/lib/crypto-tools/decrypt-stream.js rename to Storj/protocol-v2/lib/crypto-tools/decrypt-stream.js diff --git a/Storj/core/lib/crypto-tools/deterministic-key-iv.js b/Storj/protocol-v2/lib/crypto-tools/deterministic-key-iv.js similarity index 100% rename from Storj/core/lib/crypto-tools/deterministic-key-iv.js rename to Storj/protocol-v2/lib/crypto-tools/deterministic-key-iv.js diff --git a/Storj/core/lib/crypto-tools/encrypt-stream.js b/Storj/protocol-v2/lib/crypto-tools/encrypt-stream.js similarity index 100% rename from Storj/core/lib/crypto-tools/encrypt-stream.js rename to Storj/protocol-v2/lib/crypto-tools/encrypt-stream.js diff --git a/Storj/core/lib/crypto-tools/keypair.js b/Storj/protocol-v2/lib/crypto-tools/keypair.js similarity index 100% rename from Storj/core/lib/crypto-tools/keypair.js rename to Storj/protocol-v2/lib/crypto-tools/keypair.js diff --git a/Storj/core/lib/crypto-tools/keyring.js b/Storj/protocol-v2/lib/crypto-tools/keyring.js similarity index 100% rename from Storj/core/lib/crypto-tools/keyring.js rename to Storj/protocol-v2/lib/crypto-tools/keyring.js diff --git a/Storj/core/lib/deps.js b/Storj/protocol-v2/lib/deps.js similarity index 100% rename from Storj/core/lib/deps.js rename to Storj/protocol-v2/lib/deps.js diff --git a/Storj/core/lib/file-handling/file-demuxer.js b/Storj/protocol-v2/lib/file-handling/file-demuxer.js similarity index 100% rename from Storj/core/lib/file-handling/file-demuxer.js rename to Storj/protocol-v2/lib/file-handling/file-demuxer.js diff --git a/Storj/core/lib/file-handling/file-muxer.js b/Storj/protocol-v2/lib/file-handling/file-muxer.js similarity index 100% rename from Storj/core/lib/file-handling/file-muxer.js rename to Storj/protocol-v2/lib/file-handling/file-muxer.js diff --git a/Storj/core/lib/network/contact.js b/Storj/protocol-v2/lib/network/contact.js similarity index 100% rename from Storj/core/lib/network/contact.js rename to Storj/protocol-v2/lib/network/contact.js diff --git a/Storj/core/lib/network/farmer.js b/Storj/protocol-v2/lib/network/farmer.js similarity index 100% rename from Storj/core/lib/network/farmer.js rename to Storj/protocol-v2/lib/network/farmer.js diff --git a/Storj/core/lib/network/index.js b/Storj/protocol-v2/lib/network/index.js similarity index 100% rename from Storj/core/lib/network/index.js rename to Storj/protocol-v2/lib/network/index.js diff --git a/Storj/core/lib/network/monitor.js b/Storj/protocol-v2/lib/network/monitor.js similarity index 100% rename from Storj/core/lib/network/monitor.js rename to Storj/protocol-v2/lib/network/monitor.js diff --git a/Storj/core/lib/network/protocol.js b/Storj/protocol-v2/lib/network/protocol.js similarity index 100% rename from Storj/core/lib/network/protocol.js rename to Storj/protocol-v2/lib/network/protocol.js diff --git a/Storj/core/lib/network/renter.js b/Storj/protocol-v2/lib/network/renter.js similarity index 100% rename from Storj/core/lib/network/renter.js rename to Storj/protocol-v2/lib/network/renter.js diff --git a/Storj/core/lib/network/shard-server.js b/Storj/protocol-v2/lib/network/shard-server.js similarity index 100% rename from Storj/core/lib/network/shard-server.js rename to Storj/protocol-v2/lib/network/shard-server.js diff --git a/Storj/core/lib/network/transport.js b/Storj/protocol-v2/lib/network/transport.js similarity index 100% rename from Storj/core/lib/network/transport.js rename to Storj/protocol-v2/lib/network/transport.js diff --git a/Storj/core/lib/patches.js b/Storj/protocol-v2/lib/patches.js similarity index 100% rename from Storj/core/lib/patches.js rename to Storj/protocol-v2/lib/patches.js diff --git a/Storj/core/lib/sips/0003/index.js b/Storj/protocol-v2/lib/sips/0003/index.js similarity index 100% rename from Storj/core/lib/sips/0003/index.js rename to Storj/protocol-v2/lib/sips/0003/index.js diff --git a/Storj/core/lib/sips/0003/trigger-manager.js b/Storj/protocol-v2/lib/sips/0003/trigger-manager.js similarity index 100% rename from Storj/core/lib/sips/0003/trigger-manager.js rename to Storj/protocol-v2/lib/sips/0003/trigger-manager.js diff --git a/Storj/core/lib/sips/index.js b/Storj/protocol-v2/lib/sips/index.js similarity index 100% rename from Storj/core/lib/sips/index.js rename to Storj/protocol-v2/lib/sips/index.js diff --git a/Storj/core/lib/storage/adapter.js b/Storj/protocol-v2/lib/storage/adapter.js similarity index 100% rename from Storj/core/lib/storage/adapter.js rename to Storj/protocol-v2/lib/storage/adapter.js diff --git a/Storj/core/lib/storage/adapters/embedded.js b/Storj/protocol-v2/lib/storage/adapters/embedded.js similarity index 100% rename from Storj/core/lib/storage/adapters/embedded.js rename to Storj/protocol-v2/lib/storage/adapters/embedded.js diff --git a/Storj/core/lib/storage/adapters/ram.js b/Storj/protocol-v2/lib/storage/adapters/ram.js similarity index 100% rename from Storj/core/lib/storage/adapters/ram.js rename to Storj/protocol-v2/lib/storage/adapters/ram.js diff --git a/Storj/core/lib/storage/item.js b/Storj/protocol-v2/lib/storage/item.js similarity index 100% rename from Storj/core/lib/storage/item.js rename to Storj/protocol-v2/lib/storage/item.js diff --git a/Storj/core/lib/storage/manager.js b/Storj/protocol-v2/lib/storage/manager.js similarity index 100% rename from Storj/core/lib/storage/manager.js rename to Storj/protocol-v2/lib/storage/manager.js diff --git a/Storj/core/lib/storage/migration.js b/Storj/protocol-v2/lib/storage/migration.js similarity index 100% rename from Storj/core/lib/storage/migration.js rename to Storj/protocol-v2/lib/storage/migration.js diff --git a/Storj/core/lib/utils.js b/Storj/protocol-v2/lib/utils.js similarity index 100% rename from Storj/core/lib/utils.js rename to Storj/protocol-v2/lib/utils.js diff --git a/Storj/core/lib/version.js b/Storj/protocol-v2/lib/version.js similarity index 100% rename from Storj/core/lib/version.js rename to Storj/protocol-v2/lib/version.js diff --git a/Storj/core/package-lock.json b/Storj/protocol-v2/package-lock.json similarity index 100% rename from Storj/core/package-lock.json rename to Storj/protocol-v2/package-lock.json diff --git a/Storj/core/package.json b/Storj/protocol-v2/package.json similarity index 100% rename from Storj/core/package.json rename to Storj/protocol-v2/package.json diff --git a/Storj/core/test/.eslintrc b/Storj/protocol-v2/test/.eslintrc similarity index 100% rename from Storj/core/test/.eslintrc rename to Storj/protocol-v2/test/.eslintrc diff --git a/Storj/core/test/audit-tools/audit-stream.unit.js b/Storj/protocol-v2/test/audit-tools/audit-stream.unit.js similarity index 100% rename from Storj/core/test/audit-tools/audit-stream.unit.js rename to Storj/protocol-v2/test/audit-tools/audit-stream.unit.js diff --git a/Storj/core/test/audit-tools/proof-stream.unit.js b/Storj/protocol-v2/test/audit-tools/proof-stream.unit.js similarity index 100% rename from Storj/core/test/audit-tools/proof-stream.unit.js rename to Storj/protocol-v2/test/audit-tools/proof-stream.unit.js diff --git a/Storj/core/test/audit-tools/verification.unit.js b/Storj/protocol-v2/test/audit-tools/verification.unit.js similarity index 100% rename from Storj/core/test/audit-tools/verification.unit.js rename to Storj/protocol-v2/test/audit-tools/verification.unit.js diff --git a/Storj/core/test/bridge-client/blacklist.unit.js b/Storj/protocol-v2/test/bridge-client/blacklist.unit.js similarity index 100% rename from Storj/core/test/bridge-client/blacklist.unit.js rename to Storj/protocol-v2/test/bridge-client/blacklist.unit.js diff --git a/Storj/core/test/bridge-client/exchange-report.unit.js b/Storj/protocol-v2/test/bridge-client/exchange-report.unit.js similarity index 100% rename from Storj/core/test/bridge-client/exchange-report.unit.js rename to Storj/protocol-v2/test/bridge-client/exchange-report.unit.js diff --git a/Storj/core/test/bridge-client/index.unit.js b/Storj/protocol-v2/test/bridge-client/index.unit.js similarity index 100% rename from Storj/core/test/bridge-client/index.unit.js rename to Storj/protocol-v2/test/bridge-client/index.unit.js diff --git a/Storj/core/test/bridge-client/upload-state.unit.js b/Storj/protocol-v2/test/bridge-client/upload-state.unit.js similarity index 100% rename from Storj/core/test/bridge-client/upload-state.unit.js rename to Storj/protocol-v2/test/bridge-client/upload-state.unit.js diff --git a/Storj/core/test/contract/index.unit.js b/Storj/protocol-v2/test/contract/index.unit.js similarity index 100% rename from Storj/core/test/contract/index.unit.js rename to Storj/protocol-v2/test/contract/index.unit.js diff --git a/Storj/core/test/contract/offer-manager.unit.js b/Storj/protocol-v2/test/contract/offer-manager.unit.js similarity index 100% rename from Storj/core/test/contract/offer-manager.unit.js rename to Storj/protocol-v2/test/contract/offer-manager.unit.js diff --git a/Storj/core/test/contract/offer-stream.unit.js b/Storj/protocol-v2/test/contract/offer-stream.unit.js similarity index 100% rename from Storj/core/test/contract/offer-stream.unit.js rename to Storj/protocol-v2/test/contract/offer-stream.unit.js diff --git a/Storj/core/test/crypto-tools/cipher-key-iv.unit.js b/Storj/protocol-v2/test/crypto-tools/cipher-key-iv.unit.js similarity index 100% rename from Storj/core/test/crypto-tools/cipher-key-iv.unit.js rename to Storj/protocol-v2/test/crypto-tools/cipher-key-iv.unit.js diff --git a/Storj/core/test/crypto-tools/deterministic-key-iv.unit.js b/Storj/protocol-v2/test/crypto-tools/deterministic-key-iv.unit.js similarity index 100% rename from Storj/core/test/crypto-tools/deterministic-key-iv.unit.js rename to Storj/protocol-v2/test/crypto-tools/deterministic-key-iv.unit.js diff --git a/Storj/core/test/crypto-tools/encrypt-stream+decrypt-stream.unit.js b/Storj/protocol-v2/test/crypto-tools/encrypt-stream+decrypt-stream.unit.js similarity index 100% rename from Storj/core/test/crypto-tools/encrypt-stream+decrypt-stream.unit.js rename to Storj/protocol-v2/test/crypto-tools/encrypt-stream+decrypt-stream.unit.js diff --git a/Storj/core/test/crypto-tools/keypair.unit.js b/Storj/protocol-v2/test/crypto-tools/keypair.unit.js similarity index 100% rename from Storj/core/test/crypto-tools/keypair.unit.js rename to Storj/protocol-v2/test/crypto-tools/keypair.unit.js diff --git a/Storj/core/test/crypto-tools/keyring.unit.js b/Storj/protocol-v2/test/crypto-tools/keyring.unit.js similarity index 100% rename from Storj/core/test/crypto-tools/keyring.unit.js rename to Storj/protocol-v2/test/crypto-tools/keyring.unit.js diff --git a/Storj/core/test/file-handling/file-demuxer.unit.js b/Storj/protocol-v2/test/file-handling/file-demuxer.unit.js similarity index 100% rename from Storj/core/test/file-handling/file-demuxer.unit.js rename to Storj/protocol-v2/test/file-handling/file-demuxer.unit.js diff --git a/Storj/core/test/file-handling/file-muxer.unit.js b/Storj/protocol-v2/test/file-handling/file-muxer.unit.js similarity index 100% rename from Storj/core/test/file-handling/file-muxer.unit.js rename to Storj/protocol-v2/test/file-handling/file-muxer.unit.js diff --git a/Storj/core/test/network/contact.unit.js b/Storj/protocol-v2/test/network/contact.unit.js similarity index 100% rename from Storj/core/test/network/contact.unit.js rename to Storj/protocol-v2/test/network/contact.unit.js diff --git a/Storj/core/test/network/farmer.unit.js b/Storj/protocol-v2/test/network/farmer.unit.js similarity index 100% rename from Storj/core/test/network/farmer.unit.js rename to Storj/protocol-v2/test/network/farmer.unit.js diff --git a/Storj/core/test/network/index.unit.js b/Storj/protocol-v2/test/network/index.unit.js similarity index 100% rename from Storj/core/test/network/index.unit.js rename to Storj/protocol-v2/test/network/index.unit.js diff --git a/Storj/core/test/network/monitor.unit.js b/Storj/protocol-v2/test/network/monitor.unit.js similarity index 100% rename from Storj/core/test/network/monitor.unit.js rename to Storj/protocol-v2/test/network/monitor.unit.js diff --git a/Storj/core/test/network/protocol.unit.js b/Storj/protocol-v2/test/network/protocol.unit.js similarity index 100% rename from Storj/core/test/network/protocol.unit.js rename to Storj/protocol-v2/test/network/protocol.unit.js diff --git a/Storj/core/test/network/renter.unit.js b/Storj/protocol-v2/test/network/renter.unit.js similarity index 100% rename from Storj/core/test/network/renter.unit.js rename to Storj/protocol-v2/test/network/renter.unit.js diff --git a/Storj/core/test/network/shard-server.unit.js b/Storj/protocol-v2/test/network/shard-server.unit.js similarity index 100% rename from Storj/core/test/network/shard-server.unit.js rename to Storj/protocol-v2/test/network/shard-server.unit.js diff --git a/Storj/core/test/network/transport.unit.js b/Storj/protocol-v2/test/network/transport.unit.js similarity index 100% rename from Storj/core/test/network/transport.unit.js rename to Storj/protocol-v2/test/network/transport.unit.js diff --git a/Storj/core/test/sips/0003/trigger-manager.unit.js b/Storj/protocol-v2/test/sips/0003/trigger-manager.unit.js similarity index 100% rename from Storj/core/test/sips/0003/trigger-manager.unit.js rename to Storj/protocol-v2/test/sips/0003/trigger-manager.unit.js diff --git a/Storj/core/test/storage/adapter.unit.js b/Storj/protocol-v2/test/storage/adapter.unit.js similarity index 100% rename from Storj/core/test/storage/adapter.unit.js rename to Storj/protocol-v2/test/storage/adapter.unit.js diff --git a/Storj/core/test/storage/adapters/embedded.unit.js b/Storj/protocol-v2/test/storage/adapters/embedded.unit.js similarity index 100% rename from Storj/core/test/storage/adapters/embedded.unit.js rename to Storj/protocol-v2/test/storage/adapters/embedded.unit.js diff --git a/Storj/core/test/storage/adapters/ram.unit.js b/Storj/protocol-v2/test/storage/adapters/ram.unit.js similarity index 100% rename from Storj/core/test/storage/adapters/ram.unit.js rename to Storj/protocol-v2/test/storage/adapters/ram.unit.js diff --git a/Storj/core/test/storage/item.unit.js b/Storj/protocol-v2/test/storage/item.unit.js similarity index 100% rename from Storj/core/test/storage/item.unit.js rename to Storj/protocol-v2/test/storage/item.unit.js diff --git a/Storj/core/test/storage/manager.unit.js b/Storj/protocol-v2/test/storage/manager.unit.js similarity index 100% rename from Storj/core/test/storage/manager.unit.js rename to Storj/protocol-v2/test/storage/manager.unit.js diff --git a/Storj/core/test/storage/migration.unit.js b/Storj/protocol-v2/test/storage/migration.unit.js similarity index 100% rename from Storj/core/test/storage/migration.unit.js rename to Storj/protocol-v2/test/storage/migration.unit.js diff --git a/Storj/core/test/utils.unit.js b/Storj/protocol-v2/test/utils.unit.js similarity index 100% rename from Storj/core/test/utils.unit.js rename to Storj/protocol-v2/test/utils.unit.js diff --git a/Storj/core/test/version.unit.js b/Storj/protocol-v2/test/version.unit.js similarity index 100% rename from Storj/core/test/version.unit.js rename to Storj/protocol-v2/test/version.unit.js